[project @ 2001-08-22 11:45:06 by sewardj]
[ghc-hetmet.git] / ghc / tests / programs / jeff-bug / Instruction.hs
1 module Instruction where
2
3 import Arithmetic
4 import Memory
5
6 -- Begin Signature ------------------------------------------------------
7
8 {- 
9
10 While not knowing the details of a particular instruction set, the
11 Instruction class allows code defined in arithmetic and other
12 modules to do the right thing for the often-defined instructions.
13
14 -}
15
16
17 class (Show i, Eq i) => Instruction i where
18    
19    -- is a nop instruction?
20    isNoOp :: i -> Bool
21
22    -- is an add instruction?
23    isAddOp :: i -> Bool
24    isSubOp :: i -> Bool
25    isMultOp :: i -> Bool
26    isDivOp :: i -> Bool
27    isJumpOp :: i -> Bool
28    isMemOp :: i -> Bool
29    isLoadOp :: i -> Bool
30    isStoreOp :: i -> Bool
31    isAluOp  :: i -> Bool
32    isCmpOp  :: i -> Bool
33    isBoolOp  :: i -> Bool
34    isMoveOp :: i -> Bool
35
36    -- map the instruction to an AluOp (undefined if not isAluOp)
37    aluOp :: i -> AluOp 
38
39    -- is a conditional instruction?
40    isCond :: i -> Bool
41
42    -- is a parallel instruction? 
43    -- example:  [r1,r2] <- SWAP [r1,r2] can be mapped two instruction
44    isPar :: i -> Bool
45    -- get the first instruction (if isPar)
46    fstOp :: i -> AluOp
47    -- get the second instruction (if isPar)
48    sndOp :: i -> AluOp
49
50    memOp :: i -> LoadStoreOp
51
52    noOp :: i
53
54
55 -- End Signature ------------------------------------------------------
56
57
58
59
60
61
62
63