The handling of phi was incorrect and we would sometimes miss escapes. We now handle phis at the very end of the pass to make sure the defs for their arguments have all been processed.
21 lines
356 B
Text
21 lines
356 B
Text
export function w $main() {
|
|
@start
|
|
%a =l alloc4 4
|
|
%b =l alloc4 4
|
|
storew 4, %a
|
|
storew 5, %b
|
|
|
|
@loop
|
|
# %mem will be %a and %b successively,
|
|
# but we do not know it when processing
|
|
# the phi because %b goes through a cpy
|
|
%mem =l phi @start %a, @loop %bcpy
|
|
|
|
%w =w load %mem
|
|
%eq5 =w ceqw %w, 5
|
|
%bcpy =l copy %b
|
|
jnz %eq5, @exit, @loop
|
|
|
|
@exit
|
|
ret 0
|
|
}
|