Jlm
Loading...
Searching...
No Matches
Command.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2019 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
30#include <jlm/llvm/opt/pull.hpp>
35#include <jlm/rvsdg/view.hpp>
37#include <jlm/tooling/CommandPaths.hpp>
39
40#ifdef ENABLE_MLIR
43#endif
44
45#include <llvm/IR/LLVMContext.h>
46#include <llvm/IR/Module.h>
47#include <llvm/IRReader/IRReader.h>
48#include <llvm/Support/raw_os_ostream.h>
49#include <llvm/Support/SourceMgr.h>
50
51#include <sys/stat.h>
52
53#include <fstream>
54#include <unordered_map>
55
56namespace jlm::tooling
57{
58
59Command::~Command() = default;
60
61void
63{
64 const auto command = ToString();
65 const auto returnCode = system(command.c_str());
66 if (returnCode != EXIT_SUCCESS)
67 {
68 throw util::Error(
69 util::strfmt("Subcommand failed with status code ", returnCode, ": ", command));
70 }
71}
72
74
75std::string
77{
78 return "PrintCommands";
79}
80
81void
83{
85 {
86 if (node != &CommandGraph_->GetEntryNode() && node != &CommandGraph_->GetExitNode())
87 std::cout << node->GetCommand().ToString() << "\n";
88 }
89}
90
91std::unique_ptr<CommandGraph>
92PrintCommandsCommand::Create(std::unique_ptr<CommandGraph> commandGraph)
93{
94 std::unique_ptr<CommandGraph> newCommandGraph(new CommandGraph());
95 auto & printCommandsNode =
96 PrintCommandsCommand::Create(*newCommandGraph, std::move(commandGraph));
97 newCommandGraph->GetEntryNode().AddEdge(printCommandsNode);
98 printCommandsNode.AddEdge(newCommandGraph->GetExitNode());
99 return newCommandGraph;
100}
101
103
104std::string
106{
107 std::string inputFiles;
108 for (auto & inputFile : InputFiles_)
109 inputFiles += inputFile.to_str() + " ";
110
111 std::string libraryPaths;
112 for (auto & libraryPath : LibraryPaths_)
113 libraryPaths += "-L" + libraryPath + " ";
114
115 std::string libraries;
116 for (const auto & library : Libraries_)
117 libraries += "-l" + library + " ";
118
119 std::string includePaths;
120 for (auto & includePath : IncludePaths_)
121 includePaths += "-I" + includePath + " ";
122
123 std::string macroDefinitions;
124 for (auto & macroDefinition : MacroDefinitions_)
125 macroDefinitions += "-D" + macroDefinition + " ";
126
127 std::string warnings;
128 for (auto & warning : Warnings_)
129 warnings += "-W" + warning + " ";
130
131 std::string flags;
132 for (auto & flag : Flags_)
133 flags += "-f" + flag + " ";
134
135 std::string arguments;
136 if (UsePthreads_)
137 arguments += "-pthread ";
138
139 if (Verbose_)
140 arguments += "-v ";
141
142 if (Rdynamic_)
143 arguments += "-rdynamic ";
144
145 if (Suppress_)
146 arguments += "-w ";
147
148 if (Md_)
149 {
150 arguments += "-MD ";
151 arguments += "-MF " + DependencyFile_.to_str() + " ";
152 arguments += "-MT " + Mt_ + " ";
153 }
154
155 std::string languageStandardArgument = LanguageStandard_ != LanguageStandard::Unspecified
156 ? "-std=" + ToString(LanguageStandard_) + " "
157 : "";
158
159 std::string clangArguments;
160 if (!ClangArguments_.empty())
161 {
162 for (auto & clangArgument : ClangArguments_)
163 clangArguments += "-Xclang " + ToString(clangArgument) + " ";
164 }
165
166 /*
167 * TODO: Remove LinkerCommand_ attribute and merge both paths into a single strfmt() call.
168 */
169 if (LinkerCommand_)
170 {
171 return util::strfmt(
172 clangpath.to_str() + " ",
173 "-no-pie -O0 ",
174 arguments,
175 inputFiles,
176 "-o ",
178 " ",
179 libraryPaths,
180 libraries);
181 }
182 else
183 {
184 return util::strfmt(
185 clangpath.to_str() + " ",
186 arguments,
187 " ",
188 warnings,
189 " ",
190 flags,
191 " ",
192 languageStandardArgument,
193 ReplaceAll(macroDefinitions, std::string("\""), std::string("\\\"")),
194 " ",
195 includePaths,
196 " ",
197 "-S -emit-llvm ",
198 clangArguments,
199 "-o ",
201 " ",
202 inputFiles);
203 }
204}
205
206std::string
208{
209 static std::unordered_map<LanguageStandard, const char *> map(
211 { LanguageStandard::Gnu89, "gnu89" },
212 { LanguageStandard::Gnu99, "gnu99" },
213 { LanguageStandard::C89, "c89" },
214 { LanguageStandard::C99, "c99" },
215 { LanguageStandard::C11, "c11" },
216 { LanguageStandard::Cpp98, "c++98" },
217 { LanguageStandard::Cpp03, "c++03" },
218 { LanguageStandard::Cpp11, "c++11" },
219 { LanguageStandard::Cpp14, "c++14" } });
220
221 JLM_ASSERT(map.find(languageStandard) != map.end());
222 return map[languageStandard];
223}
224
225std::string
227{
228 static std::unordered_map<ClangArgument, const char *> map({
229 { ClangArgument::DisableO0OptNone, "-disable-O0-optnone" },
230 });
231
232 JLM_ASSERT(map.find(clangArgument) != map.end());
233 return map[clangArgument];
234}
235
236std::string
237ClangCommand::ReplaceAll(std::string str, const std::string & from, const std::string & to)
238{
239 size_t start_pos = 0;
240 while ((start_pos = str.find(from, start_pos)) != std::string::npos)
241 {
242 str.replace(start_pos, from.length(), to);
243 start_pos += to.length();
244 }
245 return str;
246}
247
248LlcCommand::~LlcCommand() = default;
249
250std::string
252{
253 return util::strfmt(
254 llcpath.to_str() + " ",
255 "-",
257 " ",
258 "--relocation-model=",
260 " ",
261 "-filetype=obj ",
262 "-o ",
264 " ",
266}
267
268std::string
269LlcCommand::ToString(const OptimizationLevel & optimizationLevel)
270{
271 static std::unordered_map<OptimizationLevel, const char *> map(
272 { { OptimizationLevel::O0, "O0" },
273 { OptimizationLevel::O1, "O1" },
274 { OptimizationLevel::O2, "O2" },
275 { OptimizationLevel::O3, "O3" } });
276
277 JLM_ASSERT(map.find(optimizationLevel) != map.end());
278 return map[optimizationLevel];
279}
280
281std::string
282LlcCommand::ToString(const RelocationModel & relocationModel)
283{
284 static std::unordered_map<RelocationModel, const char *> map({
285 { RelocationModel::Static, "static" },
286 { RelocationModel::Pic, "pic" },
287 });
288
289 JLM_ASSERT(map.find(relocationModel) != map.end());
290 return map[relocationModel];
291}
292
294
296 std::string programName,
297 const jlm::tooling::JlmOptCommandLineOptions & commandLineOptions)
298 : ProgramName_(std::move(programName)),
299 CommandLineOptions_(std::move(commandLineOptions))
300{}
301
302std::string
304{
305 std::string optimizationArguments;
306 for (auto & optimization : CommandLineOptions_.GetOptimizationIds())
307 optimizationArguments +=
308 "--" + std::string(JlmOptCommandLineOptions::ToCommandLineArgument(optimization)) + " ";
309
310 auto inputFormatArgument = "--input-format="
313 + " ";
314
315 auto outputFormatArgument = "--output-format="
318 + " ";
319
320 auto outputFileArgument = !CommandLineOptions_.GetOutputFile().to_str().empty()
321 ? "-o " + CommandLineOptions_.GetOutputFile().to_str() + " "
322 : "";
323
324 std::string statisticsArguments;
325 auto & demandedStatistics =
327 for (auto & statisticsId : demandedStatistics.Items())
328 {
329 statisticsArguments +=
330 "--" + std::string(JlmOptCommandLineOptions::ToCommandLineArgument(statisticsId)) + " ";
331 }
332
333 std::string statisticsDirArgument =
335 + " ";
336
337 return util::strfmt(
339 " ",
340 inputFormatArgument,
341 outputFormatArgument,
342 optimizationArguments,
343 statisticsDirArgument,
344 statisticsArguments,
345 outputFileArgument,
347}
348
349void
376
377std::vector<std::shared_ptr<rvsdg::Transformation>>
379{
380 std::unordered_map<
382 std::shared_ptr<rvsdg::Transformation>>
383 transformations;
384
385 std::vector<std::shared_ptr<rvsdg::Transformation>> transformationSequence;
386 for (auto optimizationId : CommandLineOptions_.GetOptimizationIds())
387 {
388 if (auto it = transformations.find(optimizationId); it != transformations.end())
389 {
390 transformationSequence.push_back(it->second);
391 }
392 else
393 {
394 auto transformation = CreateTransformation(optimizationId);
395 transformationSequence.push_back(transformation);
396 transformations[optimizationId] = transformation;
397 }
398 }
399
400 return transformationSequence;
401}
402
403std::shared_ptr<rvsdg::Transformation>
405{
406 using Andersen = llvm::aa::Andersen;
407 using AgnosticMrs = llvm::aa::AgnosticModRefSummarizer;
408 using RegionAwareMrs = llvm::aa::RegionAwareModRefSummarizer;
409
410 switch (optimizationId)
411 {
413 return std::make_shared<llvm::aa::PointsToAnalysisStateEncoder<Andersen, AgnosticMrs>>();
415 return std::make_shared<llvm::aa::PointsToAnalysisStateEncoder<Andersen, RegionAwareMrs>>();
417 return std::make_shared<llvm::AggregateAllocaSplitting>();
419 return std::make_shared<llvm::CommonNodeElimination>();
421 return std::make_shared<llvm::DeadNodeElimination>();
423 return std::make_shared<llvm::FunctionInlining>();
425 return std::make_shared<llvm::IfConversion>();
427 return std::make_shared<llvm::IOBarrierElimination>();
429 return std::make_shared<llvm::InvariantValueRedirection>(
432 return std::make_shared<llvm::LoadChainSeparation>();
434 return std::make_shared<llvm::LoopStrengthReduction>();
436 return std::make_shared<llvm::LoopUnrolling>(4);
438 return std::make_shared<llvm::LoopUnswitching>(llvm::LoopUnswitchingDefaultHeuristic::create());
440 return std::make_shared<llvm::NodeHoisting>();
442 return std::make_shared<llvm::NodeSinking>();
444 return std::make_shared<llvm::NodeHoisting>();
446 return std::make_shared<llvm::NodeReduction>();
448 return std::make_shared<llvm::PredicateCorrelation>();
450 return std::make_shared<llvm::RvsdgTreePrinter>(
453 return std::make_shared<llvm::ScalarEvolution>();
455 return std::make_shared<llvm::StoreValueForwarding>();
456 default:
457 JLM_UNREACHABLE("Unhandled optimization id.");
458 }
459}
460
461std::unique_ptr<llvm::LlvmRvsdgModule>
463 const util::FilePath & llvmIrFile,
465{
466 ::llvm::LLVMContext llvmContext;
467 ::llvm::SMDiagnostic diagnostic;
468 auto llvmModule = ::llvm::parseIRFile(llvmIrFile.to_str(), diagnostic, llvmContext);
469
470 if (llvmModule == nullptr)
471 {
472 std::string errors;
473 ::llvm::raw_string_ostream os(errors);
474 diagnostic.print(ProgramName_.c_str(), os);
475 throw util::Error(errors);
476 }
477
478 auto interProceduralGraphModule = llvm::ConvertLlvmModule(*llvmModule);
479
480 // Dispose of Llvm module. It is no longer needed.
481 llvmModule.reset();
482
483 auto rvsdgModule =
485
486 return rvsdgModule;
487}
488
489std::unique_ptr<llvm::LlvmRvsdgModule>
491{
492#ifdef ENABLE_MLIR
494 return rvsdggen.ReadAndConvertMlir(mlirIrFile);
495#else
497 "This version of jlm-opt has not been compiled with support for the MLIR backend\n");
498#endif
499}
500
501std::unique_ptr<llvm::LlvmRvsdgModule>
503 const util::FilePath & inputFile,
504 const JlmOptCommandLineOptions::InputFormat & inputFormat,
506{
508 {
509 return ParseLlvmIrFile(inputFile, statisticsCollector);
510 }
512 {
513 return ParseMlirIrFile(inputFile, statisticsCollector);
514 }
515 else
516 {
517 JLM_UNREACHABLE("Unhandled input format.");
518 }
519}
520
521void
523 const llvm::LlvmRvsdgModule & rvsdgModule,
524 const util::FilePath & outputFile,
526{
527 auto ascii = view(&rvsdgModule.Rvsdg().GetRootRegion());
528
529 if (outputFile == "")
530 {
531 std::cout << ascii << std::flush;
532 }
533 else
534 {
535 std::ofstream fileStream(outputFile.to_str());
536 fileStream << ascii;
537 fileStream.close();
538 }
539}
540
541void
543 llvm::LlvmRvsdgModule & rvsdgModule,
544 const util::FilePath & outputFile,
546{
547 auto jlm_module =
549
550 ::llvm::LLVMContext ctx;
551 auto llvm_module = llvm::IpGraphToLlvmConverter::CreateAndConvertModule(*jlm_module, ctx);
552
553 if (outputFile == "")
554 {
555 ::llvm::raw_os_ostream os(std::cout);
556 llvm_module->print(os, nullptr);
557 }
558 else
559 {
560 std::error_code ec;
561 ::llvm::raw_fd_ostream os(outputFile.to_str(), ec);
562 llvm_module->print(os, nullptr);
563 }
564}
565
566void
568 const llvm::LlvmRvsdgModule & rvsdgModule,
569 const util::FilePath & outputFile,
571{
572#ifdef ENABLE_MLIR
574 auto omega = mlirgen.ConvertModule(rvsdgModule);
575 mlirgen.Print(omega, outputFile);
576#else
577 throw util::Error(
578 "This version of jlm-opt has not been compiled with support for the MLIR backend\n");
579#endif
580}
581
582void
584 const llvm::LlvmRvsdgModule & rvsdgModule,
585 const util::FilePath & outputFile,
587{
588 auto & rootRegion = rvsdgModule.Rvsdg().GetRootRegion();
589 auto tree = rvsdg::Region::ToTree(rootRegion);
590
591 if (outputFile == "")
592 {
593 std::cout << tree << std::flush;
594 }
595 else
596 {
597 std::ofstream fs;
598 fs.open(outputFile.to_str());
599 fs << tree;
600 fs.close();
601 }
602}
603
604void
606 const llvm::LlvmRvsdgModule & rvsdgModule,
607 const util::FilePath & outputFile,
610{
611 auto & rootRegion = rvsdgModule.Rvsdg().GetRootRegion();
612
613 util::graph::Writer writer;
614 llvm::LlvmDotWriter dotWriter;
615 dotWriter.WriteGraphs(writer, rootRegion, true);
616
617 if (outputFile == "")
618 {
619 writer.outputAllGraphs(std::cout, format);
620 }
621 else
622 {
623 std::ofstream fs;
624 fs.open(outputFile.to_str());
625 writer.outputAllGraphs(fs, format);
626 fs.close();
627 }
628}
629
630void
632 const llvm::LlvmRvsdgModule & rvsdgModule,
633 const util::FilePath & outputFile,
635{
636 const auto & rootRegion = rvsdgModule.Rvsdg().GetRootRegion();
637 const auto json = rvsdg::Region::toJson(rootRegion);
638
639 if (outputFile == "")
640 {
641 std::cout << json << std::flush;
642 }
643 else
644 {
645 std::ofstream fs{};
646 fs.open(outputFile.to_str());
647 fs << json;
648 fs.close();
649 }
650}
651
652void
654 llvm::LlvmRvsdgModule & rvsdgModule,
655 const util::FilePath & outputFile,
656 const JlmOptCommandLineOptions::OutputFormat & outputFormat,
658{
660 {
661 PrintAsAscii(rvsdgModule, outputFile, statisticsCollector);
662 }
664 {
665 PrintAsLlvm(rvsdgModule, outputFile, statisticsCollector);
666 }
668 {
669 PrintAsMlir(rvsdgModule, outputFile, statisticsCollector);
670 }
672 {
673 PrintAsRvsdgTree(rvsdgModule, outputFile, statisticsCollector);
674 }
676 {
678 }
680 {
682 }
684 {
685 printAsRvsdgJsonTree(rvsdgModule, outputFile, statisticsCollector);
686 }
687 else
688 {
689 JLM_UNREACHABLE("Unhandled output format.");
690 }
691}
692
693MkdirCommand::~MkdirCommand() noexcept = default;
694
695std::string
696MkdirCommand::ToString() const
697{
698 return util::strfmt("mkdir ", Path_.to_str());
699}
700
701void
703{
704 if (mkdir(Path_.to_str().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
705 throw util::Error("mkdir failed: " + Path_.to_str());
706}
707
708LlvmOptCommand::~LlvmOptCommand() noexcept = default;
709
710std::string
711LlvmOptCommand::ToString() const
712{
713 std::string optimizationArguments;
714 if (!Optimizations_.empty())
715 {
716 optimizationArguments = "-passes=";
717 bool first = true;
718 for (auto & optimization : Optimizations_)
719 {
720 if (first)
721 {
722 optimizationArguments += ToString(optimization) + " ";
723 first = false;
724 }
725 else
726 {
727 optimizationArguments += "," + ToString(optimization) + " ";
728 }
729 }
730 }
731
732 return util::strfmt(
733 clangpath.Dirname().Join("opt").to_str(),
734 " ",
735 optimizationArguments,
736 WriteLlvmAssembly_ ? "-S " : "",
737 "-o ",
738 OutputFile().to_str(),
739 " ",
740 InputFile_.to_str());
741}
742
743std::string
745{
746 static std::unordered_map<Optimization, const char *> map({
747 { Optimization::Mem2Reg, "mem2reg" },
748 });
749
750 JLM_ASSERT(map.find(optimization) != map.end());
751 return map[optimization];
752}
753
754LlvmLinkCommand::~LlvmLinkCommand() noexcept = default;
755
756std::string
757LlvmLinkCommand::ToString() const
758{
759 std::string inputFilesArgument;
760 for (auto & inputFile : InputFiles_)
761 inputFilesArgument += inputFile.to_str() + " ";
762
763 return util::strfmt(
764 clangpath.Dirname().Join("llvm-link").to_str(),
765 " ",
766 WriteLlvmAssembly_ ? "-S " : "",
767 Verbose_ ? "-v " : "",
768 "-o ",
769 OutputFile_.to_str(),
770 " ",
771 inputFilesArgument);
772}
773
774JlmHlsCommand::~JlmHlsCommand() noexcept = default;
775
776std::string
777JlmHlsCommand::ToString() const
778{
779 std::string options;
780 for (auto & o : Options)
781 {
782 options += o + " ";
783 }
784 return util::strfmt("jlm-hls ", options, "-o ", OutputFolder_.to_str(), " ", InputFile_.to_str());
785}
786
788
789std::string
790JlmHlsExtractCommand::ToString() const
791{
792 return util::strfmt(
793 "jlm-hls ",
794 "--extract ",
795 "--hls-function ",
796 HlsFunctionName(),
797 " ",
798 " -o ",
799 OutputFolder_.to_str(),
800 " ",
801 InputFile().to_str());
802}
803
804}
static jlm::util::StatisticsCollector statisticsCollector
Definition PullTests.cpp:17
util::HashSet< rvsdg::Output * > arguments
static std::unique_ptr<::llvm::Module > CreateAndConvertModule(InterProceduralGraphModule &ipGraphModule, ::llvm::LLVMContext &ctx)
static std::shared_ptr< const LoopUnswitchingDefaultHeuristic > create()
static std::unique_ptr< InterProceduralGraphModule > CreateAndConvertModule(LlvmRvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector)
static void Print(::mlir::rvsdg::OmegaNode &omega, const util::FilePath &filePath)
::mlir::rvsdg::OmegaNode ConvertModule(const llvm::LlvmRvsdgModule &rvsdgModule)
std::unique_ptr< llvm::LlvmRvsdgModule > ReadAndConvertMlir(const util::FilePath &filePath)
util::graph::Graph & WriteGraphs(util::graph::Writer &writer, const Region &region, bool emitTypeGraph)
Region & GetRootRegion() const noexcept
Definition graph.hpp:99
static std::string toJson(const Region &region, const util::AnnotationMap &annotationMap) noexcept
Definition region.cpp:492
static std::string ToTree(const rvsdg::Region &region, const util::AnnotationMap &annotationMap) noexcept
Definition region.cpp:650
Graph & Rvsdg() noexcept
static void CreateAndRun(RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector, std::vector< std::shared_ptr< Transformation > > transformations, DotWriter &dotWriter, const bool dumpRvsdgGraphs)
Creates a transformation sequence and invokes its Run() method.
std::string ToString() const override
Definition Command.cpp:105
std::vector< util::FilePath > InputFiles_
Definition Command.hpp:242
std::vector< std::string > Libraries_
Definition Command.hpp:250
std::vector< std::string > MacroDefinitions_
Definition Command.hpp:247
std::vector< std::string > Warnings_
Definition Command.hpp:248
std::vector< std::string > LibraryPaths_
Definition Command.hpp:251
LanguageStandard LanguageStandard_
Definition Command.hpp:260
util::FilePath OutputFile_
Definition Command.hpp:243
std::vector< ClangArgument > ClangArguments_
Definition Command.hpp:261
std::vector< std::string > Flags_
Definition Command.hpp:249
static std::string ReplaceAll(std::string str, const std::string &from, const std::string &to)
Definition Command.cpp:237
util::FilePath DependencyFile_
Definition Command.hpp:244
std::vector< std::string > IncludePaths_
Definition Command.hpp:246
static std::vector< CommandGraph::Node * > SortNodesTopological(const CommandGraph &commandGraph)
virtual void Run() const
Definition Command.cpp:62
virtual std::string ToString() const =0
~JlmHlsCommand() noexcept override
~JlmHlsExtractCommand() noexcept override
const util::StatisticsCollectorSettings & GetStatisticsCollectorSettings() const noexcept
const util::FilePath & GetInputFile() const noexcept
static std::string_view ToCommandLineArgument(OptimizationId optimizationId)
const llvm::RvsdgTreePrinter::Configuration & GetRvsdgTreePrinterConfiguration() const noexcept
const util::FilePath & GetOutputFile() const noexcept
InputFormat GetInputFormat() const noexcept
OutputFormat GetOutputFormat() const noexcept
const std::vector< OptimizationId > & GetOptimizationIds() const noexcept
std::unique_ptr< llvm::LlvmRvsdgModule > ParseMlirIrFile(const util::FilePath &inputFile, util::StatisticsCollector &statisticsCollector) const
Definition Command.cpp:490
JlmOptCommand(std::string programName, const JlmOptCommandLineOptions &commandLineOptions)
Definition Command.cpp:295
static void printAsRvsdgJsonTree(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:631
static void PrintRvsdgModule(llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, const JlmOptCommandLineOptions::OutputFormat &outputFormat, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:653
static void PrintAsLlvm(llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:542
static void PrintAsAscii(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:522
std::unique_ptr< llvm::LlvmRvsdgModule > ParseLlvmIrFile(const util::FilePath &inputFile, util::StatisticsCollector &statisticsCollector) const
Definition Command.cpp:462
static void PrintAsRvsdgTree(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:583
std::shared_ptr< rvsdg::Transformation > CreateTransformation(JlmOptCommandLineOptions::OptimizationId optimizationId) const
Definition Command.cpp:404
void Run() const override
Definition Command.cpp:350
JlmOptCommandLineOptions CommandLineOptions_
Definition Command.hpp:433
std::string ToString() const override
Definition Command.cpp:303
static void PrintAsMlir(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:567
std::unique_ptr< llvm::LlvmRvsdgModule > ParseInputFile(const util::FilePath &inputFile, const JlmOptCommandLineOptions::InputFormat &inputFormat, util::StatisticsCollector &statisticsCollector) const
Definition Command.cpp:502
static void PrintAsGraphs(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, jlm::util::graph::OutputFormat format, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:605
std::vector< std::shared_ptr< rvsdg::Transformation > > GetTransformations() const
Definition Command.cpp:378
RelocationModel RelocationModel_
Definition Command.hpp:329
util::FilePath InputFile_
Definition Command.hpp:330
std::string ToString() const override
Definition Command.cpp:251
OptimizationLevel OptimizationLevel_
Definition Command.hpp:328
util::FilePath OutputFile_
Definition Command.hpp:331
~LlvmLinkCommand() noexcept override
~LlvmOptCommand() noexcept override
std::string ToString() const override
Definition Command.cpp:711
~MkdirCommand() noexcept override
void Run() const override
Definition Command.cpp:702
std::unique_ptr< CommandGraph > CommandGraph_
Definition Command.hpp:81
std::string ToString() const override
Definition Command.cpp:76
void Run() const override
Definition Command.cpp:82
static std::unique_ptr< CommandGraph > Create(std::unique_ptr< CommandGraph > commandGraph)
Definition Command.cpp:92
const std::string & to_str() const noexcept
Definition file.hpp:275
const HashSet< Statistics::Id > & GetDemandedStatistics() const noexcept
const FilePath & GetOutputDirectory() const noexcept
void PrintStatistics()
Print collected statistics to file. If no statistics have been collected, this is a no-op.
void outputAllGraphs(std::ostream &out, OutputFormat format)
#define JLM_ASSERT(x)
Definition common.hpp:16
#define JLM_UNREACHABLE(msg)
Definition common.hpp:43
static std::unique_ptr< LlvmRvsdgModule > ConvertInterProceduralGraphModule(InterProceduralGraphModule &interProceduralGraphModule, InterProceduralGraphToRvsdgStatisticsCollector &statisticsCollector)
std::unique_ptr< InterProceduralGraphModule > ConvertLlvmModule(::llvm::Module &llvmModule)
static std::string strfmt(Args... args)
Definition strfmt.hpp:35