diff options
| author | gracefu <81774659+gracefuu@users.noreply.github.com> | 2021-04-12 01:29:40 +0800 |
|---|---|---|
| committer | gracefu <81774659+gracefuu@users.noreply.github.com> | 2021-04-16 15:21:17 +0800 |
| commit | cfeb412a4263809698f941081197cd0ff7f260aa (patch) | |
| tree | 09f34468d720286fc3791c0c2083bbcde277a520 /src/codegen.zig | |
| parent | dc136627251c920713536807e0da922c140ca588 (diff) | |
| download | zig-cfeb412a4263809698f941081197cd0ff7f260aa.tar.gz zig-cfeb412a4263809698f941081197cd0ff7f260aa.zip | |
stage2 x86_64: fix incorrect comment in genX8664BinMath
Co-authored-by: joachimschmidt557 <joachim.schmidt557@outlook.com>
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index ee2f5403cc..6a80a4db6b 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -1505,8 +1505,14 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { /// ADD, SUB, XOR, OR, AND fn genX8664BinMath(self: *Self, inst: *ir.Inst, op_lhs: *ir.Inst, op_rhs: *ir.Inst) !MCValue { // We'll handle these ops in two steps. - // 1) Prepare an output register, and put one of the arguments in it + // 1) Prepare an output location (register or memory) + // This location will be the location of the operand that dies (if one exists) + // or just a temporary register (if one doesn't exist) // 2) Perform the op with the other argument + // 3) Sometimes, the output location is memory but the op doesn't support it. + // In this case, copy that location to a register, then perform the op to that register instead. + // + // TODO: make this algorithm less bad try self.code.ensureCapacity(self.code.items.len + 8); |
