Skip to content

Commit

Permalink
Disable splitting of spills in GlobalRegAlloc (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer authored Jan 7, 2025
1 parent c445353 commit ba531b6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aeneas/src/mach/GlobalRegAlloc.v3
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
def verbose = false;
def colorVerbose = false;
def COALESCE = false;
def SPLIT_SPILLS = false; // TODO: fix splitting of spills

// Implements global register allocation via graph coloring, including spilling, splitting,
// and coalescing.
Expand Down Expand Up @@ -617,7 +618,7 @@ class GlobalRegAlloc(regSet: MachRegSet, codegen: SsaMachGen) {
// Decide whether to insert reload right before this use or on block level.
def processSpill(vreg: VReg, constraint: int, block: SsaBlock) {
var node = graph.nodes[vreg.varNum];
if (node.defBlock == block) {
if (!SPLIT_SPILLS || node.defBlock == block) {
var newVreg = codegen.dupVReg(vreg);
newVreg.notSpillable = true;
newVreg.reloadFrom = vreg;
Expand Down Expand Up @@ -669,6 +670,7 @@ class GlobalRegAlloc(regSet: MachRegSet, codegen: SsaMachGen) {
// Insert reload at the start of the commonDominator block
def insertReload(vreg: VReg, node: Node) {
node.commonDominator = findDominatorOutOfLoop(node);
// TODO(fix): this can sometimes insert the reload before the definition.
codegen.insertReload(vreg, (node.newVreg, 0), codegen.instrs[node.commonDominator.mark].next);
blockReloads[node.commonDominator.mark].put(node.newVreg);
}
Expand Down

0 comments on commit ba531b6

Please sign in to comment.