issues
search
dongjinBaek
/
swpp202101-team2
1
stars
0
forks
source link
[Sprint3] Alloca2RegPass
#31
Closed
dongjinBaek
closed
3 years ago
dongjinBaek
commented
3 years ago
Alloca2RegPass
changes load/store variables using alloca to reg
assigning registers
for alloca variable of length n, replace with n global variables named $reg0, ... $reg(n-1)
add load $regi 0 instruction.
this load inst is not actually loaded, and backend will allocate specific register instead
load
change load instruction using alloca variable by
split the block into upper, bottom part of load inst.
between splitted block, insert n blocks for switch, which unconditional branch to bottom part is the only instruction
replace terminator inst. of upper part to switch inst, which leads to n switch blocks made above
insert phinode at the start of the bottom block, so that value is differed by which reg it used
replace all uses of load inst to phi node
store
change store inst similarly with load inst, but with some changes
switch block has call inst calling custom $store function
this function call will be changed to storing value to register in backend
there is no phinode needed
Alloca2RegPass
assigning registers
load
store