Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison include/llvm/CodeGen/Passes.h @ 85:5e5d649e25d2
Update LLVM 3.7
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Feb 2015 15:19:25 +0900 |
parents | 67baa08a3894 60c9769439b8 |
children | b0dd3743370f |
comparison
equal
deleted
inserted
replaced
82:e218c19a8176 | 85:5e5d649e25d2 |
---|---|
103 PassManagerBase *PM; | 103 PassManagerBase *PM; |
104 AnalysisID StartAfter; | 104 AnalysisID StartAfter; |
105 AnalysisID StopAfter; | 105 AnalysisID StopAfter; |
106 bool Started; | 106 bool Started; |
107 bool Stopped; | 107 bool Stopped; |
108 bool AddingMachinePasses; | |
108 | 109 |
109 protected: | 110 protected: |
110 TargetMachine *TM; | 111 TargetMachine *TM; |
111 PassConfigImpl *Impl; // Internal data structures | 112 PassConfigImpl *Impl; // Internal data structures |
112 bool Initialized; // Flagged after all passes are configured. | 113 bool Initialized; // Flagged after all passes are configured. |
179 IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const; | 180 IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const; |
180 | 181 |
181 /// Return true if the optimized regalloc pipeline is enabled. | 182 /// Return true if the optimized regalloc pipeline is enabled. |
182 bool getOptimizeRegAlloc() const; | 183 bool getOptimizeRegAlloc() const; |
183 | 184 |
185 /// Return true if the default global register allocator is in use and | |
186 /// has not be overriden on the command line with '-regalloc=...' | |
187 bool usingDefaultRegAlloc() const; | |
188 | |
184 /// Add common target configurable passes that perform LLVM IR to IR | 189 /// Add common target configurable passes that perform LLVM IR to IR |
185 /// transforms following machine independent optimization. | 190 /// transforms following machine independent optimization. |
186 virtual void addIRPasses(); | 191 virtual void addIRPasses(); |
187 | 192 |
188 /// Add passes to lower exception handling for the code generator. | 193 /// Add passes to lower exception handling for the code generator. |
210 /// MachineScheduler pass for this function and target at the current | 215 /// MachineScheduler pass for this function and target at the current |
211 /// optimization level. | 216 /// optimization level. |
212 /// | 217 /// |
213 /// This can also be used to plug a new MachineSchedStrategy into an instance | 218 /// This can also be used to plug a new MachineSchedStrategy into an instance |
214 /// of the standard ScheduleDAGMI: | 219 /// of the standard ScheduleDAGMI: |
215 /// return new ScheduleDAGMI(C, new MyStrategy(C)) | 220 /// return new ScheduleDAGMI(C, make_unique<MyStrategy>(C), /* IsPostRA= */false) |
216 /// | 221 /// |
217 /// Return NULL to select the default (generic) machine scheduler. | 222 /// Return NULL to select the default (generic) machine scheduler. |
218 virtual ScheduleDAGInstrs * | 223 virtual ScheduleDAGInstrs * |
219 createMachineScheduler(MachineSchedContext *C) const { | 224 createMachineScheduler(MachineSchedContext *C) const { |
220 return nullptr; | 225 return nullptr; |
256 /// MachineLoopInfo, and MachineTraceMetrics analyses. | 261 /// MachineLoopInfo, and MachineTraceMetrics analyses. |
257 virtual bool addILPOpts() { | 262 virtual bool addILPOpts() { |
258 return false; | 263 return false; |
259 } | 264 } |
260 | 265 |
261 /// addPreRegAlloc - This method may be implemented by targets that want to | 266 /// This method may be implemented by targets that want to run passes |
262 /// run passes immediately before register allocation. This should return | 267 /// immediately before register allocation. |
263 /// true if -print-machineinstrs should print after these passes. | 268 virtual void addPreRegAlloc() { } |
264 virtual bool addPreRegAlloc() { | |
265 return false; | |
266 } | |
267 | 269 |
268 /// createTargetRegisterAllocator - Create the register allocator pass for | 270 /// createTargetRegisterAllocator - Create the register allocator pass for |
269 /// this target at the current optimization level. | 271 /// this target at the current optimization level. |
270 virtual FunctionPass *createTargetRegisterAllocator(bool Optimized); | 272 virtual FunctionPass *createTargetRegisterAllocator(bool Optimized); |
271 | 273 |
287 /// all virtual registers. | 289 /// all virtual registers. |
288 virtual bool addPreRewrite() { | 290 virtual bool addPreRewrite() { |
289 return false; | 291 return false; |
290 } | 292 } |
291 | 293 |
292 /// addPostRegAlloc - This method may be implemented by targets that want to | 294 /// This method may be implemented by targets that want to run passes after |
293 /// run passes after register allocation pass pipeline but before | 295 /// register allocation pass pipeline but before prolog-epilog insertion. |
294 /// prolog-epilog insertion. This should return true if -print-machineinstrs | 296 virtual void addPostRegAlloc() { } |
295 /// should print after these passes. | |
296 virtual bool addPostRegAlloc() { | |
297 return false; | |
298 } | |
299 | 297 |
300 /// Add passes that optimize machine instructions after register allocation. | 298 /// Add passes that optimize machine instructions after register allocation. |
301 virtual void addMachineLateOptimization(); | 299 virtual void addMachineLateOptimization(); |
302 | 300 |
303 /// addPreSched2 - This method may be implemented by targets that want to | 301 /// This method may be implemented by targets that want to run passes after |
304 /// run passes after prolog-epilog insertion and before the second instruction | 302 /// prolog-epilog insertion and before the second instruction scheduling pass. |
305 /// scheduling pass. This should return true if -print-machineinstrs should | 303 virtual void addPreSched2() { } |
306 /// print after these passes. | |
307 virtual bool addPreSched2() { | |
308 return false; | |
309 } | |
310 | 304 |
311 /// addGCPasses - Add late codegen passes that analyze code for garbage | 305 /// addGCPasses - Add late codegen passes that analyze code for garbage |
312 /// collection. This should return true if GC info should be printed after | 306 /// collection. This should return true if GC info should be printed after |
313 /// these passes. | 307 /// these passes. |
314 virtual bool addGCPasses(); | 308 virtual bool addGCPasses(); |
315 | 309 |
316 /// Add standard basic block placement passes. | 310 /// Add standard basic block placement passes. |
317 virtual void addBlockPlacement(); | 311 virtual void addBlockPlacement(); |
318 | 312 |
319 /// addPreEmitPass - This pass may be implemented by targets that want to run | 313 /// This pass may be implemented by targets that want to run passes |
320 /// passes immediately before machine code is emitted. This should return | 314 /// immediately before machine code is emitted. |
321 /// true if -print-machineinstrs should print out the code after the passes. | 315 virtual void addPreEmitPass() { } |
322 virtual bool addPreEmitPass() { | |
323 return false; | |
324 } | |
325 | 316 |
326 /// Utilities for targets to add passes to the pass manager. | 317 /// Utilities for targets to add passes to the pass manager. |
327 /// | 318 /// |
328 | 319 |
329 /// Add a CodeGen pass at this point in the pipeline after checking overrides. | 320 /// Add a CodeGen pass at this point in the pipeline after checking overrides. |
330 /// Return the pass that was added, or zero if no pass was added. | 321 /// Return the pass that was added, or zero if no pass was added. |
331 AnalysisID addPass(AnalysisID PassID); | 322 /// @p printAfter if true and adding a machine function pass add an extra |
323 /// machine printer pass afterwards | |
324 /// @p verifyAfter if true and adding a machine function pass add an extra | |
325 /// machine verification pass afterwards. | |
326 AnalysisID addPass(AnalysisID PassID, bool verifyAfter = true, | |
327 bool printAfter = true); | |
332 | 328 |
333 /// Add a pass to the PassManager if that pass is supposed to be run, as | 329 /// Add a pass to the PassManager if that pass is supposed to be run, as |
334 /// determined by the StartAfter and StopAfter options. Takes ownership of the | 330 /// determined by the StartAfter and StopAfter options. Takes ownership of the |
335 /// pass. | 331 /// pass. |
336 void addPass(Pass *P); | 332 /// @p printAfter if true and adding a machine function pass add an extra |
333 /// machine printer pass afterwards | |
334 /// @p verifyAfter if true and adding a machine function pass add an extra | |
335 /// machine verification pass afterwards. | |
336 void addPass(Pass *P, bool verifyAfter = true, bool printAfter = true); | |
337 | 337 |
338 /// addMachinePasses helper to create the target-selected or overriden | 338 /// addMachinePasses helper to create the target-selected or overriden |
339 /// regalloc pass. | 339 /// regalloc pass. |
340 FunctionPass *createRegAllocPass(bool Optimized); | 340 FunctionPass *createRegAllocPass(bool Optimized); |
341 | 341 |
342 /// printAndVerify - Add a pass to dump then verify the machine function, if | 342 /// printAndVerify - Add a pass to dump then verify the machine function, if |
343 /// those steps are enabled. | 343 /// those steps are enabled. |
344 /// | 344 /// |
345 void printAndVerify(const char *Banner); | 345 void printAndVerify(const std::string &Banner); |
346 | |
347 /// Add a pass to print the machine function if printing is enabled. | |
348 void addPrintPass(const std::string &Banner); | |
349 | |
350 /// Add a pass to perform basic verification of the machine function if | |
351 /// verification is enabled. | |
352 void addVerifyPass(const std::string &Banner); | |
346 }; | 353 }; |
347 } // namespace llvm | 354 } // namespace llvm |
348 | 355 |
349 /// List of target independent CodeGen pass IDs. | 356 /// List of target independent CodeGen pass IDs. |
350 namespace llvm { | 357 namespace llvm { |
351 FunctionPass *createAtomicExpandPass(const TargetMachine *TM); | 358 FunctionPass *createAtomicExpandPass(const TargetMachine *TM); |
352 | |
353 /// \brief Create a basic TargetTransformInfo analysis pass. | |
354 /// | |
355 /// This pass implements the target transform info analysis using the target | |
356 /// independent information available to the LLVM code generator. | |
357 ImmutablePass * | |
358 createBasicTargetTransformInfoPass(const TargetMachine *TM); | |
359 | 359 |
360 /// createUnreachableBlockEliminationPass - The LLVM code generator does not | 360 /// createUnreachableBlockEliminationPass - The LLVM code generator does not |
361 /// work well with unreachable basic blocks (what live ranges make sense for a | 361 /// work well with unreachable basic blocks (what live ranges make sense for a |
362 /// block that cannot be reached?). As such, a code generator should either | 362 /// block that cannot be reached?). As such, a code generator should either |
363 /// not instruction select unreachable blocks, or run this pass as its | 363 /// not instruction select unreachable blocks, or run this pass as its |
511 /// MachineBlockPlacementStats - This pass collects statistics about the | 511 /// MachineBlockPlacementStats - This pass collects statistics about the |
512 /// basic block placement using branch probabilities and block frequency | 512 /// basic block placement using branch probabilities and block frequency |
513 /// information. | 513 /// information. |
514 extern char &MachineBlockPlacementStatsID; | 514 extern char &MachineBlockPlacementStatsID; |
515 | 515 |
516 /// GCLowering Pass - Performs target-independent LLVM IR transformations for | 516 /// GCLowering Pass - Used by gc.root to perform its default lowering |
517 /// highly portable strategies. | 517 /// operations. |
518 /// | |
519 FunctionPass *createGCLoweringPass(); | 518 FunctionPass *createGCLoweringPass(); |
519 | |
520 /// ShadowStackGCLowering - Implements the custom lowering mechanism | |
521 /// used by the shadow stack GC. Only runs on functions which opt in to | |
522 /// the shadow stack collector. | |
523 FunctionPass *createShadowStackGCLoweringPass(); | |
520 | 524 |
521 /// GCMachineCodeAnalysis - Target-independent pass to mark safe points | 525 /// GCMachineCodeAnalysis - Target-independent pass to mark safe points |
522 /// in machine code. Must be added very late during code generation, just | 526 /// in machine code. Must be added very late during code generation, just |
523 /// prior to output, and importantly after all CFG transformations (such as | 527 /// prior to output, and importantly after all CFG transformations (such as |
524 /// branch folding). | 528 /// branch folding). |
557 FunctionPass *createStackProtectorPass(const TargetMachine *TM); | 561 FunctionPass *createStackProtectorPass(const TargetMachine *TM); |
558 | 562 |
559 /// createMachineVerifierPass - This pass verifies cenerated machine code | 563 /// createMachineVerifierPass - This pass verifies cenerated machine code |
560 /// instructions for correctness. | 564 /// instructions for correctness. |
561 /// | 565 /// |
562 FunctionPass *createMachineVerifierPass(const char *Banner = nullptr); | 566 FunctionPass *createMachineVerifierPass(const std::string& Banner); |
563 | 567 |
564 /// createDwarfEHPass - This pass mulches exception handling code into a form | 568 /// createDwarfEHPass - This pass mulches exception handling code into a form |
565 /// adapted to code generation. Required if using dwarf exception handling. | 569 /// adapted to code generation. Required if using dwarf exception handling. |
566 FunctionPass *createDwarfEHPass(const TargetMachine *TM); | 570 FunctionPass *createDwarfEHPass(const TargetMachine *TM); |
571 | |
572 /// createWinEHPass - Prepares personality functions used by MSVC on Windows, | |
573 /// in addition to the Itanium LSDA based personalities. | |
574 FunctionPass *createWinEHPass(const TargetMachine *TM); | |
567 | 575 |
568 /// createSjLjEHPreparePass - This pass adapts exception handling code to use | 576 /// createSjLjEHPreparePass - This pass adapts exception handling code to use |
569 /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. | 577 /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. |
570 /// | 578 /// |
571 FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM); | 579 FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM); |
599 /// the intrinsic for later emission to the StackMap. | 607 /// the intrinsic for later emission to the StackMap. |
600 extern char &StackMapLivenessID; | 608 extern char &StackMapLivenessID; |
601 | 609 |
602 /// createJumpInstrTables - This pass creates jump-instruction tables. | 610 /// createJumpInstrTables - This pass creates jump-instruction tables. |
603 ModulePass *createJumpInstrTablesPass(); | 611 ModulePass *createJumpInstrTablesPass(); |
612 | |
613 /// createForwardControlFlowIntegrityPass - This pass adds control-flow | |
614 /// integrity. | |
615 ModulePass *createForwardControlFlowIntegrityPass(); | |
604 } // End llvm namespace | 616 } // End llvm namespace |
605 | 617 |
606 /// This initializer registers TargetMachine constructor, so the pass being | 618 /// This initializer registers TargetMachine constructor, so the pass being |
607 /// initialized can use target dependent interfaces. Please do not move this | 619 /// initialized can use target dependent interfaces. Please do not move this |
608 /// macro to be together with INITIALIZE_PASS, which is a complete target | 620 /// macro to be together with INITIALIZE_PASS, which is a complete target |