Add a forELF flag, allowing the removal of forCygwin and simplification of
authorChris Lattner <sabre@nondot.org>
Mon, 21 Nov 2005 22:19:48 +0000 (22:19 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Nov 2005 22:19:48 +0000 (22:19 +0000)
conditionals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24475 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 3a1ac86576fabac727defd3f8bfe9615d014eda1..7420012d70c4854fe37f2ff5b429fdad938dd338 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 (!forCygwin && !forDarwin)
+  if (forELF)
     O << "\t.type\t" << CurrentFnName << ", @function\n";
   O << CurrentFnName << ":\n";
 
index 36f4249e223a58da644036ddbbfe33412a0d9e4d..5b9742bd4406f802b5ad779fdf1053dfaf026f13 100644 (file)
@@ -39,15 +39,18 @@ AsmWriterFlavor("x86-asm-syntax",
                 cl::init(att));
 
 /// doInitialization
-bool X86SharedAsmPrinter::doInitialization(ModuleM) {
-  forCygwin = false;
+bool X86SharedAsmPrinter::doInitialization(Module &M) {
+  bool forCygwin = false;
   forDarwin = false;
+  forELF    = false;
   bool forWin32 = false;
   const std::string& TT = M.getTargetTriple();
   if (TT.length() > 5) {
     forCygwin = TT.find("cygwin") != std::string::npos ||
                 TT.find("mingw")  != std::string::npos;
     forDarwin = TT.find("darwin") != std::string::npos;
+    if (!forDarwin && !forCygwin)
+      forELF = true;
   } else if (TT.empty()) {
 #if defined(__CYGWIN__) || defined(__MINGW32__)
     forCygwin = true;
@@ -55,6 +58,8 @@ bool X86SharedAsmPrinter::doInitialization(Module& M) {
     forDarwin = true;
 #elif defined(_WIN32)
     forWin32 = true;
+#else
+    forELF = true;
 #endif
   }
 
@@ -139,7 +144,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
       }
 
       EmitAlignment(Align);
-      if (!forCygwin && !forDarwin) {
+      if (forELF) {
         O << "\t.type " << name << ",@object\n";
         O << "\t.size " << name << "," << Size << "\n";
       }
index 61dd2f295e72b96e61e35a2e9f9fcff4db4941af..649ec4d02473ee9cb66c7a3c22cb7d0188f219d8 100755 (executable)
@@ -29,12 +29,12 @@ extern Statistic<> EmittedInsts;
 
 struct X86SharedAsmPrinter : public AsmPrinter {
   X86SharedAsmPrinter(std::ostream &O, TargetMachine &TM)
-    : AsmPrinter(O, TM), forCygwin(false), forDarwin(false) { }
+    : AsmPrinter(O, TM), forELF(false), forDarwin(false) { }
 
   bool doInitialization(Module &M);
   bool doFinalization(Module &M);
 
-  bool forCygwin;
+  bool forELF;
   bool forDarwin;
 
   // Necessary for Darwin to print out the apprioriate types of linker stubs
index 1c9f803a0e111fba333991056e1f4e5d39664669..f4464b3e437360afe07a55ab3f1f9b0473702d77 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 (!forCygwin && !forDarwin)
+  if (forELF)
     O << "\t.type\t" << CurrentFnName << ", @function\n";
   O << CurrentFnName << ":\n";