[LLVMdev] Type Legalizer - Load handling problem

Duncan Sands baldrick at free.fr
Fri Aug 29 06:32:06 PDT 2008


Hi,

> How will LOAD:i8 with an i16 operand be lowered in type legalizer? (i16
> type is not legal for our target)

what does "LOAD:i8 with an i16 operand" mean?  Are you saying that the
type of a pointer is i16, and you are loading an i8 value from the
pointed to location?  If so, you are in trouble because many parts of
the code generator assume that the type of a pointer is legal.

> Following assertion in function ExpandIntegerOperand (file
> LegalizeIntegerTypes.cpp) is not allowing us to change LOAD node. 
> 
>  
> 
> assert(Res.getValueType() == N->getValueType(0) && N->getNumValues() ==
> 1 && "Invalid operand expansion");
> 
>  
> 
> LOAD node has two values but the assertion checks N->getNumValues() == 1
> which is not letting us change load operation. 

Yup, in this case you need to return an SDValue with null Val field,
and take care of replacing values yourself.

> Also in the first check of the insertion, 0th value type (MVT::Other
> (chain) for load) of the node N is being compared with the value type of
> Res. It is not trying to compare 1st value (which is i8) of LOAD with
> the 1st value of Res.

Since the assertion only allows the node to have one value, this is not
a problem.

Ciao,

Duncan.



More information about the llvm-dev mailing list