aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp9
-rw-r--r--lib/Target/PowerPC/PPCISelDAGToDAG.cpp6
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 9cf6863..717b831 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -189,7 +189,14 @@ namespace {
O << ')';
}
void printMemRegReg(const MachineInstr *MI, unsigned OpNo) {
- printOperand(MI, OpNo);
+ // When used as the base register, r0 reads constant zero rather than
+ // the value contained in the register. For this reason, the darwin
+ // assembler requires that we print r0 as 0 (no r) when used as the base.
+ const MachineOperand &MO = MI->getOperand(OpNo);
+ if (MO.getReg() == PPC::R0)
+ O << '0';
+ else
+ O << TM.getRegisterInfo()->get(MO.getReg()).Name;
O << ", ";
printOperand(MI, OpNo+1);
}
diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index b9550f5..338be66 100644
--- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -454,8 +454,7 @@ bool PPCDAGToDAGISel::SelectAddrIdx(SDOperand N, SDOperand &Base,
return true;
}
- // FIXME: This should be a CopyFromReg R0 rather than a load of 0.
- Base = CurDAG->getTargetNode(PPC::LI, MVT::i32, getI32Imm(0));
+ Base = CurDAG->getRegister(PPC::R0, MVT::i32);
Index = Select(N);
return true;
}
@@ -470,8 +469,7 @@ bool PPCDAGToDAGISel::SelectAddrIdxOnly(SDOperand N, SDOperand &Base,
return true;
}
- // FIXME: This should be a CopyFromReg R0 rather than a load of 0.
- Base = CurDAG->getTargetNode(PPC::LI, MVT::i32, getI32Imm(0));
+ Base = CurDAG->getRegister(PPC::R0, MVT::i32);
Index = Select(N);
return true;
}