aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-11-02 00:02:37 -0400
committerkcbanner <kcbanner@gmail.com>2023-11-05 20:34:13 -0500
commitce293c982e1b6d9db775e02fefb8905caa4ee748 (patch)
treebb3a9a7ef4746efaeb656857aff91172520ee309 /src/codegen/spirv
parent58789cb054b16e87d0a9b69ed8484cd30664fdb0 (diff)
downloadzig-ce293c982e1b6d9db775e02fefb8905caa4ee748.tar.gz
zig-ce293c982e1b6d9db775e02fefb8905caa4ee748.zip
cbe: avoid collisions with builtins and intrinsics
Changes: - Add `isMangledIdent` to determine if `fmtIdent` would make any edits to the identifier - Any function that has a mangled identifier is referred to using the mangled identifer within the current file, but if it is exported the first export will be with the non-mangled name. - Add `zig_import` to import a symbol under a different name - Add a level of indirection to float function names. Now, they are referred to as `zig_float_fn_<float type>_<operation>`. The definitions in zig.h are wrapped with `zig_import` to import the symbol under the real name. The specific problem that sparked this change was the combination of `zig_libc_name_f80(name) __##name##x` with the input `fma`, resulting in `__fmax`, which is a new intrinsic in recent versions of cl.exe. With the above changes in place, compiler_rt can output the following: ``` static zig_weak_linkage_fn zig_f80 zig_e___fmax(zig_f80, zig_f80, zig_f80); zig_export(zig_weak_linkage_fn zig_f80 zig_e___fmax(zig_f80, zig_f80, zig_f80), __fmax, "__fmax"); ``` Within compiler_rt, `zig_e___fmax` is used to refer to the function, but consumers will import `__fmax`, which maps to their `zig_float_fn_f80_fma` definition from zig.h.
Diffstat (limited to 'src/codegen/spirv')
0 files changed, 0 insertions, 0 deletions