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_CONSTPROP_H
00040 #define CBZ_CONSTPROP_H
00041
00042 #include "udduChains.h"
00043
00053 class constantPropChanger : public Changer {
00054 public:
00055 typedef list<threeAddrNode*> threeAddr_list;
00056
00058 static void change();
00059
00061 static void change(unitNode *);
00062
00064 static void change(procNode *);
00065
00066 private:
00070 constantPropChanger (udduChains *chain) :
00071 Changer (Preorder, Subtree, false),
00072 _changed (false), _udchain(chain) { }
00073
00075 inline void reset() { _changed = false; }
00076
00078 udduChains *_udchain;
00079
00081 bool _changed;
00082
00083 exprNode *at_expr (exprNode *);
00084 Node *at_threeAddr (threeAddrNode *, Order);
00085 Node *at_conditiongoto (conditiongotoNode *, Order);
00086 Node *at_return (returnNode*, Order);
00087 };
00088
00089
00112 class constantFoldingChanger : public Changer {
00113 friend class constantPropChanger;
00114 public:
00115
00117 static void change();
00118
00120 static void change(unitNode *);
00121
00123 static void change(procNode *);
00124
00125 private:
00126 constantFoldingChanger () :
00127 Changer (Preorder, Subtree, false),
00128 _changed (false), _cfg_changed(false), _current_block(NULL) {}
00129
00131 inline void reset() { _changed = _cfg_changed = false; }
00132
00134 bool _changed;
00135
00137 bool _cfg_changed;
00138
00140 basicblockNode *_current_block;
00141
00142 Node *at_threeAddr (threeAddrNode *, Order);
00143 Node *at_conditiongoto (conditiongotoNode *, Order);
00144 Node *at_basicblock (basicblockNode *, Order);
00145 };
00146
00147 #endif // CBZ_CONSTPROP_H