[llvm-commits] [llvm] r112461 - /llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
Bill Wendling
isanbard at gmail.com
Sun Aug 29 18:36:05 PDT 2010
Author: void
Date: Sun Aug 29 20:36:05 2010
New Revision: 112461
URL: http://llvm.org/viewvc/llvm-project?rev=112461&view=rev
Log:
When adding a register, we should mark it as "def" if it can optionally define
said (physical) register.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=112461&r1=112460&r2=112461&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Sun Aug 29 20:36:05 2010
@@ -253,7 +253,6 @@
return I->second;
}
-
/// AddRegisterOperand - Add the specified register as an operand to the
/// specified machine instr. Insert register copies if the register is
/// not in the required register class.
@@ -337,7 +336,10 @@
const ConstantFP *CFP = F->getConstantFPValue();
MI->addOperand(MachineOperand::CreateFPImm(CFP));
} else if (RegisterSDNode *R = dyn_cast<RegisterSDNode>(Op)) {
- MI->addOperand(MachineOperand::CreateReg(R->getReg(), false));
+ unsigned Reg = R->getReg();
+ const TargetInstrDesc &TID = MI->getDesc();
+ MI->addOperand(MachineOperand::CreateReg(Reg,
+ (Reg == 0 || !TID.OpInfo) ? false : TID.OpInfo[IIOpNum].isOptionalDef()));
} else if (GlobalAddressSDNode *TGA = dyn_cast<GlobalAddressSDNode>(Op)) {
MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(), TGA->getOffset(),
TGA->getTargetFlags()));
More information about the llvm-commits
mailing list