30 | 30 |
in
|
31 | 31 |
checkBlock instrs progCtx routCtx'
|
32 | 32 |
|
|
33 |
-- -- -- -- -- -- -- -- -- -- -- --
|
|
34 |
|
33 | 35 |
checkInstr (COPY src dst) progCtx routCtx =
|
34 | 36 |
case Map.lookup src routCtx of
|
35 | 37 |
Just (PoisonedWith _) ->
|
|
39 | 41 |
checkInstr (DELTA dst val) progCtx routCtx =
|
40 | 42 |
-- TODO check that dst is not poisoned
|
41 | 43 |
Map.insert dst (UpdatedWith (Immediate val)) routCtx
|
|
44 |
|
|
45 |
checkInstr (ADD dst src) progCtx routCtx =
|
|
46 |
-- TODO check that dst is not poisoned
|
|
47 |
Map.insert dst (UpdatedWith src) routCtx
|
|
48 |
checkInstr (SUB dst src) progCtx routCtx =
|
|
49 |
-- TODO check that dst is not poisoned
|
|
50 |
Map.insert dst (UpdatedWith src) routCtx
|
|
51 |
|
|
52 |
checkInstr (AND dst src) progCtx routCtx =
|
|
53 |
-- TODO check that dst is not poisoned
|
|
54 |
Map.insert dst (UpdatedWith src) routCtx
|
|
55 |
checkInstr (OR dst src) progCtx routCtx =
|
|
56 |
-- TODO check that dst is not poisoned
|
|
57 |
Map.insert dst (UpdatedWith src) routCtx
|
|
58 |
checkInstr (XOR dst src) progCtx routCtx =
|
|
59 |
-- TODO check that dst is not poisoned
|
|
60 |
Map.insert dst (UpdatedWith src) routCtx
|
|
61 |
|
42 | 62 |
checkInstr (JSR name) progCtx routCtx =
|
43 | 63 |
let
|
44 | 64 |
Just calledRout = lookupRoutine program name
|
|
60 | 80 |
-- TODO: oooh, this one's gonna be fun too
|
61 | 81 |
--checkBlock blk progCtx routCtx
|
62 | 82 |
routCtx
|
|
83 |
|
|
84 |
-- TODO -- THESE ARE WEAK --
|
|
85 |
checkInstr (SEI blk) progCtx routCtx =
|
|
86 |
checkBlock blk progCtx routCtx
|
|
87 |
checkInstr (PUSH _ blk) progCtx routCtx =
|
|
88 |
checkBlock blk progCtx routCtx
|
|
89 |
|
|
90 |
checkInstr (BIT dst) progCtx routCtx =
|
|
91 |
-- TODO check that dst is not poisoned
|
|
92 |
Map.insert dst (UpdatedWith (Immediate 0)) routCtx
|
|
93 |
|
|
94 |
checkInstr (SHR dst flg) progCtx routCtx =
|
|
95 |
-- TODO check that dst is not poisoned
|
|
96 |
Map.insert dst (UpdatedWith flg) routCtx
|
|
97 |
checkInstr (SHL dst flg) progCtx routCtx =
|
|
98 |
-- TODO check that dst is not poisoned
|
|
99 |
Map.insert dst (UpdatedWith flg) routCtx
|
|
100 |
|
|
101 |
checkInstr (COPYROUTINE name dst) progCtx routCtx =
|
|
102 |
-- TODO check that dst is not poisoned
|
|
103 |
Map.insert dst (UpdatedWith (Immediate 7)) routCtx
|
|
104 |
|
|
105 |
checkInstr (JMPVECTOR dst) progCtx routCtx =
|
|
106 |
routCtx
|
|
107 |
|
63 | 108 |
checkInstr NOP progCtx routCtx =
|
64 | 109 |
routCtx
|
65 | |
|
|
110 |
|
|
111 |
{-
|
66 | 112 |
checkInstr instr _ _ = error (
|
67 | 113 |
"Internal error: sixtypical doesn't know how to " ++
|
68 | 114 |
"analyze '" ++ (show instr) ++ "'")
|
|
115 |
-}
|
69 | 116 |
|
70 | 117 |
--
|
71 | 118 |
-- Utility function:
|