aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-09-23 17:09:21 +0300
committerVeikka Tuominen <git@vexu.eu>2022-09-24 14:43:03 +0300
commitfdf4c875ffbbeb24f844718d9eb92bac38e7147e (patch)
treedec80b3abbf3d39eb0dda7683d7edd37827c52f0 /src/codegen/llvm.zig
parent3525b8778edd235d8d0ad2b55eee83eacd33d5cf (diff)
downloadzig-fdf4c875ffbbeb24f844718d9eb92bac38e7147e.tar.gz
zig-fdf4c875ffbbeb24f844718d9eb92bac38e7147e.zip
llvm: avoid crash on duplicate asm input/output name
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index b2b811beba..b2b9d7de2c 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -5972,7 +5972,9 @@ pub const FuncGen = struct {
}
if (!std.mem.eql(u8, name, "_")) {
- name_map.putAssumeCapacityNoClobber(name, total_i);
+ const gop = name_map.getOrPutAssumeCapacity(name);
+ if (gop.found_existing) return self.todo("duplicate asm output name '{s}'", .{name});
+ gop.value_ptr.* = total_i;
}
total_i += 1;
}
@@ -6028,7 +6030,9 @@ pub const FuncGen = struct {
}
if (!std.mem.eql(u8, name, "_")) {
- name_map.putAssumeCapacityNoClobber(name, total_i);
+ const gop = name_map.getOrPutAssumeCapacity(name);
+ if (gop.found_existing) return self.todo("duplicate asm input name '{s}'", .{name});
+ gop.value_ptr.* = total_i;
}
// In the case of indirect inputs, LLVM requires the callsite to have