MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / splitDeviceCode

Method splitDeviceCode

lib/compilers/clang.ts:226–243  ·  view source on GitHub ↗
(assembly: string)

Source from the content-addressed store, hash-verified

224 }
225
226 async splitDeviceCode(assembly: string) {
227 // Check to see if there is any offload code in the assembly file.
228 if (!offloadRegexp.test(assembly)) return null;
229
230 offloadRegexp.lastIndex = 0;
231 const matches = assembly.matchAll(offloadRegexp);
232 let prevStart = 0;
233 const devices: Record<string, string> = {};
234 for (const match of matches) {
235 const [full, startOrEnd, triple] = match;
236 if (startOrEnd === '__START__') {
237 prevStart = match.index + full.length + 1;
238 } else {
239 devices[triple] = assembly.substring(prevStart, match.index);
240 }
241 }
242 return devices;
243 }
244
245 override async extractDeviceCode(result, filters: ParseFiltersAndOutputOptions, compilationInfo: CompilationInfo) {
246 const split = await this.splitDeviceCode(result.asm);

Callers 2

extractDeviceCodeMethod · 0.95
clang-tests.tsFile · 0.80

Calls 1

testMethod · 0.80

Tested by

no test coverage detected