6#ifndef JLM_TOOLING_COMMANDLINE_HPP
7#define JLM_TOOLING_COMMANDLINE_HPP
70 AAAndersenRegionAware,
71 AggregateAllocaSplitting,
72 CommonNodeElimination,
77 InvariantValueRedirection,
79 LoopStrengthReduction,
100 std::vector<OptimizationId> optimizations,
101 const bool dumpRvsdgGraphs)
102 : InputFile_(std::move(inputFile)),
103 InputFormat_(inputFormat),
104 OutputFile_(std::move(outputFile)),
105 OutputFormat_(outputFormat),
106 StatisticsCollectorSettings_(std::move(statisticsCollectorSettings)),
107 OptimizationIds_(std::move(optimizations)),
108 RvsdgTreePrinterConfiguration_(std::move(rvsdgTreePrinterConfiguration)),
109 dumpRvsdgGraphs_(dumpRvsdgGraphs)
113 Reset() noexcept override;
115 [[nodiscard]] const util::FilePath &
116 GetInputFile() const noexcept
121 [[nodiscard]] InputFormat
133 [[nodiscard]] OutputFormat
136 return OutputFormat_;
142 return StatisticsCollectorSettings_;
145 [[nodiscard]]
const std::vector<OptimizationId> &
148 return OptimizationIds_;
154 return RvsdgTreePrinterConfiguration_;
160 return dumpRvsdgGraphs_;
163 static OptimizationId
164 FromCommandLineArgumentToOptimizationId(std::string_view commandLineArgument);
167 FromCommandLineArgumentToStatisticsId(std::string_view commandLineArgument);
169 static std::string_view
170 ToCommandLineArgument(OptimizationId optimizationId);
172 static std::string_view
175 static std::string_view
176 ToCommandLineArgument(InputFormat inputFormat);
178 static std::string_view
179 ToCommandLineArgument(OutputFormat outputFormat);
181 static std::unique_ptr<JlmOptCommandLineOptions>
189 std::vector<OptimizationId> optimizations,
190 bool dumpRvsdgGraphs)
192 return std::make_unique<JlmOptCommandLineOptions>(
193 std::move(inputFile),
195 std::move(outputFile),
197 std::move(statisticsCollectorSettings),
198 std::move(rvsdgTreePrinterConfiguration),
199 std::move(optimizations),
214 GetStatisticsIdCommandLineArguments();
216 static const std::unordered_map<OutputFormat, std::string_view> &
217 GetOutputFormatCommandLineArguments();
220 GetOptimizationIdCommandLineMap();
251 : OnlyPrintCommands_(false),
252 GenerateDebugInformation_(false),
263 static std::string_view
264 ToString(
const OptimizationLevel & optimizationLevel);
266 static std::string_view
267 ToString(
const LanguageStandard & languageStandard);
270 Reset() noexcept override;
272 bool OnlyPrintCommands_;
273 bool GenerateDebugInformation_;
284 util::FilePath OutputFile_;
285 std::vector<std::
string> Libraries_;
286 std::vector<std::
string> MacroDefinitions_;
287 std::vector<std::
string> LibraryPaths_;
288 std::vector<std::
string> Warnings_;
289 std::vector<std::
string> IncludePaths_;
290 std::vector<std::
string> Flags_;
292 util::HashSet<util::Statistics::Id> JlmOptPassStatistics_;
305 bool requiresParsing,
306 bool requiresOptimization,
307 bool requiresAssembly,
308 bool requiresLinking)
309 : RequiresLinking_(requiresLinking),
310 RequiresParsing_(requiresParsing),
311 RequiresOptimization_(requiresOptimization),
312 RequiresAssembly_(requiresAssembly),
313 InputFile_(std::move(inputFile)),
314 OutputFile_(std::move(outputFile)),
315 DependencyFile_(std::move(dependencyFile)),
328 return DependencyFile_;
337 [[nodiscard]]
const std::string &
346 OutputFile_ = outputFile;
352 return RequiresParsing_;
358 return RequiresOptimization_;
364 return RequiresAssembly_;
370 return RequiresLinking_;
400 ExtractHlsFunction_(false),
402 dumpRvsdgGraphs_(false)
408 Reset() noexcept override;
410 util::FilePath InputFile_;
411 util::FilePath OutputFiles_;
413 std::
string HlsFunction_;
414 bool ExtractHlsFunction_;
415 size_t MemoryLatency_;
416 bool dumpRvsdgGraphs_;
450 : OnlyPrintCommands_(false),
451 GenerateDebugInformation_(false),
456 GenerateFirrtl_(false),
465 Reset() noexcept override;
467 bool OnlyPrintCommands_;
468 bool GenerateDebugInformation_;
473 bool GenerateFirrtl_;
480 util::FilePath OutputFile_;
481 std::vector<std::
string> Libraries_;
482 std::vector<std::
string> MacroDefinitions_;
483 std::vector<std::
string> LibraryPaths_;
484 std::vector<std::
string> Warnings_;
485 std::vector<std::
string> IncludePaths_;
486 std::vector<std::
string> Flags_;
487 std::vector<std::
string> JlmHls_;
490 std::
string HlsFunctionRegex_;
505 : RequiresLinking_(link),
506 RequiresParsing_(parse),
507 RequiresOptimization_(optimize),
508 RequiresAssembly_(assemble),
509 InputFile_(std::move(inputFile)),
510 OutputFile_(std::move(outputFile)),
511 DependencyFile_(std::move(dependencyFile)),
524 return DependencyFile_;
533 [[nodiscard]]
const std::string &
542 OutputFile_ = outputFile;
548 return RequiresParsing_;
554 return RequiresOptimization_;
560 return RequiresAssembly_;
566 return RequiresLinking_;
620 IsObjectFile(const util::FilePath & file)
622 return file.suffix() ==
"o";
652 Parse(
int argc, const
char * const * argv);
670 Parse(
int argc, const
char * const * argv);
688 Parse(
int argc, const
char * const * arv);
692 IsObjectFile(const util::FilePath & file);
694 static util::FilePath
695 CreateObjectFileFromFile(const util::FilePath & f);
697 static util::FilePath
698 CreateDependencyFileFromFile(const util::FilePath & f);
static const jlm::tooling::JlcCommandLineOptions & ParseCommandLineArguments(const std::vector< std::string > &commandLineArguments)
FilePath Join(const std::string &other) const
std::string base() const noexcept
Returns the base name of the file without the path.
FilePath Dirname() const noexcept
Returns the path to the file or directory's parent directory. Emulates the behavior of the GNU coreut...