Fix a bug in stack layout with safe foreign calls (#8083)
[ghc.git] / compiler / nativeGen / RegClass.hs
1 {-# OPTIONS -fno-warn-tabs #-}
2 -- The above warning supression flag is a temporary kludge.
3 -- While working on this module you are encouraged to remove it and
4 -- detab the module (please do the detabbing in a separate patch). See
5 -- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
6 -- for details
7
8
9 -- | An architecture independent description of a register's class.
10 module RegClass
11 ( RegClass (..) )
12
13 where
14
15 import Outputable
16 import Unique
17
18
19 -- | The class of a register.
20 -- Used in the register allocator.
21 -- We treat all registers in a class as being interchangable.
22 --
23 data RegClass
24 = RcInteger
25 | RcFloat
26 | RcDouble
27 | RcDoubleSSE -- x86 only: the SSE regs are a separate class
28 deriving Eq
29
30
31 instance Uniquable RegClass where
32 getUnique RcInteger = mkRegClassUnique 0
33 getUnique RcFloat = mkRegClassUnique 1
34 getUnique RcDouble = mkRegClassUnique 2
35 getUnique RcDoubleSSE = mkRegClassUnique 3
36
37 instance Outputable RegClass where
38 ppr RcInteger = Outputable.text "I"
39 ppr RcFloat = Outputable.text "F"
40 ppr RcDouble = Outputable.text "D"
41 ppr RcDoubleSSE = Outputable.text "S"