constant switch test bug in x86Translate

Stephen Weeks MLton@sourcelight.com
Tue, 16 Jan 2001 16:08:16 -0800 (PST)


> 1. if the test is an immediate, choose the right label.
>    pros: a simple fix
>    cons: why do it in the codegen when the cps simplifier normally does it

I vote for this solution.  I'm guessing it's a small amount of SML code, and it
generates better code than the other solutions.  I don't mind a bit of repeated
simplification.  In practice, there is a lot of similar simplification code at
various passes in the compiler, and for good reasons.  Running simplifications
to a fixed point is costly, so you can't guarantee that the output of one pass
has no redexes.  But, you want to run simplifications fairly frequently, to
keep the ILs small.  

So if it is indeed a simple fix, and keeps the IL slightly simpler, it seems
like a win to me.