-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTODO
247 lines (215 loc) · 11.1 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
OutLine:
✔ ResolverAndChecker @done(05-10 20)
✔ UsagePreChecker @done(05-10 20)
✔ IRBuilder @done(05-10 20)
✔ FuncallInline @done(05-10 20)
✔ ElimateMutliStaticData @done(05-10 20)
✔ RegisterAllocator @done(05-10 20)
✔ MemAndStack @done(05-10 20)
✔ ElimateMemQuad @done(05-11 09)
✔ AssemblyDump @done(05-10 20)
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new StupidBranchFucker(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new OrphanFuncFucker(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new InlineProcessor(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
// new ExprMerger(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new BinaryOpProcessor(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new StaticDataProcessor(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new FuncArgProcessor(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new RegLifetimeAnalyser(ir).run();
if (irOutS != null) (new IRPrinter(irOutS)).visit(ir);
new RegisterAllocator(ir).run();
Optim:
☐ Change Allocator @started(05-10 10) @today
Projects:
✔ Semantic analysis @started(19-03-05 18:58) @done(05-10 10) @lasted()
✔ Generate Simple antlr @started(19-03-04 17) @done(19-03-13 21) @lasted(1w2d3h46m41s)
✔ Generate AST nodes and Type nodes for at most 1 day @started(19-03-16 14) @done(05-10 10) @lasted()
✔ IR generate @done(05-10 10)
✔ ASM Code @done(05-10 10)
☐ code optimize
TODO|FIXME|FIX|BUG|UGLY|HACK|NOTE|IDEA|REVIEW|DEBUG|OPTIMIZE
Parser:
✔ change antlr extension to use @started(19-03-05 18) @done(19-03-05 18) @lasted(54m24s)
ASTNode:
✔ Node @done(03-16 14)
✔ AST (programNode) @done(03-16 17)
✔ Decl(define) @done(03-16 16)
✔ Func @done(03-16 17)
✔ Class @done(03-16 17)
✔ Var @done(03-16 17)
✘ VarList @cancelled(03-16 17)
✔ Stmt @done(03-17 15)
✔ Block @done(03-17 15)
✔ Expr @done(03-17 15)
✔ If (cond) @done(03-17 15)
✔ While @done(03-17 15)
✔ For @done(03-17 15)
✔ Continue @done(03-17 15)
✔ Break @done(03-17 15)
✔ Return @done(03-17 15)
✘ Blank @cancelled(03-17 15)
✘ VarDecl @cancelled(03-17 15)
✔ Expr @done(03-17 15)
✔ FuncCall @done(03-17 16) class method ?? done with
✔ unary @done(03-17 16)
✔ suffix @done(03-17 16)
✔ prefix @done(03-17 16)
✔ lhs @done(03-20 21)
✔ memberaccess @done(03-17 21)
✔ array index(aref, subscript) @done(03-17 21)
✔ binary or and @done(03-17 16)
✔ new @done(03-17 16)
✔ identifier? var-decl-node @done(03-17 21)
✔ assign @done(03-17 17)
✔ this @done(03-17 16)
✔ const(literal) @done(03-17 16)
✔ int @done(03-17 16)
✔ string @done(03-17 16)
✔ bool @done(03-17 16)
✔ null @done(03-17 16)
✔ typeNode @done(03-20 18)
✔ compare my g4 with fanzhou @started(03-20 18) @done(03-21 14) @lasted(20h14m37s)
typeOrVoid -> typeFuncName
parameterDeclarationList -> paramDeclarationList
memberDeclaration -> classBody
typeType -> type
nonArrayTypeType -> typeName
conditionStatement
loopStatement
jumpStatement
✘ check ASTBuilder out @started(19-03-18 21:27) @cancelled(03-24 20) @wasted()
✔ G4 file outline with ASTBuilder: @done(03-21 16)
✔ compilationUnit @done(03-21 08)
✔ translationUnit* EOF @done(03-21 08)
✔ translationUnit @done(03-21 08)
✔ variableDeclaration @done(03-21 08)
✔ type variableDeclaratorList '' @done(03-21 09)
✔ variableDeclarator (',' variableDeclarator)* @done(03-21 09)
✔ Identifier ('=' expression)? @done(03-21 09)
✘ type @cancelled(03-21 09)
✔ type '[' ']' # arrayType @done(03-21 09)
✔ typeName # nonarrayType @done(03-21 09)
✔ Int Bool String Identifier ✔ functionDeclaration @done(03-21 10)
✔ typeFuncName? Identifier '(' paramDeclarationList? ')' block @done(03-21 10)
✔ typeFuncName type void @done(03-21 10)
✔ paramDeclaration (',' paramDeclaration)* @done(03-21 10)
✔ type Identifier @done(03-21 10)
✔ classDeclaration @done(03-21 08)
✔ Class Identifier '{' classBody* '}' @done(03-21 11)
✔ functionDeclaration variableDeclaration @done(03-21 11)
✔ statement @done(03-21 11)
✔ block @done(03-21 11)
✔ '{' blockBody* '}' # blockStmt @done(03-21 11)
✔ statement variableDeclaration @done(03-21 11)
✔ expression '' # exprStmt @done(03-21 11)
✔ If '(' expression ')' statement (Else statement)? # condStmt @done(03-21 11)
✔ While '(' expression ')' statement # whileStmt @done(03-21 11)
✔ For + statement @done(03-21 12)
✔ forDeclaration (type variableDeclaratorList) ';' expression? ';' expression? #forCondInit @done(03-21 12)
✔ expression? ';' expression? ';' expression? #forCondNon @done(03-21 12)
✔ Continue '' # continueStmt @done(03-21 12)
✔ Break '' # breakStmt @done(03-21 12)
✔ Return expression? '' # returnStmt @done(03-21 12)
✔ '' # blankStmt @done(03-21 12)
✔ expression @started(03-21 12) @done(03-21 16) @lasted(4h14m55s)
// NOTE: position of primary expression
✔ primaryExpression # primaryExpr @done(03-21 12)
✔ Identifier # identifierExpr @done(03-21 12)
✔ This # thisExpr @done(03-21 12)
✔ literal # constExpr @done(03-21 12)
✔ IntLiteral StringLiteral Null (True | False) @done(03-21 12)
✔ '(' expression ')' # subExpr @done(03-21 14) () operator
✔ expression op = ('++' | '--') # suffixExpr @done(03-21 16)
✔ expression '.' Identifier # memberExpr // under lhs @done(03-21 14)
✔ arr = expression '[' index = expression ']' # arefExpr // under lhs @done(03-21 14)
✔ expression '(' paramList? ')' # funcallExpr @done(03-21 14)
✔ expression (',' expression)* @done(03-21 14)
✔ prefix unary @done(03-21 16)
<assoc = right> op = ('++' | '--') expression # prefixExpr
<assoc = right> op = ('+' | '-') expression # prefixExpr
<assoc = right> op = ('!' | '~') expression # prefixExpr
✔ <assoc = right> New creator # newExpr @done(03-21 14)
✔ typeName ('[' expression ']')+ ('[' ']')+ ('[' expression ']')+ # errorCreator @done(03-21 14)
✔ typeName ('[' expression ']')+ ('[' ']')* # arrayCreator @done(03-21 16)
✔ typeName ('(' ')')? # nonArrayCreator @done(03-21 14)
// suffix
✔ expression op = ('*' | '/' | '%') expression # binaryExpr @done(03-21 15)
✔ expression op = ('+' | '-') expression # binaryExpr @done(03-21 15)
// shift
✔ expression op = ('<<' | '>>') expression # binaryExpr @done(03-21 15)
// compare
✔ expression op = ('<' | '>') expression # binaryExpr @done(03-21 15)
✔ expression op = ('<=' | '>=') expression # binaryExpr @done(03-21 15)
✔ expression op = ('==' | '!=') expression # binaryExpr @done(03-21 15)
// bitwise
✔ expression op = '&' expression # binaryExpr @done(03-21 15)
✔ expression op = '^' expression # binaryExpr @done(03-21 15)
✔ expression op = '|' expression # binaryExpr @done(03-21 15)
// logical
✔ <assoc = right> expression op = '&&' expression # binaryExpr @done(03-21 15)
✔ <assoc = right> expression op = '||' expression # binaryExpr @done(03-21 15)
// assign
✔ <assoc = right> expression op = '=' expression # assignExpr @done(03-21 15)
✔ FIX 2 bug @started(03-21 16) @done(03-22 21) @lasted(1d5h7m1s)
✔ 1, list add null -> have to check for it @done(03-21 17)
✔ 2, escape sequence -> fixed in stringliteral Node @done(03-22 21)
✔ 3, for each rule have to check set-null @done(03-21 17)
✔ Opt with ? : operator @done(03-21 17)
✔ 4, visit DeclNode but can not change into detail instance @done(03-22 20)
-> fix by: 1, add acceptfunction in each node 2, specify each node in visit(abstract Node)
✔ add Location type @done(03-23 13)
✘ change arrayList into LinkedHashSet or not? @started(19-03-16 17:30) @cancelled(03-24 20) @wasted()
TypeResolve:
✔ type @done(03-17 22)
✔ array @done(03-17 22)
✔ func, class @done(03-17 22)
✔ int, bool, string @done(03-17 22)
✔ null void @done(03-17 22)
✔ Scope init -> also called as symbol-table @done(03-16 16)
✔ entity @done(03-23 16) what is diff between type and entity
✔ globalScopePreScanner.visit(ast); @done(03-23 20)
✔ new ClassVarMemberScanner(globalScope).visit(ast); @done(03-24 13)
Do tormorrow:
✔ new FunctionScopeScanner(globalScope).visit(ast); @high @today @started(03-24 20) @done(03-25 20) @lasted(1d8m44s)
✔ new StaticUsagePreScanner(globalScope).visit(ast); @done(05-10 10)
✔ FIX: all VarEntity's type is varType, and baseType is selfdefined @started(03-24 09) @done(03-24 09) @lasted(47m29s)
// FIX: seems no need to store childs for scopes
✔ FIX: funcEntity not have scope, but body have, how to connect them? @done(03-27 16)
entity do as a assistant
✔ FIX: What I thought Visitor of visitList might be wrong @critical @done(03-27 16)
✔ FIX: newExpr-node, dim and Expr<dim> is the same size? or dim is really dim, but Expr only store inited expr? @done(03-26 19)
✔ FIXED: block body should have order (can not split stmt and decl from build AST) @done(03-26 10)
✔ FIXED: allowed class to have their own as member @done(03-26 19)
--> inter-reference --> check by redirect ASTNode-decl-order
✔ FIX: ptr.ptr.(ptr).alt.alt.a = alt.af().pf().af().pf().b; @done(03-27 16)
✔ FIXED: array_init_[] --> arrayType cnt error @done(03-26 11)
✔ FIXED: allow resolve and checker to splite : AST, fun-para, class, block , for-decl @done(03-26 17)
✘ FIX: allow class{class{{}}} @cancelled(05-08 15)
✔ UGLY: change Error into each node, no need to specify Error with invalid @done(03-27 16)
✔ UGLY: int [][] b = new int[3][4]; int [][] c = new int[10][21]; b = c; @done(03-27 16)
✔ UGLY: NOTE: == or != means the memory-Location -> (!node.getName().equals(curClass.getName())) @done(03-26 17)
✔ FIXED: err: func with no return Type @done(03-26 21)
✔ FIXED: int x = f(x); @done(03-26 21) -> check first then add.
✔ FIXED: @done(03-26 22)
equals remain: others
isEqual remain: compare with type-> Type.baseType or Type.InnerType
✔ Can not find right class ClassEntity classEntity = (ClassEntity) scopeStack.getFirst().get(className); @done(03-27 09)
✔ What if change Mnull into null? @done(04-06 10)
✔ too much call stacks for compilers: change visit into accept. @started(05-08 15) @done(05-10 10) @lasted(1d19h3m48s)
✔ UGLY: change all invalid into valid @started(05-08 15) @done(05-10 10) @lasted(1d19h3m48s)
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
RAX RCX RDX RBX RSP RBP RSI RDI
These are the basic forms of addressing:
[ number ]
[ reg ]
[ reg + reg*scale ] scale is 1, 2, 4, or 8 only
[ reg + number ]
[ reg + reg*scale + number ]