Skip to content

Commit 56fd8f1

Browse files
bokrzesiigcbot
authored andcommitted
[LLVM16] Adjusting InternalOptions/ApiOptions to newer LLVM
Porting IGC code to LLVM16 * Adjusting InternalOptions/ApiOptions to newer LLVM
1 parent 1d8b14f commit 56fd8f1

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

IGC/Options/src/Options.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ SPDX-License-Identifier: MIT
77
============================= end_copyright_notice ===========================*/
88

99
#include "igc/Options/Options.h"
10-
1110
#include <llvm/Option/Option.h>
11+
#include <llvmWrapper/Option/OptTable.h>
1212

1313
using namespace IGC::options;
1414
using namespace llvm::opt;
1515
using llvm::raw_ostream;
1616

17-
#define PREFIX(NAME, VALUE) static const char *const API_##NAME[] = VALUE;
17+
#define PREFIX(NAME, VALUE) static IGCLLVM::OptPrefixUnionTy API_##NAME = VALUE;
1818
#include "igc/Options/ApiOptions.inc"
1919
#undef PREFIX
2020

21-
#define PREFIX(NAME, VALUE) static const char *const INTERNAL_##NAME[] = VALUE;
21+
#define PREFIX(NAME, VALUE) static IGCLLVM::OptPrefixUnionTy INTERNAL_##NAME = VALUE;
2222
#include "igc/Options/InternalOptions.inc"
2323
#undef PREFIX
2424

@@ -52,9 +52,9 @@ static const OptTable::Info InternalInfoTable[] = {
5252
};
5353

5454
namespace {
55-
class IGCApiOptTable : public OptTable {
55+
class IGCApiOptTable : public IGCLLVM::GenericOptTable {
5656
public:
57-
IGCApiOptTable() : OptTable(ApiInfoTable) {
57+
IGCApiOptTable() : IGCLLVM::GenericOptTable(ApiInfoTable) {
5858
OptTable &Opt = *this;
5959
(void)Opt;
6060
#define OPTTABLE_ARG_INIT
@@ -63,9 +63,9 @@ class IGCApiOptTable : public OptTable {
6363
}
6464
};
6565

66-
class IGCInternalOptTable : public OptTable {
66+
class IGCInternalOptTable : public IGCLLVM::GenericOptTable {
6767
public:
68-
IGCInternalOptTable() : OptTable(InternalInfoTable) {
68+
IGCInternalOptTable() : IGCLLVM::GenericOptTable(InternalInfoTable) {
6969
OptTable &Opt = *this;
7070
(void)Opt;
7171
#define OPTTABLE_ARG_INIT

IGC/WrapperLLVM/include/llvmWrapper/Option/OptTable.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,24 @@ SPDX-License-Identifier: MIT
1212
#include "llvm/Config/llvm-config.h"
1313
#include "llvm/Option/OptTable.h"
1414
#include "llvm/Support/raw_ostream.h"
15+
#include <llvm/ADT/ArrayRef.h>
1516

1617
namespace IGCLLVM {
18+
19+
using GenericOptTable =
20+
#if LLVM_VERSION_MAJOR >= 16
21+
llvm::opt::GenericOptTable;
22+
#else // LLVM_VERSION_MAJOR
23+
llvm::opt::OptTable;
24+
#endif // LLVM_VERSION_MAJOR
25+
26+
using OptPrefixUnionTy =
27+
#if LLVM_VERSION_MAJOR >= 16
28+
llvm::ArrayRef<llvm::StringLiteral>;
29+
#else // LLVM_VERSION_MAJOR
30+
const char* const [];
31+
#endif // LLVM_VERSION_MAJOR
32+
1733
inline void printHelp(const llvm::opt::OptTable &Options, llvm::raw_ostream &OS,
1834
const char *Usage, const char *Title,
1935
unsigned FlagsToInclude, unsigned FlagsToExclude,

0 commit comments

Comments
 (0)