aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-20 19:34:09 +0000
committerChris Lattner <sabre@nondot.org>2009-06-20 19:34:09 +0000
commit357a0caeb6c2cd2b955779f2ccaf17872b649a50 (patch)
treee12ace0611f18737063f1cf3a8465764a790e73f /lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
parentb38ce6f78715f8ad4daa383182f1ec324142da64 (diff)
downloadexternal_llvm-357a0caeb6c2cd2b955779f2ccaf17872b649a50.tar.gz
external_llvm-357a0caeb6c2cd2b955779f2ccaf17872b649a50.tar.bz2
external_llvm-357a0caeb6c2cd2b955779f2ccaf17872b649a50.zip
eliminate the "call" operand modifier from the asm descriptions, modeling
it as a pcrel immediate instead. This gets pc-rel weirdness out of the main printoperand codepath. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
index 54de7e9dd2..64d523fb49 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
@@ -46,6 +46,24 @@ void X86ATTAsmPrinter::printPICLabel(const MCInst *MI, unsigned Op) {
}
+/// 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) {
+ const MCOperand &Op = MI->getOperand(OpNo);
+
+ if (Op.isImm())
+ O << Op.getImm();
+ 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();
+ else
+ assert(0 && "Unknown pcrel immediate operand");
+}
+
+
void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
const char *Modifier, bool NotRIPRel) {
assert(Modifier == 0 && "Modifiers should not be used");
@@ -71,6 +89,7 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
O << Op.getImm();
return;
} else if (Op.isMBBLabel()) {
+ assert(0 && "labels should only be used as pc-relative values");
// FIXME: Keep in sync with printBasicBlockLabel. printBasicBlockLabel
// should eventually call into this code, not the other way around.
@@ -109,9 +128,6 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo,
O << '$';
O << MO.getImm();
return;
- case MachineOperand::MO_MachineBasicBlock:
- printBasicBlockLabel(MO.getMBB(), false, false, VerboseAsm);
- return;
case MachineOperand::MO_JumpTableIndex: {
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
if (!isMemOp) O << '$';
@@ -389,7 +405,6 @@ void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) {
}
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);