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
29#include <jlm/llvm/opt/pull.hpp>
30#include <jlm/llvm/opt/push.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::NodeSinking>();
442 return std::make_shared<llvm::NodeHoisting>();
444 return std::make_shared<llvm::NodeReduction>();
446 return std::make_shared<llvm::PredicateCorrelation>();
448 return std::make_shared<llvm::RvsdgTreePrinter>(
451 return std::make_shared<llvm::ScalarEvolution>();
453 return std::make_shared<llvm::StoreValueForwarding>();
454 default:
455 JLM_UNREACHABLE("Unhandled optimization id.");
456 }
457}
458
459std::unique_ptr<llvm::LlvmRvsdgModule>
461 const util::FilePath & llvmIrFile,
463{
464 ::llvm::LLVMContext llvmContext;
465 ::llvm::SMDiagnostic diagnostic;
466 auto llvmModule = ::llvm::parseIRFile(llvmIrFile.to_str(), diagnostic, llvmContext);
467
468 if (llvmModule == nullptr)
469 {
470 std::string errors;
471 ::llvm::raw_string_ostream os(errors);
472 diagnostic.print(ProgramName_.c_str(), os);
473 throw util::Error(errors);
474 }
475
476 auto interProceduralGraphModule = llvm::ConvertLlvmModule(*llvmModule);
477
478 // Dispose of Llvm module. It is no longer needed.
479 llvmModule.reset();
480
481 auto rvsdgModule =
483
484 return rvsdgModule;
485}
486
487std::unique_ptr<llvm::LlvmRvsdgModule>
489{
490#ifdef ENABLE_MLIR
492 return rvsdggen.ReadAndConvertMlir(mlirIrFile);
493#else
495 "This version of jlm-opt has not been compiled with support for the MLIR backend\n");
496#endif
497}
498
499std::unique_ptr<llvm::LlvmRvsdgModule>
501 const util::FilePath & inputFile,
502 const JlmOptCommandLineOptions::InputFormat & inputFormat,
504{
506 {
507 return ParseLlvmIrFile(inputFile, statisticsCollector);
508 }
510 {
511 return ParseMlirIrFile(inputFile, statisticsCollector);
512 }
513 else
514 {
515 JLM_UNREACHABLE("Unhandled input format.");
516 }
517}
518
519void
521 const llvm::LlvmRvsdgModule & rvsdgModule,
522 const util::FilePath & outputFile,
524{
525 auto ascii = view(&rvsdgModule.Rvsdg().GetRootRegion());
526
527 if (outputFile == "")
528 {
529 std::cout << ascii << std::flush;
530 }
531 else
532 {
533 std::ofstream fileStream(outputFile.to_str());
534 fileStream << ascii;
535 fileStream.close();
536 }
537}
538
539void
541 llvm::LlvmRvsdgModule & rvsdgModule,
542 const util::FilePath & outputFile,
544{
545 auto jlm_module =
547
548 ::llvm::LLVMContext ctx;
549 auto llvm_module = llvm::IpGraphToLlvmConverter::CreateAndConvertModule(*jlm_module, ctx);
550
551 if (outputFile == "")
552 {
553 ::llvm::raw_os_ostream os(std::cout);
554 llvm_module->print(os, nullptr);
555 }
556 else
557 {
558 std::error_code ec;
559 ::llvm::raw_fd_ostream os(outputFile.to_str(), ec);
560 llvm_module->print(os, nullptr);
561 }
562}
563
564void
566 const llvm::LlvmRvsdgModule & rvsdgModule,
567 const util::FilePath & outputFile,
569{
570#ifdef ENABLE_MLIR
572 auto omega = mlirgen.ConvertModule(rvsdgModule);
573 mlirgen.Print(omega, outputFile);
574#else
575 throw util::Error(
576 "This version of jlm-opt has not been compiled with support for the MLIR backend\n");
577#endif
578}
579
580void
582 const llvm::LlvmRvsdgModule & rvsdgModule,
583 const util::FilePath & outputFile,
585{
586 auto & rootRegion = rvsdgModule.Rvsdg().GetRootRegion();
587 auto tree = rvsdg::Region::ToTree(rootRegion);
588
589 if (outputFile == "")
590 {
591 std::cout << tree << std::flush;
592 }
593 else
594 {
595 std::ofstream fs;
596 fs.open(outputFile.to_str());
597 fs << tree;
598 fs.close();
599 }
600}
601
602void
604 const llvm::LlvmRvsdgModule & rvsdgModule,
605 const util::FilePath & outputFile,
608{
609 auto & rootRegion = rvsdgModule.Rvsdg().GetRootRegion();
610
611 util::graph::Writer writer;
612 llvm::LlvmDotWriter dotWriter;
613 dotWriter.WriteGraphs(writer, rootRegion, true);
614
615 if (outputFile == "")
616 {
617 writer.outputAllGraphs(std::cout, format);
618 }
619 else
620 {
621 std::ofstream fs;
622 fs.open(outputFile.to_str());
623 writer.outputAllGraphs(fs, format);
624 fs.close();
625 }
626}
627
628void
630 const llvm::LlvmRvsdgModule & rvsdgModule,
631 const util::FilePath & outputFile,
633{
634 const auto & rootRegion = rvsdgModule.Rvsdg().GetRootRegion();
635 const auto json = rvsdg::Region::toJson(rootRegion);
636
637 if (outputFile == "")
638 {
639 std::cout << json << std::flush;
640 }
641 else
642 {
643 std::ofstream fs{};
644 fs.open(outputFile.to_str());
645 fs << json;
646 fs.close();
647 }
648}
649
650void
652 llvm::LlvmRvsdgModule & rvsdgModule,
653 const util::FilePath & outputFile,
654 const JlmOptCommandLineOptions::OutputFormat & outputFormat,
656{
658 {
659 PrintAsAscii(rvsdgModule, outputFile, statisticsCollector);
660 }
662 {
663 PrintAsLlvm(rvsdgModule, outputFile, statisticsCollector);
664 }
666 {
667 PrintAsMlir(rvsdgModule, outputFile, statisticsCollector);
668 }
670 {
671 PrintAsRvsdgTree(rvsdgModule, outputFile, statisticsCollector);
672 }
674 {
676 }
678 {
680 }
682 {
683 printAsRvsdgJsonTree(rvsdgModule, outputFile, statisticsCollector);
684 }
685 else
686 {
687 JLM_UNREACHABLE("Unhandled output format.");
688 }
689}
690
691MkdirCommand::~MkdirCommand() noexcept = default;
692
693std::string
694MkdirCommand::ToString() const
695{
696 return util::strfmt("mkdir ", Path_.to_str());
697}
698
699void
701{
702 if (mkdir(Path_.to_str().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)
703 throw util::Error("mkdir failed: " + Path_.to_str());
704}
705
706LlvmOptCommand::~LlvmOptCommand() noexcept = default;
707
708std::string
709LlvmOptCommand::ToString() const
710{
711 std::string optimizationArguments;
712 if (!Optimizations_.empty())
713 {
714 optimizationArguments = "-passes=";
715 bool first = true;
716 for (auto & optimization : Optimizations_)
717 {
718 if (first)
719 {
720 optimizationArguments += ToString(optimization) + " ";
721 first = false;
722 }
723 else
724 {
725 optimizationArguments += "," + ToString(optimization) + " ";
726 }
727 }
728 }
729
730 return util::strfmt(
731 clangpath.Dirname().Join("opt").to_str(),
732 " ",
733 optimizationArguments,
734 WriteLlvmAssembly_ ? "-S " : "",
735 "-o ",
736 OutputFile().to_str(),
737 " ",
738 InputFile_.to_str());
739}
740
741std::string
743{
744 static std::unordered_map<Optimization, const char *> map({
745 { Optimization::Mem2Reg, "mem2reg" },
746 });
747
748 JLM_ASSERT(map.find(optimization) != map.end());
749 return map[optimization];
750}
751
752LlvmLinkCommand::~LlvmLinkCommand() noexcept = default;
753
754std::string
755LlvmLinkCommand::ToString() const
756{
757 std::string inputFilesArgument;
758 for (auto & inputFile : InputFiles_)
759 inputFilesArgument += inputFile.to_str() + " ";
760
761 return util::strfmt(
762 clangpath.Dirname().Join("llvm-link").to_str(),
763 " ",
764 WriteLlvmAssembly_ ? "-S " : "",
765 Verbose_ ? "-v " : "",
766 "-o ",
767 OutputFile_.to_str(),
768 " ",
769 inputFilesArgument);
770}
771
772JlmHlsCommand::~JlmHlsCommand() noexcept = default;
773
774std::string
775JlmHlsCommand::ToString() const
776{
777 std::string options;
778 for (auto & o : Options)
779 {
780 options += o + " ";
781 }
782 return util::strfmt("jlm-hls ", options, "-o ", OutputFolder_.to_str(), " ", InputFile_.to_str());
783}
784
786
787std::string
788JlmHlsExtractCommand::ToString() const
789{
790 return util::strfmt(
791 "jlm-hls ",
792 "--extract ",
793 "--hls-function ",
794 HlsFunctionName(),
795 " ",
796 " -o ",
797 OutputFolder_.to_str(),
798 " ",
799 InputFile().to_str());
800}
801
802}
static jlm::util::StatisticsCollector statisticsCollector
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:488
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:629
static void PrintRvsdgModule(llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, const JlmOptCommandLineOptions::OutputFormat &outputFormat, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:651
static void PrintAsLlvm(llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:540
static void PrintAsAscii(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:520
std::unique_ptr< llvm::LlvmRvsdgModule > ParseLlvmIrFile(const util::FilePath &inputFile, util::StatisticsCollector &statisticsCollector) const
Definition Command.cpp:460
static void PrintAsRvsdgTree(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:581
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:565
std::unique_ptr< llvm::LlvmRvsdgModule > ParseInputFile(const util::FilePath &inputFile, const JlmOptCommandLineOptions::InputFormat &inputFormat, util::StatisticsCollector &statisticsCollector) const
Definition Command.cpp:500
static void PrintAsGraphs(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, jlm::util::graph::OutputFormat format, util::StatisticsCollector &statisticsCollector)
Definition Command.cpp:603
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:709
~MkdirCommand() noexcept override
void Run() const override
Definition Command.cpp:700
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