[llvm-commits] CVS: llvm/lib/CodeGen/MachineInstrAnnot.cpp
Vikram Adve
vadve at cs.uiuc.edu
Thu Oct 31 09:35:00 PST 2002
Changes in directory llvm/lib/CodeGen:
MachineInstrAnnot.cpp updated: 1.5 -> 1.6
---
Log message:
Restore support for indirect function calls (which briefly wasn't working
after I removed annotations on MachineInstr for the CallDescriptor).
---
Diffs of the changes:
Index: llvm/lib/CodeGen/MachineInstrAnnot.cpp
diff -u llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.5 llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.6
--- llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.5 Tue Oct 29 13:40:17 2002
+++ llvm/lib/CodeGen/MachineInstrAnnot.cpp Thu Oct 31 09:34:48 2002
@@ -45,18 +45,24 @@
// 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 =
More information about the llvm-commits
mailing list