diff options
| author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-10-31 15:34:48 +0000 |
|---|---|---|
| committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-10-31 15:34:48 +0000 |
| commit | 8c7b93f7e3d2f938a5f437c888d75b9ee6e3474e (patch) | |
| tree | d329ceff916c7d03a4ae5def7515fe88fe93bb0f | |
| parent | c0724e8d92b001a4741642c4166b9c2a805477b1 (diff) | |
| download | bcm5719-llvm-8c7b93f7e3d2f938a5f437c888d75b9ee6e3474e.tar.gz bcm5719-llvm-8c7b93f7e3d2f938a5f437c888d75b9ee6e3474e.zip | |
Restore support for indirect function calls (which briefly wasn't working
after I removed annotations on MachineInstr for the CallDescriptor).
llvm-svn: 4469
| -rw-r--r-- | llvm/lib/CodeGen/MachineInstrAnnot.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineInstrAnnot.cpp b/llvm/lib/CodeGen/MachineInstrAnnot.cpp index 27cf7ad931c..8d7d4724f5b 100644 --- a/llvm/lib/CodeGen/MachineInstrAnnot.cpp +++ b/llvm/lib/CodeGen/MachineInstrAnnot.cpp @@ -45,18 +45,24 @@ CallArgsDescriptor::getReturnValue() const // Mechanism to get the descriptor for a CALL MachineInstr. // We get the LLVM CallInstr from the ret. addr. register argument -// of the CALL MachineInstr, then get the CallArgsDescriptor from the -// MachineCodeForInstruction object for the CallInstr. +// of the CALL MachineInstr (which is explicit operand #3 for indirect +// calls or the last implicit operand for direct calls). We then get +// the CallArgsDescriptor from the MachineCodeForInstruction object for +// the CallInstr. // This is roundabout but avoids adding a new map or annotation just // to keep track of CallArgsDescriptors. // CallArgsDescriptor *CallArgsDescriptor::get(const MachineInstr* MI) { const TmpInstruction* retAddrReg = - cast<TmpInstruction>(MI->getImplicitRef(MI->getNumImplicitRefs()-1)); + cast<TmpInstruction>(isa<Function>(MI->getOperand(0).getVRegValue()) + ? MI->getImplicitRef(MI->getNumImplicitRefs()-1) + : MI->getOperand(2).getVRegValue()); + assert(retAddrReg->getNumOperands() == 1 && isa<CallInst>(retAddrReg->getOperand(0)) && - "Order of implicit args of CALL instr. changed. FIX THIS CODE!"); + "Location of callInstr arg for CALL instr. changed? FIX THIS CODE!"); + const CallInst* callInstr = cast<CallInst>(retAddrReg->getOperand(0)); CallArgsDescriptor* desc = |

