Jlm
Command.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_TOOLING_COMMAND_HPP
7 #define JLM_TOOLING_COMMAND_HPP
8 
11 #include <jlm/util/file.hpp>
12 
13 #include <memory>
14 #include <string>
15 
16 namespace jlm::llvm
17 {
18 class LlvmRvsdgModule;
19 }
20 
21 namespace jlm::tooling
22 {
23 
29 class Command
30 {
31 public:
32  virtual ~Command();
33 
34  [[nodiscard]] virtual std::string
35  ToString() const = 0;
36 
37  virtual void
38  Run() const;
39 };
40 
44 class PrintCommandsCommand final : public Command
45 {
46 public:
48 
49  explicit PrintCommandsCommand(std::unique_ptr<CommandGraph> commandGraph)
50  : CommandGraph_(std::move(commandGraph))
51  {}
52 
54 
56 
58  operator=(const PrintCommandsCommand &) = delete;
59 
62 
63  [[nodiscard]] std::string
64  ToString() const override;
65 
66  void
67  Run() const override;
68 
69  static std::unique_ptr<CommandGraph>
70  Create(std::unique_ptr<CommandGraph> commandGraph);
71 
72 private:
73  static CommandGraph::Node &
74  Create(CommandGraph & commandGraph, std::unique_ptr<CommandGraph> printedCommandGraph)
75  {
76  auto command = std::make_unique<PrintCommandsCommand>(std::move(printedCommandGraph));
77  return CommandGraph::Node::Create(commandGraph, std::move(command));
78  }
79 
80  std::unique_ptr<CommandGraph> CommandGraph_;
81 };
82 
86 class ClangCommand final : public Command
87 {
88 public:
89  enum class LanguageStandard
90  {
92  Gnu89,
93  Gnu99,
94  C89,
95  C99,
96  C11,
97  Cpp98,
98  Cpp03,
99  Cpp11,
100  Cpp14
101  };
102 
103  enum class ClangArgument
104  {
106  };
107 
108  ~ClangCommand() override;
109 
111  std::vector<util::FilePath> inputFiles,
112  util::FilePath outputFile,
113  std::vector<std::string> libraryPaths,
114  std::vector<std::string> libraries,
115  bool usePthreads)
116  : InputFiles_(std::move(inputFiles)),
117  OutputFile_(std::move(outputFile)),
118  DependencyFile_(""),
119  Libraries_(std::move(libraries)),
120  LibraryPaths_(std::move(libraryPaths)),
121  UsePthreads_(usePthreads),
122  Verbose_(false),
123  Rdynamic_(false),
124  Suppress_(false),
125  Md_(false),
126  LanguageStandard_(LanguageStandard::Unspecified),
127  LinkerCommand_(true)
128  {}
129 
131  const util::FilePath & inputFile,
132  util::FilePath outputFile,
133  util::FilePath dependencyFile,
134  std::vector<std::string> includePaths,
135  std::vector<std::string> macroDefinitions,
136  std::vector<std::string> warnings,
137  std::vector<std::string> flags,
138  bool verbose,
139  bool rdynamic,
140  bool suppress,
141  bool usePthreads,
142  bool mD,
143  std::string mT,
144  const LanguageStandard & languageStandard,
145  std::vector<ClangArgument> clangArguments)
146  : InputFiles_({ inputFile }),
147  OutputFile_(std::move(outputFile)),
148  DependencyFile_(std::move(dependencyFile)),
149  IncludePaths_(std::move(includePaths)),
150  MacroDefinitions_(std::move(macroDefinitions)),
151  Warnings_(std::move(warnings)),
152  Flags_(std::move(flags)),
153  UsePthreads_(usePthreads),
154  Verbose_(verbose),
155  Rdynamic_(rdynamic),
156  Suppress_(suppress),
157  Md_(mD),
158  Mt_(std::move(mT)),
159  LanguageStandard_(languageStandard),
160  ClangArguments_(std::move(clangArguments)),
161  LinkerCommand_(false)
162  {}
163 
164  [[nodiscard]] std::string
165  ToString() const override;
166 
167  [[nodiscard]] const util::FilePath &
168  OutputFile() const noexcept
169  {
170  return OutputFile_;
171  }
172 
173  [[nodiscard]] const std::vector<util::FilePath> &
174  InputFiles() const noexcept
175  {
176  return InputFiles_;
177  }
178 
179  static CommandGraph::Node &
181  CommandGraph & commandGraph,
182  const std::vector<util::FilePath> & inputFiles,
183  const util::FilePath & outputFile,
184  const std::vector<std::string> & libraryPaths,
185  const std::vector<std::string> & libraries,
186  bool usePthreads)
187  {
188  std::unique_ptr<ClangCommand> command(
189  new ClangCommand(inputFiles, outputFile, libraryPaths, libraries, usePthreads));
190  return CommandGraph::Node::Create(commandGraph, std::move(command));
191  }
192 
193  static CommandGraph::Node &
195  CommandGraph & commandGraph,
196  const util::FilePath & inputFile,
197  const util::FilePath & outputFile,
198  const util::FilePath & dependencyFile,
199  const std::vector<std::string> & includePaths,
200  const std::vector<std::string> & macroDefinitions,
201  const std::vector<std::string> & warnings,
202  const std::vector<std::string> & flags,
203  bool verbose,
204  bool rdynamic,
205  bool suppress,
206  bool usePthread,
207  bool mD,
208  const std::string & mT,
209  const LanguageStandard & languageStandard,
210  const std::vector<ClangArgument> & clangArguments)
211  {
212  std::unique_ptr<ClangCommand> command(new ClangCommand(
213  inputFile,
214  outputFile,
215  dependencyFile,
216  includePaths,
217  macroDefinitions,
218  warnings,
219  flags,
220  verbose,
221  rdynamic,
222  suppress,
223  usePthread,
224  mD,
225  mT,
226  languageStandard,
227  clangArguments));
228  return CommandGraph::Node::Create(commandGraph, std::move(command));
229  }
230 
231 private:
232  static std::string
233  ToString(const LanguageStandard & languageStandard);
234 
235  static std::string
236  ToString(const ClangArgument & clangArgument);
237 
238  static std::string
239  ReplaceAll(std::string str, const std::string & from, const std::string & to);
240 
241  std::vector<util::FilePath> InputFiles_;
244 
245  std::vector<std::string> IncludePaths_;
246  std::vector<std::string> MacroDefinitions_;
247  std::vector<std::string> Warnings_;
248  std::vector<std::string> Flags_;
249  std::vector<std::string> Libraries_;
250  std::vector<std::string> LibraryPaths_;
251 
253  bool Verbose_;
254  bool Rdynamic_;
255  bool Suppress_;
256  bool Md_;
257  std::string Mt_;
258 
260  std::vector<ClangArgument> ClangArguments_;
261 
263 };
264 
268 class LlcCommand final : public Command
269 {
270 public:
271  enum class OptimizationLevel
272  {
273  O0,
274  O1,
275  O2,
276  O3
277  };
278 
279  enum class RelocationModel
280  {
281  Static,
282  Pic
283  };
284 
285  ~LlcCommand() override;
286 
288  util::FilePath inputFile,
289  util::FilePath outputFile,
290  const OptimizationLevel & optimizationLevel,
291  const RelocationModel & relocationModel)
292  : OptimizationLevel_(optimizationLevel),
293  RelocationModel_(relocationModel),
294  InputFile_(std::move(inputFile)),
295  OutputFile_(std::move(outputFile))
296  {}
297 
298  [[nodiscard]] std::string
299  ToString() const override;
300 
301  [[nodiscard]] const util::FilePath &
302  OutputFile() const noexcept
303  {
304  return OutputFile_;
305  }
306 
307  static CommandGraph::Node &
309  CommandGraph & commandGraph,
310  const util::FilePath & inputFile,
311  const util::FilePath & outputFile,
312  const OptimizationLevel & optimizationLevel,
313  const RelocationModel & relocationModel)
314  {
315  std::unique_ptr<LlcCommand> command(
316  new LlcCommand(inputFile, outputFile, optimizationLevel, relocationModel));
317  return CommandGraph::Node::Create(commandGraph, std::move(command));
318  }
319 
320 private:
321  static std::string
322  ToString(const OptimizationLevel & optimizationLevel);
323 
324  static std::string
325  ToString(const RelocationModel & relocationModel);
326 
331 };
332 
336 class JlmOptCommand final : public Command
337 {
338 public:
339  ~JlmOptCommand() override;
340 
341  JlmOptCommand(std::string programName, const JlmOptCommandLineOptions & commandLineOptions);
342 
343  [[nodiscard]] std::string
344  ToString() const override;
345 
346  void
347  Run() const override;
348 
349  static CommandGraph::Node &
351  CommandGraph & commandGraph,
352  std::string programName,
353  const JlmOptCommandLineOptions & commandLineOptions)
354  {
355  auto command =
356  std::make_unique<JlmOptCommand>(std::move(programName), std::move(commandLineOptions));
357  return CommandGraph::Node::Create(commandGraph, std::move(command));
358  }
359 
360  [[nodiscard]] const JlmOptCommandLineOptions &
361  GetCommandLineOptions() const noexcept
362  {
363  return CommandLineOptions_;
364  }
365 
366  static void
368  llvm::LlvmRvsdgModule & rvsdgModule,
369  const util::FilePath & outputFile,
370  const JlmOptCommandLineOptions::OutputFormat & outputFormat,
371  util::StatisticsCollector & statisticsCollector);
372 
373 private:
374  std::unique_ptr<llvm::LlvmRvsdgModule>
376  const util::FilePath & inputFile,
377  const JlmOptCommandLineOptions::InputFormat & inputFormat,
378  util::StatisticsCollector & statisticsCollector) const;
379 
380  std::unique_ptr<llvm::LlvmRvsdgModule>
381  ParseLlvmIrFile(const util::FilePath & inputFile, util::StatisticsCollector & statisticsCollector)
382  const;
383 
384  std::unique_ptr<llvm::LlvmRvsdgModule>
385  ParseMlirIrFile(const util::FilePath & inputFile, util::StatisticsCollector & statisticsCollector)
386  const;
387 
388  static void
389  PrintAsAscii(
390  const llvm::LlvmRvsdgModule & rvsdgModule,
391  const util::FilePath & outputFile,
392  util::StatisticsCollector & statisticsCollector);
393 
394  static void
395  PrintAsXml(
396  const llvm::LlvmRvsdgModule & rvsdgModule,
397  const util::FilePath & outputFile,
398  util::StatisticsCollector & statisticsCollector);
399 
400  static void
401  PrintAsLlvm(
402  llvm::LlvmRvsdgModule & rvsdgModule,
403  const util::FilePath & outputFile,
404  util::StatisticsCollector & statisticsCollector);
405 
406  static void
407  PrintAsMlir(
408  const llvm::LlvmRvsdgModule & rvsdgModule,
409  const util::FilePath & outputFile,
410  util::StatisticsCollector & statisticsCollector);
411 
412  static void
414  const llvm::LlvmRvsdgModule & rvsdgModule,
415  const util::FilePath & outputFile,
416  util::StatisticsCollector & statisticsCollector);
417 
418  static void
419  PrintAsDot(
420  const llvm::LlvmRvsdgModule & rvsdgModule,
421  const util::FilePath & outputFile,
422  util::StatisticsCollector & statisticsCollector);
423 
424  [[nodiscard]] std::vector<std::shared_ptr<rvsdg::Transformation>>
425  GetTransformations() const;
426 
427  [[nodiscard]] std::shared_ptr<rvsdg::Transformation>
429 
430  std::string ProgramName_;
432 };
433 
437 class MkdirCommand final : public Command
438 {
439 public:
440  ~MkdirCommand() noexcept override;
441 
442  explicit MkdirCommand(util::FilePath path)
443  : Path_(std::move(path))
444  {}
445 
446  [[nodiscard]] std::string
447  ToString() const override;
448 
449  void
450  Run() const override;
451 
452  static CommandGraph::Node &
453  Create(CommandGraph & commandGraph, const util::FilePath & path)
454  {
455  std::unique_ptr<MkdirCommand> command(new MkdirCommand(path));
456  return CommandGraph::Node::Create(commandGraph, std::move(command));
457  }
458 
459 private:
461 };
462 
466 class LlvmOptCommand final : public Command
467 {
468 public:
469  enum class Optimization
470  {
471  Mem2Reg,
472  };
473 
474  ~LlvmOptCommand() noexcept override;
475 
477  util::FilePath inputFile,
478  util::FilePath outputFile,
479  bool writeLlvmAssembly,
480  std::vector<Optimization> optimizations)
481  : InputFile_(std::move(inputFile)),
482  OutputFile_(std::move(outputFile)),
483  WriteLlvmAssembly_(writeLlvmAssembly),
484  Optimizations_(std::move(optimizations))
485  {}
486 
487  [[nodiscard]] std::string
488  ToString() const override;
489 
490  [[nodiscard]] const util::FilePath &
491  OutputFile() const noexcept
492  {
493  return OutputFile_;
494  }
495 
496  static CommandGraph::Node &
498  CommandGraph & commandGraph,
499  const util::FilePath & inputFile,
500  const util::FilePath & outputFile,
501  bool writeLlvmAssembly,
502  const std::vector<Optimization> & optimizations)
503  {
504  std::unique_ptr<LlvmOptCommand> command(
505  new LlvmOptCommand(inputFile, outputFile, writeLlvmAssembly, optimizations));
506  return CommandGraph::Node::Create(commandGraph, std::move(command));
507  }
508 
509 private:
510  static std::string
511  ToString(const Optimization & optimization);
512 
515 
517 
518  std::vector<Optimization> Optimizations_;
519 };
520 
524 class LlvmLinkCommand final : public Command
525 {
526 public:
527  ~LlvmLinkCommand() noexcept override;
528 
530  std::vector<util::FilePath> inputFiles,
531  util::FilePath outputFile,
532  bool writeLlvmAssembly,
533  bool verbose)
534  : OutputFile_(std::move(outputFile)),
535  InputFiles_(std::move(inputFiles)),
536  WriteLlvmAssembly_(writeLlvmAssembly),
537  Verbose_(verbose)
538  {}
539 
540  [[nodiscard]] std::string
541  ToString() const override;
542 
543  [[nodiscard]] const util::FilePath &
544  OutputFile() const noexcept
545  {
546  return OutputFile_;
547  }
548 
549  [[nodiscard]] const std::vector<util::FilePath> &
550  InputFiles() const noexcept
551  {
552  return InputFiles_;
553  }
554 
555  static CommandGraph::Node &
557  CommandGraph & commandGraph,
558  const std::vector<util::FilePath> & inputFiles,
559  const util::FilePath & outputFile,
560  bool writeLlvmAssembly,
561  bool verbose)
562  {
563  std::unique_ptr<LlvmLinkCommand> command(
564  new LlvmLinkCommand(inputFiles, outputFile, writeLlvmAssembly, verbose));
565  return CommandGraph::Node::Create(commandGraph, std::move(command));
566  }
567 
568 private:
570  std::vector<util::FilePath> InputFiles_;
571 
573  bool Verbose_;
574 };
575 
579 class JlmHlsCommand final : public Command
580 {
581 public:
582  ~JlmHlsCommand() noexcept override;
583 
585  util::FilePath inputFile,
586  util::FilePath outputFolder,
587  std::vector<std::string> options)
588  : InputFile_(std::move(inputFile)),
589  OutputFolder_(std::move(outputFolder)),
590  Options(std::move(options))
591  {}
592 
593  [[nodiscard]] std::string
594  ToString() const override;
595 
596  [[nodiscard]] util::FilePath
597  FirrtlFile() const noexcept
598  {
599  return OutputFolder_.WithSuffix(".fir");
600  }
601 
602  [[nodiscard]] util::FilePath
603  LlvmFile() const noexcept
604  {
605  return OutputFolder_.WithSuffix(".rest.ll");
606  }
607 
608  [[nodiscard]] util::FilePath
609  RefFile() const noexcept
610  {
611  return OutputFolder_.WithSuffix(".ref.ll");
612  }
613 
614  [[nodiscard]] util::FilePath
615  HarnessFile() const noexcept
616  {
617  return OutputFolder_.WithSuffix(".harness.cpp");
618  }
619 
620  [[nodiscard]] const util::FilePath &
621  InputFile() const noexcept
622  {
623  return InputFile_;
624  }
625 
626  static CommandGraph::Node &
628  CommandGraph & commandGraph,
629  const util::FilePath & inputFile,
630  const util::FilePath & outputFolder,
631  const std::vector<std::string> & options)
632  {
633  auto command = std::make_unique<JlmHlsCommand>(inputFile, outputFolder, options);
634  return CommandGraph::Node::Create(commandGraph, std::move(command));
635  }
636 
637 private:
640  std::vector<std::string> Options;
641 };
642 
647 class JlmHlsExtractCommand final : public Command
648 {
649 public:
650  ~JlmHlsExtractCommand() noexcept override;
651 
653  util::FilePath inputFile,
654  util::FilePath outputFolder,
655  std::string hlsFunctionName)
656  : InputFile_(std::move(inputFile)),
657  OutputFolder_(std::move(outputFolder)),
658  HlsFunctionName_(std::move(hlsFunctionName))
659  {}
660 
661  [[nodiscard]] std::string
662  ToString() const override;
663 
664  [[nodiscard]] util::FilePath
665  HlsFunctionFile() const noexcept
666  {
667  return OutputFolder_.WithSuffix(".function.ll");
668  }
669 
670  [[nodiscard]] util::FilePath
671  LlvmFile() const noexcept
672  {
673  return OutputFolder_.WithSuffix(".rest.ll");
674  }
675 
676  [[nodiscard]] const util::FilePath &
677  InputFile() const noexcept
678  {
679  return InputFile_;
680  }
681 
682  [[nodiscard]] const std::string &
683  HlsFunctionName() const noexcept
684  {
685  return HlsFunctionName_;
686  }
687 
688  static CommandGraph::Node &
690  CommandGraph & commandGraph,
691  const util::FilePath & inputFile,
692  const std::string & hlsFunctionName,
693  const util::FilePath & outputFolder)
694  {
695  std::unique_ptr<JlmHlsExtractCommand> command(
696  new JlmHlsExtractCommand(inputFile, outputFolder, hlsFunctionName));
697  return CommandGraph::Node::Create(commandGraph, std::move(command));
698  }
699 
700 private:
703 
704  std::string HlsFunctionName_;
705 };
706 
707 }
708 
709 #endif
const std::vector< util::FilePath > & InputFiles() const noexcept
Definition: Command.hpp:174
ClangCommand(const util::FilePath &inputFile, util::FilePath outputFile, util::FilePath dependencyFile, std::vector< std::string > includePaths, std::vector< std::string > macroDefinitions, std::vector< std::string > warnings, std::vector< std::string > flags, bool verbose, bool rdynamic, bool suppress, bool usePthreads, bool mD, std::string mT, const LanguageStandard &languageStandard, std::vector< ClangArgument > clangArguments)
Definition: Command.hpp:130
std::string ToString() const override
Definition: Command.cpp:101
std::vector< util::FilePath > InputFiles_
Definition: Command.hpp:241
std::vector< std::string > Libraries_
Definition: Command.hpp:249
std::vector< std::string > MacroDefinitions_
Definition: Command.hpp:246
std::vector< std::string > Warnings_
Definition: Command.hpp:247
const util::FilePath & OutputFile() const noexcept
Definition: Command.hpp:168
std::vector< std::string > LibraryPaths_
Definition: Command.hpp:250
ClangCommand(std::vector< util::FilePath > inputFiles, util::FilePath outputFile, std::vector< std::string > libraryPaths, std::vector< std::string > libraries, bool usePthreads)
Definition: Command.hpp:110
LanguageStandard LanguageStandard_
Definition: Command.hpp:259
util::FilePath OutputFile_
Definition: Command.hpp:242
std::vector< ClangArgument > ClangArguments_
Definition: Command.hpp:260
std::vector< std::string > Flags_
Definition: Command.hpp:248
static std::string ReplaceAll(std::string str, const std::string &from, const std::string &to)
Definition: Command.cpp:233
static CommandGraph::Node & CreateLinkerCommand(CommandGraph &commandGraph, const std::vector< util::FilePath > &inputFiles, const util::FilePath &outputFile, const std::vector< std::string > &libraryPaths, const std::vector< std::string > &libraries, bool usePthreads)
Definition: Command.hpp:180
static CommandGraph::Node & CreateParsingCommand(CommandGraph &commandGraph, const util::FilePath &inputFile, const util::FilePath &outputFile, const util::FilePath &dependencyFile, const std::vector< std::string > &includePaths, const std::vector< std::string > &macroDefinitions, const std::vector< std::string > &warnings, const std::vector< std::string > &flags, bool verbose, bool rdynamic, bool suppress, bool usePthread, bool mD, const std::string &mT, const LanguageStandard &languageStandard, const std::vector< ClangArgument > &clangArguments)
Definition: Command.hpp:194
util::FilePath DependencyFile_
Definition: Command.hpp:243
std::vector< std::string > IncludePaths_
Definition: Command.hpp:245
static Node & Create(CommandGraph &commandGraph, std::unique_ptr< Command > command)
Command class.
Definition: Command.hpp:30
virtual void Run() const
Definition: Command.cpp:58
virtual std::string ToString() const =0
const util::FilePath & InputFile() const noexcept
Definition: Command.hpp:621
util::FilePath HarnessFile() const noexcept
Definition: Command.hpp:615
~JlmHlsCommand() noexcept override
util::FilePath OutputFolder_
Definition: Command.hpp:639
std::string ToString() const override
Definition: Command.cpp:749
util::FilePath FirrtlFile() const noexcept
Definition: Command.hpp:597
std::vector< std::string > Options
Definition: Command.hpp:640
util::FilePath LlvmFile() const noexcept
Definition: Command.hpp:603
static CommandGraph::Node & Create(CommandGraph &commandGraph, const util::FilePath &inputFile, const util::FilePath &outputFolder, const std::vector< std::string > &options)
Definition: Command.hpp:627
util::FilePath RefFile() const noexcept
Definition: Command.hpp:609
util::FilePath InputFile_
Definition: Command.hpp:638
const std::string & HlsFunctionName() const noexcept
Definition: Command.hpp:683
static CommandGraph::Node & Create(CommandGraph &commandGraph, const util::FilePath &inputFile, const std::string &hlsFunctionName, const util::FilePath &outputFolder)
Definition: Command.hpp:689
std::string ToString() const override
Definition: Command.cpp:762
JlmHlsExtractCommand(util::FilePath inputFile, util::FilePath outputFolder, std::string hlsFunctionName)
Definition: Command.hpp:652
util::FilePath HlsFunctionFile() const noexcept
Definition: Command.hpp:665
~JlmHlsExtractCommand() noexcept override
const util::FilePath & InputFile() const noexcept
Definition: Command.hpp:677
util::FilePath LlvmFile() const noexcept
Definition: Command.hpp:671
std::unique_ptr< llvm::LlvmRvsdgModule > ParseMlirIrFile(const util::FilePath &inputFile, util::StatisticsCollector &statisticsCollector) const
Definition: Command.cpp:475
JlmOptCommand(std::string programName, const JlmOptCommandLineOptions &commandLineOptions)
Definition: Command.cpp:291
static void PrintAsDot(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:604
static void PrintRvsdgModule(llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, const JlmOptCommandLineOptions::OutputFormat &outputFormat, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:629
static void PrintAsXml(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:527
static void PrintAsLlvm(llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:541
static void PrintAsAscii(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:507
std::unique_ptr< llvm::LlvmRvsdgModule > ParseLlvmIrFile(const util::FilePath &inputFile, util::StatisticsCollector &statisticsCollector) const
Definition: Command.cpp:447
static void PrintAsRvsdgTree(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:582
std::shared_ptr< rvsdg::Transformation > CreateTransformation(JlmOptCommandLineOptions::OptimizationId optimizationId) const
Definition: Command.cpp:400
void Run() const override
Definition: Command.cpp:346
JlmOptCommandLineOptions CommandLineOptions_
Definition: Command.hpp:431
std::string ToString() const override
Definition: Command.cpp:299
static CommandGraph::Node & Create(CommandGraph &commandGraph, std::string programName, const JlmOptCommandLineOptions &commandLineOptions)
Definition: Command.hpp:350
static void PrintAsMlir(const llvm::LlvmRvsdgModule &rvsdgModule, const util::FilePath &outputFile, util::StatisticsCollector &statisticsCollector)
Definition: Command.cpp:566
std::unique_ptr< llvm::LlvmRvsdgModule > ParseInputFile(const util::FilePath &inputFile, const JlmOptCommandLineOptions::InputFormat &inputFormat, util::StatisticsCollector &statisticsCollector) const
Definition: Command.cpp:487
const JlmOptCommandLineOptions & GetCommandLineOptions() const noexcept
Definition: Command.hpp:361
std::vector< std::shared_ptr< rvsdg::Transformation > > GetTransformations() const
Definition: Command.cpp:374
RelocationModel RelocationModel_
Definition: Command.hpp:328
util::FilePath InputFile_
Definition: Command.hpp:329
const util::FilePath & OutputFile() const noexcept
Definition: Command.hpp:302
std::string ToString() const override
Definition: Command.cpp:247
OptimizationLevel OptimizationLevel_
Definition: Command.hpp:327
LlcCommand(util::FilePath inputFile, util::FilePath outputFile, const OptimizationLevel &optimizationLevel, const RelocationModel &relocationModel)
Definition: Command.hpp:287
util::FilePath OutputFile_
Definition: Command.hpp:330
static CommandGraph::Node & Create(CommandGraph &commandGraph, const util::FilePath &inputFile, const util::FilePath &outputFile, const OptimizationLevel &optimizationLevel, const RelocationModel &relocationModel)
Definition: Command.hpp:308
util::FilePath OutputFile_
Definition: Command.hpp:569
std::string ToString() const override
Definition: Command.cpp:729
const std::vector< util::FilePath > & InputFiles() const noexcept
Definition: Command.hpp:550
static CommandGraph::Node & Create(CommandGraph &commandGraph, const std::vector< util::FilePath > &inputFiles, const util::FilePath &outputFile, bool writeLlvmAssembly, bool verbose)
Definition: Command.hpp:556
std::vector< util::FilePath > InputFiles_
Definition: Command.hpp:570
LlvmLinkCommand(std::vector< util::FilePath > inputFiles, util::FilePath outputFile, bool writeLlvmAssembly, bool verbose)
Definition: Command.hpp:529
~LlvmLinkCommand() noexcept override
const util::FilePath & OutputFile() const noexcept
Definition: Command.hpp:544
~LlvmOptCommand() noexcept override
util::FilePath OutputFile_
Definition: Command.hpp:514
util::FilePath InputFile_
Definition: Command.hpp:513
LlvmOptCommand(util::FilePath inputFile, util::FilePath outputFile, bool writeLlvmAssembly, std::vector< Optimization > optimizations)
Definition: Command.hpp:476
std::vector< Optimization > Optimizations_
Definition: Command.hpp:518
const util::FilePath & OutputFile() const noexcept
Definition: Command.hpp:491
std::string ToString() const override
Definition: Command.cpp:683
static CommandGraph::Node & Create(CommandGraph &commandGraph, const util::FilePath &inputFile, const util::FilePath &outputFile, bool writeLlvmAssembly, const std::vector< Optimization > &optimizations)
Definition: Command.hpp:497
static CommandGraph::Node & Create(CommandGraph &commandGraph, const util::FilePath &path)
Definition: Command.hpp:453
~MkdirCommand() noexcept override
std::string ToString() const override
Definition: Command.cpp:668
MkdirCommand(util::FilePath path)
Definition: Command.hpp:442
util::FilePath Path_
Definition: Command.hpp:460
void Run() const override
Definition: Command.cpp:674
std::unique_ptr< CommandGraph > CommandGraph_
Definition: Command.hpp:80
PrintCommandsCommand(PrintCommandsCommand &&)=delete
PrintCommandsCommand & operator=(const PrintCommandsCommand &)=delete
PrintCommandsCommand & operator=(PrintCommandsCommand &&)=delete
std::string ToString() const override
Definition: Command.cpp:72
void Run() const override
Definition: Command.cpp:78
static std::unique_ptr< CommandGraph > Create(std::unique_ptr< CommandGraph > commandGraph)
Definition: Command.cpp:88
PrintCommandsCommand(const PrintCommandsCommand &)=delete
PrintCommandsCommand(std::unique_ptr< CommandGraph > commandGraph)
Definition: Command.hpp:49
static CommandGraph::Node & Create(CommandGraph &commandGraph, std::unique_ptr< CommandGraph > printedCommandGraph)
Definition: Command.hpp:74
FilePath WithSuffix(const std::string &suffix) const
Definition: file.hpp:211
Global memory state passed between functions.