EvalToConstVisitor.hpp

Go to the documentation of this file.
00001 
00017 #ifndef EvalToConstVisitor_H
00018 #define EvalToConstVisitor_H
00019 
00020 #include <OpenAnalysis/ExprTree/ExprTreeVisitor.hpp>
00021 #include <OpenAnalysis/IRInterface/ConstValBasicInterface.hpp>
00022 #include <OpenAnalysis/IRInterface/EvalToConstVisitorIRInterface.hpp>
00023 #include <OpenAnalysis/ReachConsts/Interface.hpp>
00024 
00025 namespace OA {
00026 
00027 //--------------------------------------------------------------------
00030 class EvalToConstVisitor : public ExprTreeVisitor {
00031 public:
00032   EvalToConstVisitor(OA_ptr<EvalToConstVisitorIRInterface> ir,
00033                      OA_ptr<ReachConsts::Interface> rc);
00034   ~EvalToConstVisitor() {}
00035 
00036   void visitExprTreeBefore(ExprTree&) { }
00037   void visitExprTreeAfter(ExprTree&) { }
00038 
00039   //---------------------------------------
00040   // method for each ExprTree::Node subclass
00041   //---------------------------------------
00042   // default base class so that visitors can handle unknown
00043   // node sub-classes in a generic fashion
00044   void visitNode(ExprTree::Node&);
00045 
00046   void visitOpNode(ExprTree::OpNode& n);
00047   void visitCallNode(ExprTree::CallNode& n);
00048   void visitMemRefNode(ExprTree::MemRefNode& n);
00049   void visitConstSymNode(ExprTree::ConstSymNode& n);
00050   void visitConstValNode(ExprTree::ConstValNode& n);
00051 
00053   OA_ptr<ConstValBasicInterface> getConstVal() { return mEvalResult; }
00054 
00055 private:
00056   OA_ptr<ConstValBasicInterface> mEvalResult;
00057   OA_ptr<EvalToConstVisitorIRInterface> mIR;
00058   OA_ptr<ReachConsts::Interface> mReachConsts;
00059 };
00060 
00061 
00062 } // end of OA namespace
00063 
00064 #endif