OSDN Git Service

* stor-layout.c (mode_for_size_tree): Remove restiction on type
[pf3gnuchains/gcc-fork.git] / gcc / builtins.c
index bb113dc..c4200c2 100644 (file)
@@ -275,14 +275,28 @@ get_pointer_alignment (tree exp, unsigned int max_align)
        case ADDR_EXPR:
          /* See what we are pointing at and look at its alignment.  */
          exp = TREE_OPERAND (exp, 0);
+         inner = max_align;
+         while (handled_component_p (exp))
+           {
+             /* Fields in a structure can be packed, honour DECL_ALIGN
+                of the FIELD_DECL.  For all other references the conservative 
+                alignment is the element type alignment.  */
+             if (TREE_CODE (exp) == COMPONENT_REF)
+               inner = MIN (inner, DECL_ALIGN (TREE_OPERAND (exp, 1)));
+             else
+               inner = MIN (inner, TYPE_ALIGN (TREE_TYPE (exp)));
+             exp = TREE_OPERAND (exp, 0);
+           }
          if (TREE_CODE (exp) == FUNCTION_DECL)
            align = FUNCTION_BOUNDARY;
          else if (DECL_P (exp))
-           align = DECL_ALIGN (exp);
+           align = MIN (inner, DECL_ALIGN (exp));
 #ifdef CONSTANT_ALIGNMENT
          else if (CONSTANT_CLASS_P (exp))
-           align = CONSTANT_ALIGNMENT (exp, align);
+           align = MIN (inner, (unsigned)CONSTANT_ALIGNMENT (exp, align));
 #endif
+         else
+           align = MIN (align, inner);
          return MIN (align, max_align);
 
        default:
@@ -498,7 +512,7 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count)
 
   /* For a zero count, we don't care what frame address we return, so frame
      pointer elimination is OK, and using the soft frame pointer is OK.
-     For a non-zero count, we require a stable offset from the current frame
+     For a nonzero count, we require a stable offset from the current frame
      pointer to the previous one, so we must use the hard frame pointer, and
      we must disable frame pointer elimination.  */
   if (count == 0)
@@ -1585,7 +1599,6 @@ type_to_class (tree type)
     {
     case VOID_TYPE:       return void_type_class;
     case INTEGER_TYPE:    return integer_type_class;
-    case CHAR_TYPE:       return char_type_class;
     case ENUMERAL_TYPE:           return enumeral_type_class;
     case BOOLEAN_TYPE:    return boolean_type_class;
     case POINTER_TYPE:    return pointer_type_class;
@@ -5368,6 +5381,8 @@ expand_builtin_fork_or_exec (tree fn, tree arglist, rtx target, int ignore)
   TREE_PUBLIC (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
   TREE_NOTHROW (decl) = 1;
+  DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+  DECL_VISIBILITY_SPECIFIED (decl) = 1;
   call = build_function_call_expr (decl, arglist);
 
   return expand_call (call, target, ignore);
@@ -5560,6 +5575,14 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
 
   if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
     return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
+  else
+    {
+      /* Try expanding the builtin via the generic target hook.  */
+      rtx tmp = targetm.expand_library_builtin (exp, target, subtarget,
+                                               mode, ignore);
+      if (tmp != NULL_RTX)
+       return tmp;
+    }
 
   /* When not optimizing, generate calls to library functions for a certain
      set of builtins.  */
@@ -8201,9 +8224,9 @@ fold_builtin_copysign (tree fndecl, tree arglist, tree type)
 
       c1 = TREE_REAL_CST (arg1);
       c2 = TREE_REAL_CST (arg2);
+      /* c1.sign := c2.sign.  */
       real_copysign (&c1, &c2);
       return build_real (type, c1);
-      c1.sign = c2.sign;
     }
 
   /* copysign(X, Y) is fabs(X) when Y is always non-negative.
@@ -8913,6 +8936,18 @@ default_expand_builtin (tree exp ATTRIBUTE_UNUSED,
   return NULL_RTX;
 }
 
+/* Default target-specific library builtin expander that does nothing.  */
+
+rtx
+default_expand_library_builtin (tree exp ATTRIBUTE_UNUSED,
+                       rtx target ATTRIBUTE_UNUSED,
+                       rtx subtarget ATTRIBUTE_UNUSED,
+                       enum machine_mode mode ATTRIBUTE_UNUSED,
+                       int ignore ATTRIBUTE_UNUSED)
+{
+  return NULL_RTX;
+}
+
 /* Returns true is EXP represents data that would potentially reside
    in a readonly section.  */