00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef CBZ_REACHING_3ADDR_H
00040 #define CBZ_REACHING_3ADDR_H
00041
00042 #include "udduChains.h"
00043
00044
00060 class reachingDefinitionsWalker : public Walker {
00061 public:
00062 typedef list<threeAddrNode*> threeAddr_list;
00063
00065 static udduChains * analyze_all() {
00066 reachingDefinitionsWalker r;
00067 for(unit_list_p u=CBZ::Program.begin(); u!=CBZ::Program.end(); u++)
00068 (*u)->walk(r);
00069 return r.udChain;
00070 }
00071
00073 static udduChains * analyze(unitNode *unit) {
00074 reachingDefinitionsWalker r;
00075 unit->walk(r);
00076 return r.udChain;
00077 }
00078
00080 static udduChains * analyze(procNode *proc) {
00081 reachingDefinitionsWalker r;
00082 proc->walk(r);
00083 return r.udChain;
00084 }
00085
00086 private:
00089 class defFlowVal;
00090
00093 class reachingGenKillWalker;
00094
00095 reachingDefinitionsWalker (void) : Walker (Both, Subtree)
00096 { udChain = new udduChains(); }
00097
00098 void at_proc (procNode *, Order);
00099 void at_basicblock (basicblockNode *, Order);
00100
00102 void make_ud_chains (exprNode *e, exprNode *E=NULL, stmtNode * s = NULL);
00103
00105 void make_ud_chains (stmtNode *);
00106
00108 map <stmtNode *, defFlowVal *> gen, kill, in, out;
00109
00112 threeAddrNode **num2node;
00113
00115 int n;
00116
00118 defFlowVal *current_in;
00119
00121 map <threeAddrNode *, int> node2num;
00122
00124 map <threeAddrNode *, declNode *> defines;
00125
00128 map <declNode *, defFlowVal *> defs;
00129
00131 stmt_list dummies;
00132
00134 udduChains *udChain;
00135 };
00136
00137 #endif