[llvm-dev] Can't call setTypeAction() on ValueTypeActions in a derived class from the TargetLoweringBase class
Jessica Clarke via llvm-dev
llvm-dev at lists.llvm.org
Sun Feb 28 11:04:48 PST 2021
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