Skip to content

Commit af290b5

Browse files
committed
Rename opencl-c headers into opencl-c-intel
1 parent fe06526 commit af290b5

File tree

6 files changed

+56
-51
lines changed

6 files changed

+56
-51
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ if(NOT USE_PREBUILT_LLVM)
171171
${CMAKE_CURRENT_SOURCE_DIR}/patches/spirv
172172
${SPIRV_BASE_REVISION}
173173
${TARGET_BRANCH})
174+
# Prepare opencl-c-intel.h and opencl-c-intel-base.h file
175+
file(READ "${CLANG_SOURCE_DIR}/lib/Headers/opencl-c.h" opencl_c_old)
176+
string(REGEX REPLACE "#include \"opencl-c-base\.h\"" "#include \"opencl-c-intel-base.h\"" opencl_c_intel_new ${opencl_c_old})
177+
file(WRITE "${CLANG_SOURCE_DIR}/lib/Headers/opencl-c-intel.h" ${opencl_c_intel_new})
178+
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CLANG_SOURCE_DIR}/lib/Headers/opencl-c-base.h" "${CLANG_SOURCE_DIR}/lib/Headers/opencl-c-intel-base.h")
174179
endif(NOT USE_PREBUILT_LLVM)
175180

176181
#

cl_headers/CMakeLists.txt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ if(USE_PREBUILT_LLVM)
3131
else(USE_PREBUILT_LLVM)
3232
set(OPENCL_HEADERS_DIR "${CLANG_SOURCE_DIR}/lib/Headers")
3333
endif(USE_PREBUILT_LLVM)
34-
copy_file(${OPENCL_HEADERS_DIR}/opencl-c.h opencl-c.h)
35-
copy_file(${OPENCL_HEADERS_DIR}/opencl-c-base.h opencl-c-base.h)
34+
copy_file(${OPENCL_HEADERS_DIR}/opencl-c-intel.h opencl-c-intel.h)
35+
copy_file(${OPENCL_HEADERS_DIR}/opencl-c-intel-base.h opencl-c-intel-base.h)
3636
copy_file(${CMAKE_CURRENT_SOURCE_DIR}/module.modulemap module.modulemap)
3737

3838
add_custom_target (
3939
opencl.headers.target
4040
DEPENDS
4141
module.modulemap
42-
opencl-c.h
43-
opencl-c-base.h
42+
opencl-c-intel.h
43+
opencl-c-intel-base.h
4444
)
4545

4646
function(create_pcm DST MODULE HEADER OPTS DEPS)
@@ -77,19 +77,19 @@ else()
7777
endif()
7878

7979
set(OPTS -cl-ext=+all,-cl_khr_fp64,-__opencl_c_fp64)
80-
create_pcm(opencl-c-12-spir.pcm cl12spir opencl-c-base.h "${SPIR_TRIPLE};${CL12};${OPTS}" "${DEPS}")
81-
create_pcm(opencl-c-20-spir.pcm cl20spir opencl-c-base.h "${SPIR_TRIPLE};${CL20};${OPTS}" "${DEPS}")
82-
create_pcm(opencl-c-30-spir.pcm cl30spir opencl-c-base.h "${SPIR_TRIPLE};${CL30};${OPTS};${OPTS30}" "${DEPS}")
83-
create_pcm(opencl-c-12-spir64.pcm cl12spir64 opencl-c-base.h "${SPIR64_TRIPLE};${CL12};${OPTS}" "${DEPS}")
84-
create_pcm(opencl-c-20-spir64.pcm cl20spir64 opencl-c-base.h "${SPIR64_TRIPLE};${CL20};${OPTS}" "${DEPS}")
85-
create_pcm(opencl-c-30-spir64.pcm cl30spir64 opencl-c-base.h "${SPIR64_TRIPLE};${CL30};${OPTS};${OPTS30}" "${DEPS}")
80+
create_pcm(opencl-c-12-spir.pcm cl12spir opencl-c-intel-base.h "${SPIR_TRIPLE};${CL12};${OPTS}" "${DEPS}")
81+
create_pcm(opencl-c-20-spir.pcm cl20spir opencl-c-intel-base.h "${SPIR_TRIPLE};${CL20};${OPTS}" "${DEPS}")
82+
create_pcm(opencl-c-30-spir.pcm cl30spir opencl-c-intel-base.h "${SPIR_TRIPLE};${CL30};${OPTS};${OPTS30}" "${DEPS}")
83+
create_pcm(opencl-c-12-spir64.pcm cl12spir64 opencl-c-intel-base.h "${SPIR64_TRIPLE};${CL12};${OPTS}" "${DEPS}")
84+
create_pcm(opencl-c-20-spir64.pcm cl20spir64 opencl-c-intel-base.h "${SPIR64_TRIPLE};${CL20};${OPTS}" "${DEPS}")
85+
create_pcm(opencl-c-30-spir64.pcm cl30spir64 opencl-c-intel-base.h "${SPIR64_TRIPLE};${CL30};${OPTS};${OPTS30}" "${DEPS}")
8686
set(OPTS -cl-ext=+all)
87-
create_pcm(opencl-c-12-spir-fp64.pcm cl12spirfp64 opencl-c-base.h "${SPIR_TRIPLE};${CL12};${OPTS}" "${DEPS}")
88-
create_pcm(opencl-c-20-spir-fp64.pcm cl20spirfp64 opencl-c-base.h "${SPIR_TRIPLE};${CL20};${OPTS}" "${DEPS}")
89-
create_pcm(opencl-c-30-spir-fp64.pcm cl30spirfp64 opencl-c-base.h "${SPIR_TRIPLE};${CL30};${OPTS};${OPTS30};${OPTS30_FP64}" "${DEPS}")
90-
create_pcm(opencl-c-12-spir64-fp64.pcm cl12spir64fp64 opencl-c-base.h "${SPIR64_TRIPLE};${CL12};${OPTS}" "${DEPS}")
91-
create_pcm(opencl-c-20-spir64-fp64.pcm cl20spir64fp64 opencl-c-base.h "${SPIR64_TRIPLE};${CL20};${OPTS}" "${DEPS}")
92-
create_pcm(opencl-c-30-spir64-fp64.pcm cl30spir64fp64 opencl-c-base.h "${SPIR64_TRIPLE};${CL30};${OPTS};${OPTS30};${OPTS30_FP64}" "${DEPS}")
87+
create_pcm(opencl-c-12-spir-fp64.pcm cl12spirfp64 opencl-c-intel-base.h "${SPIR_TRIPLE};${CL12};${OPTS}" "${DEPS}")
88+
create_pcm(opencl-c-20-spir-fp64.pcm cl20spirfp64 opencl-c-intel-base.h "${SPIR_TRIPLE};${CL20};${OPTS}" "${DEPS}")
89+
create_pcm(opencl-c-30-spir-fp64.pcm cl30spirfp64 opencl-c-intel-base.h "${SPIR_TRIPLE};${CL30};${OPTS};${OPTS30};${OPTS30_FP64}" "${DEPS}")
90+
create_pcm(opencl-c-12-spir64-fp64.pcm cl12spir64fp64 opencl-c-intel-base.h "${SPIR64_TRIPLE};${CL12};${OPTS}" "${DEPS}")
91+
create_pcm(opencl-c-20-spir64-fp64.pcm cl20spir64fp64 opencl-c-intel-base.h "${SPIR64_TRIPLE};${CL20};${OPTS}" "${DEPS}")
92+
create_pcm(opencl-c-30-spir64-fp64.pcm cl30spir64fp64 opencl-c-intel-base.h "${SPIR64_TRIPLE};${CL30};${OPTS};${OPTS30};${OPTS30_FP64}" "${DEPS}")
9393

9494
add_custom_target (
9595
opencl.pcm.target
@@ -121,11 +121,11 @@ endfunction(pack_to_obj)
121121
if(WIN32)
122122
list(APPEND CL_HEADERS_SRC OpenCL.rc)
123123
else()
124-
pack_to_obj(opencl-c.h opencl-c.h.cpp "PCM_OPENCL_C_H")
125-
pack_to_obj(opencl-c-base.h opencl-c-base.h.cpp "PCM_OPENCL_C_BASE_H")
124+
pack_to_obj(opencl-c-intel.h opencl-c-intel.h.cpp "PCM_OPENCL_C_H")
125+
pack_to_obj(opencl-c-intel-base.h opencl-c-intel-base.h.cpp "PCM_OPENCL_C_BASE_H")
126126
list(APPEND CL_HEADERS_SRC
127-
opencl-c.h.cpp
128-
opencl-c-base.h.cpp
127+
opencl-c-intel.h.cpp
128+
opencl-c-intel-base.h.cpp
129129
opencl-c-12-spir.mod.cpp
130130
opencl-c-20-spir.mod.cpp
131131
opencl-c-30-spir.mod.cpp
@@ -164,8 +164,8 @@ add_library(${CL_HEADERS_LIB} OBJECT
164164

165165
add_dependencies(${CL_HEADERS_LIB} opencl.pcm.target)
166166
install(FILES
167-
${CMAKE_CURRENT_BINARY_DIR}/opencl-c.h
168-
${CMAKE_CURRENT_BINARY_DIR}/opencl-c-base.h
167+
${CMAKE_CURRENT_BINARY_DIR}/opencl-c-intel.h
168+
${CMAKE_CURRENT_BINARY_DIR}/opencl-c-intel-base.h
169169
${CMAKE_CURRENT_BINARY_DIR}/module.modulemap
170170
DESTINATION include/cclang
171171
)

cl_headers/OpenCL.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ END
1111
// Module with OpenCL C declarations with corresponding headers
1212
//
1313

14-
OPENCL_C_H PCM "opencl-c.h"
15-
OPENCL_C_BASE_H PCM "opencl-c-base.h"
14+
OPENCL_C_H PCM "opencl-c-intel.h"
15+
OPENCL_C_BASE_H PCM "opencl-c-intel-base.h"
1616
OPENCL_C_12_SPIR_PCM PCM "opencl-c-12-spir.pcm"
1717
OPENCL_C_20_SPIR_PCM PCM "opencl-c-20-spir.pcm"
1818
OPENCL_C_30_SPIR_PCM PCM "opencl-c-30-spir.pcm"

cl_headers/module.modulemap

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
module cl12spir {
2-
header "opencl-c.h"
3-
header "opencl-c-base.h"
2+
header "opencl-c-intel.h"
3+
header "opencl-c-intel-base.h"
44
export *
55
}
66
module cl20spir {
7-
header "opencl-c.h"
8-
header "opencl-c-base.h"
7+
header "opencl-c-intel.h"
8+
header "opencl-c-intel-base.h"
99
export *
1010
}
1111
module cl30spir {
12-
header "opencl-c.h"
13-
header "opencl-c-base.h"
12+
header "opencl-c-intel.h"
13+
header "opencl-c-intel-base.h"
1414
export *
1515
}
1616
module cl12spir64 {
17-
header "opencl-c.h"
18-
header "opencl-c-base.h"
17+
header "opencl-c-intel.h"
18+
header "opencl-c-intel-base.h"
1919
export *
2020
}
2121
module cl20spir64 {
22-
header "opencl-c.h"
23-
header "opencl-c-base.h"
22+
header "opencl-c-intel.h"
23+
header "opencl-c-intel-base.h"
2424
export *
2525
}
2626
module cl30spir64 {
27-
header "opencl-c.h"
28-
header "opencl-c-base.h"
27+
header "opencl-c-intel.h"
28+
header "opencl-c-intel-base.h"
2929
export *
3030
}
3131
module cl12spirfp64 {
32-
header "opencl-c.h"
33-
header "opencl-c-base.h"
32+
header "opencl-c-intel.h"
33+
header "opencl-c-intel-base.h"
3434
export *
3535
}
3636
module cl20spirfp64 {
37-
header "opencl-c.h"
38-
header "opencl-c-base.h"
37+
header "opencl-c-intel.h"
38+
header "opencl-c-intel-base.h"
3939
export *
4040
}
4141
module cl30spirfp64 {
42-
header "opencl-c.h"
43-
header "opencl-c-base.h"
42+
header "opencl-c-intel.h"
43+
header "opencl-c-intel-base.h"
4444
export *
4545
}
4646
module cl12spir64fp64 {
47-
header "opencl-c.h"
48-
header "opencl-c-base.h"
47+
header "opencl-c-intel.h"
48+
header "opencl-c-intel-base.h"
4949
export *
5050
}
5151
module cl20spir64fp64 {
52-
header "opencl-c.h"
53-
header "opencl-c-base.h"
52+
header "opencl-c-intel.h"
53+
header "opencl-c-intel-base.h"
5454
export *
5555
}
5656
module cl30spir64fp64 {
57-
header "opencl-c.h"
58-
header "opencl-c-base.h"
57+
header "opencl-c-intel.h"
58+
header "opencl-c-intel-base.h"
5959
export *
6060
}

opencl_clang.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ static bool GetHeaders(std::vector<Resource> &Result) {
112112
struct {
113113
const char *ID;
114114
const char *Name;
115-
} Headers[] = {{OPENCL_C_H, "opencl-c.h"},
116-
{OPENCL_C_BASE_H, "opencl-c-base.h"},
115+
} Headers[] = {{OPENCL_C_H, "opencl-c-intel.h"},
116+
{OPENCL_C_BASE_H, "opencl-c-intel-base.h"},
117117
{OPENCL_C_12_SPIR_PCM, "opencl-c-12-spir.pcm"},
118118
{OPENCL_C_20_SPIR_PCM, "opencl-c-20-spir.pcm"},
119119
{OPENCL_C_30_SPIR_PCM, "opencl-c-30-spir.pcm"},

options_compile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ std::string EffectiveOptionsFilter::processOptions(const OpenCLArgList &args,
210210
effectiveArgs.push_back(szTriple);
211211

212212
effectiveArgs.push_back("-include");
213-
effectiveArgs.push_back("opencl-c.h");
213+
effectiveArgs.push_back("opencl-c-intel.h");
214214

215215
// Don't optimize in the frontend
216216
// clang defaults to -O0, and in that mode, does not produce IR that is

0 commit comments

Comments
 (0)