Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 1 | //===- Passes.h - Parsing, selection, and running of passes -----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// \file |
| 10 | /// |
| 11 | /// Interfaces for producing common pass manager configurations and parsing |
| 12 | /// textual pass specifications. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_TOOLS_OPT_PASSES_H |
| 17 | #define LLVM_TOOLS_OPT_PASSES_H |
| 18 | |
| 19 | #include "llvm/ADT/StringRef.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | class ModulePassManager; |
| 23 | |
| 24 | /// \brief Parse a textual pass pipeline description into a \c ModulePassManager. |
| 25 | /// |
| 26 | /// The format of the textual pass pipeline description looks something like: |
| 27 | /// |
| 28 | /// module(function(instcombine,sroa),dce,cgscc(inliner,function(...)),...) |
| 29 | /// |
| 30 | /// Pass managers have ()s describing the nest structure of passes. All passes |
| 31 | /// are comma separated. As a special shortcut, if the very first pass is not |
| 32 | /// a module pass (as a module pass manager is), this will automatically form |
| 33 | /// the shortest stack of pass managers that allow inserting that first pass. |
| 34 | /// So, assuming function passes 'fpassN', CGSCC passes 'cgpassN', and loop passes |
| 35 | /// 'lpassN', all of these are valid: |
| 36 | /// |
| 37 | /// fpass1,fpass2,fpass3 |
| 38 | /// cgpass1,cgpass2,cgpass3 |
| 39 | /// lpass1,lpass2,lpass3 |
| 40 | /// |
| 41 | /// And they are equivalent to the following (resp.): |
| 42 | /// |
| 43 | /// module(function(fpass1,fpass2,fpass3)) |
| 44 | /// module(cgscc(cgpass1,cgpass2,cgpass3)) |
| 45 | /// module(function(loop(lpass1,lpass2,lpass3))) |
| 46 | /// |
| 47 | /// This shortcut is especially useful for debugging and testing small pass |
| 48 | /// combinations. Note that these shortcuts don't introduce any other magic. If |
| 49 | /// the sequence of passes aren't all the exact same kind of pass, it will be |
| 50 | /// an error. You cannot mix different levels implicitly, you must explicitly |
| 51 | /// form a pass manager in which to nest passes. |
Chandler Carruth | 4d35631 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 52 | bool parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText, |
| 53 | bool VerifyEachPass = true); |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 54 | |
| 55 | } |
| 56 | |
| 57 | #endif |