[llvm-commits] [llvm] r59872 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/ARM/AsmPrinter/Makefile lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
Anton Korobeynikov
asl at math.spbu.ru
Sat Nov 22 08:15:43 PST 2008
Author: asl
Date: Sat Nov 22 10:15:34 2008
New Revision: 59872
URL: http://llvm.org/viewvc/llvm-project?rev=59872&view=rev
Log:
Make a convenient helper for printing offsets.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sat Nov 22 10:15:34 2008
@@ -362,6 +362,9 @@
/// this is suported by the target.
void printVisibility(const std::string& Name, unsigned Visibility) const;
+ /// printOffset - This is just convenient handler for printing offsets.
+ void printOffset(int64_t Offset) const;
+
private:
const GlobalValue *findGlobalValue(const Constant* CV);
void EmitLLVMUsedList(Constant *List);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sat Nov 22 10:15:34 2008
@@ -1526,6 +1526,13 @@
}
}
+void AsmPrinter::printOffset(int64_t Offset) const {
+ if (Offset > 0)
+ O << '+' << Offset;
+ else if (Offset < 0)
+ O << Offset;
+}
+
GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
if (!S->usesMetadata())
return 0;
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sat Nov 22 10:15:34 2008
@@ -300,12 +300,9 @@
FnStubs.insert(Name);
} else
O << Name;
-
- if (MO.getOffset() > 0)
- O << '+' << MO.getOffset();
- else if (MO.getOffset() < 0)
- O << MO.getOffset();
-
+
+ printOffset(MO.getOffset());
+
if (isCallOp && Subtarget->isTargetELF() &&
TM.getRelocationModel() == Reloc::PIC_)
O << "(PLT)";
@@ -345,7 +342,7 @@
assert(V < (1 << 12) && "Not a valid so_imm value!");
unsigned Imm = ARM_AM::getSOImmValImm(V);
unsigned Rot = ARM_AM::getSOImmValRot(V);
-
+
// Print low-level immediate formation info, per
// A5.1.3: "Data-processing operands - Immediate".
if (Rot) {
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/Makefile Sat Nov 22 10:15:34 2008
@@ -1,4 +1,4 @@
-##===- lib/Target/X86/Makefile -----------------------------*- Makefile -*-===##
+##===- lib/Target/ARM/Makefile -----------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
@@ -9,7 +9,7 @@
LEVEL = ../../../..
LIBRARYNAME = LLVMARMAsmPrinter
-# Hack: we need to include 'main' x86 target directory to grab private headers
+# Hack: we need to include 'main' arm target directory to grab private headers
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
include $(LEVEL)/Makefile.common
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Sat Nov 22 10:15:34 2008
@@ -398,10 +398,7 @@
}
O << Name;
- if (MO.getOffset() > 0)
- O << "+" << MO.getOffset();
- else if (MO.getOffset() < 0)
- O << MO.getOffset();
+ printOffset(MO.getOffset());
if (GV->hasExternalWeakLinkage())
ExtWeakSymbols.insert(GV);
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Sat Nov 22 10:15:34 2008
@@ -344,11 +344,7 @@
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 @@
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())
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=59872&r1=59871&r2=59872&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Sat Nov 22 10:15:34 2008
@@ -235,11 +235,7 @@
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 @@
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: {
More information about the llvm-commits
mailing list