[llvm-commits] [PATCH] TypeLegalizer refactoring (a part of vector-select support)

Rotem, Nadav nadav.rotem at intel.com
Wed May 18 05:18:20 PDT 2011


Hi Duncan, 

I also hit the circular dependency issue when moving this method to the cpp file.
I will fix the other issues you mentioned and commit. 

Thanks, 
Nadav



-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands
Sent: Wednesday, May 18, 2011 15:02
To: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [PATCH] TypeLegalizer refactoring (a part of vector-select support)

Hi Nadav,

> @@ -1814,6 +1732,74 @@
>
>    ValueTypeActionImpl ValueTypeActions;
>
> +  typedef std::pair<LegalizeAction, EVT> LegalizeKind;
> +
> +  LegalizeKind
> +  getTypeConversion(LLVMContext &Context, EVT VT) const {

did you try defining this out-of-line?  It is rather big to be in a header
file.  Last time I tried to do this I failed due to circular library
dependencies being created, but perhaps things are better now.

> +    // If this is a simple type, use the ComputeRegisterProp mechanism.
> +    if (VT.isSimple()) {
> +      assert((unsigned)VT.getSimpleVT().SimpleTy <
> +             array_lengthof(TransformToType));
> +      EVT NVT = TransformToType[VT.getSimpleVT().SimpleTy];
> +      LegalizeAction LA = ValueTypeActions.getTypeAction(VT.getSimpleVT());
> +      /*assert(ValueTypeActions.getTypeAction(NVT) != Promote &&
> +        "Promote may not follow Expand or Promote");*/

did you mean to comment out this assertion?

> +      return LegalizeKind(LA, NVT);
> +    }
> +
> +    // Handle Extended Scalar Types.
> +    if (!VT.isVector()) {
> +
> +      assert(VT.isInteger() && "Float types must be simple");
> +      unsigned BitSize = VT.getSizeInBits();
> +      // First promote to a power-of-two size, then expand if necessary.
> +      if (BitSize < 8 || !isPowerOf2_32(BitSize)) {
> +        return LegalizeKind(Promote, VT.getRoundIntegerType(Context));
> +      }

No need for curly brackets.

> +      return LegalizeKind(Expand,
> +                          EVT::getIntegerVT(Context, VT.getSizeInBits()/2));
> +    }
> +
> +    // Handle vector types.
> +    unsigned NumElts = VT.getVectorNumElements();
> +    EVT EltVT = VT.getVectorElementType();
> +
> +    // Vectors with only one element are always scalarized.
> +    if (NumElts == 1) {
> +      return LegalizeKind(Expand, EltVT);
> +    }

No need for curly brackets.

Otherwise it looks good.  Thanks for working on this!

Ciao, Duncan.
_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-commits mailing list