-
Notifications
You must be signed in to change notification settings - Fork 4
/
TODO
186 lines (181 loc) · 7.36 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
=== TODO
- when coding basic blocks, if a successor is containered, emit a goto
instead of coding it (it will be coded in its advanced block, and it
will probably look nicer; see random_funkyloop.bin)
=== OPTIONAL
- export graphs to graphviz:
- block graph for finding additional structures DONE
- insn/statement graphs for verifying correctness
- graphing: make entry point a different shape
- don't use ssa.fun_args_d directly, implement methods
- fun_0x8082: a8 is made explicit because fun_0x8edd() clobbers a, but we
ignore it, so we don't actually need the copy
- copy single-insn blocks (label_81c5, for instance) instead of emitting
a goto
- structure shortcut ITE conditions such as label_90dc
=== LATER
- detect volatile locations like in BCity:fun_d8f6
- casting an uint8_t to a pointer is semi-bogus
- operator precedence for type cast
- unconditional loop at SMB:label_811b
- f580: why is there a double arrow in advsequencef52c?
=== DONE
- don't DCE memory writes DONE
- don't DCE MMIO DONE
- implement default defs/uses for calls (defines all, uses all) WONTFIX
- implement method to get all definitions DONE
- allow more than one def per statement DONE
- doesn't work: what is 'defines all' supposed to mean? EXACTLY!
- find defs/returns instead (recursive on call op) DONE
- implement phi functions DONE
- implement propagation DONE
- implement proper reaching defs (current definitions include regs with
wrong indices, which is fine for returns, but hampers DCE) DONE
- pretty-print phi functions DONE
- implement expression simplification DONE
- fix tail call (see 0x8e2d in SMB1) <- that is not a tail call; anyway:
DONE (hopefully)
- implement limited CSE (typical case: A(n) := A(m) - 1; bcc A(m) - 1)
for prettiness and to avoid unnecessary temps DONE
- speed up dephiing DONE
- speed up DCE DONE (somewhat...)
- eliminate duplicates when redefining returns DONE (I think)
- clip SSA trees when encountering conditional branches that are actually
unconditional after propagation DONE
- determine true returns DONE (I hope)
- propagate into ssadefs (first attempt failed miserably) OBSOLETE
(did away with complex definitions)
- make ssa statement next/comefrom lists!!! (undeterministic branching is
BAD!!) DONE
- find if/thens that have a dead end (return) DONE
- 81c6: why is the left sequence not extended by another block? DONE
(iterative structuring)
- 8004: why are bblocks ending in branches in a sequence? WONTFIX
(they are single-block loops)
- 8edd: loop in a sequence? DONE (graphing error)
- f41b: DONE (I think, thanks to iterative structuring)
- if/then/else at f48d not recognized
- if/then at f4c2 not recognized
- code branches explicitly, not at a bblock end (cf. bblock bas81A9) DONE
(I think, I don't see anything relevant in bas81A9, but branches are now
coded explicitly)
- waitaminit: how can you translate back from SSA by omitting the index if
you have stuff like "A(26) := x" followed by "bcc (A(25))" or somesuch???
PROBABLYDONE (introduced copying and explicit phi functions where
necessary)
- DEREF is inconsistently used, making coding difficult; use separate
LOAD and STORE expressions DONE
- wrong tmp1 usage in fun_0x80c3 (used before assignment) DONE
(end bblock when encountering statements already processed)
- code proper function headers (no whatever and something) DONE
- order function parameters (there is no implied ordering due to lack of a
calling convention in the machine code; it's probably best done in the
code generator) DONE (in ssa, necessary to map call parameters
to function arguments)
- don't code memory function parameters (as C parameters) DONE
- out-of-scope tmp0 in fun_0x8e6a DONE
- return identification may cause dead code to be eliminated, which in turn
may cause input parameters to change; need to revisit args and all calls
to the function; see IDENTIRET 1037 WORKAROUND (we had to ignore returns
that don't have a dessa_name because of this, and that seems to do the job
just fine for now)
- implement barriers (SEI/CLI, for instance, gets DCEd ATM) <- do it
as an impure statement and introduce an intrinsic expression DONE
- do condition negation when coding IT(E) DONE (only IT, the other
one is already done by ordering the blocks accordingly)
- pretested loop (example: f7c5 in f694) (tricky: the loop header is more
than just a branch, it does other things, too, and that's not how a
for(;;) loop in C works; it could be done as a while() loop with comma
operator, but I'm not sure if that is really useful...) DONE
- inconsistent return types for fun_0xf3a9 DONE
- declare local (register) variables DONE
- declare memory variables as extern DONE
- implement one-shot comments for demo purposes DONE
- translate indirect jump to something other than an endless loop so it can
be properly commented on DONE
- implement expression coding DONE
- dessa bug: if an old value does not reach the bblock to begin with, it is
pointless to copy it; see 0xf377 DONE
- don't (re)declare function arguments DONE
- why does fun_0xf8f4 have three identical parameters? INVALID (seems to
have fixed itself, and I cannot find a commit in which it is broken)
- structure post loop bas8018/bas801f DONE
- make the debug output optional DONE
- declare arrays DONE
- code: clean up duplicate code that checks if code or a goto should be
emitted DONE
- simplify '1 >> 1' (bas8e5e) DONE
- comment deficiencies verbosely: DONE
- rotate DONE
- IOity of indirect accesses DONE
- indirect jumps DONE
- array sizes DONE
- zero-page globals DONE
- comment the recursion shortcut DONE
- modifies/modified comments should be shortened if too long DONE
- stack at 0 or below should not reach (e.g. BCity start_d400) DONE
- simplify constant comparisions (14 != 8 in SMB) DONE
- don't declare memory that is implicitly used by calls (BCity:fun_c41d)
DONE
- BCity:fun_e409 has undeclared array DONE
- looks like wrong propagation in rotate in Bcity:fun_d689 INVALID
(nope, that's reading the controller shift register)
- uses/modifies comments are distracting, only put them at function
definitions DONE (relegated to debug level 2)
- comment on symbolic I/O addresses DONE (added to general MMIO comment)
- RAW in BCity:fun_d9be DONE
- RAW in BCity:fun_c5b0 DONE
- advifthenF349: eliminate if(1) DONE (actually was an if(0))
- fun_0xf3a9 has extraneous return (n) which isn't used anywhere DONE
(probably fixed in b1a711b)
- don't declare locals that are defined by a function call, but not used or
returned DONE (7642846)
- implement remaining opcodes: DONE!!!
00 BRK DONE
01 ORA izx DONE
0d ORA abs DONE
0e ASL abs DONE
16 ASL zpx DONE
19 ORA aby DONE
1e ASL abx DONE
21 AND izx DONE
24 BIT zp DONE
26 ROL zp DONE
2d AND abs DONE
2e ROL abs DONE
35 AND zpx DONE
36 ROL zpx DONE
39 AND aby DONE
41 EOR izx DONE
4d EOR abs DONE
4e LSR abs DONE
50 BVC DONE
51 EOR izy DONE
55 EOR zpx DONE
56 LSR zpx DONE
59 EOR aby DONE
5d EOR abx DONE
5e LSR abx DONE
61 ADC izx DONE
6e ROR abs DONE
71 ADC izy DONE
76 ROR zpx DONE
7d ADC abx DONE
81 STA izx DONE
94 STY zpx DONE
96 STX zpy DONE
a1 LDA izx DONE
b6 LDX zpy DONE
b8 CLV DONE
ba TSX DONE
c1 CMP izx DONE
c4 CPY zp DONE
cd CMP abs DONE
d1 CMP izy DONE
d5 CMP zpx DONE
d9 CMP aby DONE
e1 SBC izx DONE
f1 SBC izy DONE
f8 SED DONE
- RAW in MBuggy:fun_55a7 DONE
- simplify !((mem_0008 & 12) != 0) (BCity fun_c41d) DONE