aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 07aaa49be5..1d31e3b130 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -289,6 +289,7 @@ void PPC32AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
std::cerr << "Error: untranslated conditional branch psuedo instruction!\n";
abort();
} else if (Opcode == PPC::IMPLICIT_DEF) {
+ --EmittedInsts; // Not an actual machine instruction
O << "; IMPLICIT DEF ";
printOp(MI->getOperand(0));
O << "\n";
@@ -306,6 +307,7 @@ void PPC32AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
O << "\n";
return;
} else if (Opcode == PPC::MovePCtoLR) {
+ ++EmittedInsts; // Actually two machine instructions
// FIXME: should probably be converted to cout.width and cout.fill
O << "bl \"L0000" << LabelNumber << "$pb\"\n";
O << "\"L0000" << LabelNumber << "$pb\":\n";
@@ -316,27 +318,28 @@ void PPC32AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
}
O << TII.getName(Opcode) << " ";
- if (Opcode == PPC::LOADLoDirect || Opcode == PPC::LOADLoIndirect) {
+ if (Opcode == PPC::LOADHiAddr) {
printOp(MI->getOperand(0));
- O << ", lo16(";
- printOp(MI->getOperand(2), true /* LoadAddrOp */);
- O << "-\"L0000" << LabelNumber << "$pb\")";
- O << "(";
+ O << ", ";
if (MI->getOperand(1).getReg() == PPC::R0)
O << "0";
else
printOp(MI->getOperand(1));
- O << ")\n";
- } else if (Opcode == PPC::LOADHiAddr) {
+ O << ", ha16(" ;
+ printOp(MI->getOperand(2), true /* LoadAddrOp */);
+ O << "-\"L0000" << LabelNumber << "$pb\")\n";
+ } else if (ArgCount == 3 && (MI->getOperand(2).isConstantPoolIndex()
+ || MI->getOperand(2).isGlobalAddress())) {
printOp(MI->getOperand(0));
- O << ", ";
+ O << ", lo16(";
+ printOp(MI->getOperand(2), true /* LoadAddrOp */);
+ O << "-\"L0000" << LabelNumber << "$pb\")";
+ O << "(";
if (MI->getOperand(1).getReg() == PPC::R0)
O << "0";
else
printOp(MI->getOperand(1));
- O << ", ha16(" ;
- printOp(MI->getOperand(2), true /* LoadAddrOp */);
- O << "-\"L0000" << LabelNumber << "$pb\")\n";
+ O << ")\n";
} else if (ArgCount == 3 && ArgType[1] == PPCII::Disimm16) {
printOp(MI->getOperand(0));
O << ", ";