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

Eric Christopher echristo at apple.com
Mon Oct 5 15:16:12 PDT 2009


Author: echristo
Date: Mon Oct  5 17:16:12 2009
New Revision: 83329

URL: http://llvm.org/viewvc/llvm-project?rev=83329&view=rev
Log:
Use FUNCTION_BOUNDARY for default function alignment. Use BITS_PER_UNIT
instead of 8 for computing alignment size - this is almost always
8 anyhow.

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=83329&r1=83328&r2=83329&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:16:12 2009
@@ -504,8 +504,8 @@
   handleVisibility(FnDecl, Fn);
 
   // Handle attribute "aligned".
-  if (DECL_ALIGN (FnDecl) != 8)
-    Fn->setAlignment(DECL_ALIGN (FnDecl) / 8);
+  if (DECL_ALIGN (FnDecl) != FUNCTION_BOUNDARY)
+    Fn->setAlignment(DECL_ALIGN (FnDecl) / BITS_PER_UNIT);
 
   // Handle functions in specified sections.
   if (DECL_SECTION_NAME(FnDecl))
@@ -1324,7 +1324,7 @@
   const Type *LLVMTy = ConvertType(type);
   unsigned NumElts = CountAggregateElements(LLVMTy);
   if (TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST &&
-      (NumElts == 1 ||  
+      (NumElts == 1 ||
        TREE_INT_CST_LOW(TYPE_SIZE_UNIT(type)) <
        TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY)) {
 
@@ -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) / 8;
+      Alignment = DECL_ALIGN(decl) / BITS_PER_UNIT;
   }
 
   const char *Name;      // Name of variable
@@ -6628,7 +6628,8 @@
     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)) / 8);
+      LVAlign = std::max(LVAlign,
+			 unsigned(DECL_ALIGN(FieldDecl)) / BITS_PER_UNIT);
 #endif
 
     // If the FIELD_DECL has an annotate attribute on it, emit it.
@@ -6838,7 +6839,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) / 8;
+      Alignment = DECL_ALIGN(exp) / BITS_PER_UNIT;
   }
 
   return LValue(BitCastToType(Decl, PTy), Alignment);





More information about the llvm-commits mailing list