6#ifndef JLM_TOOLING_COMMANDLINE_HPP
7#define JLM_TOOLING_COMMANDLINE_HPP
70 AAAndersenRegionAware,
71 AggregateAllocaSplitting,
72 CommonNodeElimination,
77 InvariantValueRedirection,
79 LoopStrengthReduction,
107 std::vector<OptimizationId> optimizations,
108 const bool dumpRvsdgGraphs)
109 : InputFile_(std::move(inputFile)),
110 InputFormat_(inputFormat),
111 OutputFile_(std::move(outputFile)),
112 OutputFormat_(outputFormat),
113 StatisticsCollectorSettings_(std::move(statisticsCollectorSettings)),
114 OptimizationIds_(std::move(optimizations)),
115 RvsdgTreePrinterConfiguration_(std::move(rvsdgTreePrinterConfiguration)),
116 dumpRvsdgGraphs_(dumpRvsdgGraphs)
120 Reset() noexcept override;
122 [[nodiscard]] const util::FilePath &
123 GetInputFile() const noexcept
128 [[nodiscard]] InputFormat
140 [[nodiscard]] OutputFormat
143 return OutputFormat_;
149 return StatisticsCollectorSettings_;
152 [[nodiscard]]
const std::vector<OptimizationId> &
155 return OptimizationIds_;
161 return RvsdgTreePrinterConfiguration_;
167 return dumpRvsdgGraphs_;
170 static OptimizationId
171 FromCommandLineArgumentToOptimizationId(std::string_view commandLineArgument);
174 FromCommandLineArgumentToStatisticsId(std::string_view commandLineArgument);
176 static std::string_view
177 ToCommandLineArgument(OptimizationId optimizationId);
179 static std::string_view
182 static std::string_view
183 ToCommandLineArgument(InputFormat inputFormat);
185 static std::string_view
186 ToCommandLineArgument(OutputFormat outputFormat);
188 static std::unique_ptr<JlmOptCommandLineOptions>
196 std::vector<OptimizationId> optimizations,
197 bool dumpRvsdgGraphs)
199 return std::make_unique<JlmOptCommandLineOptions>(
200 std::move(inputFile),
202 std::move(outputFile),
204 std::move(statisticsCollectorSettings),
205 std::move(rvsdgTreePrinterConfiguration),
206 std::move(optimizations),
221 GetStatisticsIdCommandLineArguments();
223 static const std::unordered_map<OutputFormat, std::string_view> &
224 GetOutputFormatCommandLineArguments();
227 GetOptimizationIdCommandLineMap();
258 : OnlyPrintCommands_(false),
259 GenerateDebugInformation_(false),
270 static std::string_view
271 ToString(
const OptimizationLevel & optimizationLevel);
273 static std::string_view
274 ToString(
const LanguageStandard & languageStandard);
277 Reset() noexcept override;
279 bool OnlyPrintCommands_;
280 bool GenerateDebugInformation_;
291 util::FilePath OutputFile_;
292 std::vector<std::
string> Libraries_;
293 std::vector<std::
string> MacroDefinitions_;
294 std::vector<std::
string> LibraryPaths_;
295 std::vector<std::
string> Warnings_;
296 std::vector<std::
string> IncludePaths_;
297 std::vector<std::
string> Flags_;
299 util::HashSet<util::Statistics::Id> JlmOptPassStatistics_;
312 bool requiresParsing,
313 bool requiresOptimization,
314 bool requiresAssembly,
315 bool requiresLinking)
316 : RequiresLinking_(requiresLinking),
317 RequiresParsing_(requiresParsing),
318 RequiresOptimization_(requiresOptimization),
319 RequiresAssembly_(requiresAssembly),
320 InputFile_(std::move(inputFile)),
321 OutputFile_(std::move(outputFile)),
322 DependencyFile_(std::move(dependencyFile)),
335 return DependencyFile_;
344 [[nodiscard]]
const std::string &
353 OutputFile_ = outputFile;
359 return RequiresParsing_;
365 return RequiresOptimization_;
371 return RequiresAssembly_;
377 return RequiresLinking_;
407 ExtractHlsFunction_(false),
409 dumpRvsdgGraphs_(false)
415 Reset() noexcept override;
417 util::FilePath InputFile_;
418 util::FilePath OutputFiles_;
420 std::
string HlsFunction_;
421 bool ExtractHlsFunction_;
422 size_t MemoryLatency_;
423 bool dumpRvsdgGraphs_;
457 : OnlyPrintCommands_(false),
458 GenerateDebugInformation_(false),
463 GenerateFirrtl_(false),
472 Reset() noexcept override;
474 bool OnlyPrintCommands_;
475 bool GenerateDebugInformation_;
480 bool GenerateFirrtl_;
487 util::FilePath OutputFile_;
488 std::vector<std::
string> Libraries_;
489 std::vector<std::
string> MacroDefinitions_;
490 std::vector<std::
string> LibraryPaths_;
491 std::vector<std::
string> Warnings_;
492 std::vector<std::
string> IncludePaths_;
493 std::vector<std::
string> Flags_;
494 std::vector<std::
string> JlmHls_;
497 std::
string HlsFunctionRegex_;
512 : RequiresLinking_(link),
513 RequiresParsing_(parse),
514 RequiresOptimization_(optimize),
515 RequiresAssembly_(assemble),
516 InputFile_(std::move(inputFile)),
517 OutputFile_(std::move(outputFile)),
518 DependencyFile_(std::move(dependencyFile)),
531 return DependencyFile_;
540 [[nodiscard]]
const std::string &
549 OutputFile_ = outputFile;
555 return RequiresParsing_;
561 return RequiresOptimization_;
567 return RequiresAssembly_;
573 return RequiresLinking_;
627 IsObjectFile(const util::FilePath & file)
629 return file.suffix() ==
"o";
659 Parse(
int argc, const
char * const * argv);
677 Parse(
int argc, const
char * const * argv);
695 Parse(
int argc, const
char * const * arv);
699 IsObjectFile(const util::FilePath & file);
701 static util::FilePath
702 CreateObjectFileFromFile(const util::FilePath & f);
704 static util::FilePath
705 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...