[llvm-commits] [llvm-gcc-4.2] r83332 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Bill Wendling wendling at apple.com
Tue Oct 6 11:15:19 PDT 2009


On Oct 5, 2009, at 3:25 PM, Eric Christopher wrote:

> Author: echristo
> Date: Mon Oct  5 17:25:32 2009
> New Revision: 83332
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83332&view=rev
> Log:
> Revert the BITS_PER_UNIT part of my last patch.  llvm does alignment
> computation on bytes and would fail if BITS_PER_UNIT were anything
> other than 8.
>
It might be worthwhile to put a comment around these so that future  
people won't make the same changes.

-bw

> Modified:
>    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=83332&r1=83331&r2=83332&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct  5 17:25:32 2009
> @@ -505,7 +505,7 @@
>
>   // Handle attribute "aligned".
>   if (DECL_ALIGN (FnDecl) != FUNCTION_BOUNDARY)
> -    Fn->setAlignment(DECL_ALIGN (FnDecl) / BITS_PER_UNIT);
> +    Fn->setAlignment(DECL_ALIGN (FnDecl) / 8);
>
>   // Handle functions in specified sections.
>   if (DECL_SECTION_NAME(FnDecl))
> @@ -1614,7 +1614,7 @@
>   if (DECL_ALIGN(decl)) {
>     unsigned TargetAlign = getTargetData().getABITypeAlignment(Ty);
>     if (DECL_USER_ALIGN(decl) || 8 * TargetAlign < (unsigned) 
> DECL_ALIGN(decl))
> -      Alignment = DECL_ALIGN(decl) / BITS_PER_UNIT;
> +      Alignment = DECL_ALIGN(decl) / 8;
>   }
>
>   const char *Name;      // Name of variable
> @@ -6628,8 +6628,7 @@
>     if (BitStart == 0 && // llvm pointer points to it.
>         !isBitfield(FieldDecl) &&  // bitfield computation might  
> offset pointer.
>         DECL_ALIGN(FieldDecl))
> -      LVAlign = std::max(LVAlign,
> -			 unsigned(DECL_ALIGN(FieldDecl)) / BITS_PER_UNIT);
> +      LVAlign = std::max(LVAlign, unsigned(DECL_ALIGN(FieldDecl)) /  
> 8);
> #endif
>
>     // If the FIELD_DECL has an annotate attribute on it, emit it.
> @@ -6839,7 +6838,7 @@
>   unsigned Alignment = Ty->isSized() ? TD.getABITypeAlignment(Ty) : 1;
>   if (DECL_ALIGN(exp)) {
>     if (DECL_USER_ALIGN(exp) || 8 * Alignment < (unsigned)DECL_ALIGN 
> (exp))
> -      Alignment = DECL_ALIGN(exp) / BITS_PER_UNIT;
> +      Alignment = DECL_ALIGN(exp) / 8;
>   }
>
>   return LValue(BitCastToType(Decl, PTy), Alignment);
>
>
> _______________________________________________
> 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