[llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h

Chris Lattner clattner at apple.com
Mon Jun 25 23:13:20 PDT 2007


> @@ -129,7 +130,9 @@
>    /// specified value type.  This means that it has a register  
> that directly
>    /// holds it without promotions or expansions.
>    bool isTypeLegal(MVT::ValueType VT) const {
> -    return RegClassForVT[VT] != 0;
> +    return !MVT::isExtendedValueType(VT) ?
> +           RegClassForVT[VT] != 0 :
> +           false;
>    }

This could be written more naturally as:

   return MVT::isSimpleVT(VT) && RegClassForVT[VT] != 0;


> @@ -147,9 +150,12 @@
>      }
>
>      LegalizeAction getTypeAction(MVT::ValueType VT) const {
> -      return (LegalizeAction)((ValueTypeActions[VT>>4] >> ((2*VT)  
> & 31)) & 3);
> +      return !MVT::isExtendedValueType(VT) ?
> +             (LegalizeAction)((ValueTypeActions[VT>>4] >> ((2*VT)  
> & 31)) & 3) :
> +             Expand;
>      }

I think this would be more clear with an explicit:

   if (MVT::isExtendedValueType(VT)) return Expand;

instead of ?:   :)

> @@ -242,7 +253,9 @@
>    /// expanded to some other code sequence, or the target has a  
> custom expander
>    /// for it.
>    LegalizeAction getOperationAction(unsigned Op, MVT::ValueType  
> VT) const {
> -    return (LegalizeAction)((OpActions[Op] >> (2*VT)) & 3);
> +    return !MVT::isExtendedValueType(VT) ?
> +           (LegalizeAction)((OpActions[Op] >> (2*VT)) & 3) :
> +           Expand;
>    }
>
>    /// isOperationLegal - Return true if the specified operation is  
> legal on this
> @@ -257,7 +270,9 @@
>    /// expanded to some other code sequence, or the target has a  
> custom expander
>    /// for it.
>    LegalizeAction getLoadXAction(unsigned LType, MVT::ValueType VT)  
> const {
> -    return (LegalizeAction)((LoadXActions[LType] >> (2*VT)) & 3);
> +    return !MVT::isExtendedValueType(VT) ?
> +           (LegalizeAction)((LoadXActions[LType] >> (2*VT)) & 3) :
> +           Expand;
>    }
>
>    /// isLoadXLegal - Return true if the specified load with  
> extension is legal
> @@ -272,7 +287,9 @@
>    /// expanded to some other code sequence, or the target has a  
> custom expander
>    /// for it.
>    LegalizeAction getStoreXAction(MVT::ValueType VT) const {
> -    return (LegalizeAction)((StoreXActions >> (2*VT)) & 3);
> +    return !MVT::isExtendedValueType(VT) ?
> +           (LegalizeAction)((StoreXActions >> (2*VT)) & 3) :
> +           Expand;
>    }
>
>    /// isStoreXLegal - Return true if the specified store with  
> truncation is
> @@ -287,7 +304,9 @@
>    /// for it.
>    LegalizeAction
>    getIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT) const {
> -    return (LegalizeAction)((IndexedModeActions[0][IdxMode] >>  
> (2*VT)) & 3);
> +    return !MVT::isExtendedValueType(VT) ?
> +           (LegalizeAction)((IndexedModeActions[0][IdxMode] >>  
> (2*VT)) & 3) :
> +           Expand;
>    }
>
>    /// isIndexedLoadLegal - Return true if the specified indexed  
> load is legal
> @@ -303,7 +322,9 @@
>    /// for it.
>    LegalizeAction
>    getIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT) const {
> -    return (LegalizeAction)((IndexedModeActions[1][IdxMode] >>  
> (2*VT)) & 3);
> +    return !MVT::isExtendedValueType(VT) ?
> +           (LegalizeAction)((IndexedModeActions[1][IdxMode] >>  
> (2*VT)) & 3) :
> +           Expand;
>    }

I think these would also be more clear with an explicit if stmt, but  
if you disagree, feel free to leave them.

-Chris



More information about the llvm-commits mailing list