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

Eric Christopher echristo at apple.com
Mon Oct 5 15:25:32 PDT 2009


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.

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);





More information about the llvm-commits mailing list