18 #ifndef __SUBVARIABLE_FLOW__
19 #define __SUBVARIABLE_FLOW__
42 class ReplaceVarnode {
58 ReplaceVarnode *output;
59 vector<ReplaceVarnode *> input;
82 bool returnsTraversed;
84 bool sextrestrictions;
86 map<Varnode *,ReplaceVarnode> varmap;
87 list<ReplaceVarnode> newvarlist;
88 list<ReplaceOp> oplist;
89 list<PatchRecord> patchlist;
90 vector<ReplaceVarnode *> worklist;
92 static int4 doesOrSet(
PcodeOp *orop,uintb mask);
93 static int4 doesAndClear(
PcodeOp *andop,uintb mask);
94 Address getReplacementAddress(ReplaceVarnode *rvn)
const;
95 ReplaceVarnode *setReplacement(
Varnode *vn,uintb mask,
bool &inworklist);
96 ReplaceOp *createOp(
OpCode opc,int4 numparam,ReplaceVarnode *outrvn);
97 ReplaceOp *createOpDown(
OpCode opc,int4 numparam,
PcodeOp *op,ReplaceVarnode *inrvn,int4 slot);
98 bool tryCallPull(
PcodeOp *op,ReplaceVarnode *rvn,int4 slot);
99 bool tryReturnPull(
PcodeOp *op,ReplaceVarnode *rvn,int4 slot);
100 bool tryCallReturnPush(
PcodeOp *op,ReplaceVarnode *rvn);
101 bool trySwitchPull(
PcodeOp *op,ReplaceVarnode *rvn);
102 bool traceForward(ReplaceVarnode *rvn);
103 bool traceBackward(ReplaceVarnode *rvn);
104 bool traceForwardSext(ReplaceVarnode *rvn);
105 bool traceBackwardSext(ReplaceVarnode *rvn);
106 bool createLink(ReplaceOp *rop,uintb mask,int4 slot,
Varnode *vn);
107 bool createCompareBridge(
PcodeOp *op,ReplaceVarnode *inrvn,int4 slot,
Varnode *othervn);
108 void addPush(
PcodeOp *pushOp,ReplaceVarnode *rvn);
109 void addTerminalPatch(
PcodeOp *pullop,ReplaceVarnode *rvn);
110 void addTerminalPatchSameOp(
PcodeOp *pullop,ReplaceVarnode *rvn,int4 slot);
111 void addBooleanPatch(
PcodeOp *pullop,ReplaceVarnode *rvn,int4 slot);
112 void addSuggestedPatch(ReplaceVarnode *rvn,
PcodeOp *pushop,int4 sa);
113 void addComparePatch(ReplaceVarnode *in1,ReplaceVarnode *in2,
PcodeOp *op);
114 ReplaceVarnode *addConstant(ReplaceOp *rop,uintb mask,uint4 slot,uintb val);
115 void createNewOut(ReplaceOp *rop,uintb mask);
116 void replaceInput(ReplaceVarnode *rvn);
117 bool useSameAddress(ReplaceVarnode *rvn);
118 Varnode *getReplaceVarnode(ReplaceVarnode *rvn);
119 bool processNextWork(
void);
134 vector<TransformVar *> worklist;
139 bool processNextWork(
void);
152 int4 terminatorCount;
154 vector<TransformVar *> worklist;
158 bool processNextWork(
void);
182 vector<WorkNode> workList;
183 bool allowSubpieceTerminator;
190 bool buildStore(
PcodeOp *op,int4 numLanes,int4 skipLanes);
193 bool traceForward(
TransformVar *rvn,int4 numLanes,int4 skipLanes);
194 bool traceBackward(
TransformVar *rvn,int4 numLanes,int4 skipLanes);
195 bool processNextWork(
void);