aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llc')
-rw-r--r--llvm/tools/llc/llc.cpp56
1 files changed, 37 insertions, 19 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index a2327fb..7551a80 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -67,26 +67,25 @@ static codegen::RegisterCodeGenFlags CGF;
// and back-end code generation options are specified with the target machine.
//
static cl::opt<std::string>
-InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
+ InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
static cl::list<std::string>
InstPrinterOptions("M", cl::desc("InstPrinter options"));
static cl::opt<std::string>
-InputLanguage("x", cl::desc("Input language ('ir' or 'mir')"));
+ InputLanguage("x", cl::desc("Input language ('ir' or 'mir')"));
-static cl::opt<std::string>
-OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
+static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
+ cl::value_desc("filename"));
static cl::opt<std::string>
- SplitDwarfOutputFile("split-dwarf-output",
- cl::desc(".dwo output filename"),
+ SplitDwarfOutputFile("split-dwarf-output", cl::desc(".dwo output filename"),
cl::value_desc("filename"));
static cl::opt<unsigned>
-TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
- cl::value_desc("N"),
- cl::desc("Repeat compilation N times for timing"));
+ TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
+ cl::value_desc("N"),
+ cl::desc("Repeat compilation N times for timing"));
static cl::opt<bool> TimeTrace("time-trace", cl::desc("Record time trace"));
@@ -123,7 +122,7 @@ static cl::opt<char>
cl::Prefix, cl::init('2'));
static cl::opt<std::string>
-TargetTriple("mtriple", cl::desc("Override target triple for module"));
+ TargetTriple("mtriple", cl::desc("Override target triple for module"));
static cl::opt<std::string> SplitDwarfFile(
"split-dwarf-file",
@@ -167,6 +166,11 @@ static cl::opt<bool> DiscardValueNames(
cl::desc("Discard names from Value (other than GlobalValue)."),
cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ PrintMIR2VecVocab("print-mir2vec-vocab", cl::Hidden,
+ cl::desc("Print MIR2Vec vocabulary contents"),
+ cl::init(false));
+
static cl::list<std::string> IncludeDirs("I", cl::desc("include search path"));
static cl::opt<bool> RemarksWithHotness(
@@ -409,8 +413,8 @@ int main(int argc, char **argv) {
return 0;
}
-static bool addPass(PassManagerBase &PM, const char *argv0,
- StringRef PassName, TargetPassConfig &TPC) {
+static bool addPass(PassManagerBase &PM, const char *argv0, StringRef PassName,
+ TargetPassConfig &TPC) {
if (PassName == "none")
return false;
@@ -610,7 +614,8 @@ static int compileModule(char **argv, LLVMContext &Context) {
// Figure out where we are going to send the output.
std::unique_ptr<ToolOutputFile> Out =
GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
- if (!Out) return 1;
+ if (!Out)
+ return 1;
// Ensure the filename is passed down to CodeViewDebug.
Target->Options.ObjectFilenameForDebug = Out->outputFilename();
@@ -623,7 +628,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
if (!SplitDwarfOutputFile.empty()) {
std::error_code EC;
DwoOut = std::make_unique<ToolOutputFile>(SplitDwarfOutputFile, EC,
- sys::fs::OF_None);
+ sys::fs::OF_None);
if (EC)
reportError(EC.message(), SplitDwarfOutputFile);
}
@@ -725,12 +730,25 @@ static int compileModule(char **argv, LLVMContext &Context) {
}
TPC.setInitialized();
PM.add(createPrintMIRPass(*OS));
+
+ // Add MIR2Vec vocabulary printer if requested
+ if (PrintMIR2VecVocab) {
+ PM.add(createMIR2VecVocabPrinterLegacyPass(errs()));
+ }
+
PM.add(createFreeMachineFunctionPass());
- } else if (Target->addPassesToEmitFile(
- PM, *OS, DwoOut ? &DwoOut->os() : nullptr,
- codegen::getFileType(), NoVerify, MMIWP)) {
- if (!HasMCErrors)
- reportError("target does not support generation of this file type");
+ } else {
+ if (Target->addPassesToEmitFile(PM, *OS, DwoOut ? &DwoOut->os() : nullptr,
+ codegen::getFileType(), NoVerify,
+ MMIWP)) {
+ if (!HasMCErrors)
+ reportError("target does not support generation of this file type");
+ }
+
+ // Add MIR2Vec vocabulary printer if requested
+ if (PrintMIR2VecVocab) {
+ PM.add(createMIR2VecVocabPrinterLegacyPass(errs()));
+ }
}
Target->getObjFileLowering()->Initialize(MMIWP->getMMI().getContext(),