| ... | ... | @@ -109,13 +109,19 @@ pub fn flushModule(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.No |
| 109 | 109 | const tracy = trace(@src()); |
| 110 | 110 | defer tracy.end(); |
| 111 | 111 | |
| 112 | | var hack_comp = comp; |
| 113 | | if (comp.bin_file.options.emit) |emit| { |
| 114 | | hack_comp.emit_asm = .{ |
| 115 | | .directory = emit.directory, |
| 116 | | .basename = comp.bin_file.intermediary_basename.?, |
| 117 | | }; |
| 118 | | hack_comp.bin_file.options.emit = null; |
| 112 | const outfile = comp.bin_file.options.emit.?; |
| 113 | // !!! We modify 'comp' before passing it to LLVM, but restore value afterwards |
| 114 | // We tell LLVM to not try to build a .o, only an "assembly" file. |
| 115 | // This is required by the LLVM PTX backend. |
| 116 | comp.bin_file.options.emit = null; |
| 117 | comp.emit_asm = .{ |
| 118 | .directory = outfile.directory, |
| 119 | .basename = comp.bin_file.intermediary_basename.?, |
| 120 | }; |
| 121 | defer { |
| 122 | comp.bin_file.options.emit = outfile; |
| 123 | comp.emit_asm = null; |
| 119 | 124 | } |
| 120 | | return try self.llvm_object.flushModule(hack_comp, prog_node); |
| 125 | |
| 126 | try self.llvm_object.flushModule(comp, prog_node); |
| 121 | 127 | } |