mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Use HasDotTypeDotSizeDirective instead of forELF
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24481 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
291ca1c563
commit
ac2902bcb5
@ -35,7 +35,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SwitchSection("\t.text\n", MF.getFunction());
|
||||
EmitAlignment(4); // FIXME: This should be parameterized somewhere.
|
||||
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||
if (forELF)
|
||||
if (HasDotTypeDotSizeDirective)
|
||||
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
||||
O << CurrentFnName << ":\n";
|
||||
|
||||
@ -54,7 +54,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
printMachineInstruction(II);
|
||||
}
|
||||
}
|
||||
if (forELF)
|
||||
if (HasDotTypeDotSizeDirective)
|
||||
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
|
||||
|
||||
// We didn't modify anything.
|
||||
|
@ -43,13 +43,9 @@ AsmWriterFlavor("x86-asm-syntax",
|
||||
bool X86SharedAsmPrinter::doInitialization(Module &M) {
|
||||
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||
|
||||
forELF = false;
|
||||
forDarwin = false;
|
||||
|
||||
switch (Subtarget->TargetType) {
|
||||
case X86Subtarget::isELF:
|
||||
forELF = true;
|
||||
break;
|
||||
case X86Subtarget::isDarwin:
|
||||
AlignmentIsInBytes = false;
|
||||
GlobalPrefix = "_";
|
||||
@ -59,14 +55,17 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) {
|
||||
ConstantPoolSection = "\t.const\n";
|
||||
LCOMMDirective = "\t.lcomm\t";
|
||||
COMMDirectiveTakesAlignment = false;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
forDarwin = true;
|
||||
break;
|
||||
case X86Subtarget::isCygwin:
|
||||
GlobalPrefix = "_";
|
||||
COMMDirectiveTakesAlignment = false;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
break;
|
||||
case X86Subtarget::isWindows:
|
||||
GlobalPrefix = "_";
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@ -96,9 +95,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
||||
O << COMMDirective << name << "," << Size;
|
||||
if (COMMDirectiveTakesAlignment)
|
||||
O << "," << (1 << Align);
|
||||
O << "\t\t# ";
|
||||
WriteAsOperand(O, I, true, true, &M);
|
||||
O << "\n";
|
||||
O << "\t\t" << CommentString << " " << I->getName() << "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -137,15 +134,11 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
||||
}
|
||||
|
||||
EmitAlignment(Align);
|
||||
if (forELF) {
|
||||
if (HasDotTypeDotSizeDirective) {
|
||||
O << "\t.type " << name << ",@object\n";
|
||||
O << "\t.size " << name << "," << Size << "\n";
|
||||
}
|
||||
O << name << ":\t\t\t\t# ";
|
||||
WriteAsOperand(O, I, true, true, &M);
|
||||
O << " = ";
|
||||
WriteAsOperand(O, C, false, false, &M);
|
||||
O << "\n";
|
||||
O << name << ":\t\t\t" << CommentString << ' ' << I->getName() << '\n';
|
||||
EmitGlobalConstant(C);
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,11 @@ extern Statistic<> EmittedInsts;
|
||||
|
||||
struct X86SharedAsmPrinter : public AsmPrinter {
|
||||
X86SharedAsmPrinter(std::ostream &O, TargetMachine &TM)
|
||||
: AsmPrinter(O, TM), forELF(false), forDarwin(false) { }
|
||||
: AsmPrinter(O, TM), forDarwin(false) { }
|
||||
|
||||
bool doInitialization(Module &M);
|
||||
bool doFinalization(Module &M);
|
||||
|
||||
bool forELF;
|
||||
bool forDarwin; // FIXME: eliminate.
|
||||
|
||||
// Necessary for Darwin to print out the apprioriate types of linker stubs
|
||||
|
@ -35,7 +35,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SwitchSection("\t.text\n", MF.getFunction());
|
||||
EmitAlignment(4);
|
||||
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||
if (forELF)
|
||||
if (HasDotTypeDotSizeDirective)
|
||||
O << "\t.type\t" << CurrentFnName << ", @function\n";
|
||||
O << CurrentFnName << ":\n";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user