6 #ifndef JLM_TOOLING_COMMANDLINE_HPP
7 #define JLM_TOOLING_COMMANDLINE_HPP
70 AAAndersenRegionAware,
71 AggregateAllocaSplitting,
72 CommonNodeElimination,
76 InvariantValueRedirection,
78 LoopStrengthReduction,
99 std::vector<OptimizationId> optimizations,
100 const bool dumpRvsdgGraphs)
101 : InputFile_(std::move(inputFile)),
102 InputFormat_(inputFormat),
103 OutputFile_(std::move(outputFile)),
104 OutputFormat_(outputFormat),
105 StatisticsCollectorSettings_(std::move(statisticsCollectorSettings)),
106 OptimizationIds_(std::move(optimizations)),
107 RvsdgTreePrinterConfiguration_(std::move(rvsdgTreePrinterConfiguration)),
108 dumpRvsdgGraphs_(dumpRvsdgGraphs)
112 Reset() noexcept override;
114 [[nodiscard]] const util::FilePath &
115 GetInputFile() const noexcept
120 [[nodiscard]] InputFormat
135 return OutputFormat_;
141 return StatisticsCollectorSettings_;
144 [[nodiscard]]
const std::vector<OptimizationId> &
147 return OptimizationIds_;
153 return RvsdgTreePrinterConfiguration_;
159 return dumpRvsdgGraphs_;
162 static OptimizationId
163 FromCommandLineArgumentToOptimizationId(std::string_view commandLineArgument);
166 FromCommandLineArgumentToStatisticsId(std::string_view commandLineArgument);
168 static std::string_view
169 ToCommandLineArgument(OptimizationId optimizationId);
171 static std::string_view
174 static std::string_view
175 ToCommandLineArgument(InputFormat inputFormat);
177 static std::string_view
180 static std::unique_ptr<JlmOptCommandLineOptions>
188 std::vector<OptimizationId> optimizations,
189 bool dumpRvsdgGraphs)
191 return std::make_unique<JlmOptCommandLineOptions>(
192 std::move(inputFile),
194 std::move(outputFile),
196 std::move(statisticsCollectorSettings),
197 std::move(rvsdgTreePrinterConfiguration),
198 std::move(optimizations),
213 GetStatisticsIdCommandLineArguments();
215 static const std::unordered_map<OutputFormat, std::string_view> &
216 GetOutputFormatCommandLineArguments();
219 GetOptimizationIdCommandLineMap();
250 : OnlyPrintCommands_(false),
251 GenerateDebugInformation_(false),
262 static std::string_view
263 ToString(
const OptimizationLevel & optimizationLevel);
265 static std::string_view
266 ToString(
const LanguageStandard & languageStandard);
269 Reset() noexcept override;
271 bool OnlyPrintCommands_;
272 bool GenerateDebugInformation_;
283 util::FilePath OutputFile_;
284 std::vector<std::
string> Libraries_;
285 std::vector<std::
string> MacroDefinitions_;
286 std::vector<std::
string> LibraryPaths_;
287 std::vector<std::
string> Warnings_;
288 std::vector<std::
string> IncludePaths_;
289 std::vector<std::
string> Flags_;
291 util::HashSet<util::Statistics::Id> JlmOptPassStatistics_;
304 bool requiresParsing,
305 bool requiresOptimization,
306 bool requiresAssembly,
307 bool requiresLinking)
308 : RequiresLinking_(requiresLinking),
309 RequiresParsing_(requiresParsing),
310 RequiresOptimization_(requiresOptimization),
311 RequiresAssembly_(requiresAssembly),
312 InputFile_(std::move(inputFile)),
313 OutputFile_(std::move(outputFile)),
314 DependencyFile_(std::move(dependencyFile)),
327 return DependencyFile_;
336 [[nodiscard]]
const std::string &
345 OutputFile_ = outputFile;
351 return RequiresParsing_;
357 return RequiresOptimization_;
363 return RequiresAssembly_;
369 return RequiresLinking_;
399 ExtractHlsFunction_(false),
401 dumpRvsdgGraphs_(false)
407 Reset() noexcept override;
409 util::FilePath InputFile_;
410 util::FilePath OutputFiles_;
412 std::
string HlsFunction_;
413 bool ExtractHlsFunction_;
414 size_t MemoryLatency_;
415 bool dumpRvsdgGraphs_;
449 : OnlyPrintCommands_(false),
450 GenerateDebugInformation_(false),
455 GenerateFirrtl_(false),
464 Reset() noexcept override;
466 bool OnlyPrintCommands_;
467 bool GenerateDebugInformation_;
472 bool GenerateFirrtl_;
479 util::FilePath OutputFile_;
480 std::vector<std::
string> Libraries_;
481 std::vector<std::
string> MacroDefinitions_;
482 std::vector<std::
string> LibraryPaths_;
483 std::vector<std::
string> Warnings_;
484 std::vector<std::
string> IncludePaths_;
485 std::vector<std::
string> Flags_;
486 std::vector<std::
string> JlmHls_;
489 std::
string HlsFunctionRegex_;
504 : RequiresLinking_(link),
505 RequiresParsing_(parse),
506 RequiresOptimization_(optimize),
507 RequiresAssembly_(assemble),
508 InputFile_(std::move(inputFile)),
509 OutputFile_(std::move(outputFile)),
510 DependencyFile_(std::move(dependencyFile)),
523 return DependencyFile_;
532 [[nodiscard]]
const std::string &
541 OutputFile_ = outputFile;
547 return RequiresParsing_;
553 return RequiresOptimization_;
559 return RequiresAssembly_;
565 return RequiresLinking_;
619 IsObjectFile(const util::FilePath & file)
621 return file.suffix() ==
"o";
651 Parse(
int argc, const
char * const * argv);
669 Parse(
int argc, const
char * const * argv);
687 Parse(
int argc, const
char * const * arv);
691 IsObjectFile(const util::FilePath & file);
693 static util::FilePath
694 CreateObjectFileFromFile(const util::FilePath & f);
696 static util::FilePath
697 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...
static std::string ToString(const std::vector< MemoryNodeId > &memoryNodeIds)