[llvm-dev] Can't call setTypeAction() on ValueTypeActions in a derived class from the TargetLoweringBase class
Alex Susu via llvm-dev
llvm-dev at lists.llvm.org
Sun Mar 7 09:21:46 PST 2021
Hello.
I don't have a register class for my target for the f16 type (neither for the i32
type). What I do is actually emulate the LLVM IR operations for the f16 type in my back
end class that inherits the SelectionDAGISel class.
However, for everything to work OK I have to give:
getValueTypeActions().setTypeAction(MVT::f16, TypeLegal));
Now maybe I can give a different LegalizeTypeAction like TypePromoteFloat instead of
TypeLegal. But then I need to have as I said in the previous email the possibility to call:
getValueTypeActions().setTypeAction(MVT::f16, TypeLegal));
But this call is no longer possible in the latest LLVM. And this issue seems wrong to me.
Thank you,
Alex
On 2/28/2021 9:04 PM, Jessica Clarke wrote:
> On 27 Feb 2021, at 15:03, Alex Susu via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> Hello.
>>
>> I would like to ask about what seems to be an API error in LLVM in the include/llvm/CodeGen/TargetLowering.h source file, in the class TargetLoweringBase.
>> We have the public method getValueTypeActions() that returns a constant of type const ValueTypeActionImpl. But the class ValueTypeActionImpl has the setter method setTypeAction(), which I need to use to make my Instruction Selection pass succeed. More exactly I need to give in my ISelLowering back end pass (otherwise I get error "Do not know how to promote this operator's operand!"):
>> getValueTypeActions().setTypeAction(MVT::f16, TypeLegal));
>>
>> Note that in the last almost 2 years in include/llvm/CodeGen/TargetLowering.h, in the class TargetLoweringBase the access specifier of the data member:
>> ValueTypeActionImpl ValueTypeActions;
>> was changed from protected to private, and the private specifier disallows me to use the setTypeAction() method in my back end class derived from the class TargetLowering, which is itself derived from class TargetLoweringBase.
>>
>> Therefore, I propose to define method getValueTypeActions() without const specifiers like this:
>> ValueTypeActionImpl &getValueTypeActions() {
>> return ValueTypeActions;
>> }
>> Am I correct to propose this? Or is there another way to use the method setTypeAction()?
>
> The definition of whether a type is legal is whether the target has a
> register class for it; if you want the type to be legal you need to
> define one, then TargetLoweringBase::computeRegisterProperties won't
> define the type as illegal.
>
> Jess
>
More information about the llvm-dev
mailing list