X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FProgrammersManual.html;h=347861e9638896a59a85879ee228860fae29fc25;hb=43e607303be9c3162c1d06af180efb3bdafadc02;hp=5393d7fd7d68ebb632e8d8acfb4085eb6acc09ea;hpb=6b6c73e7bc5c62d3554672e2a5e1bfe29efbfc5a;p=oota-llvm.git diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 5393d7fd7d6..347861e9638 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -129,7 +129,7 @@ with another Value
  • The AbstractTypeUser Class
  • -
  • The SymbolTable class
  • +
  • The ValueSymbolTable and TypeSymbolTable classes
  • The Core LLVM Class Hierarchy Reference @@ -803,7 +803,7 @@ vector is also useful when interfacing with code that expects vectors :).
     for ( ... ) {
    -   std::vector V;
    +   std::vector<foo> V;
        use V;
     }
     
    @@ -813,7 +813,7 @@ for ( ... ) {
    -std::vector V;
    +std::vector<foo> V;
     for ( ... ) {
        use V;
        V.clear();
    @@ -2045,12 +2045,8 @@ Type is maintained by PATypeHolder objects.
     
     

    Some data structures need more to perform more complex updates when types get -resolved. The SymbolTable class, for example, needs -move and potentially merge type planes in its representation when a pointer -changes.

    - -

    -To support this, a class can derive from the AbstractTypeUser class. This class +resolved. To support this, a class can derive from the AbstractTypeUser class. +This class allows it to get callbacks when certain types are resolved. To register to get callbacks for a particular type, the DerivedType::{add/remove}AbstractTypeUser methods can be called on a type. Note that these methods only work for @@ -2062,16 +2058,19 @@ objects) can never be refined.

    -

    This class provides a symbol table that the The +ValueSymbolTable class provides a symbol table that the Function and -Module classes use for naming definitions. The symbol table can -provide a name for any Value. -SymbolTable is an abstract data type. It hides the data it contains -and provides access to it through a controlled interface.

    +Module classes use for naming value definitions. The symbol table +can provide a name for any Value. +The +TypeSymbolTable class is used by the Module class to store +names for types.

    Note that the SymbolTable class should not be directly accessed by most clients. It should only be used when iteration over the symbol table @@ -2081,140 +2080,14 @@ all LLVM an empty name) do not exist in the symbol table.

    -

    To use the SymbolTable well, you need to understand the -structure of the information it holds. The class contains two -std::map objects. The first, pmap, is a map of -Type* to maps of name (std::string) to Value*. -Thus, Values are stored in two-dimensions and accessed by Type and -name.

    - -

    The interface of this class provides three basic types of operations: -

      -
    1. Accessors. Accessors provide read-only access to information - such as finding a value for a name with the - lookup method.
    2. -
    3. Mutators. Mutators allow the user to add information to the - SymbolTable with methods like - insert.
    4. -
    5. Iterators. Iterators allow the user to traverse the content - of the symbol table in well defined ways, such as the method - plane_begin.
    6. -
    - -

    Accessors

    -
    -
    Value* lookup(const Type* Ty, const std::string& name) const: -
    -
    The lookup method searches the type plane given by the - Ty parameter for a Value with the provided name. - If a suitable Value is not found, null is returned.
    - -
    bool isEmpty() const:
    -
    This function returns true if both the value and types maps are - empty
    -
    - -

    Mutators

    -
    -
    void insert(Value *Val):
    -
    This method adds the provided value to the symbol table. The Value must - have both a name and a type which are extracted and used to place the value - in the correct type plane under the value's name.
    - -
    void remove(Value* Val):
    -
    This method removes a named value from the symbol table. The - type and name of the Value are extracted from \p N and used to - lookup the Value in the correct type plane. If the Value is - not in the symbol table, this method silently ignores the - request.
    - -
    - -

    Iteration

    -

    The following functions describe three types of iterators you can obtain -the beginning or end of the sequence for both const and non-const. It is -important to keep track of the different kinds of iterators. There are -three idioms worth pointing out:

    - - - - - - - - - - - -
    UnitsIteratorIdiom
    Planes Of name/Value mapsPI
    
    -for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
    -     PE = ST.plane_end(); PI != PE; ++PI ) {
    -  PI->first  // This is the Type* of the plane
    -  PI->second // This is the SymbolTable::ValueMap of name/Value pairs
    -}
    -    
    name/Value pairs in a planeVI
    
    -for (SymbolTable::value_const_iterator VI = ST.value_begin(SomeType),
    -     VE = ST.value_end(SomeType); VI != VE; ++VI ) {
    -  VI->first  // This is the name of the Value
    -  VI->second // This is the Value* value associated with the name
    -}
    -    
    +

    These symbol tables support iteration over the values/types in the symbol +table with begin/end/iterator and supports querying to see if a +specific name is in the symbol table (with lookup). The +ValueSymbolTable class exposes no public mutator methods, instead, +simply call setName on a value, which will autoinsert it into the +appropriate symbol table. For types, use the Module::addTypeName method to +insert entries into the symbol table.

    -

    Using the recommended iterator names and idioms will help you avoid -making mistakes. Of particular note, make sure that whenever you use -value_begin(SomeType) that you always compare the resulting iterator -with value_end(SomeType) not value_end(SomeOtherType) or else you -will loop infinitely.

    - -
    - -
    plane_iterator plane_begin():
    -
    Get an iterator that starts at the beginning of the type planes. - The iterator will iterate over the Type/ValueMap pairs in the - type planes.
    - -
    plane_const_iterator plane_begin() const:
    -
    Get a const_iterator that starts at the beginning of the type - planes. The iterator will iterate over the Type/ValueMap pairs - in the type planes.
    - -
    plane_iterator plane_end():
    -
    Get an iterator at the end of the type planes. This serves as - the marker for end of iteration over the type planes.
    - -
    plane_const_iterator plane_end() const:
    -
    Get a const_iterator at the end of the type planes. This serves as - the marker for end of iteration over the type planes.
    - -
    value_iterator value_begin(const Type *Typ):
    -
    Get an iterator that starts at the beginning of a type plane. - The iterator will iterate over the name/value pairs in the type plane. - Note: The type plane must already exist before using this.
    - -
    value_const_iterator value_begin(const Type *Typ) const:
    -
    Get a const_iterator that starts at the beginning of a type plane. - The iterator will iterate over the name/value pairs in the type plane. - Note: The type plane must already exist before using this.
    - -
    value_iterator value_end(const Type *Typ):
    -
    Get an iterator to the end of a type plane. This serves as the marker - for end of iteration of the type plane. - Note: The type plane must already exist before using this.
    - -
    value_const_iterator value_end(const Type *Typ) const:
    -
    Get a const_iterator to the end of a type plane. This serves as the - marker for end of iteration of the type plane. - Note: the type plane must already exist before using this.
    - -
    plane_const_iterator find(const Type* Typ ) const:
    -
    This method returns a plane_const_iterator for iteration over - the type planes starting at a specific plane, given by \p Ty.
    - -
    plane_iterator find( const Type* Typ :
    -
    This method returns a plane_iterator for iteration over the - type planes starting at a specific plane, given by \p Ty.
    - -
    @@ -2314,15 +2187,15 @@ the lib/VMCore directory.

    PointerType
    Subclass of SequentialType for pointer types.
    -
    PackedType
    -
    Subclass of SequentialType for packed (vector) types. A - packed type is similar to an ArrayType but is distinguished because it is - a first class type wherease ArrayType is not. Packed types are used for +
    VectorType
    +
    Subclass of SequentialType for vector types. A + vector type is similar to an ArrayType but is distinguished because it is + a first class type wherease ArrayType is not. Vector types are used for vector operations and are usually small vectors of of an integer or floating point type.
    StructType
    Subclass of DerivedTypes for struct types.
    -
    FunctionType
    +
    FunctionType
    Subclass of DerivedTypes for function types.
    • bool isVarArg() const: Returns true if its a vararg @@ -2516,7 +2389,7 @@ method. In addition, all LLVM values can be named. The "name" of the
    -

    The name of this instruction is "foo". NOTE +

    The name of this instruction is "foo". NOTE that the name of any value may be missing (an empty string), so names should ONLY be used for debugging (making the source code easier to read, debugging printouts), they should not be used to keep track of values or map @@ -2748,10 +2621,20 @@ a subclass, which represents the address of a global variable or function.

  • ConstantInt : This subclass of Constant represents an integer constant of any width.