Use HasDotTypeDotSizeDirective instead of forELF
authorChris Lattner <sabre@nondot.org>
Mon, 21 Nov 2005 23:06:54 +0000 (23:06 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Nov 2005 23:06:54 +0000 (23:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24481 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ATTAsmPrinter.cpp
lib/Target/X86/X86AsmPrinter.cpp
lib/Target/X86/X86AsmPrinter.h
lib/Target/X86/X86IntelAsmPrinter.cpp

index 9a21e617b858faff0759ca56af395d50840885fb..b2641073725d6b5bad74c502ecd123b0330d8db1 100755 (executable)
@@ -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.
index 561a0b106da58855e08e79711666496c4b49281a..85cc3c28bdfae834f307181a85ffd0bc24eb04e5 100644 (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);
   }
   
index 1f3f40dd4083da7bd42658926eddd7cb139475d3..3267d4ec647fae8d5af23d4bf1508ae5fafbf72d 100755 (executable)
@@ -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
index f4464b3e437360afe07a55ab3f1f9b0473702d77..e54328bb25de48f8917d40030a023625f17533bd 100755 (executable)
@@ -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";