[llvm-commits] [llvm] r132263 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/TargetLowering.cpp

Duncan Sands baldrick at free.fr
Sun May 29 05:00:12 PDT 2011


Hi Nadav,

> +      assert((NVT.isSimple()&&  LA != TypeLegal )?
> +             ValueTypeActions.getTypeAction(
> +               NVT.getSimpleVT()) != TypePromoteInteger
> +              : 1&&  "Promote may not follow Expand or Promote");

why not just

   !(NVT.isSimple() && LA != Legal) || 
ValueTypeActions.getTypeAction(NVT.getSimpleVT()) != Promote

?

> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sat May 28 12:57:14 2011
> @@ -80,35 +80,26 @@
>         assert(false&&  "Unknown legalize action!");
>       case TargetLowering::Legal:
>         return Legal;
> -    case TargetLowering::Promote:
> -      // Promote can mean
> -      //   1) For integers, use a larger integer type (e.g. i8 ->  i32).
> -      //   2) For vectors, use a wider vector type (e.g. v3i32 ->  v4i32).
> -      if (!VT.isVector())
> -        return PromoteInteger;
> +    case TargetLowering::TypePromoteInteger:
> +      return PromoteInteger;
> +    case TargetLowering::TypeExpandInteger:
> +      return ExpandInteger;
> +    case TargetLowering::TypeExpandFloat:
> +      return ExpandFloat;
> +    case TargetLowering::TypeSoftenFloat:
> +        return SoftenFloat;
> +    case TargetLowering::TypeWidenVector:
>         return WidenVector;
> -    case TargetLowering::Expand:
> -      // Expand can mean
> -      // 1) split scalar in half, 2) convert a float to an integer,
> -      // 3) scalarize a single-element vector, 4) split a vector in two.
> -      if (!VT.isVector()) {
> -        if (VT.isInteger())
> -          return ExpandInteger;
> -        if (VT.getSizeInBits() ==
> -                TLI.getTypeToTransformTo(*DAG.getContext(), VT).getSizeInBits())
> -          return SoftenFloat;
> -        return ExpandFloat;
> -      }
> -
> -      if (VT.getVectorNumElements() == 1)
> -        return ScalarizeVector;
> -      return SplitVector;
> +    case TargetLowering::TypeScalarizeVector:
> +      return ScalarizeVector;
> +    case TargetLowering::TypeSplitVector:
> +       return SplitVector;
>       }

What's the point of all this?  LegalizeTypes can just use the
TargetLowering::LegalizeTypeAction enum rather than its own identical
copy.

Ciao, Duncan.



More information about the llvm-commits mailing list