Chris Lattner | 1d21f3e | 2002-04-09 05:21:26 +0000 | [diff] [blame] | 1 | //===-- Sparc.cpp - General implementation file for the Sparc Target ------===// |
| 2 | // |
| 3 | // This file contains the code for the Sparc Target that does not fit in any of |
| 4 | // the other files in this directory. |
| 5 | // |
| 6 | //===----------------------------------------------------------------------===// |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 7 | |
Chris Lattner | 20b1ea0 | 2001-09-14 03:47:57 +0000 | [diff] [blame] | 8 | #include "SparcInternals.h" |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame^] | 9 | #include "MappingInfo.h" |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 10 | #include "llvm/Function.h" |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 11 | #include "llvm/PassManager.h" |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame^] | 12 | #include "llvm/Assembly/PrintModulePass.h" |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 13 | #include "llvm/Transforms/Scalar.h" |
Misha Brukman | fce1143 | 2002-10-28 00:28:31 +0000 | [diff] [blame] | 14 | #include "llvm/CodeGen/MachineFunction.h" |
Chris Lattner | 78d881d | 2002-12-28 20:17:43 +0000 | [diff] [blame] | 15 | #include "llvm/CodeGen/MachineFunctionInfo.h" |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 16 | #include "llvm/CodeGen/PreSelection.h" |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/PeepholeOpts.h" |
| 18 | #include "llvm/CodeGen/InstrSelection.h" |
| 19 | #include "llvm/CodeGen/InstrScheduling.h" |
| 20 | #include "llvm/CodeGen/RegisterAllocation.h" |
| 21 | #include "llvm/CodeGen/MachineCodeForInstruction.h" |
Chris Lattner | 48e6079 | 2003-08-13 02:38:16 +0000 | [diff] [blame^] | 22 | #include "llvm/Target/TargetMachineImpls.h" |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 23 | #include "Support/CommandLine.h" |
Ruchira Sasanka | e38bd533 | 2001-09-15 00:30:44 +0000 | [diff] [blame] | 24 | |
Chris Lattner | 6af2040 | 2002-12-03 05:41:54 +0000 | [diff] [blame] | 25 | static const unsigned ImplicitRegUseList[] = { 0 }; /* not used yet */ |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 26 | // Build the MachineInstruction Description Array... |
Chris Lattner | 3501fea | 2003-01-14 22:00:31 +0000 | [diff] [blame] | 27 | const TargetInstrDescriptor SparcMachineInstrDesc[] = { |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 28 | #define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \ |
| 29 | NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \ |
| 30 | { OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \ |
Chris Lattner | 6af2040 | 2002-12-03 05:41:54 +0000 | [diff] [blame] | 31 | NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS, 0, \ |
| 32 | ImplicitRegUseList, ImplicitRegUseList }, |
Chris Lattner | 9a3d63b | 2001-09-19 15:56:23 +0000 | [diff] [blame] | 33 | #include "SparcInstr.def" |
| 34 | }; |
Vikram S. Adve | 0fb4980 | 2001-09-18 13:01:29 +0000 | [diff] [blame] | 35 | |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 36 | //--------------------------------------------------------------------------- |
| 37 | // Command line options to control choice of code generation passes. |
| 38 | //--------------------------------------------------------------------------- |
| 39 | |
Misha Brukman | fe8a796 | 2003-08-06 23:25:25 +0000 | [diff] [blame] | 40 | static cl::opt<bool> DisablePreOpt("disable-preopt", |
Misha Brukman | 58ba50f | 2003-08-06 23:06:21 +0000 | [diff] [blame] | 41 | cl::desc("Disable optimizations prior to instruction selection")); |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 42 | |
Misha Brukman | fe8a796 | 2003-08-06 23:25:25 +0000 | [diff] [blame] | 43 | static cl::opt<bool> DisableSched("disable-sched", |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 44 | cl::desc("Disable local scheduling pass")); |
| 45 | |
Misha Brukman | fe8a796 | 2003-08-06 23:25:25 +0000 | [diff] [blame] | 46 | static cl::opt<bool> DisablePeephole("disable-peephole", |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 47 | cl::desc("Disable peephole optimization pass")); |
| 48 | |
Vikram S. Adve | 20a3be3 | 2003-08-12 15:51:02 +0000 | [diff] [blame] | 49 | static cl::opt<bool> EmitMappingInfo("emitmaps", |
| 50 | cl::desc("Emit LLVM-to-MachineCode mapping info to assembly")); |
Brian Gaeke | 2e2f2dc | 2003-06-18 21:14:23 +0000 | [diff] [blame] | 51 | |
Vikram S. Adve | 20a3be3 | 2003-08-12 15:51:02 +0000 | [diff] [blame] | 52 | static cl::opt<bool> DisableStrip("disable-strip", |
| 53 | cl::desc("Do not strip the LLVM bytecode included in executable")); |
| 54 | |
| 55 | static cl::opt<bool> DumpInput("dump-input", |
| 56 | cl::desc("Print bytecode before native code generation"), |
| 57 | cl::Hidden); |
Brian Gaeke | 2e2f2dc | 2003-06-18 21:14:23 +0000 | [diff] [blame] | 58 | |
Vikram S. Adve | 0fb4980 | 2001-09-18 13:01:29 +0000 | [diff] [blame] | 59 | //---------------------------------------------------------------------------- |
Chris Lattner | 46cbff6 | 2001-09-14 16:56:32 +0000 | [diff] [blame] | 60 | // allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine |
| 61 | // that implements the Sparc backend. (the llvm/CodeGen/Sparc.h interface) |
Vikram S. Adve | 0fb4980 | 2001-09-18 13:01:29 +0000 | [diff] [blame] | 62 | //---------------------------------------------------------------------------- |
Ruchira Sasanka | cc3ccac | 2001-10-15 16:25:28 +0000 | [diff] [blame] | 63 | |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 64 | TargetMachine *allocateSparcTargetMachine(unsigned Configuration) { |
| 65 | return new UltraSparc(); |
| 66 | } |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 67 | |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 68 | //--------------------------------------------------------------------------- |
| 69 | // class UltraSparcFrameInfo |
| 70 | // |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 71 | // Interface to stack frame layout info for the UltraSPARC. |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 72 | // Starting offsets for each area of the stack frame are aligned at |
| 73 | // a multiple of getStackFrameSizeAlignment(). |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 74 | //--------------------------------------------------------------------------- |
| 75 | |
| 76 | int |
Misha Brukman | fce1143 | 2002-10-28 00:28:31 +0000 | [diff] [blame] | 77 | UltraSparcFrameInfo::getFirstAutomaticVarOffset(MachineFunction& , |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 78 | bool& pos) const |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 79 | { |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 80 | pos = false; // static stack area grows downwards |
| 81 | return StaticAreaOffsetFromFP; |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | int |
Misha Brukman | fce1143 | 2002-10-28 00:28:31 +0000 | [diff] [blame] | 85 | UltraSparcFrameInfo::getRegSpillAreaOffset(MachineFunction& mcInfo, |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 86 | bool& pos) const |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 87 | { |
Chris Lattner | 78d881d | 2002-12-28 20:17:43 +0000 | [diff] [blame] | 88 | // ensure no more auto vars are added |
| 89 | mcInfo.getInfo()->freezeAutomaticVarsArea(); |
Vikram S. Adve | 0bc0516 | 2002-04-25 04:43:45 +0000 | [diff] [blame] | 90 | |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 91 | pos = false; // static stack area grows downwards |
Chris Lattner | 78d881d | 2002-12-28 20:17:43 +0000 | [diff] [blame] | 92 | unsigned autoVarsSize = mcInfo.getInfo()->getAutomaticVarsSize(); |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 93 | return StaticAreaOffsetFromFP - autoVarsSize; |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | int |
Misha Brukman | fce1143 | 2002-10-28 00:28:31 +0000 | [diff] [blame] | 97 | UltraSparcFrameInfo::getTmpAreaOffset(MachineFunction& mcInfo, |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 98 | bool& pos) const |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 99 | { |
Chris Lattner | 78d881d | 2002-12-28 20:17:43 +0000 | [diff] [blame] | 100 | MachineFunctionInfo *MFI = mcInfo.getInfo(); |
| 101 | MFI->freezeAutomaticVarsArea(); // ensure no more auto vars are added |
| 102 | MFI->freezeSpillsArea(); // ensure no more spill slots are added |
Vikram S. Adve | 0bc0516 | 2002-04-25 04:43:45 +0000 | [diff] [blame] | 103 | |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 104 | pos = false; // static stack area grows downwards |
Chris Lattner | 78d881d | 2002-12-28 20:17:43 +0000 | [diff] [blame] | 105 | unsigned autoVarsSize = MFI->getAutomaticVarsSize(); |
| 106 | unsigned spillAreaSize = MFI->getRegSpillsSize(); |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 107 | int offset = autoVarsSize + spillAreaSize; |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 108 | return StaticAreaOffsetFromFP - offset; |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | int |
Misha Brukman | fce1143 | 2002-10-28 00:28:31 +0000 | [diff] [blame] | 112 | UltraSparcFrameInfo::getDynamicAreaOffset(MachineFunction& mcInfo, |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 113 | bool& pos) const |
| 114 | { |
Vikram S. Adve | e6d2c41 | 2002-03-18 03:08:07 +0000 | [diff] [blame] | 115 | // Dynamic stack area grows downwards starting at top of opt-args area. |
| 116 | // The opt-args, required-args, and register-save areas are empty except |
| 117 | // during calls and traps, so they are shifted downwards on each |
| 118 | // dynamic-size alloca. |
| 119 | pos = false; |
Chris Lattner | 78d881d | 2002-12-28 20:17:43 +0000 | [diff] [blame] | 120 | unsigned optArgsSize = mcInfo.getInfo()->getMaxOptionalArgsSize(); |
Vikram S. Adve | e1f7280 | 2002-09-16 15:39:26 +0000 | [diff] [blame] | 121 | if (int extra = optArgsSize % getStackFrameSizeAlignment()) |
| 122 | optArgsSize += (getStackFrameSizeAlignment() - extra); |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 123 | int offset = optArgsSize + FirstOptionalOutgoingArgOffsetFromSP; |
Vikram S. Adve | e6d2c41 | 2002-03-18 03:08:07 +0000 | [diff] [blame] | 124 | assert((offset - OFFSET) % getStackFrameSizeAlignment() == 0); |
Vikram S. Adve | 00521d7 | 2001-11-12 23:26:35 +0000 | [diff] [blame] | 125 | return offset; |
Vikram S. Adve | 9db4318 | 2001-10-22 13:44:23 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Chris Lattner | 20b1ea0 | 2001-09-14 03:47:57 +0000 | [diff] [blame] | 128 | //--------------------------------------------------------------------------- |
| 129 | // class UltraSparcMachine |
| 130 | // |
| 131 | // Purpose: |
| 132 | // Primary interface to machine description for the UltraSPARC. |
| 133 | // Primarily just initializes machine-dependent parameters in |
| 134 | // class TargetMachine, and creates machine-dependent subclasses |
Chris Lattner | 3501fea | 2003-01-14 22:00:31 +0000 | [diff] [blame] | 135 | // for classes such as TargetInstrInfo. |
Chris Lattner | 20b1ea0 | 2001-09-14 03:47:57 +0000 | [diff] [blame] | 136 | // |
| 137 | //--------------------------------------------------------------------------- |
| 138 | |
Vikram S. Adve | 0fb4980 | 2001-09-18 13:01:29 +0000 | [diff] [blame] | 139 | UltraSparc::UltraSparc() |
Chris Lattner | 10daaa1 | 2003-04-26 20:11:09 +0000 | [diff] [blame] | 140 | : TargetMachine("UltraSparc-Native", false), |
Vikram S. Adve | 7f37fe5 | 2001-11-08 04:55:13 +0000 | [diff] [blame] | 141 | schedInfo(*this), |
| 142 | regInfo(*this), |
Vikram S. Adve | b704840 | 2001-11-09 02:16:04 +0000 | [diff] [blame] | 143 | frameInfo(*this), |
Vikram S. Adve | d55697c | 2002-09-20 00:52:09 +0000 | [diff] [blame] | 144 | cacheInfo(*this), |
Chris Lattner | c56406c | 2002-10-29 21:48:17 +0000 | [diff] [blame] | 145 | optInfo(*this) { |
Chris Lattner | 20b1ea0 | 2001-09-14 03:47:57 +0000 | [diff] [blame] | 146 | } |
| 147 | |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 148 | |
| 149 | // addPassesToEmitAssembly - This method controls the entire code generation |
| 150 | // process for the ultra sparc. |
| 151 | // |
Chris Lattner | 6334205 | 2002-10-29 21:12:46 +0000 | [diff] [blame] | 152 | bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 153 | { |
Brian Gaeke | 2e2f2dc | 2003-06-18 21:14:23 +0000 | [diff] [blame] | 154 | // The following 3 passes used to be inserted specially by llc. |
| 155 | // Replace malloc and free instructions with library calls. |
| 156 | PM.add(createLowerAllocationsPass()); |
| 157 | |
Brian Gaeke | 2e2f2dc | 2003-06-18 21:14:23 +0000 | [diff] [blame] | 158 | // Strip all of the symbols from the bytecode so that it will be smaller... |
| 159 | if (!DisableStrip) |
| 160 | PM.add(createSymbolStrippingPass()); |
| 161 | |
Chris Lattner | 155e68f | 2003-04-23 16:24:55 +0000 | [diff] [blame] | 162 | // FIXME: implement the switch instruction in the instruction selector. |
| 163 | PM.add(createLowerSwitchPass()); |
Brian Gaeke | 2e2f2dc | 2003-06-18 21:14:23 +0000 | [diff] [blame] | 164 | |
Vikram S. Adve | 248932b | 2003-08-01 15:53:24 +0000 | [diff] [blame] | 165 | // decompose multi-dimensional array references into single-dim refs |
| 166 | PM.add(createDecomposeMultiDimRefsPass()); |
| 167 | |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 168 | // Construct and initialize the MachineFunction object for this fn. |
Chris Lattner | 227c3d3 | 2002-10-28 01:12:41 +0000 | [diff] [blame] | 169 | PM.add(createMachineCodeConstructionPass(*this)); |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 170 | |
| 171 | //Insert empty stackslots in the stack frame of each function |
| 172 | //so %fp+offset-8 and %fp+offset-16 are empty slots now! |
| 173 | PM.add(createStackSlotsPass(*this)); |
| 174 | |
Misha Brukman | 58ba50f | 2003-08-06 23:06:21 +0000 | [diff] [blame] | 175 | if (!DisablePreOpt) { |
| 176 | // Specialize LLVM code for this target machine |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 177 | PM.add(createPreSelectionPass(*this)); |
Misha Brukman | 58ba50f | 2003-08-06 23:06:21 +0000 | [diff] [blame] | 178 | // Run basic dataflow optimizations on LLVM code |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 179 | PM.add(createReassociatePass()); |
| 180 | PM.add(createLICMPass()); |
| 181 | PM.add(createGCSEPass()); |
| 182 | } |
Vikram S. Adve | deb9634 | 2003-07-29 19:58:00 +0000 | [diff] [blame] | 183 | |
| 184 | // If LLVM dumping after transformations is requested, add it to the pipeline |
| 185 | if (DumpInput) |
Misha Brukman | 58ba50f | 2003-08-06 23:06:21 +0000 | [diff] [blame] | 186 | PM.add(new PrintFunctionPass("Input code to instsr. selection:\n", |
| 187 | &std::cerr)); |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 188 | |
| 189 | PM.add(createInstructionSelectionPass(*this)); |
| 190 | |
| 191 | if (!DisableSched) |
| 192 | PM.add(createInstructionSchedulingWithSSAPass(*this)); |
| 193 | |
| 194 | PM.add(getRegisterAllocator(*this)); |
| 195 | |
| 196 | PM.add(getPrologEpilogInsertionPass()); |
| 197 | |
| 198 | if (!DisablePeephole) |
| 199 | PM.add(createPeepholeOptsPass(*this)); |
| 200 | |
Vikram S. Adve | 20a3be3 | 2003-08-12 15:51:02 +0000 | [diff] [blame] | 201 | if (EmitMappingInfo) |
| 202 | PM.add(getMappingInfoCollector(Out)); |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 203 | |
| 204 | // Output assembly language to the .s file. Assembly emission is split into |
| 205 | // two parts: Function output and Global value output. This is because |
| 206 | // function output is pipelined with all of the rest of code generation stuff, |
| 207 | // allowing machine code representations for functions to be free'd after the |
| 208 | // function has been emitted. |
| 209 | // |
| 210 | PM.add(getFunctionAsmPrinterPass(Out)); |
Chris Lattner | 227c3d3 | 2002-10-28 01:12:41 +0000 | [diff] [blame] | 211 | PM.add(createMachineCodeDestructionPass()); // Free stuff no longer needed |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 212 | |
| 213 | // Emit Module level assembly after all of the functions have been processed. |
| 214 | PM.add(getModuleAsmPrinterPass(Out)); |
| 215 | |
| 216 | // Emit bytecode to the assembly file into its special section next |
Vikram S. Adve | 20a3be3 | 2003-08-12 15:51:02 +0000 | [diff] [blame] | 217 | if (EmitMappingInfo) { |
| 218 | PM.add(getEmitBytecodeToAsmPass(Out)); |
| 219 | PM.add(getFunctionInfo(Out)); |
| 220 | } |
| 221 | |
Chris Lattner | 6334205 | 2002-10-29 21:12:46 +0000 | [diff] [blame] | 222 | return false; |
Chris Lattner | 4f94637 | 2002-10-28 01:03:43 +0000 | [diff] [blame] | 223 | } |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 224 | |
| 225 | // addPassesToJITCompile - This method controls the JIT method of code |
| 226 | // generation for the UltraSparc. |
| 227 | // |
| 228 | bool UltraSparc::addPassesToJITCompile(PassManager &PM) { |
Misha Brukman | a512450 | 2003-06-06 07:11:16 +0000 | [diff] [blame] | 229 | const TargetData &TD = getTargetData(); |
| 230 | |
| 231 | PM.add(new TargetData("lli", TD.isLittleEndian(), TD.getPointerSize(), |
| 232 | TD.getPointerAlignment(), TD.getDoubleAlignment())); |
| 233 | |
| 234 | // Replace malloc and free instructions with library calls. |
| 235 | // Do this after tracing until lli implements these lib calls. |
| 236 | // For now, it will emulate malloc and free internally. |
| 237 | PM.add(createLowerAllocationsPass()); |
| 238 | |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 239 | // FIXME: implement the switch instruction in the instruction selector. |
| 240 | PM.add(createLowerSwitchPass()); |
| 241 | |
Misha Brukman | 58ba50f | 2003-08-06 23:06:21 +0000 | [diff] [blame] | 242 | // decompose multi-dimensional array references into single-dim refs |
| 243 | PM.add(createDecomposeMultiDimRefsPass()); |
| 244 | |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 245 | // Construct and initialize the MachineFunction object for this fn. |
| 246 | PM.add(createMachineCodeConstructionPass(*this)); |
| 247 | |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 248 | PM.add(createInstructionSelectionPass(*this)); |
| 249 | |
| 250 | // new pass: convert Value* in MachineOperand to an unsigned register |
| 251 | // this brings it in line with what the X86 JIT's RegisterAllocator expects |
| 252 | //PM.add(createAddRegNumToValuesPass()); |
| 253 | |
| 254 | PM.add(getRegisterAllocator(*this)); |
| 255 | PM.add(getPrologEpilogInsertionPass()); |
| 256 | |
Misha Brukman | d1ef7a8 | 2003-05-30 20:00:13 +0000 | [diff] [blame] | 257 | if (!DisablePeephole) |
| 258 | PM.add(createPeepholeOptsPass(*this)); |
| 259 | |
Misha Brukman | 86172ab | 2003-05-27 22:24:48 +0000 | [diff] [blame] | 260 | return false; // success! |
| 261 | } |