From c3b31161e7014b1949374e23b5f8bc3cd08893fc Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 14 Aug 2006 18:39:35 +0000 Subject: [PATCH] Fix verification failures. llvm-svn: 29661 --- llvm/docs/LinkTimeOptimization.html | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/llvm/docs/LinkTimeOptimization.html b/llvm/docs/LinkTimeOptimization.html index f3a61185938e..ce96ade80e74 100644 --- a/llvm/docs/LinkTimeOptimization.html +++ b/llvm/docs/LinkTimeOptimization.html @@ -7,7 +7,7 @@
- LLVM Link Time Optimization: design and implentation + LLVM Link Time Optimization: design and implementation
-
  • Multi-phase communication between LLVM and linker
  • +
  • Multi-phase communication between LLVM and linker
  • -
  • LLVMlto
  • +
  • LLVMlto +
  • Debugging Information
  • -

    Written by Devang Patel

    +

    Written by Devang Patel

    @@ -71,6 +71,7 @@ files. This tight integration between the linker and LLVM optimizer helps to do optimizations that are not possible in other models. The linker input allows optimizer to avoid relying on conservative escape analysis.

    +
    @@ -81,11 +82,12 @@ optimizer to avoid relying on conservative escape analysis.

    Following example illustrates advantage of integrated approach that uses clean interface. +

    -
    --- a.h --- +--- a.h ---
    extern int foo1(void);
    extern void foo2(void);
    extern void foo4(void); @@ -113,7 +115,7 @@ clean interface.
    }

    --- main.c --- -
    #include +
    #include < stdio.h >
    #include "a.h"

    void foo4(void) { @@ -130,11 +132,10 @@ clean interface.
    $ llvm-gcc4 a.o main.o -o main # <-- standard link command without any modifications
    -

    In this example, the linker recognizes that foo2() is a externally visible symbol defined in LLVM byte code file. This information is collected using - readLLVMByteCodeFile() . Based on this + readLLVMObjectFile() . Based on this information, linker completes its usual symbol resolution pass and finds that foo2() is not used anywhere. This information is used by LLVM optimizer and it removes foo2(). As soon as foo2() is removed, optimizer @@ -153,6 +154,7 @@ optimizer can not remove foo3() without the linker's input.

    +

    • Compiler driver invokes link time optimizer separately.

      In this model link time optimizer is not able to take advantage of information collected during normal linker's symbol resolution phase. In above example, @@ -171,7 +173,7 @@ significantly, which is not necessary. Plus, this approach requires staying synchronized with linker developements on various platforms, which is not the main focus of link time optimizer. Finally, this approach increases end user's build time due to duplicate work done by this separate tool and linker itself. -

      +
    @@ -203,7 +205,7 @@ optimizer by sharing this information during various linking phases.

    The linker first reads all object files in natural order and collects symbol information. This includes native object files as well as LLVM byte code files. -In this phase, the linker uses readLLVMByteCodeFile() +In this phase, the linker uses readLLVMObjectFile() to collect symbol information from each LLVM bytecode files and updates its internal global symbol table accordingly. The intent of this interface is to avoid overhead in the non LLVM case, where all input object files are native @@ -224,7 +226,7 @@ In this stage, the linker resolves symbols using global symbol table information to report undefined symbol errors, read archive members, resolve weak symbols etc... The linker is able to do this seamlessly even though it does not know exact content of input LLVM bytecode files because it uses symbol information -provided by readLLVMByteCodeFile() . +provided by readLLVMObjectFile() . If dead code stripping is enabled then linker collects list of live symbols.

    @@ -352,7 +354,7 @@ as .o file at name and location provided by the linker. Valid HTML 4.01! - Devang Patel
    + Devang Patel
    LLVM Compiler Infrastructure
    Last modified: $Date$