[llvm-commits] [llvm] r163806 - /llvm/trunk/include/llvm/Target/TargetLowering.h

Eric Christopher echristo at apple.com
Thu Sep 13 17:54:05 PDT 2012


Please document the "what on earth are these constants" in this code.

Thanks!

-eric

On Sep 13, 2012, at 8:24 AM, Micah Villmow <villmow at gmail.com> wrote:

> Author: villmow
> Date: Thu Sep 13 10:24:43 2012
> New Revision: 163806
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=163806&view=rev
> Log:
> The current implementation does not allow more than 32 types to be properly handled with target lowering. This doubles the size to 64bit types and easily allows extension to more types.
> 
> Modified:
>    llvm/trunk/include/llvm/Target/TargetLowering.h
> 
> Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=163806&r1=163805&r2=163806&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetLowering.h Thu Sep 13 10:24:43 2012
> @@ -497,7 +497,8 @@
>            (unsigned)VT.getSimpleVT().SimpleTy < sizeof(CondCodeActions[0])*4 &&
>            "Table isn't big enough!");
>     LegalizeAction Action = (LegalizeAction)
> -      ((CondCodeActions[CC] >> (2*VT.getSimpleVT().SimpleTy)) & 3);
> +      ((CondCodeActions[CC][VT.getSimpleVT().SimpleTy >> 5]
> +        >> (2*(VT.getSimpleVT().SimpleTy & 0x1F))) & 3);
>     assert(Action != Promote && "Can't promote condition code!");
>     return Action;
>   }
> @@ -554,6 +555,7 @@
>     }
>     return EVT::getEVT(Ty, AllowUnknown);
>   }
> +  
> 
>   /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
>   /// function arguments in the caller parameter area.  This is the actual
> @@ -1153,8 +1155,10 @@
>     assert(VT < MVT::LAST_VALUETYPE &&
>            (unsigned)CC < array_lengthof(CondCodeActions) &&
>            "Table isn't big enough!");
> -    CondCodeActions[(unsigned)CC] &= ~(uint64_t(3UL)  << VT.SimpleTy*2);
> -    CondCodeActions[(unsigned)CC] |= (uint64_t)Action << VT.SimpleTy*2;
> +    CondCodeActions[(unsigned)CC][VT.SimpleTy >> 5]
> +      &= ~(uint64_t(3UL)  << (VT.SimpleTy & 0x1F)*2);
> +    CondCodeActions[(unsigned)CC][VT.SimpleTy >> 5]
> +      |= (uint64_t)Action << (VT.SimpleTy & 0x1F)*2;
>   }
> 
>   /// AddPromotedToType - If Opc/OrigVT is specified as being promoted, the
> @@ -1933,7 +1937,7 @@
>   /// CondCodeActions - For each condition code (ISD::CondCode) keep a
>   /// LegalizeAction that indicates how instruction selection should
>   /// deal with the condition code.
> -  uint64_t CondCodeActions[ISD::SETCC_INVALID];
> +  uint64_t CondCodeActions[ISD::SETCC_INVALID][2];
> 
>   ValueTypeActionImpl ValueTypeActions;
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list