diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2003-07-02 01:13:57 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2003-07-02 01:13:57 +0000 |
commit | b5f8ada255168d1dd908203be48a139d0d4f381a (patch) | |
tree | cfab4e0f2e90ddec4aaf6b84072998c44906172f /llvm/lib/Target/Sparc/SparcRegInfo.cpp | |
parent | 29eafac9ff37eb93b7dc98298fe78ba6a53c77bc (diff) | |
download | bcm5719-llvm-b5f8ada255168d1dd908203be48a139d0d4f381a.tar.gz bcm5719-llvm-b5f8ada255168d1dd908203be48a139d0d4f381a.zip |
Bug/case fixes:
(1) select: Ok to convert a pointer to a float or double.
(2) regalloc: Some MachineInstr* for caller-saving code before a call
were being inserted before and after the call!
(3) Don't insert the caller-saving instructions in the
MachineCodeForInstruction for the Call instruction.
*All* instructions generated by register allocation need to be
recorded in those maps, but it needs to be done uniformly.
llvm-svn: 7051
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcRegInfo.cpp')
-rw-r--r-- | llvm/lib/Target/Sparc/SparcRegInfo.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/llvm/lib/Target/Sparc/SparcRegInfo.cpp b/llvm/lib/Target/Sparc/SparcRegInfo.cpp index fbed0007272..95bd87f9505 100644 --- a/llvm/lib/Target/Sparc/SparcRegInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegInfo.cpp @@ -942,14 +942,23 @@ void UltraSparcRegInfo::colorCallArgs(MachineInstr *CallMI, for(unsigned i=0; i < ReorderedVec.size(); i++) CallAI->InstrnsBefore.push_back( ReorderedVec[i] ); - //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 } //--------------------------------------------------------------------------- @@ -1361,10 +1370,10 @@ UltraSparcRegInfo::insertCallerSavingCode int StackOff = PRA.MF.getInfo()->pushTempValue(getSpilledRegSize(RegType)); - std::vector<MachineInstr*> AdIBef, AdIAft; - //---- Insert code for pushing the reg on stack ---------- + std::vector<MachineInstr*> AdIBef, AdIAft; + // We may need a scratch register to copy the saved value // to/from memory. This may itself have to insert code to // free up a scratch register. Any such code should go before @@ -1395,6 +1404,9 @@ UltraSparcRegInfo::insertCallerSavingCode //---- Insert code for popping the reg from the stack ---------- + AdIBef.clear(); + AdIAft.clear(); + // We may need a scratch register to copy the saved value // from memory. This may itself have to insert code to // free up a scratch register. Any such code should go |