Added support for both call/jmpl instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@930 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
index b36e8e4..43ea5a5 100644
--- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
@@ -149,7 +149,7 @@
const LiveVarSet *const LVSetAft )
{
// Now find the LR of the return value of the call
- // The last *implicit operand* is the return value of a call
+
// We do this because, we look at the LV set *after* the instruction
// to determine, which LRs must be saved across calls. The return value
@@ -158,19 +158,13 @@
LiveRange *RetValLR = NULL;
- unsigned NumOfImpRefs = MInst->getNumImplicitRefs();
- if( NumOfImpRefs > 0 ) {
+ const Value *RetVal = MRI.getCallInstRetVal( MInst );
- if( MInst->implicitRefIsDefined(NumOfImpRefs-1) ) {
-
- const Value *RetVal = MInst->getImplicitRef(NumOfImpRefs-1);
- RetValLR = LRI.getLiveRangeForValue( RetVal );
- assert( RetValLR && "No LR for RetValue of call");
- }
-
+ if( RetVal ) {
+ RetValLR = LRI.getLiveRangeForValue( RetVal );
+ assert( RetValLR && "No LR for RetValue of call");
}
-
if( DEBUG_RA)
cout << "\n For call inst: " << *MInst;
@@ -356,20 +350,17 @@
// to determine, which LRs must be saved across calls. The return value
// of the call is live in this set - but we must not save/restore it.
- unsigned NumOfImpRefs = MInst->getNumImplicitRefs();
- if( NumOfImpRefs > 0 ) {
-
- if( MInst->implicitRefIsDefined(NumOfImpRefs-1) ) {
- const Value *RetVal = MInst->getImplicitRef(NumOfImpRefs-1);
- LiveRange *RetValLR = LRI.getLiveRangeForValue( RetVal );
- assert( RetValLR && "No LR for RetValue of call");
+ const Value *RetVal = MRI.getCallInstRetVal( MInst );
- PushedRegSet.insert(
- MRI.getUnifiedRegNum((RetValLR->getRegClass())->getID(),
- RetValLR->getColor() ) );
- }
+ if( RetVal ) {
+ LiveRange *RetValLR = LRI.getLiveRangeForValue( RetVal );
+ assert( RetValLR && "No LR for RetValue of call");
+
+ PushedRegSet.insert(
+ MRI.getUnifiedRegNum((RetValLR->getRegClass())->getID(),
+ RetValLR->getColor() ) );
}