[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
Sat Feb 27 07:03:56 PST 2021


   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()?

   Thank you very much,
     Alex


More information about the llvm-dev mailing list