Skip to content

Commit

Permalink
llvm: convert global assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobly0 committed Jul 24, 2023
1 parent 533111e commit 3fc2e36
Show file tree
Hide file tree
Showing 3 changed files with 632 additions and 544 deletions.
14 changes: 5 additions & 9 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1034,15 +1034,11 @@ pub const Object = struct {

fn genModuleLevelAssembly(object: *Object) !void {
const mod = object.module;
if (mod.global_assembly.count() == 0) return;
var buffer = std.ArrayList(u8).init(mod.gpa);
defer buffer.deinit();
var it = mod.global_assembly.iterator();
while (it.next()) |kv| {
try buffer.appendSlice(kv.value_ptr.*);
try buffer.append('\n');
}
object.llvm_module.setModuleInlineAsm2(buffer.items.ptr, buffer.items.len - 1);

const writer = object.builder.setModuleAsm();
var it = mod.global_assembly.valueIterator();
while (it.next()) |assembly| try writer.print("{s}\n", .{assembly.*});
try object.builder.finishModuleAsm();
}

fn resolveExportExternCollisions(object: *Object) !void {
Expand Down
Loading

0 comments on commit 3fc2e36

Please sign in to comment.