diff options
author | Roland Scheidegger <[email protected]> | 2013-04-20 01:46:04 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-04-20 02:27:53 +0200 |
commit | 85974e5fee152c96239aa87040799a557cd789ab (patch) | |
tree | 074035c9ca771a94442f4db3acc52400fca4ff51 /src/mapi/mapi_abi.py | |
parent | 8f5d4283c0448ed2e5d2c12bb46ec70be7744a7b (diff) |
gallivm: implement switch opcode
Should be able to handle all things which make this tricky to implement.
Fallthroughs, including most notably into/out of default, should be handled
correctly but are quite a mess.
If we see largely unoptimized switches in the wild should probably think
about some "real" switch optimization pass, e.g. things like this:
switch
case1
someinst
brk
case2
default
case3
someinst
brk
case4
someinst
endswitch
are legal, but the pointless case2/case3 statements not only cause condition
evaluation but will turn this into a "fake" fallthrough case (because
mask and defaultmask are already updated for case2 when default is
encountered) requiring executing code twice.
If default is at the end though, there's never any code re-execution, and
if that's not the case if there's no fallthrough in (not even a fake one)
and out of default there's no code re-execution neither.
v2: add comments, and use enum for break type instead of magic boolean.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mapi/mapi_abi.py')
0 files changed, 0 insertions, 0 deletions