- //Insert machine instructions before and after call into the
- //call instructions map --- Anand
- const CallInst *callInst = argDesc->getCallInst();
- MachineCodeForInstruction &mvec = MachineCodeForInstruction::get(callInst);
- mvec.insert(mvec.begin(), CallAI->InstrnsBefore.begin(),
- CallAI->InstrnsBefore.end());
- mvec.insert(mvec.end(), CallAI->InstrnsAfter.begin(),
- CallAI->InstrnsAfter.end());
+#ifndef NDEBUG
+ // Temporary sanity checking code to detect whether the same machine
+ // instruction is ever inserted twice before/after a call.
+ // I suspect this is happening but am not sure. --Vikram, 7/1/03.
+ //
+ std::set<const MachineInstr*> instrsSeen;
+ for (int i = 0, N = CallAI->InstrnsBefore.size(); i < N; ++i) {
+ assert(instrsSeen.find(CallAI->InstrnsBefore[i]) == instrsSeen.end() &&
+ "Duplicate machine instruction in InstrnsBefore!");
+ instrsSeen.insert(CallAI->InstrnsBefore[i]);
+ }
+ for (int i = 0, N = CallAI->InstrnsAfter.size(); i < N; ++i) {
+ assert(instrsSeen.find(CallAI->InstrnsAfter[i]) == instrsSeen.end() &&
+ "Duplicate machine instruction in InstrnsBefore/After!");
+ instrsSeen.insert(CallAI->InstrnsAfter[i]);
+ }
+#endif