X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FUsingLibraries.html;h=af57907ef66a730bbc6977265999d2afb5a862fe;hb=4d515d0b09d43af59cd040bfb8bf1b7a2b992980;hp=490fd1a51704b32d6194e73da7f09451c14c1f26;hpb=e0f33aea9aee4953ad454486c33daf3712ae48b9;p=oota-llvm.git diff --git a/docs/UsingLibraries.html b/docs/UsingLibraries.html index 490fd1a5170..af57907ef66 100644 --- a/docs/UsingLibraries.html +++ b/docs/UsingLibraries.html @@ -23,6 +23,8 @@

Written by Reid Spencer

+

Warning: This document is out of date, please see llvm-config for more information.

+
Abstract
@@ -31,8 +33,10 @@ tools. In addition to the LLVM tool set, the functionality of LLVM is available through a set of libraries. To use LLVM as a toolkit for constructing tools, a developer needs to understand what is contained in the - various libraries, what they depend on, and how to use them. This document - describes the contents of the libraries and how and when to use them. + various libraries, what they depend on, and how to use them. Fortunately, + there is a tool, llvm-config to aid with this. This document + describes the contents of the libraries and how to use llvm-config + to generate command line options.

@@ -42,20 +46,20 @@

If you're writing a compiler, virtual machine, or any other utility based on LLVM, you'll need to figure out which of the many libraries files you will need to link with to be successful. An understanding of the contents of these - files and their inter-relationships will be useful in coming up with an optimal - specification for the libraries to link with. The purpose of this document is - to reduce some of the trial and error that the author experienced in using - LLVM.

+ libraries will be useful in coming up with an optimal specification for the + libraries to link with. The purpose of this document is to reduce some of + the trial and error that the author experienced in using LLVM.

LLVM produces two types of libraries: archives (ending in .a) and objects (ending in .o). However, both are libraries. Libraries ending in .o are known as re-linked libraries because they contain all the compilation units of the library linked together as a single .o file. - Furthermore, many of the libraries have both forms of library. The + Furthermore, several of the libraries have both forms of library. The re-linked libraries are used whenever you want to include all symbols from the library. The archive libraries are used whenever you want to only resolve outstanding symbols at that point in the link without including everything in the library.

-

When linking your tools, you will use the LLVMLIBS make variable. +

If you're using the LLVM Makefile system to link your tools,you will use + the LLVMLIBS make variable. (see the Makefile Guide for details). This variable specifies which LLVM libraries to link into your tool and the order in which they will be linked. You specify re-linked libraries by @@ -72,373 +76,332 @@ - - - - - - - - - + + + + + + + + + + + + + + + - - - - + + + + - + - + - + - + - + - + - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + - + - + - + - -
LibraryFormsDescription
Core Libraries
LLVMAsmParser.oLLVM Assembly Parsing
LLVMBCReader.oLLVM Bytecode Reading
LLVMBCWriter.oLLVM Bytecode Writing
LLVMDebugger.oSource Level Debugging Support
LLVMSupport.a .o
LLVMArchive.aLLVM archive reading and writing
LLVMAsmParser.aLLVM assembly parsing
LLVMBCReader.aLLVM bitcode reading
LLVMBCWriter.aLLVM bitcode writing
LLVMCore.aLLVM core intermediate representation
LLVMDebugger.aSource level debugging support
LLVMLinker.aBitcode and archive linking interface
LLVMSupport.a General support utilities
LLVMSystem.a .oOperating system abstraction
LLVMCore.oLLVM Core IR
LLVMSystem.aOperating system abstraction layer
LLVMbzip2.aBZip2 compression library
Analysis Libraries
LLVMAnalysis.a .o
LLVMAnalysis.a Various analysis passes.
LLVMDataStructure.a .o
LLVMDataStructure.o Data structure analysis passes.
LLVMipa.a .o
LLVMipa.a Inter-procedural analysis passes.
Transformation Libraries
LLVMInstrumentation.a .o
LLVMInstrumentation.a Instrumentation passes.
LLVMipo.a .o
LLVMipo.a All inter-procedural optimization passes.
LLVMScalarOpts.a .o
LLVMScalarOpts.a All scalar optimization passes.
LLVMTransforms.a .oUncategorized transformation passes.
LLVMTransformUtils.a .oTransformation utilities.
LLVMProfilePaths.oProfile paths for instrumentation.
LLVMTransformUtils.aTransformation utilities used by many passes.
Code Generation Libraries
LLVMCodeGen.o Native code generation infrastructure
LLVMSelectionDAG.oAggressive instruction selector for directed acyclic graphs
Target Libraries
LLVMAlpha.oCode generation for Alpha architecture
LLVMARM.oCode generation for ARM architecture
LLVMCBackend.o 'C' language code generator.
LLVMIA64.oCode generation for IA64 architecture
LLVMPowerPC.oPowerPC code generation backend
LLVMSelectionDAG.oAggressive instruction selector for Directed Acyclic Graphs.
LLVMSkeleton.a .oSkeleton for a code generation backend.
LLVMSparcV9.oCode generation for SparcV9.
LLVMSparcV9RegAlloc.a .oGraph-coloring register allocator for SparcV9.
LLVMSparcV9InstrSched.oInstruction scheduling for SparcV9.
LLVMSparcV9LiveVar.oLive variable analysis SparcV9.
LLVMSparcV9ModuloSched.oModulo scheduling for SparcV9.
LLVMTarget.a .oCode generation for PowerPC architecture
LLVMSparc.oCode generation for Sparc architecture
LLVMTarget.a Generic code generation utilities.
LLVMX86.oIntel x86 code generation backend
Code generation for Intel x86 architecture
Runtime Libraries
LLVMInterpreter.oBytecode Interpreter
Bitcode Interpreter
LLVMJIT.oBytecode JIT Compiler
Bitcode JIT Compiler
LLVMExecutionEngine.o Virtual machine engine
LLVMexecve.oexecve(2) replacement for llee
-

Library Dependencies
+
Using llvm-config
-

The following list shows the dependency relationships between libraries. - This information can be automatically generated with the - GenLibDeps.pl utility in the llvm/utils directory.

+

The llvm-config tool is a perl script that produces on its output + various kinds of information. For example, the source or object directories + used to build LLVM can be accessed by passing options to llvm-config. + For complete details on this tool, please see the + manual page.

+

To understand the relationships between libraries, the llvm-config + can be very useful. If all you know is that you want certain libraries to + be available, you can generate the complete set of libraries to link with + using one of four options, as below:

+
    +
  1. --ldflags. This generates the command line options necessary to + be passed to the ld tool in order to link with LLVM. Most notably, + the -L option is provided to specify a library search directory + that contains the LLVM libraries.
  2. +
  3. --libs. This generates command line options suitable for + use with a gcc-style linker. That is, libraries are given with a -l option + and object files are given with a full path.
  4. +
  5. --libnames. This generates a list of just the library file + names. If you know the directory in which these files reside (see --ldflags) + then you can find the libraries there.
  6. +
  7. --libfiles. This generates the full path names of the + LLVM library files.
  8. +
+

If you wish to delve further into how llvm-config generates the + correct order (based on library dependencies), please see the tool named + GenLibDeps.pl in the utils source directory of LLVM.

+ - - - + + + + +

Dependency Relationships Of Libraries

+

This graph shows the dependency of archive libraries on other archive + libraries or objects. Where a library has both archive and object forms, only + the archive form is shown.

+ Library Dependencies +

Dependency Relationships Of Object Files

+

This graph shows the dependency of object files on archive libraries or + other objects. Where a library has both object and archive forms, only the + dependency to the archive form is shown.

+ Object File Dependencies +

The following list shows the dependency relationships between libraries in + textual form. The information is the same as shown on the graphs but arranged + alphabetically.

libLLVMAnalysis.a
    -
  • libLLVMScalarOpts.a
  • +
  • libLLVMCore.a
  • libLLVMSupport.a
  • +
  • libLLVMSystem.a
  • libLLVMTarget.a
  • -
  • libLLVMTransformUtils.a
  • -
  • LLVMCore.o
libLLVMArchive.a
    +
  • libLLVMBCReader.a
  • +
  • libLLVMCore.a
  • +
  • libLLVMSupport.a
  • +
  • libLLVMSystem.a
  • +
+
libLLVMAsmParser.a
    +
  • libLLVMCore.a
  • +
  • libLLVMSystem.a
  • +
+
libLLVMBCReader.a
    +
  • libLLVMCore.a
  • libLLVMSupport.a
  • libLLVMSystem.a
  • -
  • LLVMBCReader.o
-
libLLVMDataStructure.a
    +
    libLLVMBCWriter.a
      +
    • libLLVMCore.a
    • +
    • libLLVMSupport.a
    • +
    • libLLVMSystem.a
    • +
    +
    libLLVMCodeGen.a
    • libLLVMAnalysis.a
    • +
    • libLLVMCore.a
    • +
    • libLLVMScalarOpts.a
    • libLLVMSupport.a
    • +
    • libLLVMSystem.a
    • libLLVMTarget.a
    • libLLVMTransformUtils.a
    • -
    • LLVMCore.o
    • +
    +
    libLLVMCore.a
      +
    • libLLVMSupport.a
    • +
    • libLLVMSystem.a
    • +
    +
    libLLVMDebugger.a
      +
    • libLLVMBCReader.a
    • +
    • libLLVMCore.a
    • +
    • libLLVMSupport.a
    • +
    • libLLVMSystem.a
    libLLVMInstrumentation.a
      +
    • libLLVMCore.a
    • +
    • libLLVMScalarOpts.a
    • libLLVMSupport.a
    • libLLVMTransformUtils.a
    • -
    • LLVMCore.o
    libLLVMLinker.a
    • libLLVMArchive.a
    • +
    • libLLVMBCReader.a
    • +
    • libLLVMCore.a
    • +
    • libLLVMSupport.a
    • libLLVMSystem.a
    • -
    • LLVMBCReader.o
    • -
    • LLVMCore.o
    libLLVMScalarOpts.a
    • libLLVMAnalysis.a
    • +
    • libLLVMCore.a
    • libLLVMSupport.a
    • +
    • libLLVMSystem.a
    • libLLVMTarget.a
    • libLLVMTransformUtils.a
    • -
    • LLVMCore.o
    -
    libLLVMSparcV9RegAlloc.a
      +
      libLLVMSelectionDAG.a
      • libLLVMAnalysis.a
      • +
      • libLLVMCodeGen.a
      • +
      • libLLVMCore.a
      • libLLVMSupport.a
      • -
      • LLVMCodeGen.o
      • -
      • LLVMCore.o
      • -
      • LLVMSparcV9LiveVar.o
      • -
      • LLVMSparcV9.o
      • +
      • libLLVMSystem.a
      • +
      • libLLVMTarget.a
      • +
      • libLLVMTransformUtils.a
      libLLVMSupport.a
      • libLLVMSystem.a
      • -
      • LLVMbzip2.o
      • +
      • libLLVMbzip2.a
      libLLVMSystem.a
      libLLVMTarget.a
        +
      • libLLVMCore.a
      • libLLVMSupport.a
      • -
      • LLVMCore.o
      • +
      • libLLVMSystem.a
      libLLVMTransformUtils.a
      • libLLVMAnalysis.a
      • -
      • libLLVMScalarOpts.a
      • -
      • libLLVMSupport.a
      • -
      • LLVMCore.o
      • -
      -
      libLLVMTransforms.a
        -
      • libLLVMAnalysis.a
      • +
      • libLLVMCore.a
      • libLLVMSupport.a
      • +
      • libLLVMSystem.a
      • libLLVMTarget.a
      • -
      • libLLVMTransformUtils.a
      • -
      • LLVMCore.o
      • +
      • libLLVMipa.a
      • +
      +
      libLLVMbzip2.a
      libLLVMipa.a
      • libLLVMAnalysis.a
      • +
      • libLLVMCore.a
      • libLLVMSupport.a
      • -
      • LLVMCore.o
      • +
      • libLLVMSystem.a
      libLLVMipo.a
      • libLLVMAnalysis.a
      • -
      • libLLVMipa.a
      • -
      • libLLVMScalarOpts.a
      • +
      • libLLVMCore.a
      • libLLVMSupport.a
      • +
      • libLLVMSystem.a
      • libLLVMTarget.a
      • libLLVMTransformUtils.a
      • -
      • LLVMCore.o
      • +
      • libLLVMipa.a
      -
      LLVMAnalysis.o
        +
        libLLVMlto.a
          +
        • libLLVMAnalysis.a
        • +
        • libLLVMBCReader.a
        • +
        • libLLVMBCWriter.a
        • +
        • libLLVMCore.a
        • +
        • libLLVMLinker.a
        • libLLVMScalarOpts.a
        • libLLVMSupport.a
        • +
        • libLLVMSystem.a
        • libLLVMTarget.a
        • -
        • libLLVMTransformUtils.a
        • -
        • LLVMCore.o
        • -
        -
        LLVMAsmParser.o
          -
        • LLVMCore.o
        • +
        • libLLVMipa.a
        • +
        • libLLVMipo.a
        -
        LLVMBCReader.o
          +
          LLVMARM.o
            +
          • libLLVMCodeGen.a
          • +
          • libLLVMCore.a
          • +
          • libLLVMSelectionDAG.a
          • libLLVMSupport.a
          • libLLVMSystem.a
          • -
          • LLVMCore.o
          • -
          -
          LLVMBCWriter.o
            -
          • libLLVMSupport.a
          • -
          • LLVMCore.o
          • -
          -
          LLVMCBackend.o
            -
          • libLLVMAnalysis.a
          • -
          • libLLVMipa.a
          • -
          • libLLVMScalarOpts.a
          • -
          • libLLVMSupport.a
          • libLLVMTarget.a
          • -
          • LLVMCore.o
          -
          LLVMCodeGen.o
            -
          • libLLVMAnalysis.a
          • +
            LLVMAlpha.o
              +
            • libLLVMCodeGen.a
            • +
            • libLLVMCore.a
            • +
            • libLLVMSelectionDAG.a
            • libLLVMSupport.a
            • +
            • libLLVMSystem.a
            • libLLVMTarget.a
            • -
            • LLVMCore.o
            • -
            -
            LLVMCore.o
              -
            • libLLVMSupport.a
            -
            LLVMDataStructure.o
              +
              LLVMCBackend.o
              • libLLVMAnalysis.a
              • +
              • libLLVMCodeGen.a
              • +
              • libLLVMCore.a
              • +
              • libLLVMScalarOpts.a
              • libLLVMSupport.a
              • +
              • libLLVMSystem.a
              • libLLVMTarget.a
              • libLLVMTransformUtils.a
              • -
              • LLVMCore.o
              • -
              -
              LLVMDebugger.o
                -
              • libLLVMSupport.a
              • -
              • libLLVMSystem.a
              • -
              • LLVMBCReader.o
              • -
              • LLVMCodeGen.o
              • -
              • LLVMCore.o
              • -
              • LLVMExecutionEngine.o
              • +
              • libLLVMipa.a
              LLVMExecutionEngine.o
                +
              • libLLVMCore.a
              • libLLVMSupport.a
              • libLLVMSystem.a
              • libLLVMTarget.a
              • -
              • LLVMCore.o
              • -
              • LLVMInterpreter.o
              • -
              • LLVMJIT.o
              -
              LLVMInstrumentation.o
                +
                LLVMIA64.o
                  +
                • libLLVMCodeGen.a
                • +
                • libLLVMCore.a
                • +
                • libLLVMSelectionDAG.a
                • libLLVMSupport.a
                • -
                • libLLVMTransformUtils.a
                • -
                • LLVMCore.o
                • +
                • libLLVMSystem.a
                • +
                • libLLVMTarget.a
                LLVMInterpreter.o
                  +
                • LLVMExecutionEngine.o
                • +
                • libLLVMCodeGen.a
                • +
                • libLLVMCore.a
                • libLLVMSupport.a
                • libLLVMSystem.a
                • libLLVMTarget.a
                • -
                • LLVMCore.o
                • -
                • LLVMExecutionEngine.o
                LLVMJIT.o
                  +
                • LLVMExecutionEngine.o
                • +
                • libLLVMCore.a
                • libLLVMSupport.a
                • libLLVMSystem.a
                • libLLVMTarget.a
                • -
                • LLVMCore.o
                • -
                • LLVMExecutionEngine.o
                LLVMPowerPC.o
                  -
                • libLLVMScalarOpts.a
                • -
                • libLLVMSupport.a
                • -
                • libLLVMTarget.a
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                -
                LLVMProfilePaths.o
                  -
                • libLLVMInstrumentation.a
                • -
                • libLLVMSupport.a
                • -
                • LLVMCore.o
                • -
                -
                LLVMScalarOpts.o
                  -
                • libLLVMAnalysis.a
                • -
                • libLLVMSupport.a
                • -
                • libLLVMTarget.a
                • -
                • libLLVMTransformUtils.a
                • -
                • LLVMCore.o
                • -
                -
                LLVMSelectionDAG.o
                  -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                -
                LLVMSkeleton.o
                  -
                • libLLVMTarget.a
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                -
                LLVMSparcV8.o
                  -
                • libLLVMScalarOpts.a
                • -
                • libLLVMSupport.a
                • -
                • libLLVMTarget.a
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                -
                LLVMSparcV9.o
                  -
                • libLLVMScalarOpts.a
                • -
                • libLLVMSparcV9RegAlloc.a
                • -
                • libLLVMSupport.a
                • -
                • libLLVMTarget.a
                • -
                • LLVMBCWriter.o
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                • LLVMSparcV9InstrSched.o
                • -
                • LLVMSparcV9ModuloSched.o
                • -
                -
                LLVMSparcV9InstrSched.o
                  -
                • libLLVMSupport.a
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                • LLVMSparcV9LiveVar.o
                • -
                • LLVMSparcV9.o
                • -
                -
                LLVMSparcV9LiveVar.o
                  -
                • libLLVMSupport.a
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                -
                LLVMSparcV9ModuloSched.o
                  +
                • libLLVMCodeGen.a
                • +
                • libLLVMCore.a
                • +
                • libLLVMSelectionDAG.a
                • libLLVMSupport.a
                • +
                • libLLVMSystem.a
                • libLLVMTarget.a
                • -
                • LLVMCodeGen.o
                • -
                • LLVMCore.o
                • -
                • LLVMSparcV9.o
                -
                LLVMSparcV9RegAlloc.o
                  -
                • libLLVMAnalysis.a
                • +
                  LLVMSparc.o
                    +
                  • libLLVMCodeGen.a
                  • +
                  • libLLVMCore.a
                  • +
                  • libLLVMSelectionDAG.a
                  • libLLVMSupport.a
                  • -
                  • LLVMCodeGen.o
                  • -
                  • LLVMCore.o
                  • -
                  • LLVMSparcV9LiveVar.o
                  • -
                  • LLVMSparcV9.o
                  • -
                  -
                  LLVMSupport.o
                  • libLLVMSystem.a
                  • -
                  • LLVMbzip2.o
                  • -
                  -
                  LLVMSystem.o
                    -
                  -
                  LLVMTarget.o
                    -
                  • libLLVMSupport.a
                  • -
                  • LLVMCore.o
                  • -
                  -
                  LLVMTransformUtils.o
                    -
                  • libLLVMAnalysis.a
                  • -
                  • libLLVMScalarOpts.a
                  • -
                  • libLLVMSupport.a
                  • -
                  • LLVMCore.o
                  • -
                  -
                  LLVMTransforms.o
                    -
                  • libLLVMAnalysis.a
                  • -
                  • libLLVMSupport.a
                  • libLLVMTarget.a
                  • -
                  • libLLVMTransformUtils.a
                  • -
                  • LLVMCore.o
                  LLVMX86.o
                    -
                  • libLLVMScalarOpts.a
                  • -
                  • libLLVMSupport.a
                  • -
                  • libLLVMTarget.a
                  • -
                  • LLVMCodeGen.o
                  • -
                  • LLVMCore.o
                  • -
                  -
                  LLVMbzip2.o
                    -
                  -
                  LLVMipa.o
                    -
                  • libLLVMAnalysis.a
                  • -
                  • libLLVMSupport.a
                  • -
                  • LLVMCore.o
                  • -
                  -
                  LLVMipo.o
                    -
                  • libLLVMAnalysis.a
                  • -
                  • libLLVMipa.a
                  • -
                  • libLLVMScalarOpts.a
                  • +
                  • libLLVMCodeGen.a
                  • +
                  • libLLVMCore.a
                  • +
                  • libLLVMSelectionDAG.a
                  • libLLVMSupport.a
                  • +
                  • libLLVMSystem.a
                  • libLLVMTarget.a
                  • -
                  • libLLVMTransformUtils.a
                  • -
                  • LLVMCore.o
@@ -478,7 +441,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> Reid Spencer -The LLVM Compiler Infrastructure +The LLVM Compiler Infrastructure
Last modified: $Date$