Skip to content

Commit

Permalink
stage2: sparc64: Spill CCR before doing calls
Browse files Browse the repository at this point in the history
  • Loading branch information
koachan committed Jun 6, 2022
1 parent 2dfe307 commit 97c43af
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/arch/sparc64/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,11 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions.

var info = try self.resolveCallingConventionValues(fn_ty, .caller);
defer info.deinit(self);

// CCR is volatile across function calls
// (SCD 2.4.1, page 3P-10)
try self.spillCompareFlagsIfOccupied();

for (info.args) |mc_arg, arg_i| {
const arg = args[arg_i];
const arg_ty = self.air.typeOf(arg);
Expand Down

0 comments on commit 97c43af

Please sign in to comment.