OSDN Git Service

* c-common.c (expand_unordered_cmp): Delete.
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Jun 2004 05:26:07 +0000 (05:26 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 Jun 2004 05:26:07 +0000 (05:26 +0000)
(expand_tree_builtin): Delete.
* c-common.h (expand_tree_builtin): Delete function prototype.
* c-typeck.c (build_function_call): Don't call expand_tree_builtin.

* call.c (build_cxx_call): Don't call expand_tree_builtin.  No
longer take both "args" and "convert_args" as arguments.
(build_op_delete_call): Update call to build_cxx_call.
(build_over_call): Likewise, update call to build_cxx_call.
* cp-tree.h (build_cxx_call): Update funtion prototype.
* typeck.c (build_function_call): Don't call expand_tree_builtin.
* rtti.c (throw_bad_cast): Update call to build_cxx_call.
(throw_bad_typeid): Likewise.
(build_dynamic_cast_1): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83579 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/rtti.c
gcc/cp/typeck.c

index 37024fb..be18213 100644 (file)
@@ -1,3 +1,10 @@
+2004-06-23  Roger Sayle  <roger@eyesopen.com>
+
+       * c-common.c (expand_unordered_cmp): Delete.
+       (expand_tree_builtin): Delete.
+       * c-common.h (expand_tree_builtin): Delete function prototype.
+       * c-typeck.c (build_function_call): Don't call expand_tree_builtin.
+
 2004-06-23  Richard Henderson  <rth@redhat.com>
 
        * gimplify.c (gimplify_compound_lval): Don't set ARRAY_REF or
index ab5b2ae..dddd6ec 100644 (file)
@@ -3500,155 +3500,6 @@ strip_pointer_operator (tree t)
   return t;
 }
 
-static tree expand_unordered_cmp (tree, tree, enum tree_code, enum tree_code);
-
-/* Expand a call to an unordered comparison function such as
-   __builtin_isgreater().  FUNCTION is the function's declaration and
-   PARAMS a list of the values passed.  For __builtin_isunordered(),
-   UNORDERED_CODE is UNORDERED_EXPR and ORDERED_CODE is NOP_EXPR.  In
-   other cases, UNORDERED_CODE and ORDERED_CODE are comparison codes
-   that give the opposite of the desired result.  UNORDERED_CODE is
-   used for modes that can hold NaNs and ORDERED_CODE is used for the
-   rest.  */
-
-static tree
-expand_unordered_cmp (tree function, tree params,
-                     enum tree_code unordered_code,
-                     enum tree_code ordered_code)
-{
-  tree arg0, arg1, type;
-  enum tree_code code0, code1;
-
-  /* Check that we have exactly two arguments.  */
-  if (params == 0 || TREE_CHAIN (params) == 0)
-    {
-      error ("too few arguments to function `%s'",
-            IDENTIFIER_POINTER (DECL_NAME (function)));
-      return error_mark_node;
-    }
-  else if (TREE_CHAIN (TREE_CHAIN (params)) != 0)
-    {
-      error ("too many arguments to function `%s'",
-            IDENTIFIER_POINTER (DECL_NAME (function)));
-      return error_mark_node;
-    }
-
-  arg0 = TREE_VALUE (params);
-  arg1 = TREE_VALUE (TREE_CHAIN (params));
-
-  code0 = TREE_CODE (TREE_TYPE (arg0));
-  code1 = TREE_CODE (TREE_TYPE (arg1));
-
-  /* Make sure that the arguments have a common type of REAL.  */
-  type = 0;
-  if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
-      && (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
-    type = common_type (TREE_TYPE (arg0), TREE_TYPE (arg1));
-
-  if (type == 0 || TREE_CODE (type) != REAL_TYPE)
-    {
-      error ("non-floating-point argument to function `%s'",
-            IDENTIFIER_POINTER (DECL_NAME (function)));
-      return error_mark_node;
-    }
-
-  if (unordered_code == UNORDERED_EXPR)
-    {
-      if (MODE_HAS_NANS (TYPE_MODE (type)))
-       return build_binary_op (unordered_code,
-                               convert (type, arg0),
-                               convert (type, arg1),
-                               0);
-      else
-       return integer_zero_node;
-    }
-
-  return build_unary_op (TRUTH_NOT_EXPR,
-                        build_binary_op (MODE_HAS_NANS (TYPE_MODE (type))
-                                         ? unordered_code
-                                         : ordered_code,
-                                         convert (type, arg0),
-                                         convert (type, arg1),
-                                         0),
-                        0);
-}
-
-
-/* Recognize certain built-in functions so we can make tree-codes
-   other than CALL_EXPR.  We do this when it enables fold-const.c
-   to do something useful.  */
-/* ??? By rights this should go in builtins.c, but only C and C++
-   implement build_{binary,unary}_op.  Not exactly sure what bits
-   of functionality are actually needed from those functions, or
-   where the similar functionality exists in the other front ends.  */
-
-tree
-expand_tree_builtin (tree function, tree params, tree coerced_params)
-{
-  if (DECL_BUILT_IN_CLASS (function) != BUILT_IN_NORMAL)
-    return NULL_TREE;
-
-  switch (DECL_FUNCTION_CODE (function))
-    {
-    case BUILT_IN_ABS:
-    case BUILT_IN_LABS:
-    case BUILT_IN_LLABS:
-    case BUILT_IN_IMAXABS:
-    case BUILT_IN_FABS:
-    case BUILT_IN_FABSL:
-    case BUILT_IN_FABSF:
-      if (coerced_params == 0)
-       return integer_zero_node;
-      return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0);
-
-    case BUILT_IN_CONJ:
-    case BUILT_IN_CONJF:
-    case BUILT_IN_CONJL:
-      if (coerced_params == 0)
-       return integer_zero_node;
-      return build_unary_op (CONJ_EXPR, TREE_VALUE (coerced_params), 0);
-
-    case BUILT_IN_CREAL:
-    case BUILT_IN_CREALF:
-    case BUILT_IN_CREALL:
-      if (coerced_params == 0)
-       return integer_zero_node;
-      return non_lvalue (build_unary_op (REALPART_EXPR,
-                                        TREE_VALUE (coerced_params), 0));
-
-    case BUILT_IN_CIMAG:
-    case BUILT_IN_CIMAGF:
-    case BUILT_IN_CIMAGL:
-      if (coerced_params == 0)
-       return integer_zero_node;
-      return non_lvalue (build_unary_op (IMAGPART_EXPR,
-                                        TREE_VALUE (coerced_params), 0));
-
-    case BUILT_IN_ISGREATER:
-      return expand_unordered_cmp (function, params, UNLE_EXPR, LE_EXPR);
-
-    case BUILT_IN_ISGREATEREQUAL:
-      return expand_unordered_cmp (function, params, UNLT_EXPR, LT_EXPR);
-
-    case BUILT_IN_ISLESS:
-      return expand_unordered_cmp (function, params, UNGE_EXPR, GE_EXPR);
-
-    case BUILT_IN_ISLESSEQUAL:
-      return expand_unordered_cmp (function, params, UNGT_EXPR, GT_EXPR);
-
-    case BUILT_IN_ISLESSGREATER:
-      return expand_unordered_cmp (function, params, UNEQ_EXPR, EQ_EXPR);
-
-    case BUILT_IN_ISUNORDERED:
-      return expand_unordered_cmp (function, params, UNORDERED_EXPR, NOP_EXPR);
-
-    default:
-      break;
-    }
-
-  return NULL_TREE;
-}
-
 /* Walk the statement tree, rooted at *tp.  Apply FUNC to all the
    sub-trees of *TP in a pre-order traversal.  FUNC is called with the
    DATA and the address of each sub-tree.  If FUNC returns a non-NULL
index 03c6c75..abb921e 100644 (file)
@@ -1032,8 +1032,6 @@ extern tree default_conversion (tree);
 
 extern tree common_type (tree, tree);
 
-extern tree expand_tree_builtin (tree, tree, tree);
-
 extern tree decl_constant_value (tree);
 
 /* Handle increment and decrement of boolean types.  */
index ad6a90a..8a5d06f 100644 (file)
@@ -1886,20 +1886,6 @@ build_function_call (tree function, tree params)
 
   check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params);
 
-  /* Recognize certain built-in functions so we can make tree-codes
-     other than CALL_EXPR.  We do this when it enables fold-const.c
-     to do something useful.  */
-
-  if (TREE_CODE (function) == ADDR_EXPR
-      && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
-      && DECL_BUILT_IN (TREE_OPERAND (function, 0)))
-    {
-      result = expand_tree_builtin (TREE_OPERAND (function, 0),
-                                   params, coerced_params);
-      if (result)
-       return result;
-    }
-
   result = build (CALL_EXPR, TREE_TYPE (fntype),
                  function, coerced_params, NULL_TREE);
   TREE_SIDE_EFFECTS (result) = 1;
index f67eb22..531df51 100644 (file)
@@ -1,3 +1,15 @@
+2004-06-23  Roger Sayle  <roger@eyesopen.com>
+
+       * call.c (build_cxx_call): Don't call expand_tree_builtin.  No
+       longer take both "args" and "convert_args" as arguments.
+       (build_op_delete_call): Update call to build_cxx_call.
+       (build_over_call): Likewise, update call to build_cxx_call.
+       * cp-tree.h (build_cxx_call): Update funtion prototype.
+       * typeck.c (build_function_call): Don't call expand_tree_builtin.
+       * rtti.c (throw_bad_cast): Update call to build_cxx_call.
+       (throw_bad_typeid): Likewise.
+       (build_dynamic_cast_1): Likewise.
+
 2004-06-22  Richard Henderson  <rth@redhat.com>
 
        * class.c (build_vfn_ref): Take a pointer not object.  Build
index 2a659cc..e02fa17 100644 (file)
@@ -4023,7 +4023,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
          /* The placement args might not be suitable for overload
             resolution at this point, so build the call directly.  */
          mark_used (fn);
-         return build_cxx_call (fn, args, args);
+         return build_cxx_call (fn, args);
        }
       else
        return build_function_call (fn, args);
@@ -4843,33 +4843,19 @@ build_over_call (struct z_candidate *cand, int flags)
   else
     fn = build_addr_func (fn);
 
-  return build_cxx_call (fn, args, converted_args);
+  return build_cxx_call (fn, converted_args);
 }
 
-/* Build and return a call to FN, using the the CONVERTED_ARGS.  ARGS
-   gives the original form of the arguments.  This function performs
+/* Build and return a call to FN, using ARGS.  This function performs
    no overload resolution, conversion, or other high-level
    operations.  */
 
 tree
-build_cxx_call(tree fn, tree args, tree converted_args)
+build_cxx_call (tree fn, tree args)
 {
   tree fndecl;
 
-  /* Recognize certain built-in functions so we can make tree-codes
-     other than CALL_EXPR.  We do this when it enables fold-const.c
-     to do something useful.  */
-  if (TREE_CODE (fn) == ADDR_EXPR
-      && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
-      && DECL_BUILT_IN (TREE_OPERAND (fn, 0)))
-    {
-      tree exp;
-      exp = expand_tree_builtin (TREE_OPERAND (fn, 0), args, converted_args);
-      if (exp)
-       return exp;
-    }
-
-  fn = build_call (fn, converted_args);
+  fn = build_call (fn, args);
 
   /* If this call might throw an exception, note that fact.  */
   fndecl = get_callee_fndecl (fn);
index 36d98c6..9638c2d 100644 (file)
@@ -3626,7 +3626,7 @@ extern tree strip_top_quals (tree);
 extern tree perform_implicit_conversion (tree, tree);
 extern tree perform_direct_initialization_if_possible (tree, tree);
 extern tree in_charge_arg_for_name (tree);
-extern tree build_cxx_call (tree, tree, tree);
+extern tree build_cxx_call (tree, tree);
 #ifdef ENABLE_CHECKING
 extern void validate_conversion_obstack (void);
 #endif /* ENABLE_CHECKING */
index ac149c8..b57de9d 100644 (file)
@@ -176,7 +176,7 @@ throw_bad_cast (void)
     fn = push_throw_library_fn (fn, build_function_type (ptr_type_node,
                                                         void_list_node));
   
-  return build_cxx_call (fn, NULL_TREE, NULL_TREE);
+  return build_cxx_call (fn, NULL_TREE);
 }
 
 /* Return an expression for "__cxa_bad_typeid()".  The expression
@@ -193,7 +193,7 @@ throw_bad_typeid (void)
       fn = push_throw_library_fn (fn, t);
     }
 
-  return convert_from_reference (build_cxx_call (fn, NULL_TREE, NULL_TREE));
+  return convert_from_reference (build_cxx_call (fn, NULL_TREE));
 }
 \f
 /* Return an lvalue expression whose type is "const std::type_info"
@@ -652,7 +652,7 @@ build_dynamic_cast_1 (tree type, tree expr)
               pop_nested_namespace (ns);
               dynamic_cast_node = dcast_fn;
            }
-          result = build_cxx_call (dcast_fn, elems, elems);
+          result = build_cxx_call (dcast_fn, elems);
 
          if (tc == REFERENCE_TYPE)
            {
index 8800007..2dc21db 100644 (file)
@@ -2411,7 +2411,6 @@ build_function_call (tree function, tree params)
 {
   tree fntype, fndecl;
   tree coerced_params;
-  tree result;
   tree name = NULL_TREE;
   int is_method;
   tree original = function;
@@ -2489,21 +2488,7 @@ build_function_call (tree function, tree params)
   if (warn_format)
     check_function_format (NULL, TYPE_ATTRIBUTES (fntype), coerced_params);
 
-  /* Recognize certain built-in functions so we can make tree-codes
-     other than CALL_EXPR.  We do this when it enables fold-const.c
-     to do something useful.  */
-
-  if (TREE_CODE (function) == ADDR_EXPR
-      && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL
-      && DECL_BUILT_IN (TREE_OPERAND (function, 0)))
-    {
-      result = expand_tree_builtin (TREE_OPERAND (function, 0),
-                                   params, coerced_params);
-      if (result)
-       return result;
-    }
-
-  return build_cxx_call (function, params, coerced_params);
+  return build_cxx_call (function, coerced_params);
 }
 \f
 /* Convert the actual parameter expressions in the list VALUES