Specification for LLVM system

Index

Checkout LLVM from CVS

cvs root directory:
/home/vadve/vadve/Research/DynOpt/CVSRepository
project name:
llvm
For those who are not familar with cvs, there are two steps you should do:
  1. set CVSROOT. Add the following line into the .cshrc file in your home directory if you are using tcsh or csh:
    setenv CVSROOT /home/vadve/vadve/Research/DynOpt/CVSRepository
  2. check out. Go to the directory you want to store LLVM, type
    cvs checkout llvm
note: the c front-end implementation is not in cvs. If you want to use it, you can use excutable in Chris Lattner's directory
/home/vadve/lattner/cvs/gcc_install/bin/gcc
a brief usage of this gcc and other tools are introduced later. To read it now, click here.

Compile and Run

There is a makefile in each directory. You can simple type gmake in the ~/llvm directory to compile all the files or you can type gmake in the certain directory to compile all files and subdirectories in that directory.
You might want to add the the following directory into your path:
llvm/tools/Debug
so you can run tools in any directory. If you are using csh or tcsh, add
setenv PATH llvm/tools/Debug:${PATH}
at the end of the file .cshrc in your home directory.

Program Layout

Many useful infomation can be obtained from the LLVM doxygen tree available at http://llvm.cs.uiuc.edu/doxygen/
The following is a brief introduction to code layout:

Depend and Debug directories

Most directories contain these two directories. The depend directory contains dependance files which will be used during complilation. The debug directory contains object files, library files or executables after compilation.

llvm/include

This directory contains common head files supporting the LLVM library. Specific head files which are only used by certain directory are place in that directory instead of here.

llvm/lib

This directory contains most important files of LLVM system.
llvm/lib/transforms/
This directory contains files and directories for transforming one representation to another representation.
llvm/lib/Target/
This directory contains files and directories for target machine. The files under llvm/lib/Target describe the common property for any target machine. The directory llvm/lib/Target/Sparc describe the sparc machine specification.
llvm/lib/Analysis/
This directory contains files and directories for doing all kinds of data and control analysis.
llvm/lib/AsmParser/
This directory contains files and directories for parsing the llvm assemly files.
llvm/lib/ByteCode/
This directory contains files and directories for reading and write LLVM bytecode.
llvm/lib/CWrite/
This directory contains files and directories for writing c files as output.
llvm/lib/CodeGen/
This directory contains files and directories for instruction selection, instruction scheduling and register allocation.
llvm/lib/Reoptimizer
This directory contains files and directories for all kinds of optimizations, e.g. dead code elimination, Loop Invariant Code Motion, etc.
llvm/lib/Support/
This directory contains some files and directories supporting the library, e.g. commandline processor and statistic reporter.
llvm/lib/VMCore/
This directory contains files and directories for implementing the virtual machine instruction set.

llvm/test

This directory contains llvm assembly and other files to test the llvm library.

llvm/tools

The tools directory contains many tools. You can always get help by typing command_name --help . The following is a brief introduction to each tool.

analyze
???
as
llvm .ll -> .bc assembler
The assembler transfroms the human readable assembly to llvm bytecode.
dis
llvm .bc -> .ll disassembler
The disassembler transfroms the llvm bytecode to human readable assembly.
extract
???
gccas
llvm .ll -> .bc assembler
The assembler transfroms the human readable assembly to llvm bytecode.
gccld
many llvm bytecode -> llvm bytecode + optimizations
gccld links many llvm bytecode files into one bytecode file and does some optimization.
link
many llvm bytecode -> llvm bytecode
link takes many llvm bytecode files and link them into one llvm bytecode file.
llc
llvm bytecode -> SPARC assembly
llc takes a llvm bytecode file and output a SPARC assembly file.
lli
llvm interpreter
lli reads a llvm bytecode file and execute it.
opt
llvm .bc -> .bc modular optimizer
opt reads llvm bytecode and do certain optimization, then output llvm bytecode .

tutorial for using tools

Links


If you have any question, please send an email to Lattner Chris Arthur or Guochun Shi.

Last modified: Wed Jul 17 17:55:16 CDT 2002