aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-20 07:03:18 +0000
committerChris Lattner <sabre@nondot.org>2009-06-20 07:03:18 +0000
commitc12430644a9f49a056286f8ebe0e55ccc23bdde0 (patch)
tree40b96f97a28a3ce6e9e2635ffebac6e4e627653e /lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
parent694f6c81e885818840d374c855cd0c91ed3f2f15 (diff)
implement support for lowering subregs when preparing to print
LEA64_32r, eliminating a bunch of modifier logic stuff on addr modes. Implement support for printing mbb labels as operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
index 0267c4e580..0311a10a17 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
@@ -15,6 +15,7 @@
#define DEBUG_TYPE "asm-printer"
#include "llvm/MC/MCInst.h"
#include "X86ATTAsmPrinter.h"
+#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -25,9 +26,8 @@ using namespace llvm;
#undef MachineInstr
void X86ATTAsmPrinter::printSSECC(const MCInst *MI, unsigned Op) {
- unsigned char value = MI->getOperand(Op).getImm();
- assert(value <= 7 && "Invalid ssecc argument!");
- switch (value) {
+ switch (MI->getOperand(Op).getImm()) {
+ default: assert(0 && "Invalid ssecc argument!");
case 0: O << "eq"; break;
case 1: O << "lt"; break;
case 2: O << "le"; break;
@@ -48,7 +48,7 @@ void X86ATTAsmPrinter::printPICLabel(const MCInst *MI, unsigned Op) {
void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
const char *Modifier, bool NotRIPRel) {
- //assert(Modifier == 0 && "Modifiers should not be used");
+ assert(Modifier == 0 && "Modifiers should not be used");
const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isReg()) {
@@ -70,6 +70,15 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
O << '$';
O << Op.getImm();
return;
+ } else if (Op.isMBBLabel()) {
+ // FIXME: Keep in sync with printBasicBlockLabel. printBasicBlockLabel
+ // should eventually call into this code, not the other way around.
+
+ O << TAI->getPrivateGlobalPrefix() << "BB" << Op.getMBBLabelFunction()
+ << '_' << Op.getMBBLabelBlock();
+
+ // FIXME: with verbose asm print llvm bb name, add to operand.
+ return;
}
O << "<<UNKNOWN OPERAND KIND>>";
@@ -338,9 +347,10 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
#endif
}
-void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op,
- const char *Modifier,
- bool NotRIPRel) {
+void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) {
+ const char *Modifier = 0;
+ bool NotRIPRel = false;
+
const MCOperand &BaseReg = MI->getOperand(Op);
const MCOperand &IndexReg = MI->getOperand(Op+2);
const MCOperand &DispSpec = MI->getOperand(Op+3);
@@ -386,13 +396,12 @@ void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op,
}
}
-void X86ATTAsmPrinter::printMemReference(const MCInst *MI, unsigned Op,
- const char *Modifier, bool NotRIPRel){
+void X86ATTAsmPrinter::printMemReference(const MCInst *MI, unsigned Op) {
//assert(isMem(MI, Op) && "Invalid memory reference!");
const MCOperand &Segment = MI->getOperand(Op+4);
if (Segment.getReg()) {
- printOperand(MI, Op+4, Modifier);
+ printOperand(MI, Op+4);
O << ':';
}
- printLeaMemReference(MI, Op, Modifier, NotRIPRel);
+ printLeaMemReference(MI, Op);
}