-
Notifications
You must be signed in to change notification settings - Fork 0
/
mylog
executable file
·80 lines (50 loc) · 3.34 KB
/
mylog
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
VariableDecl and FunctionDecl in class need to check whether it has the same name with class name.
The bug needs fixing.
int a = new int; bool b = new bool; string c = new string;
These are illegal but have not been checked.
Now calling append after BB is ended will do nothing.
when dealing with assign in ir, calculate lhs's address first and then calculate rhs's value, which can
save a pair of store and load if rhs is logicOpExpr. Not sure in this way whether there is any side effect.
how does string store in memory? if I get a new string at runtime(such as #getString or #toString), I should
check whether the string exists in const string pool of memory, but how?
logic shortcut in function call parameters
self-loop does not strictly dominate itself?
ssa does not transform global variable for now.
maybe dst of instruction can be LocalReg. fix it later.
alloca and malloc have no side effect when eliminating dead code ??
Some visitExpr can be replaced by visit in order to reduce cast. Maybe do it later.
CFGSimplifier may delete irFunc.head. For now I don't allow deleting irFunc.head.
If allowing deleting irFunc.head, headBB and entryBB should be distinguished(now they are the same).
Optim order can be considered carefully. Rather than run for a fixed number of loops, it is better to
end optim when nothing is modified. Some interfaces should be changed in order to be more suitable for
debuging(for example, printIR every time when a single optim is finished) and arrange different optims.
For now my optim doesn't work for 570 because I haven't turned global variables to local when constructing
SSA.
For 593, it can be optimized to ret 30 but it costs 7 cycles of optim.
For some Instructions(like Alloca, BinaryOperation), dst must be LocalReg. For now some of dst are Register.
need to record some problems with function call and return.
I don't understand the defination of conventional SSA. I didn't use Algorithm 3.6 on ssa_book. In my parallel copy area,
there is no loop of assignments.
DefUseChain is for LocalReg, so the type should be LocalReg rather than Register.
names should be redesigned. remove @ # $.
ir-interpreter needs to execute Phi parallel. The bug needs fixing.
global __str_i
is this necessary?
How to deal with caller and callee registers?
Can I push [memory] in NASM?
In Callee, arguments need to be moved from physical registers or memory to virtual registers.
GlobalReg is not a proper name. DefReg and UseReg's type is LocalReg rather than Register.
problems with register allocation: uninitailized variable, caller and calle.
add isEntry and isExit for BasicBlock and Block
As for uninitailized problem,
1. local variable: solved in ssa construction
2. global variable: placed in .bss(a place for uninitialized data).
When trying to read uninitialized globel variable, it seems to
give me 0.
In my nasm, global variable's name(such as _a) may conflict with builtin function as _stringEq.
TODO: turn _stringEq to __stringEq
DCE can eliminate most of output irrelevant code. However, I see two exceptions so far.
1. loop (T264)
2. call function which wastes time but does nothing related to result. For example, a function that calles itself recursively.
For now I don't know how to do output irrelevant elimination globally(output attribute can pass among functions),
and I plan to write some naive code to solve case 1.