aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/AsmPrinter
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-11-22 16:15:34 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-11-22 16:15:34 +0000
commit7751ad92daeea5a3502fbc266ae814baec5c03e6 (patch)
treee8fe5ac64eef58c1c5313b6c94b8037be8d04aa4 /lib/Target/X86/AsmPrinter
parent253174bf50c932abaa680f465e2888c0e5272267 (diff)
downloadexternal_llvm-7751ad92daeea5a3502fbc266ae814baec5c03e6.zip
external_llvm-7751ad92daeea5a3502fbc266ae814baec5c03e6.tar.gz
external_llvm-7751ad92daeea5a3502fbc266ae814baec5c03e6.tar.bz2
Make a convenient helper for printing offsets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp12
-rw-r--r--lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp12
2 files changed, 4 insertions, 20 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index 556757a..66319c3 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
@@ -344,11 +344,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
O << "@GOTOFF";
}
- int Offset = MO.getOffset();
- if (Offset > 0)
- O << '+' << Offset;
- else if (Offset < 0)
- O << Offset;
+ printOffset(MO.getOffset());
if (isMemOp && Subtarget->isPICStyleRIPRel() && !NotRIPRel)
O << "(%rip)";
@@ -429,11 +425,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
if (GV->hasExternalWeakLinkage())
ExtWeakSymbols.insert(GV);
- int Offset = MO.getOffset();
- if (Offset > 0)
- O << '+' << Offset;
- else if (Offset < 0)
- O << Offset;
+ printOffset(MO.getOffset());
if (isThreadLocal) {
if (TM.getRelocationModel() == Reloc::PIC_ || Subtarget->is64Bit())
diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
index 4868906..1d4a695 100644
--- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
@@ -235,11 +235,7 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
if (!isMemOp) O << "OFFSET ";
O << "[" << TAI->getPrivateGlobalPrefix() << "CPI"
<< getFunctionNumber() << "_" << MO.getIndex();
- int Offset = MO.getOffset();
- if (Offset > 0)
- O << " + " << Offset;
- else if (Offset < 0)
- O << Offset;
+ printOffset(MO.getOffset());
O << "]";
return;
}
@@ -258,11 +254,7 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
O << "__imp_";
}
O << Name;
- int Offset = MO.getOffset();
- if (Offset > 0)
- O << " + " << Offset;
- else if (Offset < 0)
- O << Offset;
+ printOffset(MO.getOffset());
return;
}
case MachineOperand::MO_ExternalSymbol: {