Jlm
Loading...
Searching...
No Matches
jlm
tooling
CommandGraphGenerator.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2022 Nico Reißmann <nico.reissmann@gmail.com>
3
* See COPYING for terms of redistribution.
4
*/
5
6
#ifndef JLM_TOOLING_COMMANDGRAPHGENERATOR_HPP
7
#define JLM_TOOLING_COMMANDGRAPHGENERATOR_HPP
8
9
#include <
jlm/tooling/Command.hpp
>
10
#include <
jlm/tooling/CommandLine.hpp
>
11
12
#include <memory>
13
14
namespace
jlm::tooling
15
{
16
17
class
CommandGraph;
18
22
template
<
class
T>
23
class
CommandGraphGenerator
24
{
25
static_assert
(
26
std::is_base_of<CommandLineOptions, T>::value,
27
"T is not derived from CommandLineOptions."
);
28
29
public
:
30
virtual
~CommandGraphGenerator
() noexcept = default;
31
38
[[nodiscard]] virtual std::unique_ptr<
CommandGraph
>
39
GenerateCommandGraph
(const T & commandLineOptions) = 0;
40
};
41
45
class
JlcCommandGraphGenerator
final : public
CommandGraphGenerator
<
JlcCommandLineOptions
>
46
{
47
public
:
48
~JlcCommandGraphGenerator
() noexcept override;
49
50
JlcCommandGraphGenerator
() = default;
51
52
[[nodiscard]] std::unique_ptr<
CommandGraph
>
53
GenerateCommandGraph
(const
JlcCommandLineOptions
& commandLineOptions) override;
54
55
[[nodiscard]] static std::unique_ptr<
CommandGraph
>
56
Generate(const
JlcCommandLineOptions
& commandLineOptions)
57
{
58
JlcCommandGraphGenerator
commandLineGenerator;
59
return
commandLineGenerator.
GenerateCommandGraph
(commandLineOptions);
60
}
61
62
private
:
63
static
util::FilePath
64
CreateJlmOptCommandOutputFile(
const
util::FilePath
& inputFile);
65
66
static
util::FilePath
67
CreateParserCommandOutputFile(
const
util::FilePath
& inputFile);
68
69
static
ClangCommand::LanguageStandard
70
ConvertLanguageStandard(
const
JlcCommandLineOptions::LanguageStandard
& languageStandard);
71
72
static
LlcCommand::OptimizationLevel
73
ConvertOptimizationLevel(
const
JlcCommandLineOptions::OptimizationLevel
& optimizationLevel);
74
75
static
CommandGraph::Node
&
76
CreateParserCommand(
77
CommandGraph
& commandGraph,
78
const
util::FilePath
& outputFile,
79
const
JlcCommandLineOptions::Compilation
& compilation,
80
const
JlcCommandLineOptions
& commandLineOptions);
81
};
82
86
class
JhlsCommandGraphGenerator
final :
public
CommandGraphGenerator
<JhlsCommandLineOptions>
87
{
88
public
:
89
~JhlsCommandGraphGenerator
() noexcept override;
90
91
JhlsCommandGraphGenerator
() = default;
92
93
[[nodiscard]] std::unique_ptr<
CommandGraph
>
94
GenerateCommandGraph(const
JhlsCommandLineOptions
& commandLineOptions) override;
95
96
[[nodiscard]] static std::unique_ptr<
CommandGraph
>
97
Generate(const
JhlsCommandLineOptions
& commandLineOptions)
98
{
99
JhlsCommandGraphGenerator
commandLineGenerator;
100
return
commandLineGenerator.
GenerateCommandGraph
(commandLineOptions);
101
}
102
103
private
:
104
static
util::FilePath
105
CreateParserCommandOutputFile(
106
const
util::FilePath
& tmpDirectory,
107
const
util::FilePath
& inputFile);
108
109
static
util::FilePath
110
CreateJlmOptCommandOutputFile(
111
const
util::FilePath
& tmpDirectory,
112
const
util::FilePath
& inputFile);
113
114
static
ClangCommand::LanguageStandard
115
ConvertLanguageStandard(
const
JhlsCommandLineOptions::LanguageStandard
& languageStandard);
116
117
static
LlcCommand::OptimizationLevel
118
ConvertOptimizationLevel(
const
JhlsCommandLineOptions::OptimizationLevel
& optimizationLevel);
119
};
120
121
}
122
123
#endif
// JLM_TOOLING_COMMANDGRAPHGENERATOR_HPP
CommandLine.hpp
Command.hpp
jlm::tooling::ClangCommand::LanguageStandard
LanguageStandard
Definition
Command.hpp:91
jlm::tooling::CommandGraphGenerator
Definition
CommandGraphGenerator.hpp:24
jlm::tooling::CommandGraphGenerator::GenerateCommandGraph
virtual std::unique_ptr< CommandGraph > GenerateCommandGraph(const T &commandLineOptions)=0
jlm::tooling::CommandGraphGenerator::~CommandGraphGenerator
virtual ~CommandGraphGenerator() noexcept=default
jlm::tooling::CommandGraph::Node
Definition
CommandGraph.hpp:122
jlm::tooling::CommandGraph
Definition
CommandGraph.hpp:25
jlm::tooling::JhlsCommandGraphGenerator
Definition
CommandGraphGenerator.hpp:87
jlm::tooling::JhlsCommandGraphGenerator::~JhlsCommandGraphGenerator
~JhlsCommandGraphGenerator() noexcept override
jlm::tooling::JhlsCommandGraphGenerator::GenerateCommandGraph
std::unique_ptr< CommandGraph > GenerateCommandGraph(const JhlsCommandLineOptions &commandLineOptions) override
Definition
CommandGraphGenerator.cpp:266
jlm::tooling::JhlsCommandLineOptions
Definition
CommandLine.hpp:423
jlm::tooling::JhlsCommandLineOptions::OptimizationLevel
OptimizationLevel
Definition
CommandLine.hpp:428
jlm::tooling::JhlsCommandLineOptions::LanguageStandard
LanguageStandard
Definition
CommandLine.hpp:436
jlm::tooling::JlcCommandGraphGenerator
Definition
CommandGraphGenerator.hpp:46
jlm::tooling::JlcCommandGraphGenerator::GenerateCommandGraph
std::unique_ptr< CommandGraph > GenerateCommandGraph(const JlcCommandLineOptions &commandLineOptions) override
Definition
CommandGraphGenerator.cpp:107
jlm::tooling::JlcCommandGraphGenerator::~JlcCommandGraphGenerator
~JlcCommandGraphGenerator() noexcept override
jlm::tooling::JlcCommandLineOptions::Compilation
Definition
CommandLine.hpp:298
jlm::tooling::JlcCommandLineOptions
Definition
CommandLine.hpp:224
jlm::tooling::JlcCommandLineOptions::LanguageStandard
LanguageStandard
Definition
CommandLine.hpp:237
jlm::tooling::JlcCommandLineOptions::OptimizationLevel
OptimizationLevel
Definition
CommandLine.hpp:229
jlm::tooling::LlcCommand::OptimizationLevel
OptimizationLevel
Definition
Command.hpp:273
jlm::util::FilePath
Definition
file.hpp:19
jlm::tooling
Definition
Command.cpp:57
Generated by
1.9.8