[llvm-dev] get ty2

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 18 06:38:26 PDT 2017

On 18 July 2017 at 03:09, Anastasiya Ruzhanskaya via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> 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



More information about the llvm-dev mailing list