mirror of
git://c9x.me/qbe.git
synced 2026-04-05 09:59:47 +00:00
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.
22 lines
356 B
Plaintext
22 lines
356 B
Plaintext
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
|
|
}
|