X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegAlloc%2FLinear%2FFreeRegs.hs;fp=compiler%2FnativeGen%2FRegAlloc%2FLinear%2FFreeRegs.hs;h=bee8c98c617bd24535e593aa26895759c8415ac8;hb=cbc96da034482b769889c109f6cc822f42b12027;hp=0000000000000000000000000000000000000000;hpb=d7d09c18459983be1ef690e0d9136a8736b1976f;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs b/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs new file mode 100644 index 0000000..bee8c98 --- /dev/null +++ b/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs @@ -0,0 +1,41 @@ + +module RegAlloc.Linear.FreeRegs ( + FreeRegs(), + noFreeRegs, + releaseReg, + initFreeRegs, + getFreeRegs, + allocateReg +) + +#include "HsVersions.h" + +where + +-- ----------------------------------------------------------------------------- +-- The free register set +-- This needs to be *efficient* +-- Here's an inefficient 'executable specification' of the FreeRegs data type: +-- +-- type FreeRegs = [RegNo] +-- noFreeRegs = 0 +-- releaseReg n f = if n `elem` f then f else (n : f) +-- initFreeRegs = allocatableRegs +-- getFreeRegs cls f = filter ( (==cls) . regClass . RealReg ) f +-- allocateReg f r = filter (/= r) f + + +#if defined(powerpc_TARGET_ARCH) +import RegAlloc.Linear.PPC.FreeRegs + +#elif defined(sparc_TARGET_ARCH) +import RegAlloc.Linear.SPARC.FreeRegs + +#elif defined(i386_TARGET_ARCH) || defined(x86_64_TARGET_ARCH) +import RegAlloc.Linear.X86.FreeRegs + +#else +#error "RegAlloc.Linear.FreeRegs not defined for this architecture." + +#endif +