-
Notifications
You must be signed in to change notification settings - Fork 164
/
ToDo
271 lines (267 loc) · 6.85 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
= ToDo
== Current
- generate IR
- simplify IR node name: IntValue -> Int, StringValue -> Str.
- make operators signed, instead of having signed value types.
- refactoring: rename class: Assmebler -> AssermblyFile
- refactoring: remove CodeGenerator.stackGrowsLower
- refactoring: remove AssemblyFile stack.
- refactoring: remove CodeGenerator#compileLHS (resolve in IR generation)
- refactoring: CodeGeneratorOptions should not provide PeepholeOptimizer
- refactoring: classify Assembler
- refactoring: classify Linker
* use enum for register names
== Done
- generate resolved AST
- constant table
- types
- scope, frame
- integer literal
- 1, 2, 3, ...
- octal (010)
- hex (0x1f)
- 1U, 1L, 1UL
- character literal
- 'c'
- standard escape sequence ('\n', ...)
- octal escape sequence ('\077')
- string literal
- "string"
- standard escape sequence ('\n', ...)
- octal escape sequence ("\077")
- import
- single import
- recursive import
- import function
- import type
- build x86 test environment
- compile "Hello, World"
- write unit tests
- funcall
- 0 arg
- 1 arg
- 2 args
- 3
- 4 - 10 args
- variables
- param
- reference
- assign
- lvar
- assign
- reference
- initializer
- common symbol
- assign
- reference
- global variable
- define
- reference
- assign
- private common symbol
- assign
- reference
- private global variable
- define
- assign
- reference
- function-static variable
- assign
- reference
- initializer
- op
- +
- -
- *
- /
- %
- bitwise op
- ~
- &
- |
- ^
- >>
- <<
- unary op
- +@
- -@
- !
- comparison op
- ==
- !=
- >
- >=
- <
- <=
- self assignment
- +=, -=, *=, ...
- ++
- --
- control structure
- if
- while
- flow
- break
- continue
- for
- flow
- break
- continue
- do...while
- flow
- break
- continue
- switch
- goto
- valued control structure
- &&
- ||
- a ? b : c
- array
- as LHS
- as RHS
- reject negative length array definition
- struct
- as LHS
- as RHS
- recursive definition with pointer
- union
- as LHS
- as RHS
- recursive definition with pointer
- pointer
- *ptr
- *ptr = val
- ptr->memb
- ptr->memb = val
- &expr
- function pointer
- refer
- call ptr(arg)
- complex LHS
- local variable
- parameter
- global variables / common symbols
- static variables
- *arr[0] = ...
- *st.memb = ...
- *ptr++ = ...
- *(ptr + N) = ...
- their combination
- bare block ({...})
- cast
- semantic check (control)
- reject break from out of loop/switch
- reject continue from out of loop
- semantic check (reference)
- check all symbols are resolved
- check duplicated parameters
- check if the calling function exists
- warn unused static variables
- warn unused local variables
- warn unused static functions
- check if aref base expr is indexable (a must be indeable where a[0])
- check if funcall base expr is callable (a must be callable where a())
- semantic check (type)
- simple type check (binary ops, unary ops)
- a[0]
- *ptr
- ct.memb
- ptr->memb
- funcall args
- prohibit circular struct/union definition
- implicit cast
- validate struct/union member (ct.memb)
- validate struct/union member (ct->memb)
- check duplicated struct/union members
- ptr + int; ptr - int
- check return type
- check if &expr is assignable
- use user type instead of struct/union
- do not use #equals for type check
- check if void is not used with array, struct, union.
- op for various types
- signed char
- signed short
- signed int
- signed long
- unsigned char
- unsigned short
- unsigned int
- unsigned long
- Multibyte input
- parse command line option
- --dump-tokens
- --dump-ast
- print node location in error message
- parse command line option more precisely
- --dump-reference
- --dump-semantic
- add standard load path (use -I option)
- call GNU as and GNU ld instead of gcc.
- rename asm methods
- lvar overlapped allocation
- pointer comparison
- ptr==ptr should work
- ptr&&ptr should work
- cond?ptr:ptr should work
- !ptr should work
- implement NULL as reserved word
- duplicated import did not propagate symbols
- test if static function is really static
- test switch stmt
- remove FIXME from Entity.java
- implement cast
- dump UTF-8 string byte by byte.
- sizeof
- calculate address on AX register.
- prohibit multi-dimension array without size
- extern gvar access
- implement source repository
- handle multiple arguments (source files, assembly files, object files)
- -l
- -L
- -Wl, -Xlinker
- -Wa, -Xassembler
- write install.sh
- va_list
- objectify instruction
- fix &puts
- AsmEntity -> AsmOperand
- Symbol -> LabelRef
- Literal should not inherit AsmEntity
- toString -> toSource
- reject struct/union/array on stmt context
- ComplexType -> CompositeType
- impelement -O options
- -O (peephole optimization)
- movl $0, %eax => xorl %eax, %eax
- addl $1, %eax => incl %eax
- addl $-1, %eax => decl %eax
- subl $1, %eax => decl %eax
- subl $-1, %eax => incl %eax
- addl $0, %eax => NONE
- subl $0, %eax => NONE
- imull $0, %eax => xorl %eax, %eax
- imull $1, %eax => NONE
- generate prologue/epilogue after function body.
- -O (fast immediate load)
- check "puts = str"
- -O (jump elimination)
- useless label elimination
- -fPIC (PIC generation)
- -shared
- Java 5
- label refactoring
- Label -> Symbol
- all Symbols should be got from objects
- implement unnamed (code) Label
- bin/cbc: resolve symbolic link
- --readonly-plt
- -fPIE, -pie
- implement difference against PIC
- check opassign semantic as operator
- use enum for compiler mode.
- type handling
- "extern char*[] sys_errlist" is array, not pointer
- &puts should be typed as int(*)(char*)*, not int(*)(char*)**