jump tables and cases
Matthew Fluet
Matthew Fluet <fluet@CS.Cornell.EDU>
Mon, 4 Dec 2000 03:09:53 -0500 (EST)
Were the changes to preserve big integer case statements ever added to
MLton? I went ahead and added support to generate jump tables to the
x86-backend. That was the last feature I really wanted to get into the
backend, and it should also help with compile times (in particular, the
datatype representing x86 instructions has 50 variants, and I crawl over
this a lot). I recall that Steve pointed out that mlyacc generated
parsers have big integer case statements, so it might also improve the
parse phase.
Right now it's just the most straight forward version of jump tables that
I could come up with. I look at the Switch transfer, determine the min
and max integer cases and the length and produce a jump table if
(max - min + 1) / length >= 7/8
(i.e., make sure that the jump table will be relatively dense).
I could easily produce a binary search tree as well.