Initialize the target architecture based on compiler defines, so if compiled on
authorMisha Brukman <brukman+llvm@gmail.com>
Fri, 18 Jul 2003 22:21:40 +0000 (22:21 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Fri, 18 Jul 2003 22:21:40 +0000 (22:21 +0000)
x86 or Sparc, LLC will automatically default to that platform, no guessing
required. On another platform, it will default to `noarch' and will have to
guess which architecture to compile to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7207 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llc/llc.cpp

index 4d1bb772edf318c532bd587eb74c91f6e85780fb..71667c34a3ccd2fe336c2ed2ac4b3794af0fc671 100644 (file)
@@ -35,7 +35,14 @@ Arch("march", cl::desc("Architecture to generate assembly for:"), cl::Prefix,
      cl::values(clEnumVal(x86, "  IA-32 (Pentium and above)"),
                 clEnumValN(Sparc, "sparc", "  SPARC V9"),
                0),
-     cl::init(noarch));
+#if defined(i386) || defined(__i386__) || defined(__x86__)
+     cl::init(x86)
+#elif defined(sparc) || defined(__sparc__) || defined(__sparcv9)
+     cl::init(Sparc)
+#else
+     cl::init(noarch)
+#endif
+     );
 
 // GetFileNameRoot - Helper function to get the basename of a filename...
 static inline std::string