Skip to content

Commit 3f80901

Browse files
aus-intelsys_zuul
authored andcommitted
Remove indirection for input args
AdaptorCM has four classes related to translation input arguments. Remove extra layers of indirection for input arguments. Removed fields were not used anyway. Change-Id: Ic514cc355dd93116d0b46dc09ca4089c9591ccde
1 parent 51e187a commit 3f80901

File tree

5 files changed

+14
-115
lines changed

5 files changed

+14
-115
lines changed

IGC/AdaptorOCL/ocl_igc_interface/impl/fcl_ocl_translation_ctx_impl.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5050
#include <vector>
5151

5252
#if !defined(WDDM_LINUX) && (!defined(IGC_VC_DISABLED) || !IGC_VC_DISABLED)
53-
#include "CMFE/AdaptorCM/cm_args.h"
53+
#include "CMFE/AdaptorCM/Frontend.h"
5454
#endif // !defined(WDDM_LINUX) && (!defined(IGC_VC_DISABLED) || !IGC_VC_DISABLED)
5555

5656
#include "cif/macros/enable.h"
@@ -146,17 +146,14 @@ void runFeInvocation(const InvocationInfo& Invocation,
146146
return;
147147
}
148148

149-
IGC::CM::FeInputArgsImpl InputArgs;
149+
IGC::AdaptorCM::Frontend::InputArgs InputArgs;
150150
InputArgs.InputText = InputText;
151151
InputArgs.CompilationOpts = Invocation.getFEArgs();
152-
(void)InputArgs.ExtraFiles; // !!! extra files are not used at the moment
153-
// InputArgs.SupportDirs = SupportDirs;
154-
InputArgs.OutputFormat = IGC::AdaptorCM::Frontend::IInputArgs::FormatT::SPIR_V_BC;
155152

156153
using FEOutput = IGC::AdaptorCM::Frontend::IOutputArgs;
157154
auto FeDeleter = [](FEOutput* out) { out->discard(); };
158155
std::unique_ptr<FEOutput, decltype(FeDeleter)> Res(
159-
IGC::AdaptorCM::Frontend::translate(&InputArgs),
156+
IGC::AdaptorCM::Frontend::translate(InputArgs),
160157
FeDeleter);
161158

162159
if (!Res) {

IGC/CMFE/AdaptorCM/Frontend.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <sstream>
1010

1111
#include "Frontend.h"
12-
#include "InputArgsWrapper.h"
1312

1413
#if defined(__linux__)
1514
#include <dlfcn.h>
@@ -91,12 +90,7 @@ IGC::AdaptorCM::Frontend::getDriverInvocation(int argc, const char * argv[]) {
9190
return BuildCommandLine(argc, argv);
9291
}
9392

94-
IOutputArgs *IGC::AdaptorCM::Frontend::translate(const IInputArgs *Input) {
95-
96-
if (!Input) {
97-
llvm::report_fatal_error("empty input passed to AdaptorCM::Translate", false);
98-
}
99-
93+
IOutputArgs *IGC::AdaptorCM::Frontend::translate(const InputArgs &Input) {
10094
auto DL = getFELibrary();
10195

10296
auto Compile = reinterpret_cast<decltype(&IntelCMClangFECompile)>(
@@ -106,13 +100,7 @@ IOutputArgs *IGC::AdaptorCM::Frontend::translate(const IInputArgs *Input) {
106100
"haven't found IntelCMClangFECompile function in the dynamic library", false);
107101
}
108102

109-
InputArgsWrapper::ErrorType Error;
110-
InputArgsWrapper WrappedInput(*Input, Error);
111-
if (!Error.empty()) {
112-
llvm::report_fatal_error(Error, false);
113-
}
114-
115-
return Compile(&WrappedInput);
103+
return Compile(&Input);
116104
}
117105

118106
using StringVect_t = IGC::AdaptorCM::Frontend::StringVect_t;

IGC/CMFE/AdaptorCM/Frontend.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@ namespace IGC {
77
namespace AdaptorCM {
88
namespace Frontend {
99

10-
struct IInputArgs {
11-
using StrT = Intel::CM::ClangFE::IInputArgs::StrT;
12-
template <typename T> using SeqT = Intel::CM::ClangFE::IInputArgs::SeqT<T>;
13-
// output formats
14-
enum class FormatT { LLVM_IR, LLVM_IR_BC, SPIR_V_BC, PREPROC };
15-
16-
virtual const StrT &getSrc() const = 0;
17-
virtual const SeqT<StrT> &getCompOpts() const = 0;
18-
virtual const SeqT<StrT> &getExtraFiles() const = 0;
19-
virtual const SeqT<StrT> &getSupportDirs() const = 0;
20-
21-
virtual FormatT getOutputFormat() const = 0;
22-
virtual ~IInputArgs() {}
10+
struct InputArgs final : public Intel::CM::ClangFE::IInputArgs {
11+
StrT InputText;
12+
SeqT<StrT> CompilationOpts;
13+
SeqT<FileT<StrT>> ExtraFiles;
14+
15+
const StrT &getSrc() const override { return InputText; }
16+
const SeqT<StrT> &getCompOpts() const override { return CompilationOpts; }
17+
const SeqT<FileT<StrT>> &getExtraFiles() const override { return ExtraFiles; }
2318
};
2419

2520
using StringVect_t = std::vector<std::string>;
@@ -34,7 +29,7 @@ struct AbiCompatibilityInfo {
3429
};
3530
bool validateABICompatibility(AbiCompatibilityInfo *AbiInfo = nullptr);
3631

37-
IOutputArgs *translate(const IInputArgs *);
32+
IOutputArgs *translate(const InputArgs &);
3833

3934
IDriverInvocation *getDriverInvocation(int argc, const char * argv[]);
4035

IGC/CMFE/AdaptorCM/InputArgsWrapper.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

IGC/CMFE/AdaptorCM/cm_args.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)