IntervalPartition & IntervalIterator classes have been split out into
[oota-llvm.git] / include / llvm / SymTabValue.h
1 //===-- llvm/SymTabDef.h - Implement SymbolTable Defs ------------*- C++ -*--=//
2 //
3 // This subclass of Def implements a def that has a symbol table for keeping
4 // track of children.  This is used by the DefHolder template class...
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef LLVM_SYMTABDEF_H
9 #define LLVM_SYMTABDEF_H
10
11 #include "llvm/Value.h"               // Get the definition of Value
12 #include "llvm/ConstantPool.h"
13
14 class SymbolTable;
15 class ConstPoolVal;
16
17 class SymTabValue : public Value {
18 public:
19   typedef ConstantPool ConstantPoolType;
20 private:
21   SymbolTable *SymTab, *ParentSymTab;
22   ConstantPool ConstPool;   // The constant pool
23
24 protected:
25   void setParentSymTab(SymbolTable *ST);
26 public:
27   SymTabValue(const Type *Ty, ValueTy dty, const string &name = "");
28   ~SymTabValue();    // Implemented in Def.cpp
29
30   // hasSymbolTable() - Returns true if there is a symbol table allocated to
31   // this object AND if there is at least one name in it!
32   //
33   bool hasSymbolTable() const;
34
35   // CAUTION: The current symbol table may be null if there are no names (ie, 
36   // the symbol table is empty) 
37   //
38   inline       SymbolTable *getSymbolTable()       { return SymTab; }
39   inline const SymbolTable *getSymbolTable() const { return SymTab; }
40
41   inline const ConstantPool &getConstantPool() const{ return ConstPool; }
42   inline       ConstantPool &getConstantPool()      { return ConstPool; }
43
44   // getSymbolTableSure is guaranteed to not return a null pointer, because if
45   // the method does not already have a symtab, one is created.  Use this if
46   // you intend to put something into the symbol table for the method.
47   //
48   SymbolTable *getSymbolTableSure();  // Implemented in Def.cpp
49 };
50
51 #endif