[llvm-commits] [parallel] CVS: llvm/tools/llc/Makefile llc.cpp

Misha Brukman brukman at cs.uiuc.edu
Mon Mar 1 20:26:33 PST 2004


Changes in directory llvm/tools/llc:

Makefile updated: 1.44 -> 1.44.2.1
llc.cpp updated: 1.88 -> 1.88.2.1

---
Log message:

Merge from trunk

---
Diffs of the changes:  (+43 -16)

Index: llvm/tools/llc/Makefile
diff -u llvm/tools/llc/Makefile:1.44 llvm/tools/llc/Makefile:1.44.2.1
--- llvm/tools/llc/Makefile:1.44	Mon Dec 15 17:10:25 2003
+++ llvm/tools/llc/Makefile	Mon Mar  1 17:59:18 2004
@@ -8,15 +8,19 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../..
 TOOLNAME = llc
-USEDLIBS = sparc \
+USEDLIBS = cwriter \
+	   sparcv8 \
+           sparcv9 \
            x86 \
-	   selectiondag \
-           regalloc \
+           powerpc \
+           selectiondag \
+           sparcv9regalloc \
            sched \
-           select \
+           sparcv9select \
            codegen \
            target.a \
-           livevar \
+           sparcv9livevar \
+           ipa.a   \
            transforms.a \
            scalaropts.a \
            analysis.a \


Index: llvm/tools/llc/llc.cpp
diff -u llvm/tools/llc/llc.cpp:1.88 llvm/tools/llc/llc.cpp:1.88.2.1
--- llvm/tools/llc/llc.cpp:1.88	Sun Dec 28 03:51:04 2003
+++ llvm/tools/llc/llc.cpp	Mon Mar  1 17:59:18 2004
@@ -37,12 +37,15 @@
 
 static cl::opt<bool> Force("f", cl::desc("Overwrite output files"));
 
-enum ArchName { noarch, x86, Sparc };
+enum ArchName { noarch, X86, SparcV8, SparcV9, PowerPC, CBackend };
 
 static cl::opt<ArchName>
 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"),
+     cl::values(clEnumValN(X86,      "x86",     "  IA-32 (Pentium and above)"),
+                clEnumValN(SparcV8,  "sparcv8", "  SPARC V8 (experimental)"),
+                clEnumValN(SparcV9,  "sparcv9", "  SPARC V9"),
+                clEnumValN(PowerPC,  "powerpc", "  PowerPC (experimental)"),
+                clEnumValN(CBackend, "c",       "  C backend"),
 		0),
      cl::init(noarch));
 
@@ -67,7 +70,8 @@
 //
 int main(int argc, char **argv) {
   cl::ParseCommandLineOptions(argc, argv, " llvm system compiler\n");
-  
+  PrintStackTraceOnErrorSignal();
+
   // Load the module to be compiled...
   std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename));
   if (M.get() == 0) {
@@ -81,11 +85,20 @@
   TargetMachine* (*TargetMachineAllocator)(const Module&,
                                            IntrinsicLowering *) = 0;
   switch (Arch) {
-  case x86:
+  case CBackend:
+    TargetMachineAllocator = allocateCTargetMachine;
+    break;
+  case X86:
     TargetMachineAllocator = allocateX86TargetMachine;
     break;
-  case Sparc:
-    TargetMachineAllocator = allocateSparcTargetMachine;
+  case SparcV9:
+    TargetMachineAllocator = allocateSparcV9TargetMachine;
+    break;
+  case SparcV8:
+    TargetMachineAllocator = allocateSparcV8TargetMachine;
+    break;
+  case PowerPC:
+    TargetMachineAllocator = allocatePowerPCTargetMachine;
     break;
   default:
     // Decide what the default target machine should be, by looking at
@@ -95,19 +108,25 @@
     if (mod.getEndianness()  == Module::LittleEndian &&
         mod.getPointerSize() == Module::Pointer32) { 
       TargetMachineAllocator = allocateX86TargetMachine;
+    } else if (mod.getEndianness() == Module::BigEndian &&
+        mod.getPointerSize() == Module::Pointer32) { 
+      TargetMachineAllocator = allocatePowerPCTargetMachine;
     } else if (mod.getEndianness()  == Module::BigEndian &&
                mod.getPointerSize() == Module::Pointer64) { 
-      TargetMachineAllocator = allocateSparcTargetMachine;
+      TargetMachineAllocator = allocateSparcV9TargetMachine;
     } else {
       // If the module is target independent, favor a target which matches the
       // current build system.
 #if defined(i386) || defined(__i386__) || defined(__x86__)
       TargetMachineAllocator = allocateX86TargetMachine;
 #elif defined(sparc) || defined(__sparc__) || defined(__sparcv9)
-      TargetMachineAllocator = allocateSparcTargetMachine;
+      TargetMachineAllocator = allocateSparcV9TargetMachine;
+#elif defined(__POWERPC__) || defined(__ppc__) || defined(__APPLE__)
+      TargetMachineAllocator = allocatePowerPCTargetMachine;
 #else
       std::cerr << argv[0] << ": module does not specify a target to use.  "
-                << "You must use the -march option.\n";
+                << "You must use the -march option.  If no native target is "
+                << "available, use -march=c to emit C code.\n";
       return 1;
 #endif
     } 
@@ -150,7 +169,11 @@
       Out = &std::cout;
     } else {
       OutputFilename = GetFileNameRoot(InputFilename); 
-      OutputFilename += ".s";
+
+      if (Arch != CBackend)
+        OutputFilename += ".s";
+      else
+        OutputFilename += ".cbe.c";
       
       if (!Force && std::ifstream(OutputFilename.c_str())) {
         // If force is not specified, make sure not to overwrite a file!





More information about the llvm-commits mailing list