diff options
Diffstat (limited to 'lib/Target/PowerPC/PPCAsmPrinter.cpp')
| -rw-r--r-- | lib/Target/PowerPC/PPCAsmPrinter.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 9cf686353a..717b831086 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); } |
