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";
printMachineInstruction(II);
}
}
- if (forELF)
+ if (HasDotTypeDotSizeDirective)
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
// We didn't modify anything.
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 = "_";
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;
}
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;
}
}
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);
}
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