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