Chris Lattner | aa4c91f | 2003-12-28 07:59:53 +0000 | [diff] [blame] | 1 | //===-- Passes.cpp - Target independent code generation passes ------------===// |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 2 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 7 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Alkis Evlogimenos | 7237ece | 2003-10-02 16:57:49 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file defines interfaces to access the target independent code |
| 11 | // generation passes provided by the LLVM backend. |
| 12 | // |
| 13 | //===---------------------------------------------------------------------===// |
| 14 | |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 15 | #include "llvm/Analysis/Passes.h" |
| 16 | #include "llvm/Analysis/Verifier.h" |
| 17 | #include "llvm/Transforms/Scalar.h" |
| 18 | #include "llvm/PassManager.h" |
| 19 | #include "llvm/CodeGen/GCStrategy.h" |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/MachineFunctionPass.h" |
Alkis Evlogimenos | 7237ece | 2003-10-02 16:57:49 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/Passes.h" |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 22 | #include "llvm/CodeGen/RegAllocRegistry.h" |
| 23 | #include "llvm/Target/TargetLowering.h" |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 24 | #include "llvm/Target/TargetOptions.h" |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 25 | #include "llvm/Assembly/PrintModulePass.h" |
| 26 | #include "llvm/Support/CommandLine.h" |
| 27 | #include "llvm/Support/Debug.h" |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 28 | #include "llvm/Support/ErrorHandling.h" |
Jim Laskey | 13ec702 | 2006-08-01 14:21:23 +0000 | [diff] [blame] | 29 | |
Chris Lattner | aa4c91f | 2003-12-28 07:59:53 +0000 | [diff] [blame] | 30 | using namespace llvm; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 31 | |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 32 | static cl::opt<bool> DisablePostRA("disable-post-ra", cl::Hidden, |
| 33 | cl::desc("Disable Post Regalloc")); |
| 34 | static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden, |
| 35 | cl::desc("Disable branch folding")); |
| 36 | static cl::opt<bool> DisableTailDuplicate("disable-tail-duplicate", cl::Hidden, |
| 37 | cl::desc("Disable tail duplication")); |
| 38 | static cl::opt<bool> DisableEarlyTailDup("disable-early-taildup", cl::Hidden, |
| 39 | cl::desc("Disable pre-register allocation tail duplication")); |
| 40 | static cl::opt<bool> EnableBlockPlacement("enable-block-placement", |
| 41 | cl::Hidden, cl::desc("Enable probability-driven block placement")); |
| 42 | static cl::opt<bool> EnableBlockPlacementStats("enable-block-placement-stats", |
| 43 | cl::Hidden, cl::desc("Collect probability-driven block placement stats")); |
| 44 | static cl::opt<bool> DisableCodePlace("disable-code-place", cl::Hidden, |
| 45 | cl::desc("Disable code placement")); |
| 46 | static cl::opt<bool> DisableSSC("disable-ssc", cl::Hidden, |
| 47 | cl::desc("Disable Stack Slot Coloring")); |
| 48 | static cl::opt<bool> DisableMachineDCE("disable-machine-dce", cl::Hidden, |
| 49 | cl::desc("Disable Machine Dead Code Elimination")); |
| 50 | static cl::opt<bool> DisableMachineLICM("disable-machine-licm", cl::Hidden, |
| 51 | cl::desc("Disable Machine LICM")); |
| 52 | static cl::opt<bool> DisableMachineCSE("disable-machine-cse", cl::Hidden, |
| 53 | cl::desc("Disable Machine Common Subexpression Elimination")); |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 54 | static cl::opt<cl::boolOrDefault> |
| 55 | OptimizeRegAlloc("optimize-regalloc", cl::Hidden, |
| 56 | cl::desc("Enable optimized register allocation compilation path.")); |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 57 | static cl::opt<cl::boolOrDefault> |
| 58 | EnableMachineSched("enable-misched", cl::Hidden, |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 59 | cl::desc("Enable the machine instruction scheduling pass.")); |
| 60 | static cl::opt<bool> EnableStrongPHIElim("strong-phi-elim", cl::Hidden, |
| 61 | cl::desc("Use strong PHI elimination.")); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 62 | static cl::opt<bool> DisablePostRAMachineLICM("disable-postra-machine-licm", |
| 63 | cl::Hidden, |
| 64 | cl::desc("Disable Machine LICM")); |
| 65 | static cl::opt<bool> DisableMachineSink("disable-machine-sink", cl::Hidden, |
| 66 | cl::desc("Disable Machine Sinking")); |
| 67 | static cl::opt<bool> DisableLSR("disable-lsr", cl::Hidden, |
| 68 | cl::desc("Disable Loop Strength Reduction Pass")); |
| 69 | static cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden, |
| 70 | cl::desc("Disable Codegen Prepare")); |
| 71 | static cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden, |
| 72 | cl::desc("Disable Copy Propagation pass")); |
| 73 | static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden, |
| 74 | cl::desc("Print LLVM IR produced by the loop-reduce pass")); |
| 75 | static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden, |
| 76 | cl::desc("Print LLVM IR input to isel pass")); |
| 77 | static cl::opt<bool> PrintGCInfo("print-gc", cl::Hidden, |
| 78 | cl::desc("Dump garbage collector data")); |
| 79 | static cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden, |
| 80 | cl::desc("Verify generated machine code"), |
| 81 | cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL)); |
| 82 | |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 83 | /// Allow standard passes to be disabled by command line options. This supports |
| 84 | /// simple binary flags that either suppress the pass or do nothing. |
| 85 | /// i.e. -disable-mypass=false has no effect. |
| 86 | /// These should be converted to boolOrDefault in order to use applyOverride. |
| 87 | static AnalysisID applyDisable(AnalysisID ID, bool Override) { |
| 88 | if (Override) |
| 89 | return &NoPassID; |
| 90 | return ID; |
| 91 | } |
| 92 | |
| 93 | /// Allow Pass selection to be overriden by command line options. This supports |
| 94 | /// flags with ternary conditions. TargetID is passed through by default. The |
| 95 | /// pass is suppressed when the option is false. When the option is true, the |
| 96 | /// StandardID is selected if the target provides no default. |
| 97 | static AnalysisID applyOverride(AnalysisID TargetID, cl::boolOrDefault Override, |
| 98 | AnalysisID StandardID) { |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 99 | switch (Override) { |
| 100 | case cl::BOU_UNSET: |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 101 | return TargetID; |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 102 | case cl::BOU_TRUE: |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 103 | if (TargetID != &NoPassID) |
| 104 | return TargetID; |
| 105 | if (StandardID == &NoPassID) |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 106 | report_fatal_error("Target cannot enable pass"); |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 107 | return StandardID; |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 108 | case cl::BOU_FALSE: |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 109 | return &NoPassID; |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 110 | } |
| 111 | llvm_unreachable("Invalid command line option state"); |
| 112 | } |
| 113 | |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 114 | /// Allow standard passes to be disabled by the command line, regardless of who |
| 115 | /// is adding the pass. |
| 116 | /// |
| 117 | /// StandardID is the pass identified in the standard pass pipeline and provided |
| 118 | /// to addPass(). It may be a target-specific ID in the case that the target |
| 119 | /// directly adds its own pass, but in that case we harmlessly fall through. |
| 120 | /// |
| 121 | /// TargetID is the pass that the target has configured to override StandardID. |
| 122 | /// |
| 123 | /// StandardID may be a pseudo ID. In that case TargetID is the name of the real |
| 124 | /// pass to run. This allows multiple options to control a single pass depending |
| 125 | /// on where in the pipeline that pass is added. |
| 126 | static AnalysisID overridePass(AnalysisID StandardID, AnalysisID TargetID) { |
| 127 | if (StandardID == &PostRASchedulerID) |
| 128 | return applyDisable(TargetID, DisablePostRA); |
| 129 | |
| 130 | if (StandardID == &BranchFolderPassID) |
| 131 | return applyDisable(TargetID, DisableBranchFold); |
| 132 | |
| 133 | if (StandardID == &TailDuplicateID) |
| 134 | return applyDisable(TargetID, DisableTailDuplicate); |
| 135 | |
| 136 | if (StandardID == &TargetPassConfig::EarlyTailDuplicateID) |
| 137 | return applyDisable(TargetID, DisableEarlyTailDup); |
| 138 | |
| 139 | if (StandardID == &MachineBlockPlacementID) |
| 140 | return applyDisable(TargetID, DisableCodePlace); |
| 141 | |
| 142 | if (StandardID == &CodePlacementOptID) |
| 143 | return applyDisable(TargetID, DisableCodePlace); |
| 144 | |
| 145 | if (StandardID == &StackSlotColoringID) |
| 146 | return applyDisable(TargetID, DisableSSC); |
| 147 | |
| 148 | if (StandardID == &DeadMachineInstructionElimID) |
| 149 | return applyDisable(TargetID, DisableMachineDCE); |
| 150 | |
| 151 | if (StandardID == &MachineLICMID) |
| 152 | return applyDisable(TargetID, DisableMachineLICM); |
| 153 | |
| 154 | if (StandardID == &MachineCSEID) |
| 155 | return applyDisable(TargetID, DisableMachineCSE); |
| 156 | |
| 157 | if (StandardID == &MachineSchedulerID) |
| 158 | return applyOverride(TargetID, EnableMachineSched, StandardID); |
| 159 | |
| 160 | if (StandardID == &TargetPassConfig::PostRAMachineLICMID) |
| 161 | return applyDisable(TargetID, DisablePostRAMachineLICM); |
| 162 | |
| 163 | if (StandardID == &MachineSinkingID) |
| 164 | return applyDisable(TargetID, DisableMachineSink); |
| 165 | |
| 166 | if (StandardID == &MachineCopyPropagationID) |
| 167 | return applyDisable(TargetID, DisableCopyProp); |
| 168 | |
| 169 | return TargetID; |
| 170 | } |
| 171 | |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 172 | //===---------------------------------------------------------------------===// |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 173 | /// TargetPassConfig |
| 174 | //===---------------------------------------------------------------------===// |
| 175 | |
| 176 | INITIALIZE_PASS(TargetPassConfig, "targetpassconfig", |
| 177 | "Target Pass Configuration", false, false) |
| 178 | char TargetPassConfig::ID = 0; |
| 179 | |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 180 | static char NoPassIDAnchor = 0; |
| 181 | char &llvm::NoPassID = NoPassIDAnchor; |
| 182 | |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 183 | // Pseudo Pass IDs. |
| 184 | char TargetPassConfig::EarlyTailDuplicateID = 0; |
| 185 | char TargetPassConfig::PostRAMachineLICMID = 0; |
| 186 | |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 187 | namespace llvm { |
| 188 | class PassConfigImpl { |
| 189 | public: |
| 190 | // List of passes explicitly substituted by this target. Normally this is |
| 191 | // empty, but it is a convenient way to suppress or replace specific passes |
| 192 | // that are part of a standard pass pipeline without overridding the entire |
| 193 | // pipeline. This mechanism allows target options to inherit a standard pass's |
| 194 | // user interface. For example, a target may disable a standard pass by |
| 195 | // default by substituting NoPass, and the user may still enable that standard |
| 196 | // pass with an explicit command line option. |
| 197 | DenseMap<AnalysisID,AnalysisID> TargetPasses; |
| 198 | }; |
| 199 | } // namespace llvm |
| 200 | |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 201 | // Out of line virtual method. |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 202 | TargetPassConfig::~TargetPassConfig() { |
| 203 | delete Impl; |
| 204 | } |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 205 | |
Andrew Trick | 61f1e3d | 2012-02-08 21:22:48 +0000 | [diff] [blame] | 206 | // Out of line constructor provides default values for pass options and |
| 207 | // registers all common codegen passes. |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 208 | TargetPassConfig::TargetPassConfig(TargetMachine *tm, PassManagerBase &pm) |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 209 | : ImmutablePass(ID), TM(tm), PM(pm), Impl(0), Initialized(false), |
Andrew Trick | ffea03f | 2012-02-08 21:22:39 +0000 | [diff] [blame] | 210 | DisableVerify(false), |
| 211 | EnableTailMerge(true) { |
| 212 | |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 213 | Impl = new PassConfigImpl(); |
| 214 | |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 215 | // Register all target independent codegen passes to activate their PassIDs, |
| 216 | // including this pass itself. |
| 217 | initializeCodeGen(*PassRegistry::getPassRegistry()); |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 218 | |
| 219 | // Substitute Pseudo Pass IDs for real ones. |
| 220 | substitutePass(EarlyTailDuplicateID, TailDuplicateID); |
| 221 | substitutePass(PostRAMachineLICMID, MachineLICMID); |
| 222 | |
| 223 | // Temporarily disable experimental passes. |
| 224 | substitutePass(MachineSchedulerID, NoPassID); |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | /// createPassConfig - Create a pass configuration object to be used by |
| 228 | /// addPassToEmitX methods for generating a pipeline of CodeGen passes. |
| 229 | /// |
| 230 | /// Targets may override this to extend TargetPassConfig. |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 231 | TargetPassConfig *LLVMTargetMachine::createPassConfig(PassManagerBase &PM) { |
| 232 | return new TargetPassConfig(this, PM); |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | TargetPassConfig::TargetPassConfig() |
| 236 | : ImmutablePass(ID), PM(*(PassManagerBase*)0) { |
| 237 | llvm_unreachable("TargetPassConfig should not be constructed on-the-fly"); |
| 238 | } |
| 239 | |
Andrew Trick | ffea03f | 2012-02-08 21:22:39 +0000 | [diff] [blame] | 240 | // Helper to verify the analysis is really immutable. |
| 241 | void TargetPassConfig::setOpt(bool &Opt, bool Val) { |
| 242 | assert(!Initialized && "PassConfig is immutable"); |
| 243 | Opt = Val; |
| 244 | } |
| 245 | |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 246 | void TargetPassConfig::substitutePass(char &StandardID, char &TargetID) { |
| 247 | Impl->TargetPasses[&StandardID] = &TargetID; |
| 248 | } |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 249 | |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 250 | AnalysisID TargetPassConfig::getPassSubstitution(AnalysisID ID) const { |
| 251 | DenseMap<AnalysisID, AnalysisID>::const_iterator |
| 252 | I = Impl->TargetPasses.find(ID); |
| 253 | if (I == Impl->TargetPasses.end()) |
| 254 | return ID; |
| 255 | return I->second; |
| 256 | } |
| 257 | |
| 258 | /// Add a CodeGen pass at this point in the pipeline after checking for target |
| 259 | /// and command line overrides. |
| 260 | AnalysisID TargetPassConfig::addPass(char &ID) { |
| 261 | assert(!Initialized && "PassConfig is immutable"); |
| 262 | |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 263 | AnalysisID TargetID = getPassSubstitution(&ID); |
| 264 | AnalysisID FinalID = overridePass(&ID, TargetID); |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 265 | if (FinalID == &NoPassID) |
| 266 | return FinalID; |
| 267 | |
| 268 | Pass *P = Pass::createPass(FinalID); |
Andrew Trick | ebe18ef | 2012-02-08 21:22:34 +0000 | [diff] [blame] | 269 | if (!P) |
| 270 | llvm_unreachable("Pass ID not registered"); |
| 271 | PM.add(P); |
Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 272 | return FinalID; |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 273 | } |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 274 | |
| 275 | void TargetPassConfig::printNoVerify(const char *Banner) const { |
| 276 | if (TM->shouldPrintMachineCode()) |
| 277 | PM.add(createMachineFunctionPrinterPass(dbgs(), Banner)); |
| 278 | } |
| 279 | |
| 280 | void TargetPassConfig::printAndVerify(const char *Banner) const { |
| 281 | if (TM->shouldPrintMachineCode()) |
| 282 | PM.add(createMachineFunctionPrinterPass(dbgs(), Banner)); |
| 283 | |
| 284 | if (VerifyMachineCode) |
| 285 | PM.add(createMachineVerifierPass(Banner)); |
| 286 | } |
| 287 | |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 288 | /// Add common target configurable passes that perform LLVM IR to IR transforms |
| 289 | /// following machine independent optimization. |
| 290 | void TargetPassConfig::addIRPasses() { |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 291 | // Basic AliasAnalysis support. |
| 292 | // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that |
| 293 | // BasicAliasAnalysis wins if they disagree. This is intended to help |
| 294 | // support "obvious" type-punning idioms. |
| 295 | PM.add(createTypeBasedAliasAnalysisPass()); |
| 296 | PM.add(createBasicAliasAnalysisPass()); |
| 297 | |
| 298 | // Before running any passes, run the verifier to determine if the input |
| 299 | // coming from the front-end and/or optimizer is valid. |
| 300 | if (!DisableVerify) |
| 301 | PM.add(createVerifierPass()); |
| 302 | |
| 303 | // Run loop strength reduction before anything else. |
| 304 | if (getOptLevel() != CodeGenOpt::None && !DisableLSR) { |
| 305 | PM.add(createLoopStrengthReducePass(getTargetLowering())); |
| 306 | if (PrintLSR) |
| 307 | PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs())); |
| 308 | } |
| 309 | |
| 310 | PM.add(createGCLoweringPass()); |
| 311 | |
| 312 | // Make sure that no unreachable blocks are instruction selected. |
| 313 | PM.add(createUnreachableBlockEliminationPass()); |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 314 | } |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 315 | |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 316 | /// Add common passes that perform LLVM IR to IR transforms in preparation for |
| 317 | /// instruction selection. |
| 318 | void TargetPassConfig::addISelPrepare() { |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 319 | if (getOptLevel() != CodeGenOpt::None && !DisableCGP) |
| 320 | PM.add(createCodeGenPreparePass(getTargetLowering())); |
| 321 | |
| 322 | PM.add(createStackProtectorPass(getTargetLowering())); |
| 323 | |
| 324 | addPreISel(); |
| 325 | |
| 326 | if (PrintISelInput) |
| 327 | PM.add(createPrintFunctionPass("\n\n" |
| 328 | "*** Final LLVM Code input to ISel ***\n", |
| 329 | &dbgs())); |
| 330 | |
| 331 | // All passes which modify the LLVM IR are now complete; run the verifier |
| 332 | // to ensure that the IR is valid. |
| 333 | if (!DisableVerify) |
| 334 | PM.add(createVerifierPass()); |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 335 | } |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 336 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 337 | /// Add the complete set of target-independent postISel code generator passes. |
| 338 | /// |
| 339 | /// This can be read as the standard order of major LLVM CodeGen stages. Stages |
| 340 | /// with nontrivial configuration or multiple passes are broken out below in |
| 341 | /// add%Stage routines. |
| 342 | /// |
| 343 | /// Any TargetPassConfig::addXX routine may be overriden by the Target. The |
| 344 | /// addPre/Post methods with empty header implementations allow injecting |
| 345 | /// target-specific fixups just before or after major stages. Additionally, |
| 346 | /// targets have the flexibility to change pass order within a stage by |
| 347 | /// overriding default implementation of add%Stage routines below. Each |
| 348 | /// technique has maintainability tradeoffs because alternate pass orders are |
| 349 | /// not well supported. addPre/Post works better if the target pass is easily |
| 350 | /// tied to a common pass. But if it has subtle dependencies on multiple passes, |
Andrew Trick | 06efdd2 | 2012-02-10 07:08:25 +0000 | [diff] [blame] | 351 | /// the target should override the stage instead. |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 352 | /// |
| 353 | /// TODO: We could use a single addPre/Post(ID) hook to allow pass injection |
| 354 | /// before/after any target-independent pass. But it's currently overkill. |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 355 | void TargetPassConfig::addMachinePasses() { |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 356 | // Print the instruction selected machine code... |
| 357 | printAndVerify("After Instruction Selection"); |
| 358 | |
| 359 | // Expand pseudo-instructions emitted by ISel. |
Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 360 | addPass(ExpandISelPseudosID); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 361 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 362 | // Add passes that optimize machine instructions in SSA form. |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 363 | if (getOptLevel() != CodeGenOpt::None) { |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 364 | addMachineSSAOptimization(); |
| 365 | } |
| 366 | else { |
| 367 | // If the target requests it, assign local variables to stack slots relative |
| 368 | // to one another and simplify frame index references where possible. |
| 369 | addPass(LocalStackSlotAllocationID); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 370 | } |
| 371 | |
| 372 | // Run pre-ra passes. |
| 373 | if (addPreRegAlloc()) |
| 374 | printAndVerify("After PreRegAlloc passes"); |
| 375 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 376 | // Run register allocation and passes that are tightly coupled with it, |
| 377 | // including phi elimination and scheduling. |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 378 | if (getOptimizeRegAlloc()) |
| 379 | addOptimizedRegAlloc(createRegAllocPass(true)); |
| 380 | else |
| 381 | addFastRegAlloc(createRegAllocPass(false)); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 382 | |
| 383 | // Run post-ra passes. |
| 384 | if (addPostRegAlloc()) |
| 385 | printAndVerify("After PostRegAlloc passes"); |
| 386 | |
| 387 | // Insert prolog/epilog code. Eliminate abstract frame index references... |
Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 388 | addPass(PrologEpilogCodeInserterID); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 389 | printAndVerify("After PrologEpilogCodeInserter"); |
| 390 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 391 | /// Add passes that optimize machine instructions after register allocation. |
| 392 | if (getOptLevel() != CodeGenOpt::None) |
| 393 | addMachineLateOptimization(); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 394 | |
| 395 | // Expand pseudo instructions before second scheduling pass. |
Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 396 | addPass(ExpandPostRAPseudosID); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 397 | printNoVerify("After ExpandPostRAPseudos"); |
| 398 | |
| 399 | // Run pre-sched2 passes. |
| 400 | if (addPreSched2()) |
| 401 | printNoVerify("After PreSched2 passes"); |
| 402 | |
| 403 | // Second pass scheduler. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 404 | if (getOptLevel() != CodeGenOpt::None) { |
Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 405 | addPass(PostRASchedulerID); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 406 | printNoVerify("After PostRAScheduler"); |
| 407 | } |
| 408 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 409 | // GC |
Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 410 | addPass(GCMachineCodeAnalysisID); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 411 | if (PrintGCInfo) |
| 412 | PM.add(createGCInfoPrinter(dbgs())); |
| 413 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 414 | // Basic block placement. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 415 | if (getOptLevel() != CodeGenOpt::None) |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 416 | addBlockPlacement(); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 417 | |
| 418 | if (addPreEmitPass()) |
| 419 | printNoVerify("After PreEmit passes"); |
Andrew Trick | d542265 | 2012-02-04 02:56:48 +0000 | [diff] [blame] | 420 | } |
| 421 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 422 | /// Add passes that optimize machine instructions in SSA form. |
| 423 | void TargetPassConfig::addMachineSSAOptimization() { |
| 424 | // Pre-ra tail duplication. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 425 | if (addPass(EarlyTailDuplicateID) != &NoPassID) |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 426 | printAndVerify("After Pre-RegAlloc TailDuplicate"); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 427 | |
| 428 | // Optimize PHIs before DCE: removing dead PHI cycles may make more |
| 429 | // instructions dead. |
| 430 | addPass(OptimizePHIsID); |
| 431 | |
| 432 | // If the target requests it, assign local variables to stack slots relative |
| 433 | // to one another and simplify frame index references where possible. |
| 434 | addPass(LocalStackSlotAllocationID); |
| 435 | |
| 436 | // With optimization, dead code should already be eliminated. However |
| 437 | // there is one known exception: lowered code for arguments that are only |
| 438 | // used by tail calls, where the tail calls reuse the incoming stack |
| 439 | // arguments directly (see t11 in test/CodeGen/X86/sibcall.ll). |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 440 | addPass(DeadMachineInstructionElimID); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 441 | printAndVerify("After codegen DCE pass"); |
| 442 | |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 443 | addPass(MachineLICMID); |
| 444 | addPass(MachineCSEID); |
| 445 | addPass(MachineSinkingID); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 446 | printAndVerify("After Machine LICM, CSE and Sinking passes"); |
| 447 | |
| 448 | addPass(PeepholeOptimizerID); |
| 449 | printAndVerify("After codegen peephole optimization pass"); |
| 450 | } |
| 451 | |
Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 452 | //===---------------------------------------------------------------------===// |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 453 | /// Register Allocation Pass Configuration |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 454 | //===---------------------------------------------------------------------===// |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 455 | |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 456 | bool TargetPassConfig::getOptimizeRegAlloc() const { |
| 457 | switch (OptimizeRegAlloc) { |
| 458 | case cl::BOU_UNSET: return getOptLevel() != CodeGenOpt::None; |
| 459 | case cl::BOU_TRUE: return true; |
| 460 | case cl::BOU_FALSE: return false; |
| 461 | } |
| 462 | llvm_unreachable("Invalid optimize-regalloc state"); |
| 463 | } |
| 464 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 465 | /// RegisterRegAlloc's global Registry tracks allocator registration. |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 466 | MachinePassRegistry RegisterRegAlloc::Registry; |
| 467 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 468 | /// A dummy default pass factory indicates whether the register allocator is |
| 469 | /// overridden on the command line. |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 470 | static FunctionPass *useDefaultRegisterAllocator() { return 0; } |
Jakob Stoklund Olesen | 700bfad | 2010-05-27 23:57:25 +0000 | [diff] [blame] | 471 | static RegisterRegAlloc |
| 472 | defaultRegAlloc("default", |
| 473 | "pick register allocator based on -O option", |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 474 | useDefaultRegisterAllocator); |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 475 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 476 | /// -regalloc=... command line option. |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 477 | static cl::opt<RegisterRegAlloc::FunctionPassCtor, false, |
| 478 | RegisterPassParser<RegisterRegAlloc> > |
| 479 | RegAlloc("regalloc", |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 480 | cl::init(&useDefaultRegisterAllocator), |
Jakob Stoklund Olesen | 700bfad | 2010-05-27 23:57:25 +0000 | [diff] [blame] | 481 | cl::desc("Register allocator to use")); |
Alkis Evlogimenos | 7237ece | 2003-10-02 16:57:49 +0000 | [diff] [blame] | 482 | |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 483 | |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 484 | /// Instantiate the default register allocator pass for this target for either |
| 485 | /// the optimized or unoptimized allocation path. This will be added to the pass |
| 486 | /// manager by addFastRegAlloc in the unoptimized case or addOptimizedRegAlloc |
| 487 | /// in the optimized case. |
| 488 | /// |
| 489 | /// A target that uses the standard regalloc pass order for fast or optimized |
| 490 | /// allocation may still override this for per-target regalloc |
| 491 | /// selection. But -regalloc=... always takes precedence. |
| 492 | FunctionPass *TargetPassConfig::createTargetRegisterAllocator(bool Optimized) { |
| 493 | if (Optimized) |
| 494 | return createGreedyRegisterAllocator(); |
| 495 | else |
| 496 | return createFastRegisterAllocator(); |
| 497 | } |
| 498 | |
| 499 | /// Find and instantiate the register allocation pass requested by this target |
| 500 | /// at the current optimization level. Different register allocators are |
| 501 | /// defined as separate passes because they may require different analysis. |
| 502 | /// |
| 503 | /// This helper ensures that the regalloc= option is always available, |
| 504 | /// even for targets that override the default allocator. |
| 505 | /// |
| 506 | /// FIXME: When MachinePassRegistry register pass IDs instead of function ptrs, |
| 507 | /// this can be folded into addPass. |
| 508 | FunctionPass *TargetPassConfig::createRegAllocPass(bool Optimized) { |
Jim Laskey | 9ff542f | 2006-08-01 18:29:48 +0000 | [diff] [blame] | 509 | RegisterRegAlloc::FunctionPassCtor Ctor = RegisterRegAlloc::getDefault(); |
Jakob Stoklund Olesen | 700bfad | 2010-05-27 23:57:25 +0000 | [diff] [blame] | 510 | |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 511 | // Initialize the global default. |
Jim Laskey | 13ec702 | 2006-08-01 14:21:23 +0000 | [diff] [blame] | 512 | if (!Ctor) { |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 513 | Ctor = RegAlloc; |
| 514 | RegisterRegAlloc::setDefault(RegAlloc); |
Jim Laskey | 13ec702 | 2006-08-01 14:21:23 +0000 | [diff] [blame] | 515 | } |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 516 | if (Ctor != useDefaultRegisterAllocator) |
Jakob Stoklund Olesen | 700bfad | 2010-05-27 23:57:25 +0000 | [diff] [blame] | 517 | return Ctor(); |
| 518 | |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 519 | // With no -regalloc= override, ask the target for a regalloc pass. |
| 520 | return createTargetRegisterAllocator(Optimized); |
| 521 | } |
| 522 | |
| 523 | /// Add the minimum set of target-independent passes that are required for |
| 524 | /// register allocation. No coalescing or scheduling. |
| 525 | void TargetPassConfig::addFastRegAlloc(FunctionPass *RegAllocPass) { |
| 526 | addPass(PHIEliminationID); |
| 527 | addPass(TwoAddressInstructionPassID); |
| 528 | |
| 529 | PM.add(RegAllocPass); |
| 530 | printAndVerify("After Register Allocation"); |
Jim Laskey | 33a0a6d | 2006-07-27 20:05:00 +0000 | [diff] [blame] | 531 | } |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 532 | |
| 533 | /// Add standard target-independent passes that are tightly coupled with |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 534 | /// optimized register allocation, including coalescing, machine instruction |
| 535 | /// scheduling, and register allocation itself. |
| 536 | void TargetPassConfig::addOptimizedRegAlloc(FunctionPass *RegAllocPass) { |
| 537 | // LiveVariables currently requires pure SSA form. |
| 538 | // |
| 539 | // FIXME: Once TwoAddressInstruction pass no longer uses kill flags, |
| 540 | // LiveVariables can be removed completely, and LiveIntervals can be directly |
| 541 | // computed. (We still either need to regenerate kill flags after regalloc, or |
| 542 | // preferably fix the scavenger to not depend on them). |
| 543 | addPass(LiveVariablesID); |
| 544 | |
| 545 | // Add passes that move from transformed SSA into conventional SSA. This is a |
| 546 | // "copy coalescing" problem. |
| 547 | // |
| 548 | if (!EnableStrongPHIElim) { |
| 549 | // Edge splitting is smarter with machine loop info. |
| 550 | addPass(MachineLoopInfoID); |
| 551 | addPass(PHIEliminationID); |
| 552 | } |
| 553 | addPass(TwoAddressInstructionPassID); |
| 554 | |
| 555 | // FIXME: Either remove this pass completely, or fix it so that it works on |
| 556 | // SSA form. We could modify LiveIntervals to be independent of this pass, But |
| 557 | // it would be even better to simply eliminate *all* IMPLICIT_DEFs before |
| 558 | // leaving SSA. |
| 559 | addPass(ProcessImplicitDefsID); |
| 560 | |
| 561 | if (EnableStrongPHIElim) |
| 562 | addPass(StrongPHIEliminationID); |
| 563 | |
| 564 | addPass(RegisterCoalescerID); |
| 565 | |
| 566 | // PreRA instruction scheduling. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 567 | addPass(MachineSchedulerID); |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 568 | |
| 569 | // Add the selected register allocation pass. |
| 570 | PM.add(RegAllocPass); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 571 | printAndVerify("After Register Allocation"); |
| 572 | |
Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 573 | // FinalizeRegAlloc is convenient until MachineInstrBundles is more mature, |
| 574 | // but eventually, all users of it should probably be moved to addPostRA and |
| 575 | // it can go away. Currently, it's the intended place for targets to run |
| 576 | // FinalizeMachineBundles, because passes other than MachineScheduling an |
| 577 | // RegAlloc itself may not be aware of bundles. |
| 578 | if (addFinalizeRegAlloc()) |
| 579 | printAndVerify("After RegAlloc finalization"); |
| 580 | |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 581 | // Perform stack slot coloring and post-ra machine LICM. |
Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 582 | // |
| 583 | // FIXME: Re-enable coloring with register when it's capable of adding |
| 584 | // kill markers. |
Andrew Trick | 900d7b7 | 2012-02-15 07:57:03 +0000 | [diff] [blame^] | 585 | addPass(StackSlotColoringID); |
| 586 | |
| 587 | // Run post-ra machine LICM to hoist reloads / remats. |
| 588 | // |
| 589 | // FIXME: can this move into MachineLateOptimization? |
| 590 | addPass(PostRAMachineLICMID); |
| 591 | |
| 592 | printAndVerify("After StackSlotColoring and postra Machine LICM"); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | //===---------------------------------------------------------------------===// |
| 596 | /// Post RegAlloc Pass Configuration |
| 597 | //===---------------------------------------------------------------------===// |
| 598 | |
| 599 | /// Add passes that optimize machine instructions after register allocation. |
| 600 | void TargetPassConfig::addMachineLateOptimization() { |
| 601 | // Branch folding must be run after regalloc and prolog/epilog insertion. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 602 | if (addPass(BranchFolderPassID) != &NoPassID) |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 603 | printNoVerify("After BranchFolding"); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 604 | |
| 605 | // Tail duplication. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 606 | if (addPass(TailDuplicateID) != &NoPassID) |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 607 | printNoVerify("After TailDuplicate"); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 608 | |
| 609 | // Copy propagation. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 610 | if (addPass(MachineCopyPropagationID) != &NoPassID) |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 611 | printNoVerify("After copy propagation pass"); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | /// Add standard basic block placement passes. |
| 615 | void TargetPassConfig::addBlockPlacement() { |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 616 | AnalysisID ID = &NoPassID; |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 617 | if (EnableBlockPlacement) { |
| 618 | // MachineBlockPlacement is an experimental pass which is disabled by |
| 619 | // default currently. Eventually it should subsume CodePlacementOpt, so |
| 620 | // when enabled, the other is disabled. |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 621 | ID = addPass(MachineBlockPlacementID); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 622 | } else { |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 623 | ID = addPass(CodePlacementOptID); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 624 | } |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 625 | if (ID != &NoPassID) { |
| 626 | // Run a separate pass to collect block placement statistics. |
| 627 | if (EnableBlockPlacementStats) |
| 628 | addPass(MachineBlockPlacementStatsID); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 629 | |
Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 630 | printNoVerify("After machine block placement."); |
Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 631 | } |
| 632 | } |