| ... | ... | @@ -28,10 +28,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*NvPtx { |
| 28 | 28 | if (!build_options.have_llvm) return error.PtxArchNotSupported; |
| 29 | 29 | if (!options.use_llvm) return error.PtxArchNotSupported; |
| 30 | 30 | |
| 31 | | switch (options.target.cpu.arch) { |
| 32 | | .nvptx, .nvptx64 => {}, |
| 33 | | else => return error.PtxArchNotSupported, |
| 34 | | } |
| 31 | if (!options.target.cpu.arch.isNvptx()) return error.PtxArchNotSupported; |
| 35 | 32 | |
| 36 | 33 | switch (options.target.os.tag) { |
| 37 | 34 | // TODO: does it also work with nvcl ? |
| ... | ... | @@ -59,9 +56,8 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 59 | 56 | if (!options.use_llvm) return error.PtxArchNotSupported; |
| 60 | 57 | assert(options.target.ofmt == .nvptx); |
| 61 | 58 | |
| 62 | | const nvptx = try createEmpty(allocator, options); |
| 63 | | log.info("Opening .ptx target file {s}", .{sub_path}); |
| 64 | | return nvptx; |
| 59 | log.debug("Opening .ptx target file {s}", .{sub_path}); |
| 60 | return createEmpty(allocator, options); |
| 65 | 61 | } |
| 66 | 62 | |
| 67 | 63 | pub fn deinit(self: *NvPtx) void { |
| ... | ... | @@ -76,15 +72,7 @@ pub fn updateFunc(self: *NvPtx, module: *Module, func: *Module.Fn, air: Air, liv |
| 76 | 72 | |
| 77 | 73 | pub fn updateDecl(self: *NvPtx, module: *Module, decl_index: Module.Decl.Index) !void { |
| 78 | 74 | if (!build_options.have_llvm) return; |
| 79 | | const decl = module.declPtr(decl_index); |
| 80 | | log.info("updating {s}", .{decl.name}); |
| 81 | 75 | return self.llvm_object.updateDecl(module, decl_index); |
| 82 | | // const decl_index = func.owner_decl; |
| 83 | | // const decl = module.declPtr(decl_index); |
| 84 | | |
| 85 | | // try mod.decl_exports.ensureUnusedCapacity(gpa, 1); |
| 86 | | // try mod.export_owners.ensureUnusedCapacity(gpa, 1); |
| 87 | | // mod.decl_exports.getOrPutAssumeCapacity(exported_decl_index); |
| 88 | 76 | } |
| 89 | 77 | |
| 90 | 78 | pub fn updateDeclExports( |
| ... | ... | @@ -118,7 +106,7 @@ pub fn flushModule(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.No |
| 118 | 106 | defer tracy.end(); |
| 119 | 107 | |
| 120 | 108 | const outfile = comp.bin_file.options.emit.?; |
| 121 | | // !!! We modify 'comp' before passing it to LLVM, but restore value afterwards |
| 109 | // We modify 'comp' before passing it to LLVM, but restore value afterwards. |
| 122 | 110 | // We tell LLVM to not try to build a .o, only an "assembly" file. |
| 123 | 111 | // This is required by the LLVM PTX backend. |
| 124 | 112 | comp.bin_file.options.emit = null; |