diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-07-16 05:57:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-16 05:57:32 +0000 |
| commit | e079fdeee78d37a50c4e2a9fafe77903d62dbc34 (patch) | |
| tree | c7b06e08f3696ae2b4f70a6783a7573aef8347b6 /src-self-hosted/codegen.zig | |
| parent | 82562b205f9d99c27c4d5224311734e141bf2fda (diff) | |
| parent | d29dd5834b9d7386bb88e44bd2852428863cae81 (diff) | |
| download | zig-e079fdeee78d37a50c4e2a9fafe77903d62dbc34.tar.gz zig-e079fdeee78d37a50c4e2a9fafe77903d62dbc34.zip | |
Merge pull request #5885 from ziglang/stage2-locals
self-hosted compiler local consts
Diffstat (limited to 'src-self-hosted/codegen.zig')
| -rw-r--r-- | src-self-hosted/codegen.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src-self-hosted/codegen.zig b/src-self-hosted/codegen.zig index 314d497808..e78ee28b5d 100644 --- a/src-self-hosted/codegen.zig +++ b/src-self-hosted/codegen.zig @@ -73,6 +73,7 @@ pub fn generateSymbol( .code = code, .err_msg = null, .args = mc_args, + .arg_index = 0, .branch_stack = &branch_stack, .src = src, }; @@ -255,6 +256,7 @@ const Function = struct { code: *std.ArrayList(u8), err_msg: ?*ErrorMsg, args: []MCValue, + arg_index: usize, src: usize, /// Whenever there is a runtime branch, we push a Branch onto this stack, @@ -603,7 +605,9 @@ const Function = struct { } fn genArg(self: *Function, inst: *ir.Inst.Arg) !MCValue { - return self.args[inst.args.index]; + const i = self.arg_index; + self.arg_index += 1; + return self.args[i]; } fn genBreakpoint(self: *Function, src: usize, comptime arch: std.Target.Cpu.Arch) !MCValue { |
