[project @ 1999-04-29 11:53:12 by simonpj]
[ghc-hetmet.git] / ghc / tests / programs / jeff-bug / Register.hs
1 module Register where
2
3 import Ix
4
5
6 -- Begin Signature -------------------------------------------------
7 {- 
8
9    Register captures the common instances and methods that is 
10    usually required of a register-set like type.  Register 
11    supports PCs, speculative PCs, and predicate registers.
12
13 -}
14
15
16 class (Ix a,Eq a,Ord a,Bounded a,Show a,Read a,Enum a) => Register a where
17
18         -- is the register read only?   for example, in DLX 
19         --  r0 <- r0 + r0  is equivilant to a nop because r0 is read only
20         readOnly :: a -> Bool
21
22         -- pick out the PC register
23         pc :: a 
24
25         -- pick out the speculative PC register
26         specpc :: a 
27
28         ispc :: a -> Bool
29         isspecpc :: a -> Bool 
30
31         -- is the register a predicate register?
32         ispred :: a -> Bool
33
34         readOnly x = False
35         ispred x = False
36
37 -- End Signature -------------------------------------------------
38         -- ispc and isspec should probably be defined as :
39         --       ispc r = pc == r.  havent tested this though....