aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorgwenzek <gwenzek@users.noreply.github.com>2022-02-05 15:33:00 +0100
committerGitHub <noreply@github.com>2022-02-05 16:33:00 +0200
commit0e1afb4d986c3316c6f024be50612b0a6c66777b (patch)
tree7b2bc69ae80604165ce4d11bf72ef104d4b51f86 /src/codegen/llvm.zig
parentfbc06f9c9151205896fb167b087506d6580946c4 (diff)
downloadzig-0e1afb4d986c3316c6f024be50612b0a6c66777b.tar.gz
zig-0e1afb4d986c3316c6f024be50612b0a6c66777b.zip
stage2: add support for Nvptx target
sample command: /home/guw/github/zig/stage2/bin/zig build-obj cuda_kernel.zig -target nvptx64-cuda -O ReleaseSafe this will create a kernel.ptx expose PtxKernel call convention from LLVM kernels are `export fn f() callconv(.PtxKernel)`
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 81742d4866..08fc3879a9 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -378,7 +378,7 @@ pub const Object = struct {
const mod = comp.bin_file.options.module.?;
const cache_dir = mod.zig_cache_artifact_directory;
- const emit_bin_path: ?[*:0]const u8 = if (comp.bin_file.options.emit) |emit|
+ var emit_bin_path: ?[*:0]const u8 = if (comp.bin_file.options.emit) |emit|
try emit.basenamePath(arena, try arena.dupeZ(u8, comp.bin_file.intermediary_basename.?))
else
null;
@@ -5078,6 +5078,10 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
},
.Signal => .AVR_SIGNAL,
.SysV => .X86_64_SysV,
+ .PtxKernel => return switch (target.cpu.arch) {
+ .nvptx, .nvptx64 => .PTX_Kernel,
+ else => unreachable,
+ },
};
}