aboutsummaryrefslogtreecommitdiff
path: root/src/arch/wasm/CodeGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-02-19 10:20:19 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-02-19 10:20:19 -0700
commitb5b634e4e8a2a1fe32fba50ccd175257b4213936 (patch)
tree4eed625db81dd4d6907e386084df36ec3ac85687 /src/arch/wasm/CodeGen.zig
parentefdc94c10712f610e7de5e49fd9cd6f88b4bbbae (diff)
parent02f5d2673f1bb21e7329acdd664fed565ecd4317 (diff)
downloadzig-b5b634e4e8a2a1fe32fba50ccd175257b4213936.tar.gz
zig-b5b634e4e8a2a1fe32fba50ccd175257b4213936.zip
Merge remote-tracking branch 'origin/master' into llvm16
Diffstat (limited to 'src/arch/wasm/CodeGen.zig')
-rw-r--r--src/arch/wasm/CodeGen.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 7ce6a0482b..53dc28626c 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -1255,7 +1255,7 @@ fn genFunc(func: *CodeGen) InnerError!void {
// reserve space and insert all prologue instructions at the front of the instruction list
// We insert them in reserve order as there is no insertSlice in multiArrayList.
try func.mir_instructions.ensureUnusedCapacity(func.gpa, prologue.items.len);
- for (prologue.items) |_, index| {
+ for (prologue.items, 0..) |_, index| {
const inst = prologue.items[prologue.items.len - 1 - index];
func.mir_instructions.insertAssumeCapacity(0, inst);
}
@@ -3117,7 +3117,7 @@ fn mergeBranch(func: *CodeGen, branch: *const Branch) !void {
const target_values = target_slice.items(.value);
try parent.values.ensureUnusedCapacity(func.gpa, branch.values.count());
- for (target_keys) |key, index| {
+ for (target_keys, 0..) |key, index| {
// TODO: process deaths from branches
parent.values.putAssumeCapacity(key, target_values[index]);
}
@@ -3501,7 +3501,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const values = try func.gpa.alloc(CaseValue, items.len);
errdefer func.gpa.free(values);
- for (items) |ref, i| {
+ for (items, 0..) |ref, i| {
const item_val = func.air.value(ref).?;
const int_val = func.valueAsI32(item_val, target_ty);
if (lowest_maybe == null or int_val < lowest_maybe.?) {
@@ -3561,7 +3561,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
while (value <= highest) : (value += 1) {
// idx represents the branch we jump to
const idx = blk: {
- for (case_list.items) |case, idx| {
+ for (case_list.items, 0..) |case, idx| {
for (case.values) |case_value| {
if (case_value.integer == value) break :blk @intCast(u32, idx);
}
@@ -3588,7 +3588,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
};
try func.branches.ensureUnusedCapacity(func.gpa, case_list.items.len + @boolToInt(has_else_body));
- for (case_list.items) |case, index| {
+ for (case_list.items, 0..) |case, index| {
// when sparse, we use if/else-chain, so emit conditional checks
if (is_sparse) {
// for single value prong we can emit a simple if
@@ -4558,7 +4558,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
// copy stack pointer into a temporary local, which is
// moved for each element to store each value in the right position.
const offset = try func.buildPointerOffset(result, 0, .new);
- for (elements) |elem, elem_index| {
+ for (elements, 0..) |elem, elem_index| {
const elem_val = try func.resolveInst(elem);
try func.store(offset, elem_val, elem_ty, 0);
@@ -4587,7 +4587,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
// we ensure a new local is created so it's zero-initialized
const result = try func.ensureAllocLocal(backing_type);
var current_bit: u16 = 0;
- for (elements) |elem, elem_index| {
+ for (elements, 0..) |elem, elem_index| {
const field = fields[elem_index];
if (!field.ty.hasRuntimeBitsIgnoreComptime()) continue;
@@ -4623,7 +4623,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
else => {
const result = try func.allocStack(result_ty);
const offset = try func.buildPointerOffset(result, 0, .new); // pointer to offset
- for (elements) |elem, elem_index| {
+ for (elements, 0..) |elem, elem_index| {
if (result_ty.structFieldValueComptime(elem_index) != null) continue;
const elem_ty = result_ty.structFieldType(elem_index);
@@ -6149,7 +6149,7 @@ fn callIntrinsic(
} else WValue{ .none = {} };
// Lower all arguments to the stack before we call our function
- for (args) |arg, arg_i| {
+ for (args, 0..) |arg, arg_i| {
assert(!(want_sret_param and arg == .stack));
assert(param_types[arg_i].hasRuntimeBitsIgnoreComptime());
try func.lowerArg(.C, param_types[arg_i], arg);