in some operations there is a ty2 type, for example in truncate. What is the most right way to get it ? I have seen some EVT types, but this is connected to DAG… and I don’t believe that there is no easy way to get ty2 with one call function.
For most operations you'll be looking at the type of the SDValue
itself or one of its operands. This applies to trunc, where
Op.getType() is the destination (small) type of the trunc and
Op.getOperand(0).getType() is the source (big) type.
The most common exception is sext_inreg nodes. They get created during
legalization when it's realized that the source type doesn't have a
valid register size; so both source and destination have the same type
and there's a separate "this is the type you should extend from"
operand. You'd access it with
Thank you for the answer, you helped a lot!