diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-13 19:30:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-13 19:30:11 +0000 |
commit | cae05cb324031b16a71c56a2a01b489a7c28d365 (patch) | |
tree | 115d28e959f2cd66fa1fec0a6db2a6870bdb0417 /lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp | |
parent | 73d28f4aeefb4ecfb5a96ad28f58c4ad06e69e18 (diff) |
split MCInst printing out of the X86ATTInstPrinter
class into its own X86ATTInstPrinter class. The inst
printer now has just one dependence on the code generator
(TRI).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp')
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp index 2c0b5689ae..c37b656e47 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp @@ -13,12 +13,13 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "asm-printer" +#include "X86ATTInstPrinter.h" #include "llvm/MC/MCInst.h" -#include "X86ATTAsmPrinter.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCExpr.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" +#include "llvm/Target/TargetRegisterInfo.h" // FIXME: REMOVE. using namespace llvm; // Include the auto-generated portion of the assembly writer. @@ -27,7 +28,7 @@ using namespace llvm; #include "X86GenAsmWriter.inc" #undef MachineInstr -void X86ATTAsmPrinter::printSSECC(const MCInst *MI, unsigned Op) { +void X86ATTInstPrinter::printSSECC(const MCInst *MI, unsigned Op) { switch (MI->getOperand(Op).getImm()) { default: llvm_unreachable("Invalid ssecc argument!"); case 0: O << "eq"; break; @@ -42,16 +43,16 @@ void X86ATTAsmPrinter::printSSECC(const MCInst *MI, unsigned Op) { } -void X86ATTAsmPrinter::printPICLabel(const MCInst *MI, unsigned Op) { +void X86ATTInstPrinter::printPICLabel(const MCInst *MI, unsigned Op) { llvm_unreachable("This is only used for MOVPC32r," - "should lower before asm printing!"); + "should lower before instruction printing!"); } /// print_pcrel_imm - This is used to print an immediate value that ends up /// being encoded as a pc-relative value. These print slightly differently, for /// example, a $ is not emitted. -void X86ATTAsmPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) { +void X86ATTInstPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) { const MCOperand &Op = MI->getOperand(OpNo); if (Op.isImm()) @@ -63,7 +64,7 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) { } -void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo, +void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, const char *Modifier) { assert(Modifier == 0 && "Modifiers should not be used"); @@ -85,7 +86,7 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo, O << "<<UNKNOWN OPERAND KIND>>"; } -void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) { +void X86ATTInstPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) { const MCOperand &BaseReg = MI->getOperand(Op); const MCOperand &IndexReg = MI->getOperand(Op+2); const MCOperand &DispSpec = MI->getOperand(Op+3); @@ -100,8 +101,6 @@ void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) { } if (IndexReg.getReg() || BaseReg.getReg()) { - assert(IndexReg.getReg() != X86::ESP && IndexReg.getReg() != X86::RSP); - O << '('; if (BaseReg.getReg()) printOperand(MI, Op); @@ -117,7 +116,7 @@ void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) { } } -void X86ATTAsmPrinter::printMemReference(const MCInst *MI, unsigned Op) { +void X86ATTInstPrinter::printMemReference(const MCInst *MI, unsigned Op) { const MCOperand &Segment = MI->getOperand(Op+4); if (Segment.getReg()) { printOperand(MI, Op+4); |