summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-04-02 17:52:40 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-04-02 17:52:40 +0000
commit2845936a3494539a65a4a6376e1ab1c1929f6d60 (patch)
tree9e30c881d6b4b997d1c3d67177e37154d0118be3 /llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp
parentcc24411c0a0204823b174367c773342d3faaef16 (diff)
downloadbcm5719-llvm-2845936a3494539a65a4a6376e1ab1c1929f6d60.tar.gz
bcm5719-llvm-2845936a3494539a65a4a6376e1ab1c1929f6d60.zip
Only strip symbols if emitting bytecode to the assembly file.
Move lowerselect pass to come after preselection. Move machine code construction and stack slots pass to come right before instruction selection. This is to help fix perlbmk. Update comments. Make the sequence of passes in addPassesToJITCompile look more like the sequence of passes in addPassesToEmitAssembly, including support for -print-machineinstrs. llvm-svn: 12614
Diffstat (limited to 'llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp62
1 files changed, 33 insertions, 29 deletions
diff --git a/llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index c060f75a790..0f15b135482 100644
--- a/llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -125,39 +125,34 @@ SparcV9TargetMachine::SparcV9TargetMachine(IntrinsicLowering *il)
bool
SparcV9TargetMachine::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());
- // 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());
- PM.add(createLowerSelectPass());
-
// FIXME: implement the invoke/unwind instructions!
PM.add(createLowerInvokePass());
// decompose multi-dimensional array references into single-dim refs
PM.add(createDecomposeMultiDimRefsPass());
-
- // Construct and initialize the MachineFunction object for this fn.
- PM.add(createMachineCodeConstructionPass(*this));
-
- //Insert empty stackslots in the stack frame of each function
- //so %fp+offset-8 and %fp+offset-16 are empty slots now!
- PM.add(createStackSlotsPass(*this));
- // Specialize LLVM code for this target machine and then
- // run basic dataflow optimizations on LLVM code.
+ // Lower LLVM code to the form expected by the SPARCv9 instruction selector.
PM.add(createPreSelectionPass(*this));
+ PM.add(createLowerSelectPass());
+
+ // Run basic LLVM dataflow optimizations, to clean up after pre-selection.
PM.add(createReassociatePass());
PM.add(createLICMPass());
PM.add(createGCSEPass());
+ // Construct and initialize the MachineFunction object for this fn.
+ PM.add(createMachineCodeConstructionPass(*this));
+
+ // Insert empty stackslots in the stack frame of each function
+ // so %fp+offset-8 and %fp+offset-16 are empty slots now!
+ PM.add(createStackSlotsPass(*this));
+
PM.add(createInstructionSelectionPass(*this));
if (!DisableSched)
@@ -190,9 +185,13 @@ SparcV9TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out
PM.add(createSparcV9MachineCodeDestructionPass());
// Emit bytecode to the assembly file into its special section next
- if (EmitMappingInfo)
+ if (EmitMappingInfo) {
+ // Strip all of the symbols from the bytecode so that it will be smaller...
+ if (!DisableStrip)
+ PM.add(createSymbolStrippingPass());
PM.add(createBytecodeAsmPrinterPass(Out));
-
+ }
+
return false;
}
@@ -206,35 +205,40 @@ void SparcV9JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
TD.getPointerAlignment(), TD.getDoubleAlignment()));
// Replace malloc and free instructions with library calls.
- // Do this after tracing until lli implements these lib calls.
- // For now, it will emulate malloc and free internally.
PM.add(createLowerAllocationsPass());
-
+
// FIXME: implement the switch instruction in the instruction selector.
PM.add(createLowerSwitchPass());
- PM.add(createLowerSelectPass());
-
// FIXME: implement the invoke/unwind instructions!
PM.add(createLowerInvokePass());
-
+
// decompose multi-dimensional array references into single-dim refs
PM.add(createDecomposeMultiDimRefsPass());
-
- // Construct and initialize the MachineFunction object for this fn.
- PM.add(createMachineCodeConstructionPass(TM));
- // Specialize LLVM code for this target machine and then
- // run basic dataflow optimizations on LLVM code.
+ // Lower LLVM code to the form expected by the SPARCv9 instruction selector.
PM.add(createPreSelectionPass(TM));
+ PM.add(createLowerSelectPass());
+
+ // Run basic LLVM dataflow optimizations, to clean up after pre-selection.
PM.add(createReassociatePass());
// FIXME: these passes crash the FunctionPassManager when being added...
//PM.add(createLICMPass());
//PM.add(createGCSEPass());
+ // Construct and initialize the MachineFunction object for this fn.
+ PM.add(createMachineCodeConstructionPass(TM));
+
PM.add(createInstructionSelectionPass(TM));
+ if (PrintMachineCode)
+ PM.add(createMachineFunctionPrinterPass(&std::cerr, "Before reg alloc:\n"));
+
PM.add(getRegisterAllocator(TM));
+
+ if (PrintMachineCode)
+ PM.add(createMachineFunctionPrinterPass(&std::cerr, "After reg alloc:\n"));
+
PM.add(createPrologEpilogInsertionPass());
if (!DisablePeephole)
OpenPOWER on IntegriCloud