2 module RegAlloc.Linear.FreeRegs (
12 #include "HsVersions.h"
16 -- -----------------------------------------------------------------------------
17 -- The free register set
18 -- This needs to be *efficient*
19 -- Here's an inefficient 'executable specification' of the FreeRegs data type:
21 -- type FreeRegs = [RegNo]
23 -- releaseReg n f = if n `elem` f then f else (n : f)
24 -- initFreeRegs = allocatableRegs
25 -- getFreeRegs cls f = filter ( (==cls) . regClass . RealReg ) f
26 -- allocateReg f r = filter (/= r) f
29 #if defined(powerpc_TARGET_ARCH)
30 import RegAlloc.Linear.PPC.FreeRegs
31 import PPC.Instr (maxSpillSlots)
33 #elif defined(sparc_TARGET_ARCH)
34 import RegAlloc.Linear.SPARC.FreeRegs
35 import SPARC.Instr (maxSpillSlots)
37 #elif defined(i386_TARGET_ARCH) || defined(x86_64_TARGET_ARCH)
38 import RegAlloc.Linear.X86.FreeRegs
39 import X86.Instr (maxSpillSlots)
42 #error "RegAlloc.Linear.FreeRegs not defined for this architecture."