LLVM 22.0.0git
PrintPasses.cpp File Reference
#include "llvm/IR/PrintPasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Program.h"
#include <unordered_set>

Go to the source code of this file.

Functions

static bool shouldPrintBeforeOrAfterPass (StringRef PassID, ArrayRef< std::string > PassesToPrint)
std::error_code cleanUpTempFilesImpl (ArrayRef< std::string > FileName, unsigned N)

Variables

static cl::list< std::stringPrintBefore ("print-before", llvm::cl::desc("Print IR before specified passes"), cl::CommaSeparated, cl::Hidden)
static cl::list< std::stringPrintAfter ("print-after", llvm::cl::desc("Print IR after specified passes"), cl::CommaSeparated, cl::Hidden)
static cl::opt< boolPrintBeforeAll ("print-before-all", llvm::cl::desc("Print IR before each pass"), cl::init(false), cl::Hidden)
static cl::opt< boolPrintAfterAll ("print-after-all", llvm::cl::desc("Print IR after each pass"), cl::init(false), cl::Hidden)
static cl::opt< std::stringDiffBinary ("print-changed-diff-path", cl::Hidden, cl::init("diff"), cl::desc("system diff used by change reporters"))
static cl::opt< boolPrintModuleScope ("print-module-scope", cl::desc("When printing IR for print-[before|after]{-all} " "always print a module IR"), cl::init(false), cl::Hidden)
static cl::opt< boolLoopPrintFuncScope ("print-loop-func-scope", cl::desc("When printing IR for print-[before|after]{-all} " "for a loop pass, always print function IR"), cl::init(false), cl::Hidden)
static cl::list< std::stringFilterPasses ("filter-passes", cl::value_desc("pass names"), cl::desc("Only consider IR changes for passes whose names " "match the specified value. No-op without -print-changed"), cl::CommaSeparated, cl::Hidden)
static cl::list< std::stringPrintFuncsList ("filter-print-funcs", cl::value_desc("function names"), cl::desc("Only print IR for functions whose name " "match this for all print-[before|after][-all] " "options"), cl::CommaSeparated, cl::Hidden)

Function Documentation

◆ cleanUpTempFilesImpl()

std::error_code cleanUpTempFilesImpl ( ArrayRef< std::string > FileName,
unsigned N )

Definition at line 167 of file PrintPasses.cpp.

References I, N, and llvm::sys::fs::remove().

Referenced by llvm::cleanUpTempFiles(), and llvm::prepareTempFiles().

◆ shouldPrintBeforeOrAfterPass()

bool shouldPrintBeforeOrAfterPass ( StringRef PassID,
ArrayRef< std::string > PassesToPrint )
static

Definition at line 123 of file PrintPasses.cpp.

References llvm::is_contained().

Referenced by llvm::shouldPrintAfterPass(), and llvm::shouldPrintBeforePass().

Variable Documentation

◆ DiffBinary

cl::opt< std::string > DiffBinary("print-changed-diff-path", cl::Hidden, cl::init("diff"), cl::desc("system diff used by change reporters")) ( "print-changed-diff-path" ,
cl::Hidden ,
cl::init("diff") ,
cl::desc("system diff used by change reporters")  )
static

Referenced by llvm::doSystemDiff().

◆ FilterPasses

cl::list< std::string > FilterPasses("filter-passes", cl::value_desc("pass names"), cl::desc("Only consider IR changes for passes whose names " "match the specified value. No-op without -print-changed"), cl::CommaSeparated, cl::Hidden) ( "filter-passes" ,
cl::value_desc("pass names") ,
cl::desc("Only consider IR changes for passes whose names " "match the specified value. No-op without -print-changed") ,
cl::CommaSeparated ,
cl::Hidden  )
static

◆ LoopPrintFuncScope

cl::opt< bool > LoopPrintFuncScope("print-loop-func-scope", cl::desc("When printing IR for print-[before|after]{-all} " "for a loop pass, always print function IR"), cl::init(false), cl::Hidden) ( "print-loop-func-scope" ,
cl::desc("When printing IR for print-[before|after]{-all} " "for a loop pass, always print function IR") ,
cl::init(false) ,
cl::Hidden  )
static

Referenced by llvm::forcePrintFuncIR().

◆ PrintAfter

cl::list< std::string > PrintAfter("print-after", llvm::cl::desc("Print IR after specified passes"), cl::CommaSeparated, cl::Hidden) ( "print-after" ,
llvm::cl::desc("Print IR after specified passes") ,
cl::CommaSeparated ,
cl::Hidden  )
static

◆ PrintAfterAll

cl::opt< bool > PrintAfterAll("print-after-all", llvm::cl::desc("Print IR after each pass"), cl::init(false), cl::Hidden) ( "print-after-all" ,
llvm::cl::desc("Print IR after each pass") ,
cl::init(false) ,
cl::Hidden  )
static

◆ PrintBefore

cl::list< std::string > PrintBefore("print-before", llvm::cl::desc("Print IR before specified passes"), cl::CommaSeparated, cl::Hidden) ( "print-before" ,
llvm::cl::desc("Print IR before specified passes") ,
cl::CommaSeparated ,
cl::Hidden  )
static

◆ PrintBeforeAll

cl::opt< bool > PrintBeforeAll("print-before-all", llvm::cl::desc("Print IR before each pass"), cl::init(false), cl::Hidden) ( "print-before-all" ,
llvm::cl::desc("Print IR before each pass") ,
cl::init(false) ,
cl::Hidden  )
static

◆ PrintFuncsList

cl::list< std::string > PrintFuncsList("filter-print-funcs", cl::value_desc("function names"), cl::desc("Only print IR for functions whose name " "match this for all print-[before|after][-all] " "options"), cl::CommaSeparated, cl::Hidden) ( "filter-print-funcs" ,
cl::value_desc("function names") ,
cl::desc("Only print IR for functions whose name " "match this for all print-[before|after][-all] " "options") ,
cl::CommaSeparated ,
cl::Hidden  )
static

◆ PrintModuleScope

cl::opt< bool > PrintModuleScope("print-module-scope", cl::desc("When printing IR for print-[before|after]{-all} " "always print a module IR"), cl::init(false), cl::Hidden) ( "print-module-scope" ,
cl::desc("When printing IR for print-[before|after]{-all} " "always print a module IR") ,
cl::init(false) ,
cl::Hidden  )
static