Go to the documentation of this file.00001
00015 #ifndef MANAGERCFGSTANDARD_H
00016 #define MANAGERCFGSTANDARD_H
00017
00018
00019
00020 #ifdef NO_STD_CHEADERS
00021 # include <string.h>
00022 #else
00023 # include <cstring>
00024 #endif
00025
00026
00027 #include <list>
00028 #include <set>
00029 #include <map>
00030
00031
00032 #include <OpenAnalysis/Utils/OA_ptr.hpp>
00033 #include <OpenAnalysis/CFG/CFGInterface.hpp>
00034 #include <OpenAnalysis/CFG/CFG.hpp>
00035 #include <OpenAnalysis/IRInterface/CFGIRInterface.hpp>
00036
00037 namespace OA {
00038 namespace CFG {
00039
00040
00041
00042 class Worklist;
00043
00044
00045
00050 class ManagerCFGStandard {
00051 public:
00052 ManagerCFGStandard(OA_ptr<CFGIRInterface> _ir, bool _build_stmt_level_cfg = false);
00053 virtual ~ManagerCFGStandard () { }
00054
00055
00056
00057 virtual OA_ptr<CFG> performAnalysis(ProcHandle);
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 private:
00086
00087
00088
00089
00090 IRStmtType build_block (OA_ptr<Node> prev_node,
00091 OA_ptr<IRRegionStmtIterator> si,
00092 std::list<CFG::NodeLabel>& exit_nodes,
00093 OA_ptr<std::list<CFG::NodeLabel> > break_nodes,
00094 OA_ptr<std::list<CFG::NodeLabel> > return_nodes,
00095 OA_ptr<std::list<CFG::NodeLabel> > continue_nodes);
00096
00097 IRStmtType build_stmt (OA_ptr<Node> prev_node, OA::StmtHandle,
00098 std::list<CFG::NodeLabel>& exit_nodes,
00099 OA_ptr<std::list<CFG::NodeLabel> > break_nodes,
00100 OA_ptr<std::list<CFG::NodeLabel> > return_nodes,
00101 OA_ptr<std::list<CFG::NodeLabel> > continue_nodes);
00102
00103
00104 IRStmtType build_CFG_loop (OA_ptr<Node> prev_node,
00105 OA::StmtHandle th,
00106 std::list<CFG::NodeLabel>& exit_nodes,
00107 OA_ptr<std::list<CFG::NodeLabel> > return_nodes);
00108
00109 IRStmtType build_CFG_twoway_branch (OA_ptr<Node> prev_node,
00110 OA::StmtHandle th,
00111 std::list<CFG::NodeLabel>& exit_nodes,
00112 OA_ptr<std::list<CFG::NodeLabel> > break_nodes,
00113 OA_ptr<std::list<CFG::NodeLabel> > return_nodes,
00114 OA_ptr<std::list<CFG::NodeLabel> > continue_nodes);
00115
00116 IRStmtType build_CFG_multiway_branch (OA_ptr<Node> prev_node,
00117 StmtHandle th, std::list<CFG::NodeLabel>& exit_nodes,
00118 OA_ptr<std::list<CFG::NodeLabel> > break_nodes,
00119 OA_ptr<std::list<CFG::NodeLabel> > return_nodes,
00120 OA_ptr<std::list<CFG::NodeLabel> > continue_nodes);
00121
00122
00123 IRStmtType build_CFG_multiway_branch_with_fallthrough ( OA_ptr<Node> prev_node,
00124 StmtHandle th, std::list<CFG::NodeLabel>& exit_nodes,
00125 OA_ptr<std::list<CFG::NodeLabel> > return_nodes,
00126 OA_ptr<std::list<CFG::NodeLabel> > continue_nodes);
00127
00128 IRStmtType build_CFG_end_tested_loop (OA_ptr<Node> prev_node,
00129 StmtHandle th, std::list<CFG::NodeLabel>& exit_nodes,
00130 OA_ptr<std::list<CFG::NodeLabel> > return_nodes);
00131
00132 IRStmtType build_CFG_unconditional_jump ( OA_ptr<Node> prev_node,
00133 StmtHandle stmt);
00134
00135 IRStmtType build_CFG_ustruct_twoway_branch (OA_ptr<Node>
00136 prev_node, StmtHandle stmt, std::list<CFG::NodeLabel>& exit_nodes);
00137
00138
00139
00140 IRStmtType build_CFG_unconditional_jump_i ( OA_ptr<Node> prev_node,
00141 StmtHandle stmt);
00142
00143
00144 IRStmtType build_CFG_ustruct_multiway_branch (OA_ptr<Node>
00145 prev_node, StmtHandle stmt);
00146
00147
00148
00149
00150 void HandleDelayedBranches();
00151
00152
00153 void createBasicCFG();
00154
00155
00156
00157
00158
00159 private:
00160 OA_ptr<CFGIRInterface> mIR;
00161 OA_ptr<CFG> mCFG;
00162
00163
00164
00165
00166
00167 std::map<OA_ptr<Node>, OA_ptr<Node> > mFallThrough;
00168
00169
00170
00171
00172 const bool mBuildStmtLevelCFG;
00173 };
00174
00175 }
00176 }
00177
00178 #endif