#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>
usingnamespacellvm;
static cl::list<std::string>
PrintBefore("print-before",
llvm::cl::desc("Print IR before specified passes"),
cl::CommaSeparated, cl::Hidden);
static cl::list<std::string>
PrintAfter("print-after", llvm::cl::desc("Print IR after specified passes"),
cl::CommaSeparated, cl::Hidden);
static cl::opt<bool> PrintBeforeAll("print-before-all",
llvm::cl::desc("Print IR before each pass"),
cl::init(false), cl::Hidden);
static cl::opt<bool> PrintAfterAll("print-after-all",
llvm::cl::desc("Print IR after each pass"),
cl::init(false), cl::Hidden);
cl::opt<ChangePrinter> llvm::PrintChanged(
"print-changed", cl::desc("Print changed IRs"), cl::Hidden,
cl::ValueOptional, cl::init(ChangePrinter::None),
cl::values(
clEnumValN(ChangePrinter::Quiet, "quiet", "Run in quiet mode"),
clEnumValN(ChangePrinter::DiffVerbose, "diff",
"Display patch-like changes"),
clEnumValN(ChangePrinter::DiffQuiet, "diff-quiet",
"Display patch-like changes in quiet mode"),
clEnumValN(ChangePrinter::ColourDiffVerbose, "cdiff",
"Display patch-like changes with color"),
clEnumValN(ChangePrinter::ColourDiffQuiet, "cdiff-quiet",
"Display patch-like changes in quiet mode with color"),
clEnumValN(ChangePrinter::DotCfgVerbose, "dot-cfg",
"Create a website with graphical changes"),
clEnumValN(ChangePrinter::DotCfgQuiet, "dot-cfg-quiet",
"Create a website with graphical changes in quiet mode"),
clEnumValN(ChangePrinter::Verbose, "", "")));
static cl::opt<std::string>
DiffBinary("print-changed-diff-path", cl::Hidden, cl::init("diff"),
cl::desc("system diff used by change reporters"));
static 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);
static 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);
static 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);
bool llvm::shouldPrintBeforeSomePass() { … }
bool llvm::shouldPrintAfterSomePass() { … }
static bool shouldPrintBeforeOrAfterPass(StringRef PassID,
ArrayRef<std::string> PassesToPrint) { … }
bool llvm::shouldPrintBeforeAll() { … }
bool llvm::shouldPrintAfterAll() { … }
bool llvm::shouldPrintBeforePass(StringRef PassID) { … }
bool llvm::shouldPrintAfterPass(StringRef PassID) { … }
std::vector<std::string> llvm::printBeforePasses() { … }
std::vector<std::string> llvm::printAfterPasses() { … }
bool llvm::forcePrintModuleIR() { … }
bool llvm::isPassInPrintList(StringRef PassName) { … }
bool llvm::isFilterPassesEmpty() { … }
bool llvm::isFunctionInPrintList(StringRef FunctionName) { … }
std::error_code cleanUpTempFilesImpl(ArrayRef<std::string> FileName,
unsigned N) { … }
std::error_code llvm::prepareTempFiles(SmallVector<int> &FD,
ArrayRef<StringRef> SR,
SmallVector<std::string> &FileName) { … }
std::error_code llvm::cleanUpTempFiles(ArrayRef<std::string> FileName) { … }
std::string llvm::doSystemDiff(StringRef Before, StringRef After,
StringRef OldLineFormat, StringRef NewLineFormat,
StringRef UnchangedLineFormat) { … }