1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Use HasDotTypeDotSizeDirective instead of forELF

llvm-svn: 24481
This commit is contained in:
Chris Lattner 2005-11-21 23:06:54 +00:00
parent e8b78e73f7
commit 3efe6171f1
4 changed files with 10 additions and 18 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -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

View File

@ -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";