[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86IntelAsmPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Nov 20 22:46:33 PST 2005
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.8 -> 1.9
X86AsmPrinter.cpp updated: 1.145 -> 1.146
X86IntelAsmPrinter.cpp updated: 1.4 -> 1.5
---
Log message:
Naturally align doubles in the constant pool, set PrivateGlobalPrefix on
darwin, use it when printing the constant pool indices so the labels are
appropriately private, emit cp entries to .const instead of .data on darwin
and only emit a single .section for the constant pool, not one for each
entry.
---
Diffs of the changes: (+17 -8)
X86ATTAsmPrinter.cpp | 2 +-
X86AsmPrinter.cpp | 21 +++++++++++++++------
X86IntelAsmPrinter.cpp | 2 +-
3 files changed, 17 insertions(+), 8 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.8 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.9
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.8 Wed Jul 27 01:12:34 2005
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Nov 21 00:46:22 2005
@@ -174,7 +174,7 @@
O << "]";
return;
} else if (BaseReg.isConstantPoolIndex()) {
- O << ".CPI" << CurrentFnName << "_"
+ O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_"
<< BaseReg.getConstantPoolIndex();
if (DispSpec.getImmedValue())
O << "+" << DispSpec.getImmedValue();
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.145 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.146
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.145 Wed Jul 27 01:12:34 2005
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Nov 21 00:46:22 2005
@@ -18,6 +18,7 @@
#include "X86IntelAsmPrinter.h"
#include "X86.h"
#include "llvm/Module.h"
+#include "llvm/Type.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/Support/Mangler.h"
@@ -66,6 +67,7 @@
AlignmentIsInBytes = false;
Data64bitsDirective = 0; // we can't emit a 64-bit unit
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
+ PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
}
return AsmPrinter::doInitialization(M);
@@ -82,14 +84,21 @@
if (CP.empty()) return;
+ if (forDarwin) {
+ O << "\t.const\n";
+ } else {
+ O << "\t.section .rodata\n";
+ }
+
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
- if (forDarwin)
- O << "\t.data\n";
+ // FIXME: force doubles to be naturally aligned. We should handle this
+ // more correctly in the future.
+ if (CP[i]->getType() == Type::DoubleTy)
+ emitAlignment(3);
else
- O << "\t.section .rodata\n";
- emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
- O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString
- << *CP[i] << "\n";
+ emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
+ O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_" << i
+ << ":\t\t\t\t\t" << CommentString << *CP[i] << "\n";
emitGlobalConstant(CP[i]);
}
}
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.4 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.5
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.4 Thu Jul 14 17:52:25 2005
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Mon Nov 21 00:46:22 2005
@@ -141,7 +141,7 @@
O << "]";
return;
} else if (BaseReg.isConstantPoolIndex()) {
- O << "[.CPI" << CurrentFnName << "_"
+ O << "[" << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_"
<< BaseReg.getConstantPoolIndex();
if (IndexReg.getReg()) {
More information about the llvm-commits
mailing list