X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FProgrammersManual.html;h=06794cdc3be9809934ed7a436d3cd36d1d345859;hb=a0f71e4d43d6490ddc95b7ebf0a4251054004acd;hp=945ac98755d06c4432658adc2145447719ced7d2;hpb=2b76306eb7ab0f8981446da96b5340ed5fb814ef;p=oota-llvm.git diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 945ac98755d..06794cdc3be 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -1,38 +1,73 @@ - -LLVM Programmer's Manual + + + + LLVM Programmer's Manual + + + + +
+ LLVM Programmer's Manual +
- - - - -
  LLVM Programmer's Manual
-
    -
  1. Introduction +
  2. Introduction
  3. General Information - -
  4. Helpful Hints for Common Operations -
  5. +
  6. The SymbolTable class
  7. The ilist and iplist classes - -
  8. Important iterator invalidation semantics to be aware of - - -

    Written by Dinakar Dhurjati - Chris Lattner, and - Joel Stanley

    +

    +
  9. +
  10. Important iterator invalidation semantics to be aware of.
  11. +
+
+

Written by Chris Lattner, + Dinakar Dhurjati, + Joel Stanley, and + Reid Spencer

+
- -
-Introduction -
-
-General Information -
-
   - -The C++ Standard Template Library -
-
-Helpful Hints for Common Operations -
-
   - -Basic Inspection and Traversal Routines -


Iterating over the -BasicBlocks in a Function


Iterating over the -Instructions in a BasicBlock


Turning an iterator into a class -pointer


Finding call sites: -a slightly more complex example -

-
   - -Making simple changes -
-
-The Core LLVM Class Hierarchy Reference -
-
   - -The Value class -


Important Public Members of -the Value class

-
   - -The User class -


Important Public Members of -the User class

-
   - -The Instruction class -


Important Public Members of -the Instruction class

-
   - -The BasicBlock class -


Important Public Members of -the BasicBlock class

-
   - -The GlobalValue class -


Important Public Members of -the GlobalValue class

-
   - -The Function class -


Important Public Members of -the Function class

-
   - -The GlobalVariable class -


Important Public Members of the -GlobalVariable class

-
   - -The Module class -


Important Public Members of the -Module class

-
   - -The Constant class and subclasses -


Important Public Methods

-
   - -The Type class and Derived Types -
-
   - -The Argument class -
- +

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.
+ +
Type* lookupType( const std::string& name) const:
+
The lookupType method searches through the types for a + Type with the provided name. If a suitable Type + is not found, null is returned.
+ +
bool hasTypes() const:
+
This function returns true if an entry has been made into the type + map.
+ +
bool isEmpty() const:
+
This function returns true if both the value and types maps are + empty
+ +
std::string get_name(const Value*) const:
+
This function returns the name of the Value provided or the empty + string if the Value is not in the symbol table.
+ +
std::string get_name(const Type*) const:
+
This function returns the name of the Type provided or the empty + string if the Type is not in the symbol table.
+
+ +

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 insert(const std::string& Name, Value *Val):
+
Inserts a constant or type into the symbol table with the specified + name. There can be a many to one mapping between names and constants + or types.
+ +
void insert(const std::string& Name, Type *Typ):
+
Inserts a type into the symbol table with the specified name. There + can be a many-to-one mapping between names and types. This method + allows a type with an existing entry in the symbol table to get + a new 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.
+ +
void remove(Type* Typ):
+
This method removes a named type from the symbol table. The + name of the type is extracted from \P T and used to look up + the Type in the type map. If the Type is not in the symbol + table, this method silently ignores the request.
+ +
Value* remove(const std::string& Name, Value *Val):
+
Remove a constant or type with the specified name from the + symbol table.
+ +
Type* remove(const std::string& Name, Type* T):
+
Remove a type with the specified name from the symbol table. + Returns the removed Type.
+ +
Value *value_remove(const value_iterator& It):
+
Removes a specific value from the symbol table. + Returns the removed value.
+ +
bool strip():
+
This method will strip the symbol table of its names leaving + the type and values.
+ +
void clear():
+
Empty the symbol table completely.
+
+ +

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
+    
All name/Type PairsTI
+for (SymbolTable::type_const_iterator TI = ST.type_begin(),
+     TE = ST.type_end(); TI != TE; ++TI )
+  TI->first  // This is the name of the type
+  TI->second // This is the Type* value associated with the name
+    
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
+    
+

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.
+ +
type_iterator type_begin():
+
Get an iterator to the start of the name/Type map.
+ +
type_const_iterator type_begin() cons:
+
Get a const_iterator to the start of the name/Type map.
+ +
type_iterator type_end():
+
Get an iterator to the end of the name/Type map. This serves as the + marker for end of iteration of the types.
+ +
type_const_iterator type_end() const:
+
Get a const-iterator to the end of the name/Type map. This serves + as the marker for end of iteration of the types.
+ +
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.
+ +
const ValueMap* findPlane( const Type* Typ ) cons:
+
This method returns a ValueMap* for a specific type plane. This + interface is deprecated and may go away in the future.
+
+ -
-
By: Dinakar Dhurjati and -Chris Lattner
- - -Last modified: Fri Sep 6 17:12:14 CDT 2002 - -
+ +
+
+ Valid CSS! + Valid HTML 4.01! + + Dinakar Dhurjati and + Chris Lattner
+ The LLVM Compiler Infrastructure
+ Last modified: $Date$ +
+ + + +