@@ -79,133 +79,6 @@ endif()
79
79
80
80
# ========================================= Helper functions ===========================================
81
81
82
- # Creates custom commands which build precompiled header for built-in functions.
83
- #
84
- # igc_bif_build_pch(
85
- # OUTPUT outPchFilePath
86
- # TRIPLE archTriple
87
- # HEADERS srcHeaderFilePath [srcHeaderFilePath [...]]
88
- # [DEFINES define [define [...]]]
89
- # [CHAINED chainedPchFilePath]
90
- # [OPTIONS [option [option [...]]]]
91
- # )
92
- #
93
- # @param outPchFilePath Full path where output precompiled header should be written.
94
- # Output file is only updated if it does not exist or it was changed.
95
- # @param archTriple Identifier for target architecture for compiled header.
96
- # @param srcHeaderFilePath Path to source header which will be precompiled (multiple can be specified).
97
- # @param define Additional preprocessor definition (multiple can be specified).
98
- # @param chainedPchFilePath Path to precompiled header which will be chained with currently created
99
- # precompiled header.
100
- # @param option Additional compilation option (multiple can be specified).
101
- function (igc_bif_build_pch )
102
- set (_defines )
103
- set (_chainedPchFilePath )
104
- set (_chainedPchFilePathSet NO )
105
- set (_options )
106
-
107
- set (_parseState 0 )
108
- foreach (_compileArg ${ARGN} )
109
- string (REPLACE ";" "\; " _compileArg "${_compileArg} " )
110
-
111
- # States: [0] "OUTPUT" [1] <param> [2] "TRIPLE" [3] <param> [4] "HEADERS" [5] <param> [6] *<param> [6]
112
- # *1( "DEFINES" [7] <param> [8] *<param> [8] ) *1( "CHAINED" [9] <param> [10] ) *1( "OPTIONS" [11] *<param> [11] )
113
- # Transitions: 0 (OUTPUT) -> 1 -> 2 (TRIPLE) -> 3 -> 4 (HEADERS) -> 5 -> 6
114
- # 6 (DEFINES) -> 7 -> 8
115
- # 6 (CHAINED) -> 9 -> 10
116
- # 6 (OPTIONS) -> 11
117
- # 6 -> 6
118
- # 8 (CHAINED) -> 9 -> 10
119
- # 8 (OPTIONS) -> 11
120
- # 8 -> 8
121
- # 10 (OPTIONS) -> 11
122
- # 11 -> 11
123
- # Stop States: 6, 8, 10, 11
124
- if ((_parseState EQUAL 0 ) AND (_compileArg MATCHES "^OUTPUT$" ))
125
- set (_parseState 1 )
126
- elseif (_parseState EQUAL 1 )
127
- set (_outPchFilePath "${_compileArg} " )
128
- set (_parseState 2 )
129
- elseif ((_parseState EQUAL 2 ) AND (_compileArg MATCHES "^TRIPLE$" ))
130
- set (_parseState 3 )
131
- elseif (_parseState EQUAL 3 )
132
- set (_archTriple "${_compileArg} " )
133
- set (_parseState 4 )
134
- elseif ((_parseState EQUAL 4 ) AND (_compileArg MATCHES "^HEADERS$" ))
135
- set (_parseState 5 )
136
- elseif (_parseState EQUAL 5 )
137
- set (_srcHeaderFilePaths "${_compileArg} " )
138
- set (_parseState 6 )
139
- elseif (_parseState EQUAL 6 )
140
- if (_compileArg MATCHES "^DEFINES$" )
141
- set (_parseState 7 )
142
- elseif (_compileArg MATCHES "^CHAINED$" )
143
- set (_parseState 9 )
144
- elseif (_compileArg MATCHES "^OPTIONS$" )
145
- set (_parseState 11 )
146
- else ()
147
- list (APPEND _srcHeaderFilePaths "${_compileArg} " )
148
- endif ()
149
- elseif (_parseState EQUAL 7 )
150
- set (_defines "${_compileArg} " )
151
- set (_parseState 8 )
152
- elseif (_parseState EQUAL 8 )
153
- if (_compileArg MATCHES "^CHAINED$" )
154
- set (_parseState 9 )
155
- elseif (_compileArg MATCHES "^OPTIONS$" )
156
- set (_parseState 11 )
157
- else ()
158
- list (APPEND _defines "${_compileArg} " )
159
- endif ()
160
- elseif (_parseState EQUAL 9 )
161
- set (_chainedPchFilePath "${_compileArg} " )
162
- set (_chainedPchFilePathSet YES )
163
- set (_parseState 10 )
164
- elseif ((_parseState EQUAL 10 ) AND (_compileArg MATCHES "^OPTIONS$" ))
165
- set (_parseState 11 )
166
- elseif (_parseState EQUAL 11 )
167
- list (APPEND _options "${_compileArg} " )
168
- else ()
169
- message (FATAL_ERROR "Invalid parameter token near \" ${_compileArg} \" ." )
170
- endif ()
171
- endforeach ()
172
- if (NOT ((_parseState EQUAL 6 ) OR (_parseState EQUAL 8 ) OR (_parseState EQUAL 10 ) OR (_parseState EQUAL 11 )))
173
- message (FATAL_ERROR "Invalid number of parameters." )
174
- endif ()
175
-
176
-
177
- get_filename_component (_outPchFileName "${_outPchFilePath} " NAME )
178
- get_filename_component (_outPchFileDir "${_outPchFilePath} " PATH )
179
- set (_pchTempFilePath "${_outPchFilePath} _pch.tmp" )
180
-
181
- set (_defineFlags )
182
- foreach (_define ${_defines} )
183
- string (REPLACE ";" "\; " _define "${_define} " )
184
- list (APPEND _defineFlags "-D${_define} " )
185
- endforeach ()
186
-
187
- if (_chainedPchFilePathSet )
188
- set (_chainedPchFlags "-include-pch" "${_chainedPchFilePath} " )
189
- else ()
190
- set (_chainedPchFlags )
191
- endif ()
192
-
193
- # Header precompilation is triggered by CLANG change, change of source headers or change in chained precompiled header.
194
- add_custom_command (
195
- OUTPUT "${_pchTempFilePath} "
196
- COMMAND "${CMAKE_COMMAND} " -E make_directory "${_outPchFileDir} "
197
- COMMAND clang-tool -cc1 -x cl -fblocks -fpreserve-vec3-type -Os -opencl-builtins "-triple=${_archTriple} " -cl-std=CL2.0 -emit-pch -o "${_pchTempFilePath} " ${_chainedPchFlags} ${_defineFlags} ${_options} ${_srcHeaderFilePaths}
198
- DEPENDS clang-tool ${_chainedPchFilePath} ${_srcHeaderFilePaths}
199
- COMMENT "BiF: Building OpenCL precompiled header: \" ${_outPchFileName} \" "
200
- )
201
- add_custom_command (
202
- OUTPUT "${_outPchFilePath} "
203
- COMMAND "${CMAKE_COMMAND} " -E copy_if_different "${_pchTempFilePath} " "${_outPchFilePath} "
204
- DEPENDS "${_pchTempFilePath} "
205
- COMMENT "BiF: Updating precompiled header \" ${_outPchFileName} \" if changed."
206
- )
207
- endfunction ()
208
-
209
82
# ======================================================================================================
210
83
211
84
# Creates custom command which builds LLVM Bitcode file for built-in functions.
@@ -701,34 +574,6 @@ else()
701
574
set (PCH_OPTIONS ${CL_OPTIONS} )
702
575
endif ()
703
576
704
- set (IGC_BUILD__BIF_RS_PCH_SRC "${IGC_OPTION__BIF_SRC_RS_DIR} /rs_pch.h" )
705
- set (IGC_BUILD__BIF_RS_PCH32 "${IGC_BUILD__BIF_DIR} /rs32.pch" )
706
- set (IGC_BUILD__BIF_RS_PCH64 "${IGC_BUILD__BIF_DIR} /rs64.pch" )
707
-
708
- igc_bif_build_pch (
709
- OUTPUT "${IGC_BUILD__BIF_RS_PCH32} "
710
- TRIPLE spir
711
- HEADERS "${IGC_BUILD__BIF_RS_PCH_SRC} "
712
- DEFINES "__32bit__=1" "cl_khr_fp64"
713
- OPTIONS ${PCH_OPTIONS}
714
- )
715
-
716
- igc_bif_build_pch (
717
- OUTPUT "${IGC_BUILD__BIF_RS_PCH64} "
718
- TRIPLE spir64
719
- HEADERS "${IGC_BUILD__BIF_RS_PCH_SRC} "
720
- OPTIONS ${PCH_OPTIONS}
721
- )
722
-
723
- # ======================================================================================================
724
- #concat files function
725
- # @param in_file input file.
726
- # @param out_file output file.
727
- function (cat in_file out_file )
728
- file (READ ${in_file} CONTENTS )
729
- file (APPEND ${out_file} "${CONTENTS} " )
730
- endfunction ()
731
-
732
577
# ============================================ Building .bc =============================================
733
578
734
579
# All:
0 commit comments