Convert remaining X-Form and Pseudo instructions over to asm writer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16142 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index b30977b..cadc88a 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -102,6 +102,16 @@
MVT::ValueType VT) {
O << (unsigned short)MI->getOperand(OpNo).getImmedValue();
}
+ void printBranchOperand(const MachineInstr *MI, unsigned OpNo,
+ MVT::ValueType VT) {
+ printOp(MI->getOperand(OpNo));
+ }
+ void printPICLabel(const MachineInstr *MI, unsigned OpNo,
+ MVT::ValueType VT) {
+ // FIXME: should probably be converted to cout.width and cout.fill
+ O << "\"L0000" << LabelNumber << "$pb\"\n";
+ O << "\"L0000" << LabelNumber << "$pb\":";
+ }
void printConstantPool(MachineConstantPool *MCP);
bool runOnMachineFunction(MachineFunction &F);
@@ -293,42 +303,6 @@
assert(((Desc.TSFlags & PPCII::PPC64) == 0) &&
"Instruction requires 64 bit support");
- // CALLpcrel and CALLindirect are handled specially here to print only the
- // appropriate number of args that the assembler expects. This is because
- // may have many arguments appended to record the uses of registers that are
- // holding arguments to the called function.
- if (Opcode == PPC::COND_BRANCH) {
- 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";
- return;
- } else if (Opcode == PPC::CALLpcrel) {
- O << TII.getName(Opcode) << " ";
- printOp(MI->getOperand(0));
- O << "\n";
- return;
- } else if (Opcode == PPC::CALLindirect) {
- O << TII.getName(Opcode) << " ";
- printImmOp(MI->getOperand(0), ArgType[0]);
- O << ", ";
- printImmOp(MI->getOperand(1), ArgType[0]);
- 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";
- O << "\tmflr ";
- printOp(MI->getOperand(0));
- O << "\n";
- return;
- }
-
O << TII.getName(Opcode) << " ";
if (Opcode == PPC::LOADHiAddr) {
printOp(MI->getOperand(0));