Fix up a few more spots of addrmode2 (or not) changes that were

missed. Update some comments accordingly.

Fixes rdar://8652289

llvm-svn: 118888
This commit is contained in:
Eric Christopher 2010-11-12 09:48:30 +00:00
parent 31f82720d0
commit 22d0492f34
1 changed files with 12 additions and 6 deletions

View File

@ -460,7 +460,7 @@ unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, EVT VT) {
TII.get(ARM::t2LDRpci), DestReg) TII.get(ARM::t2LDRpci), DestReg)
.addConstantPoolIndex(Idx)); .addConstantPoolIndex(Idx));
else else
// The extra reg and immediate are for addrmode2. // The extra immediate is for addrmode2.
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(ARM::LDRcp), DestReg) TII.get(ARM::LDRcp), DestReg)
.addConstantPoolIndex(Idx) .addConstantPoolIndex(Idx)
@ -505,11 +505,11 @@ unsigned ARMFastISel::ARMMaterializeGV(const GlobalValue *GV, EVT VT) {
if (RelocM == Reloc::PIC_) if (RelocM == Reloc::PIC_)
MIB.addImm(Id); MIB.addImm(Id);
} else { } else {
// The extra reg and immediate are for addrmode2. // The extra immediate is for addrmode2.
MIB = BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(ARM::LDRcp), MIB = BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(ARM::LDRcp),
DestReg) DestReg)
.addConstantPoolIndex(Idx) .addConstantPoolIndex(Idx)
.addReg(0).addImm(0); .addImm(0);
} }
AddOptionalDefs(MIB); AddOptionalDefs(MIB);
return DestReg; return DestReg;
@ -790,6 +790,12 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
if (isFloat) if (isFloat)
Offset /= 4; Offset /= 4;
// LDRH needs an additional operand.
if (!isThumb && VT.getSimpleVT().SimpleTy == MVT::i16)
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(Opc), ResultReg)
.addReg(Base).addReg(0).addImm(Offset));
else
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(Opc), ResultReg) TII.get(Opc), ResultReg)
.addReg(Base).addImm(Offset)); .addReg(Base).addImm(Offset));