Switch case-ranges, new approach (PR1255).
Stepan Dyatkovskiy
stpworld at narod.ru
Thu May 16 12:38:02 PDT 2013
Ping. Does somebody interested in this issue? I'm working on fixing some
test-suite tests now.
-Stepan
Stepan Dyatkovskiy wrote:
> Hello, I propose new approach to switch case-ranges
> implementation (PR1255).
>
> Don't modify SwitchInst, but implement new instruction.
>
> In this case:
> 1. We don't affect current functionality and tests.
> 2. We keep backward compatibility in natural way. If you need current
> functionality (without case ranges) just use 'switch'.
>
> Here I have attached set of patches:
>
> -- New instruction itself. It is called 'SwitchRInst'. Implementation
> is ConstantRange based. Internally switch is represented as just an
> array of integers. Though i-th and i+1 integer represents a range,
> and i-th integer is linked with this-range successor. This is a
> result of implementation discussions in IRC and ML.
> Patch name: switchr-2013-05-07-instruction.patch
>
> -- Parser/AsmWriter patch. After this patch IR parser will
> recognize new instruction and its syntax ('switchr' keyword will
> be added).
> Patch contains unit-tests.
> Patch name: switchr-2013-05-07-parser-writer.patch
> Requires: switchr-2013-05-07-instruction.patch
>
> -- Bitcode patch. Patch adds new instruction support
> for .bc files with.
> Patch contains unit-tests.
> Patch name: switchr-2013-05-07-bitcode.patch
> Requires: switchr-2013-05-07-instruction.patch
> [switchr-2013-05-07-parser-writer.patch] (for unit-tests)
>
> -- "Essential passes" patch. This patch finally enables 'switchr':
> it becomes absultely legal on LLVM level. Patch updates next passes:
> * SelectionDAGBuilder: lowers 'switchr';
> * IRBuilder: "Create" method;
> * SCCP: just a stub, that marks all 'switchr' successors
> as reachable.
> Patch contains unit-tests.
> Patch name: switchr-2013-05-07-essential-passes.patch
> Requires: switchr-2013-05-07-instruction.patch
> [switchr-2013-05-07-parser-writer.patch] (for unit-tests)
>
> -- Switch-to-SwitchR pass patch. Adds function pass that replaces
> 'switch' instructions with 'switchr'.
> Patch name: switchr-2013-05-07-switch-to-switchr.patch
>
> -- Clang patch. Adds '-fforce-switchr' option: with this flag clang
> will use 'switchr' instructions instead of 'switch'. Actually, it
> inserts SwitchToSwitchR patch.
> Patch contains unit-tests.
> Patch name: switchr-clang-force-flag-2013-05-07.patch
> Requires: switchr-2013-05-07-instruction.patch
> switchr-2013-05-07-switch-to-switchr.patch
> [switchr-2013-05-07-parser-writer.patch] (for unit-tests)
>
> Also I've attached summary LLVM patch (all-in-one).
>
> -Stepan.
More information about the llvm-commits
mailing list