00001 00021 #ifndef SSAIRInterface_h 00022 #define SSAIRInterface_h 00023 00024 //----------------------------------------------------------------------------- 00025 // This file contains the abstract base classes for the IR interface. 00026 // 00027 // See the top level README for a description of the IRInterface and 00028 // how to use it. 00029 //----------------------------------------------------------------------------- 00030 00031 #include <iostream> 00032 #include "IRHandles.hpp" 00033 #include <OpenAnalysis/Utils/OA_ptr.hpp> 00034 00035 namespace OA { 00036 namespace SSA { 00037 00038 00039 // Enumerate all the variable uses or variable definitions in a statement. 00040 // This is useful for analyses that require information about variable 00041 // references or definitions, such as SSA construction. 00042 // 00043 // FIXME: Move to IRHandles; even better, merge with MemRefHandleIterator 00044 class IRUseDefIterator { 00045 public: 00046 enum { Uses, Defs }; 00047 00048 IRUseDefIterator() { } 00049 virtual ~IRUseDefIterator() { } 00050 00051 virtual LeafHandle current() const = 0; // Returns the current item. 00052 virtual bool isValid () = 0; // False when all items are exhausted. 00053 00054 virtual void operator++() = 0; 00055 void operator++(int) { ++*this; } 00056 00057 virtual void reset() = 0; 00058 }; 00059 00060 00061 //----------------------------------------------------------------------------- 00062 // 00063 //----------------------------------------------------------------------------- 00064 00070 class SSAIRInterface : public virtual IRHandlesIRInterface { 00071 public: 00072 SSAIRInterface() { } 00073 virtual ~SSAIRInterface() { } 00074 00075 // FIXME: this should probably be merged with MemRefHandleIterator 00076 00077 00079 virtual OA_ptr<IRUseDefIterator> getUses(StmtHandle h) = 0; 00080 00082 virtual OA_ptr<IRUseDefIterator> getDefs(StmtHandle h) = 0; 00083 00084 // Getsymhandle Given a LeafHandle containing a use or def, return 00085 // the referened SymHandle. 00086 virtual SymHandle getSymHandle(LeafHandle h) = 0; 00087 00088 }; 00089 00090 00091 } // end of namespace SSA 00092 } // end of namespace OA 00093 00094 #endif // SSAIRInterface_h
1.7.1