[LLVMdev] Type Legalizer Question.

Evan Cheng evan.cheng at apple.com
Thu Oct 2 10:59:29 PDT 2008


On Oct 2, 2008, at 10:11 AM, sanjiv gupta wrote:

> On Thu, 2008-10-02 at 08:53 -0700, Chris Lattner wrote:
>> On Oct 2, 2008, at 8:38 AM, Eli Friedman wrote:
>>
>>> On Thu, Oct 2, 2008 at 7:34 AM, Evan Cheng <evan.cheng at apple.com>
>>> wrote:
>>>>
>>>> On Oct 2, 2008, at 2:01 AM, sanjiv gupta wrote:
>>>>
>>>>>
>>>>>>
>>>>>> So you have a i16 register class which makes the type legal. You
>>>>>> can
>>>>>> make loads and stores legal (can you?). But you will have to  
>>>>>> custom
>>>>>> lower all other i16 operations. This will work, but it requires a
>>>>>> lot
>>>>>> of target specific code.
>>>>>
>>>>> True. If we add the i16 reg class we will need to write a lot of
>>>>> target specific code.
>>>>> To avoid that our idea was not to tell the legalizer about the i16
>>>>> regclass and let it expand everything but ignore the pointers.
>>>>
>>>> You can try just marking all i16 operations, other than load and
>>>> store, as "expand". Would that work?
>>>
>>> Won't work; LLVM expects at least some basic operations, like add,  
>>> to
>>> be legal in legal register types.
>>
>> That sounds like a bug, not a feature.
>> -Chris
>
> The -enable-legalize-types infrastructure is entirely based upon
> getVTAction (), so it will be completely ignored once we have i16
> regclass,

I suspected that. But I wonder if that's going to be the approach or  
is this something we want to change.

>
> ditto with ExpandOp of LegalizeDAG.
> And LegalizeDAG::LegalizeOp() allows very few things to be auto  
> expanded.

Really?! ExpandOp handles quite a lot of cases. And you can always add  
the ones you need. Most of them share the same mechanism (and common  
code).

Evan

>
>
> -Sanjiv
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list