[llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Wed Jun 18 16:15:02 PDT 2003


Changes in directory llvm/lib/Target/Sparc:

Sparc.cpp updated: 1.68 -> 1.69

---
Log message:

lib/Target/Sparc/Sparc.cpp:
 Move LowerAllocations, PrintFunction, and SymbolStripping passes, and
  the corresponding -disable-strip and -d options, over here to the SPARC
  target-specific bits of llc. Rename -d to -dump-asm.

tools/llc/Makefile:
 Reindent. Add x86 library so that llc compiles again.

tools/llc/llc.cpp:
 Remove support for running arbitrary optimization passes. Use opt instead.
 Remove LowerAllocations, PrintFunction, and SymbolStripping passes, as noted
  above.
 Allow user to select a backend (x86 or SPARC); default to guessing from
  the endianness/pointer size of the input bytecode file.
 Fix typos.
 Delete empty .s file and exit with error status if target does not support
  static compilation.


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/Sparc.cpp
diff -u llvm/lib/Target/Sparc/Sparc.cpp:1.68 llvm/lib/Target/Sparc/Sparc.cpp:1.69
--- llvm/lib/Target/Sparc/Sparc.cpp:1.68	Mon Jun 16 10:31:52 2003
+++ llvm/lib/Target/Sparc/Sparc.cpp	Wed Jun 18 16:14:21 2003
@@ -21,6 +21,7 @@
 #include "llvm/CodeGen/MachineCodeForInstruction.h"
 #include "llvm/Reoptimizer/Mapping/MappingInfo.h" 
 #include "Support/CommandLine.h"
+#include "llvm/Assembly/PrintModulePass.h"
 
 static const unsigned ImplicitRegUseList[] = { 0 }; /* not used yet */
 // Build the MachineInstruction Description Array...
@@ -46,6 +47,14 @@
 static cl::opt<bool> DisablePeephole("nopeephole",
                                 cl::desc("Disable peephole optimization pass"));
 
+static cl::opt<bool>
+DisableStrip("disable-strip",
+	  cl::desc("Do not strip the LLVM bytecode included in the executable"));
+
+static cl::opt<bool>
+DumpAsm("dump-asm", cl::desc("Print bytecode before native code generation"),
+        cl::Hidden);
+
 //----------------------------------------------------------------------------
 // allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
 // that implements the Sparc backend. (the llvm/CodeGen/Sparc.h interface)
@@ -141,9 +150,21 @@
 //
 bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
 {
+  // The following 3 passes used to be inserted specially by llc.
+  // Replace malloc and free instructions with library calls.
+  PM.add(createLowerAllocationsPass());
+  
+  // If LLVM dumping after transformations is requested, add it to the pipeline
+  if (DumpAsm)
+    PM.add(new PrintFunctionPass("Code after xformations: \n", &std::cerr));
+  
+  // Strip all of the symbols from the bytecode so that it will be smaller...
+  if (!DisableStrip)
+    PM.add(createSymbolStrippingPass());
+
   // FIXME: implement the switch instruction in the instruction selector.
   PM.add(createLowerSwitchPass());
-
+  
   // Construct and initialize the MachineFunction object for this fn.
   PM.add(createMachineCodeConstructionPass(*this));
 





More information about the llvm-commits mailing list