77 if (cfgPass != NULL) {
81 "must overload handleProcedure method!");
91 int insCountDelta = 0;
96 PlaceHolders placeHolders;
99 std::set<TTAProgram::Instruction*> originalInstr;
104 for (
int bbIndex = 0; bbIndex < cfg.
nodeCount(); ++bbIndex) {
111 "Cannot replace a basic block without original address.");
115 for (
int bbIndex = 0; bbIndex < cfg.
nodeCount(); ++bbIndex) {
121 PlaceHolders::iterator placeHolderIter = placeHolders.find(&bb);
123 placeHolders.erase(placeHolderIter);
128 const int originalBBSize =
131 for (
int i = 1; i < originalBBSize; ++i) {
134 originalInstr.erase(&ins);
135 procedure.CodeSnippet::remove(ins);
149 "Skipped ins has a ref");
161 *lastNewInstruction, newInstruction);
164 irm.
replace(instrToCopy,*newInstruction);
166 lastNewInstruction = newInstruction;
167 if (firstNewInstruction == NULL)
168 firstNewInstruction = newInstruction;
175 assert(firstNewInstruction != NULL);
177 placeHolder, *firstNewInstruction);
181 originalInstr.erase(&placeHolder);
184 procedure.
remove(placeHolder);
194 for(std::set<TTAProgram::Instruction*>::iterator i =
195 originalInstr.begin(); i != originalInstr.end(); i++) {
198 procedure.CodeSnippet::remove(*ins);
204 if (insCountDelta != 0) {
220 for (
int j = 0; j < ins.
moveCount(); j++) {
237 int nextIndex = gcu == NULL ?
246 if (&targetIns == &nextIns) {