[LLVMdev] Inserting a custom switch instruction implementation in backend
marcello at codeplay.com
Sun Sep 22 04:31:45 PDT 2013
Thanks Hal, I take this into consideration in case I decide to go for a
custom lowering in the IR.
Il 21/09/2013 23:28, Hal Finkel ha scritto:
> ----- Original Message -----
>> Probably the easiest way for you is to lower switch instructions via
>> IR-to-IR pass in the way you want.
> In case it helps, lib/Transforms/Utils/LowerSwitch.cpp does generic switch lowering. You might be able to use that as a base for what you need to do.
>> On Sat, Sep 21, 2013 at 3:43 PM, Marcello Maggioni
>> <marcello at codeplay.com> wrote:
>>> in implementing a backend for a target we work on, I ended up
>>> needing to
>>> lower the switch instruction in a very specific way that is quite
>>> from the standard llvm way with the decision trees.
>>> The custom implementation wants to get rid of the decision blocks
>>> that llvm
>>> generates between the actual cases basic blocks and the switch root
>>> What I do currently is basically deleting these blocks manually and
>>> all the successors (updating the PHIs) to the switch root block and
>>> the instructions in the decision blocks into the switch root block
>>> and then proceed to the removal of these blocks.
>>> This seems to work fine, but is a solution that I not like very
>>> much. I
>>> would prefer being able to lower the switch instructions in my own
>>> directly instead of having to let llvm do it its own way and
>>> "morph" the
>>> result into my own.
>>> There is a clean way to custom lower the switch instruction in the
>>> without substituting the entire SelectionDAGBuilder?
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev