[llvm-commits] Final SwitchInst for PR1255: case-ranges.

Stepan Dyatkovskiy stpworld at narod.ru
Sun Jul 15 01:30:29 PDT 2012


Hi all.
Please find the patch that converts current SwitchInst into one that 
supports case-ranges. This patch is not compilable, since I removed all 
backward compatibility layer. This is how I see the final SwitchInst.

Main features
  - Case value is the subset of integers, based on APInt values 
(implemented as IntegersSubset). IntegersSubset uses packed data 
representation. It has two collections: flat numbers collection, and 
collection of pairs with indices (pointers) to the flat numbers collection.
  - To construct/modify subsets for SwitchInst IntegersSubsetMapping was 
introduced. It uses unpacked data representation and stores SwitchInst 
data as set of clusters. Cluster is integer range + successor.
  - Case value removed from instruction operands list. We needn't 
User-Use concept here, since it is just a case value, it will always 
constant, and case value couldn't reused with another instructions/values.

P.S.:  Patch contains a lot of changes. Probably you want to apply it 
locally and look at final instruction class.

P.S.2: I also have patch with backward compatibility level. It is 
compilable and passes regression tests and test-suite tests.

Thanks!

-Stepan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: final-switch.patch
Type: text/x-patch
Size: 56588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120715/f96cd7f6/attachment.bin>


More information about the llvm-commits mailing list