Skip to content

Commit

Permalink
regalloc: simplifies findOrSpillAllocatable (#2267)
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake authored Jun 25, 2024
1 parent c3c3c5f commit 8db4d0f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions internal/engine/wazevo/backend/regalloc/regalloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,7 @@ func (a *Allocator[I, B]) findOrSpillAllocatable(s *state[I, B], allocatable []R
r = RealRegInvalid
// First, check if the preferredMask has any allocatable register.
if preferred != RealRegInvalid && !forbiddenMask.has(preferred) && !s.regsInUse.has(preferred) {
for _, candidateReal := range allocatable {
// TODO: we should ensure the preferred register is in the allocatable set in the first place,
// but right now, just in case, we check it here.
if candidateReal == preferred {
return preferred
}
}
return preferred
}

var lastUseAt programCounter
Expand Down

0 comments on commit 8db4d0f

Please sign in to comment.