mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-20 11:29:24 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24440 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
adb0a068c6
commit
c41cc83117
@ -174,7 +174,7 @@ void X86ATTAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){
|
|||||||
O << "]";
|
O << "]";
|
||||||
return;
|
return;
|
||||||
} else if (BaseReg.isConstantPoolIndex()) {
|
} else if (BaseReg.isConstantPoolIndex()) {
|
||||||
O << ".CPI" << CurrentFnName << "_"
|
O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_"
|
||||||
<< BaseReg.getConstantPoolIndex();
|
<< BaseReg.getConstantPoolIndex();
|
||||||
if (DispSpec.getImmedValue())
|
if (DispSpec.getImmedValue())
|
||||||
O << "+" << DispSpec.getImmedValue();
|
O << "+" << DispSpec.getImmedValue();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "X86IntelAsmPrinter.h"
|
#include "X86IntelAsmPrinter.h"
|
||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
|
#include "llvm/Type.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/CodeGen/MachineConstantPool.h"
|
#include "llvm/CodeGen/MachineConstantPool.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
@ -66,6 +67,7 @@ bool X86SharedAsmPrinter::doInitialization(Module& M) {
|
|||||||
AlignmentIsInBytes = false;
|
AlignmentIsInBytes = false;
|
||||||
Data64bitsDirective = 0; // we can't emit a 64-bit unit
|
Data64bitsDirective = 0; // we can't emit a 64-bit unit
|
||||||
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
|
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
|
||||||
|
PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
|
||||||
}
|
}
|
||||||
|
|
||||||
return AsmPrinter::doInitialization(M);
|
return AsmPrinter::doInitialization(M);
|
||||||
@ -82,14 +84,21 @@ void X86SharedAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
|
|||||||
|
|
||||||
if (CP.empty()) return;
|
if (CP.empty()) return;
|
||||||
|
|
||||||
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
if (forDarwin) {
|
||||||
if (forDarwin)
|
O << "\t.const\n";
|
||||||
O << "\t.data\n";
|
} else {
|
||||||
else
|
|
||||||
O << "\t.section .rodata\n";
|
O << "\t.section .rodata\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
||||||
|
// 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
|
||||||
emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
|
emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
|
||||||
O << ".CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString
|
O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_" << i
|
||||||
<< *CP[i] << "\n";
|
<< ":\t\t\t\t\t" << CommentString << *CP[i] << "\n";
|
||||||
emitGlobalConstant(CP[i]);
|
emitGlobalConstant(CP[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ void X86IntelAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op){
|
|||||||
O << "]";
|
O << "]";
|
||||||
return;
|
return;
|
||||||
} else if (BaseReg.isConstantPoolIndex()) {
|
} else if (BaseReg.isConstantPoolIndex()) {
|
||||||
O << "[.CPI" << CurrentFnName << "_"
|
O << "[" << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_"
|
||||||
<< BaseReg.getConstantPoolIndex();
|
<< BaseReg.getConstantPoolIndex();
|
||||||
|
|
||||||
if (IndexReg.getReg()) {
|
if (IndexReg.getReg()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user