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