diff options
Diffstat (limited to 'lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp')
-rw-r--r-- | lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index 3e40dbb..e854c15 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -38,24 +38,24 @@ namespace { return "Sparc Assembly Printer"; } - void printOperand(const MachineInstr *MI, int opNum); - void printMemOperand(const MachineInstr *MI, int opNum, + void printOperand(const MachineInstr *MI, int opNum, raw_ostream &OS); + void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &OS, const char *Modifier = 0); - void printCCOperand(const MachineInstr *MI, int opNum); + void printCCOperand(const MachineInstr *MI, int opNum, raw_ostream &OS); virtual void EmitInstruction(const MachineInstr *MI) { - printInstruction(MI); + printInstruction(MI, O); OutStreamer.AddBlankLine(); } - void printInstruction(const MachineInstr *MI); // autogenerated. + void printInstruction(const MachineInstr *MI, raw_ostream &OS);// autogen'd. static const char *getRegisterName(unsigned RegNo); bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, const char *ExtraCode); + unsigned AsmVariant, const char *ExtraCode); bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, const char *ExtraCode); + unsigned AsmVariant, const char *ExtraCode); - bool printGetPCX(const MachineInstr *MI, unsigned OpNo); + bool printGetPCX(const MachineInstr *MI, unsigned OpNo, raw_ostream &OS); virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const; @@ -64,7 +64,8 @@ namespace { #include "SparcGenAsmWriter.inc" -void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { +void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum, + raw_ostream &O) { const MachineOperand &MO = MI->getOperand (opNum); bool CloseParen = false; if (MI->getOpcode() == SP::SETHIi && !MO.isReg() && !MO.isImm()) { @@ -103,13 +104,13 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { } void SparcAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum, - const char *Modifier) { - printOperand(MI, opNum); + raw_ostream &O, const char *Modifier) { + printOperand(MI, opNum, O); // If this is an ADD operand, emit it like normal operands. if (Modifier && !strcmp(Modifier, "arith")) { O << ", "; - printOperand(MI, opNum+1); + printOperand(MI, opNum+1, O); return; } @@ -124,14 +125,15 @@ void SparcAsmPrinter::printMemOperand(const MachineInstr *MI, int opNum, if (MI->getOperand(opNum+1).isGlobal() || MI->getOperand(opNum+1).isCPI()) { O << "%lo("; - printOperand(MI, opNum+1); + printOperand(MI, opNum+1, O); O << ")"; } else { - printOperand(MI, opNum+1); + printOperand(MI, opNum+1, O); } } -bool SparcAsmPrinter::printGetPCX(const MachineInstr *MI, unsigned opNum) { +bool SparcAsmPrinter::printGetPCX(const MachineInstr *MI, unsigned opNum, + raw_ostream &O) { std::string operand = ""; const MachineOperand &MO = MI->getOperand(opNum); switch (MO.getType()) { @@ -155,14 +157,15 @@ bool SparcAsmPrinter::printGetPCX(const MachineInstr *MI, unsigned opNum) { O << ".LLGETPC" << mfNum << '_' << bbNum << ":\n" ; O << "\tor\t" << operand - << ", %lo(_GLOBAL_OFFSET_TABLE_+(.-.LLGETPCH" << mfNum << '_' << bbNum << ")), " - << operand << '\n'; + << ", %lo(_GLOBAL_OFFSET_TABLE_+(.-.LLGETPCH" << mfNum << '_' << bbNum + << ")), " << operand << '\n'; O << "\tadd\t" << operand << ", %o7, " << operand << '\n'; return true; } -void SparcAsmPrinter::printCCOperand(const MachineInstr *MI, int opNum) { +void SparcAsmPrinter::printCCOperand(const MachineInstr *MI, int opNum, + raw_ostream &O) { int CC = (int)MI->getOperand(opNum).getImm(); O << SPARCCondCodeToString((SPCC::CondCodes)CC); } @@ -182,7 +185,7 @@ bool SparcAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, } } - printOperand(MI, OpNo); + printOperand(MI, OpNo, O); return false; } @@ -195,7 +198,7 @@ bool SparcAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, return true; // Unknown modifier O << '['; - printMemOperand(MI, OpNo); + printMemOperand(MI, OpNo, O); O << ']'; return false; |