Added virtual function to generate an instruction sequence to
[oota-llvm.git] / include / llvm / CodeGen / ValueSet.h
1 /* Title:   ValueSet.h
2    Author:  Ruchira Sasanka
3    Date:    Jun 30, 01
4    Purpose: Contains a mathematical set of Values. LiveVarSet is derived from
5             this. Contains both class and method definitions.
6 */
7
8 #ifndef VALUE_SET_H
9 #define VALUE_SET_H
10
11 #include <stdlib.h>
12
13 #include <hash_set>
14 #include <algorithm>
15 //#include <fstream>
16 #include <iostream>
17
18 #include "llvm/Value.h"
19
20
21 //------------------------ Support functions ---------------------------------
22
23 struct hashFuncValue {                  // sturcture containing the hash func
24   inline size_t operator () (const Value *const val) const 
25   { return (size_t) val;  }
26 };
27
28
29
30 //------------------- Class Definition for ValueSet --------------------------
31
32 void printValue( const Value *const v);  // func to print a Value 
33
34
35
36 class ValueSet : public hash_set<const Value *,  hashFuncValue > 
37 {
38  
39  public:
40   ValueSet();                           // constructor
41
42   inline void add(const Value *const  val) 
43     { assert( val ); insert(val);}      // for adding a live variable to set
44
45   inline void remove(const Value *const  val) 
46     { assert( val ); erase(val); }      // for removing a live var from set
47
48   bool setUnion( const ValueSet *const set1);     // for performing set union
49   void setSubtract( const ValueSet *const set1);  // for performing set diff
50
51  
52   void setDifference( const ValueSet *const set1, const ValueSet *const set2); 
53  
54   void printSet() const;                // for printing a live variable set
55 };
56
57
58
59
60
61
62 #endif