X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FProgrammersManual.html;h=716d364ed5699a2c73ca2c84ca93dbf3aee094be;hb=93c534623c4691d255ea6c870347482ff8752313;hp=e4d50039f604c97135fdd863bb3fea1377eabd16;hpb=f623a0844110f3d753296ec61f683349f05058ac;p=oota-llvm.git diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index e4d50039f60..716d364ed56 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -28,14 +28,14 @@ @@ -1571,10 +2672,10 @@ way as for other Users (with the the Instruction class is the llvm/Instruction.def file. This file contains some meta-data about the various different types of instructions in LLVM. It describes the enum values that are used as opcodes (for example -Instruction::Add and Instruction::SetLE), as well as the +Instruction::Add and Instruction::ICmp), as well as the concrete sub-classes of Instruction that implement the instruction (for example BinaryOperator and SetCondInst). Unfortunately, the use of macros in +href="#CmpInst">CmpInst). Unfortunately, the use of macros in this file confuses doxygen, so these enum values don't show up correctly in the doxygen output.

@@ -1582,121 +2683,119 @@ this file confuses doxygen, so these enum values don't show up correctly in the
- Important Public Members of the Instruction + Important Subclasses of the Instruction class
- -
- - - -
- - -
- The BasicBlock class -
-
- -

#include "llvm/BasicBlock.h"
-doxygen info: BasicBlock -Class
-Superclass: Value

- -

This class represents a single entry multiple exit section of the code, -commonly known as a basic block by the compiler community. The -BasicBlock class maintains a list of Instructions, which form the body of the block. -Matching the language definition, the last element of this list of instructions -is always a terminator instruction (a subclass of the TerminatorInst class).

- -

In addition to tracking the list of instructions that make up the block, the -BasicBlock class also keeps track of the Function that it is embedded into.

- -

Note that BasicBlocks themselves are Values, because they are referenced by instructions -like branches and can go in the switch tables. BasicBlocks have type -label.

- -
+ +
- Important Public Members of the BasicBlock + Important Public Members of the Instruction class
-
  • BasicBlock(const std::string &Name = "", Function *Parent = 0) - -

    The BasicBlock constructor is used to create new basic blocks for -insertion into a function. The constructor optionally takes a name for the new -block, and a Function to insert it into. If -the Parent parameter is specified, the new BasicBlock is -automatically inserted at the end of the specified Function, if not specified, the BasicBlock must be -manually inserted into the Function.

  • - -
  • BasicBlock::iterator - Typedef for instruction list iterator
    -BasicBlock::const_iterator - Typedef for const_iterator.
    -begin(), end(), front(), back(), -size(), empty() -STL-style functions for accessing the instruction list. - -

    These methods and typedefs are forwarding functions that have the same -semantics as the standard library methods of the same names. These methods -expose the underlying instruction list of a basic block in a way that is easy to -manipulate. To get the full complement of container operations (including -operations to update the list), you must use the getInstList() -method.

  • - -
  • BasicBlock::InstListType &getInstList() - -

    This method is used to get access to the underlying container that actually -holds the Instructions. This method must be used when there isn't a forwarding -function in the BasicBlock class for the operation that you would like -to perform. Because there are no forwarding functions for "updating" -operations, you need to use this if you want to update the contents of a -BasicBlock.

  • +
    -
  • Function *getParent() + +
    + The Constant class and subclasses +
    -

    Returns a pointer to Function the block is -embedded into, or a null pointer if it is homeless.

  • +
    -
  • TerminatorInst *getTerminator() +

    Constant represents a base class for different types of constants. It +is subclassed by ConstantInt, ConstantArray, etc. for representing +the various types of Constants. GlobalValue is also +a subclass, which represents the address of a global variable or function. +

    -

    Returns a pointer to the terminator instruction that appears at the end of -the BasicBlock. If there is no terminator instruction, or if the last -instruction in the block is not a terminator, then a null pointer is -returned.

  • +
    + +
    Important Subclasses of Constant
    +
    + -
    +
    The GlobalValue class @@ -1708,8 +2807,8 @@ returned.

    href="/doxygen/GlobalValue_8h-source.html">llvm/GlobalValue.h"
    doxygen info: GlobalValue Class
    -Superclasses: User, Value

    +Superclasses: Constant, +User, Value

    Global values (GlobalVariables or Functions) are the only LLVM values that are @@ -1733,11 +2832,11 @@ global is always a pointer to its contents. It is important to remember this when using the GetElementPtrInst instruction because this pointer must be dereferenced first. For example, if you have a GlobalVariable (a subclass of GlobalValue) that is an array of 24 ints, type [24 x -int], then the GlobalVariable is a pointer to that array. Although +i32], then the GlobalVariable is a pointer to that array. Although the address of the first element of this array and the value of the GlobalVariable are the same, they have different types. The -GlobalVariable's type is [24 x int]. The first element's type -is int. Because of this, accessing a global value requires you to +GlobalVariable's type is [24 x i32]. The first element's type +is i32. Because of this, accessing a global value requires you to dereference the pointer with GetElementPtrInst first, then its elements can be accessed. This is explained in the LLVM Language Reference Manual.

    @@ -1776,15 +2875,17 @@ GlobalValue is currently embedded into.

    #include "llvm/Function.h"
    doxygen info: Function Class
    -Superclasses: GlobalValue, User, Value

    +Superclasses: GlobalValue, +Constant, +User, +Value

    The Function class represents a single procedure in LLVM. It is actually one of the more complex classes in the LLVM heirarchy because it must keep track of a large amount of data. The Function class keeps track -of a list of BasicBlocks, a list of formal Arguments, and a SymbolTable.

    +of a list of BasicBlocks, a list of formal +Arguments, and a +SymbolTable.

    The list of BasicBlocks is the most commonly used part of Function objects. The list imposes an implicit @@ -1835,7 +2936,7 @@ is its address (after linking) which is guaranteed to be constant.

    create and what type of linkage the function should have. The FunctionType argument specifies the formal arguments and return value for the function. The same - FunctionType value can be used to + FunctionType value can be used to create multiple functions. The Parent argument specifies the Module in which the function is defined. If this argument is provided, the function will automatically be inserted into that module's list of @@ -1845,412 +2946,227 @@ is its address (after linking) which is guaranteed to be constant.

    Return whether or not the Function has a body defined. If the function is "external", it does not have a body, and thus must be resolved - by linking with a function defined in a different translation unit.

    - -
  • Function::iterator - Typedef for basic block list iterator
    - Function::const_iterator - Typedef for const_iterator.
    - - begin(), end() - size(), empty() - -

    These are forwarding methods that make it easy to access the contents of - a Function object's BasicBlock - list.

  • - -
  • Function::BasicBlockListType &getBasicBlockList() - -

    Returns the list of BasicBlocks. This - is necessary to use when you need to update the list or perform a complex - action that doesn't have a forwarding method.

  • - -
  • Function::arg_iterator - Typedef for the argument list -iterator
    - Function::const_arg_iterator - Typedef for const_iterator.
    - - arg_begin(), arg_end() - arg_size(), arg_empty() - -

    These are forwarding methods that make it easy to access the contents of - a Function object's Argument - list.

  • - -
  • Function::ArgumentListType &getArgumentList() - -

    Returns the list of Arguments. This is - necessary to use when you need to update the list or perform a complex - action that doesn't have a forwarding method.

  • - -
  • BasicBlock &getEntryBlock() - -

    Returns the entry BasicBlock for the - function. Because the entry block for the function is always the first - block, this returns the first block of the Function.

  • - -
  • Type *getReturnType()
    - FunctionType *getFunctionType() - -

    This traverses the Type of the - Function and returns the return type of the function, or the FunctionType of the actual - function.

  • - -
  • SymbolTable *getSymbolTable() - -

    Return a pointer to the SymbolTable - for this Function.

  • - - -
    - - -
    - The GlobalVariable class -
    - -
    - -

    #include "llvm/GlobalVariable.h" -
    -doxygen info: GlobalVariable -Class
    Superclasses: GlobalValue, User, Value

    - -

    Global variables are represented with the (suprise suprise) -GlobalVariable class. Like functions, GlobalVariables are also -subclasses of GlobalValue, and as such are -always referenced by their address (global values must live in memory, so their -"name" refers to their address). See GlobalValue for more on this. Global variables -may have an initial value (which must be a Constant), and if they have an initializer, they -may be marked as "constant" themselves (indicating that their contents never -change at runtime).

    - -
    - - -
    - Important Public Members of the - GlobalVariable class -
    - -
    - - - -
    - - -
    - The Module class -
    - -
    - -

    #include "llvm/Module.h"
    doxygen info: -Module Class

    - -

    The Module class represents the top level structure present in LLVM -programs. An LLVM module is effectively either a translation unit of the -original program or a combination of several translation units merged by the -linker. The Module class keeps track of a list of Functions, a list of GlobalVariables, and a SymbolTable. Additionally, it contains a few -helpful member functions that try to make common operations easy.

    - -
    - - -
    - Important Public Members of the Module class -
    - -
    - - - -

    Constructing a Module is easy. You can optionally -provide a name for it (probably based on the name of the translation unit).

    - - - -
    - - +

    These are forwarding methods that make it easy to access the contents of + a Function object's BasicBlock + list.

    -
    +
  • Function::BasicBlockListType &getBasicBlockList() - + arg_begin(), arg_end() + arg_size(), arg_empty() -
    +

    These are forwarding methods that make it easy to access the contents of + a Function object's Argument + list.

  • -
    - The Constant class and subclasses + The GlobalVariable class
    -

    Constant represents a base class for different types of constants. It -is subclassed by ConstantBool, ConstantInt, ConstantSInt, ConstantUInt, -ConstantArray etc for representing the various types of Constants.

    +

    #include "llvm/GlobalVariable.h" +
    +doxygen info: GlobalVariable + Class
    +Superclasses: GlobalValue, +Constant, +User, +Value

    +

    Global variables are represented with the (suprise suprise) +GlobalVariable class. Like functions, GlobalVariables are also +subclasses of GlobalValue, and as such are +always referenced by their address (global values must live in memory, so their +"name" refers to their constant address). See +GlobalValue for more on this. Global +variables may have an initial value (which must be a +Constant), and if they have an initializer, +they may be marked as "constant" themselves (indicating that their contents +never change at runtime).

    - Important Public Methods -
    -
    + Important Public Members of the + GlobalVariable class
    - -
    Important Subclasses of Constant
    + +
    +
    - The Type class and Derived Types + The BasicBlock class
    -

    Type as noted earlier is also a subclass of a Value class. Any primitive -type (like int, short etc) in LLVM is an instance of Type Class. All other -types are instances of subclasses of type like FunctionType, ArrayType -etc. DerivedType is the interface for all such dervied types including -FunctionType, ArrayType, PointerType, StructType. Types can have names. They can -be recursive (StructType). There exists exactly one instance of any type -structure at a time. This allows using pointer equality of Type *s for comparing -types.

    +

    #include "llvm/BasicBlock.h"
    +doxygen info: BasicBlock +Class
    +Superclass: Value

    + +

    This class represents a single entry multiple exit section of the code, +commonly known as a basic block by the compiler community. The +BasicBlock class maintains a list of Instructions, which form the body of the block. +Matching the language definition, the last element of this list of instructions +is always a terminator instruction (a subclass of the TerminatorInst class).

    + +

    In addition to tracking the list of instructions that make up the block, the +BasicBlock class also keeps track of the Function that it is embedded into.

    + +

    Note that BasicBlocks themselves are Values, because they are referenced by instructions +like branches and can go in the switch tables. BasicBlocks have type +label.

    - Important Public Methods + Important Public Members of the BasicBlock + class
    - -
    +

    Returns a pointer to Function the block is +embedded into, or a null pointer if it is homeless.

    + +
  • TerminatorInst *getTerminator() + +

    Returns a pointer to the terminator instruction that appears at the end of +the BasicBlock. If there is no terminator instruction, or if the last +instruction in the block is not a terminator, then a null pointer is +returned.

  • - -
    - Important Derived Types -
    -
    - +
    +
    The Argument class @@ -2274,7 +3190,7 @@ arguments. An argument has a pointer to the parent Function.

    Dinakar Dhurjati and Chris Lattner
    - The LLVM Compiler Infrastructure
    + The LLVM Compiler Infrastructure
    Last modified: $Date$