diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-04-28 21:49:33 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-04-28 21:49:33 +0000 |
| commit | dac88bae4f37a959e131d2ac5addacc6959144ad (patch) | |
| tree | 6bb81b7a8d201780039114b62474685cc9cb268a /llvm/lib/Target/X86 | |
| parent | 89c3861061b6df1d232aa843c8b675869d8f1f93 (diff) | |
| download | bcm5719-llvm-dac88bae4f37a959e131d2ac5addacc6959144ad.tar.gz bcm5719-llvm-dac88bae4f37a959e131d2ac5addacc6959144ad.zip | |
Properly print 'P' modifier on inline asm memory operands.
This should fix PR3379 and PR4064.
Patch inspired by Edwin Török!
llvm-svn: 70328
Diffstat (limited to 'llvm/lib/Target/X86')
| -rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index c2b053edd75..b3f4e15f022 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -570,12 +570,13 @@ void X86ATTAsmPrinter::printSSECC(const MachineInstr *MI, unsigned Op) { } void X86ATTAsmPrinter::printLeaMemReference(const MachineInstr *MI, unsigned Op, - const char *Modifier){ + const char *Modifier, + bool NotRIPRel) { MachineOperand BaseReg = MI->getOperand(Op); MachineOperand IndexReg = MI->getOperand(Op+2); const MachineOperand &DispSpec = MI->getOperand(Op+3); - bool NotRIPRel = IndexReg.getReg() || BaseReg.getReg(); + NotRIPRel |= IndexReg.getReg() || BaseReg.getReg(); if (DispSpec.isGlobal() || DispSpec.isCPI() || DispSpec.isJTI() || @@ -615,14 +616,14 @@ void X86ATTAsmPrinter::printLeaMemReference(const MachineInstr *MI, unsigned Op, } void X86ATTAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op, - const char *Modifier){ + const char *Modifier, bool NotRIPRel){ assert(isMem(MI, Op) && "Invalid memory reference!"); MachineOperand Segment = MI->getOperand(Op+4); if (Segment.getReg()) { printOperand(MI, Op+4, Modifier); O << ':'; } - printLeaMemReference(MI, Op, Modifier); + printLeaMemReference(MI, Op, Modifier, NotRIPRel); } void X86ATTAsmPrinter::printPICJumpTableSetLabel(unsigned uid, @@ -723,7 +724,7 @@ bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, return false; case 'P': // Don't print @PLT, but do print as memory. - printOperand(MI, OpNo, "mem"); + printOperand(MI, OpNo, "mem", /*NotRIPRel=*/true); return false; } } @@ -749,7 +750,7 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, // These only apply to registers, ignore on mem. break; case 'P': // Don't print @PLT, but do print as memory. - printOperand(MI, OpNo, "mem"); + printMemReference(MI, OpNo, "mem", /*NotRIPRel=*/true); return false; } } diff --git a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h index 30630e97846..65af91ac388 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h +++ b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h @@ -112,9 +112,9 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { void printMachineInstruction(const MachineInstr *MI); void printSSECC(const MachineInstr *MI, unsigned Op); void printMemReference(const MachineInstr *MI, unsigned Op, - const char *Modifier=NULL); + const char *Modifier=NULL, bool NotRIPRel = false); void printLeaMemReference(const MachineInstr *MI, unsigned Op, - const char *Modifier=NULL); + const char *Modifier=NULL, bool NotRIPRel = false); void printPICJumpTableSetLabel(unsigned uid, const MachineBasicBlock *MBB) const; void printPICJumpTableSetLabel(unsigned uid, unsigned uid2, |

