This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[java] Fix builtins decls
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Sun, 22 May 2005 23:08:06 +0200
- Subject: [java] Fix builtins decls
Hi,
tree-profiling branch dies horribly by trying to remove
__builtin_predict calls since these are believed to be trapping in Java.
I've bootstrapped/regtested i686--linux the attached patch on
tree-profiling and I am testing it on mainline now too.
OK (once mainline unslush, as this does not counts as a regression
there)
2005-05-22 Jan Hubicka <jh@suse.cz>
* builtins.c (define_builtin): Accept new flags parameter.
(initialize_builtins): Mark the builtins const and nothrow accordingly.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/builtins.c,v
retrieving revision 1.8.2.9.4.9
diff -c -3 -p -r1.8.2.9.4.9 builtins.c
*** builtins.c 18 May 2005 07:44:03 -0000 1.8.2.9.4.9
--- builtins.c 22 May 2005 21:02:39 -0000
*************** static tree min_builtin (tree, tree);
*** 41,48 ****
static tree abs_builtin (tree, tree);
static tree java_build_function_call_expr (tree, tree);
- static void define_builtin (enum built_in_function, const char *,
- tree, const char *);
--- 41,46 ----
*************** java_build_function_call_expr (tree fn,
*** 131,142 ****
/* Define a single builtin. */
static void
define_builtin (enum built_in_function val,
const char *name,
tree type,
! const char *libname)
{
tree decl;
--- 129,143 ----
+ #define BUILTIN_NOTHROW 1
+ #define BUILTIN_CONST 2
/* Define a single builtin. */
static void
define_builtin (enum built_in_function val,
const char *name,
tree type,
! const char *libname,
! int flags)
{
tree decl;
*************** define_builtin (enum built_in_function v
*** 148,153 ****
--- 149,158 ----
pushdecl (decl);
DECL_BUILT_IN_CLASS (decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (decl) = val;
+ if (flags & BUILTIN_NOTHROW)
+ TREE_NOTHROW (decl) = 1;
+ if (flags & BUILTIN_CONST)
+ TREE_READONLY (decl) = 1;
implicit_built_in_decls[val] = decl;
built_in_decls[val] = decl;
*************** initialize_builtins (void)
*** 187,229 ****
double_ftype_double_double = build_function_type (double_type_node, t);
define_builtin (BUILT_IN_FMOD, "__builtin_fmod",
! double_ftype_double_double, "fmod");
define_builtin (BUILT_IN_FMODF, "__builtin_fmodf",
! float_ftype_float_float, "fmodf");
define_builtin (BUILT_IN_ACOS, "__builtin_acos",
! double_ftype_double, "_ZN4java4lang4Math4acosEd");
define_builtin (BUILT_IN_ASIN, "__builtin_asin",
! double_ftype_double, "_ZN4java4lang4Math4asinEd");
define_builtin (BUILT_IN_ATAN, "__builtin_atan",
! double_ftype_double, "_ZN4java4lang4Math4atanEd");
define_builtin (BUILT_IN_ATAN2, "__builtin_atan2",
! double_ftype_double_double, "_ZN4java4lang4Math5atan2Edd");
define_builtin (BUILT_IN_CEIL, "__builtin_ceil",
! double_ftype_double, "_ZN4java4lang4Math4ceilEd");
define_builtin (BUILT_IN_COS, "__builtin_cos",
! double_ftype_double, "_ZN4java4lang4Math3cosEd");
define_builtin (BUILT_IN_EXP, "__builtin_exp",
! double_ftype_double, "_ZN4java4lang4Math3expEd");
define_builtin (BUILT_IN_FLOOR, "__builtin_floor",
! double_ftype_double, "_ZN4java4lang4Math5floorEd");
define_builtin (BUILT_IN_LOG, "__builtin_log",
! double_ftype_double, "_ZN4java4lang4Math3logEd");
define_builtin (BUILT_IN_POW, "__builtin_pow",
! double_ftype_double_double, "_ZN4java4lang4Math3powEdd");
define_builtin (BUILT_IN_SIN, "__builtin_sin",
! double_ftype_double, "_ZN4java4lang4Math3sinEd");
define_builtin (BUILT_IN_SQRT, "__builtin_sqrt",
! double_ftype_double, "_ZN4java4lang4Math4sqrtEd");
define_builtin (BUILT_IN_TAN, "__builtin_tan",
! double_ftype_double, "_ZN4java4lang4Math3tanEd");
t = tree_cons (NULL_TREE, boolean_type_node, end_params_node);
t = tree_cons (NULL_TREE, boolean_type_node, t);
boolean_ftype_boolean_boolean = build_function_type (boolean_type_node, t);
define_builtin (BUILT_IN_EXPECT, "__builtin_expect",
boolean_ftype_boolean_boolean,
! "__builtin_expect");
build_common_builtin_nodes ();
}
--- 192,248 ----
double_ftype_double_double = build_function_type (double_type_node, t);
define_builtin (BUILT_IN_FMOD, "__builtin_fmod",
! double_ftype_double_double, "fmod", BUILTIN_CONST);
define_builtin (BUILT_IN_FMODF, "__builtin_fmodf",
! float_ftype_float_float, "fmodf", BUILTIN_CONST);
define_builtin (BUILT_IN_ACOS, "__builtin_acos",
! double_ftype_double, "_ZN4java4lang4Math4acosEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_ASIN, "__builtin_asin",
! double_ftype_double, "_ZN4java4lang4Math4asinEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_ATAN, "__builtin_atan",
! double_ftype_double, "_ZN4java4lang4Math4atanEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_ATAN2, "__builtin_atan2",
! double_ftype_double_double, "_ZN4java4lang4Math5atan2Edd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_CEIL, "__builtin_ceil",
! double_ftype_double, "_ZN4java4lang4Math4ceilEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_COS, "__builtin_cos",
! double_ftype_double, "_ZN4java4lang4Math3cosEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_EXP, "__builtin_exp",
! double_ftype_double, "_ZN4java4lang4Math3expEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_FLOOR, "__builtin_floor",
! double_ftype_double, "_ZN4java4lang4Math5floorEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_LOG, "__builtin_log",
! double_ftype_double, "_ZN4java4lang4Math3logEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_POW, "__builtin_pow",
! double_ftype_double_double, "_ZN4java4lang4Math3powEdd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_SIN, "__builtin_sin",
! double_ftype_double, "_ZN4java4lang4Math3sinEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_SQRT, "__builtin_sqrt",
! double_ftype_double, "_ZN4java4lang4Math4sqrtEd",
! BUILTIN_CONST);
define_builtin (BUILT_IN_TAN, "__builtin_tan",
! double_ftype_double, "_ZN4java4lang4Math3tanEd",
! BUILTIN_CONST);
t = tree_cons (NULL_TREE, boolean_type_node, end_params_node);
t = tree_cons (NULL_TREE, boolean_type_node, t);
boolean_ftype_boolean_boolean = build_function_type (boolean_type_node, t);
define_builtin (BUILT_IN_EXPECT, "__builtin_expect",
boolean_ftype_boolean_boolean,
! "__builtin_expect",
! BUILTIN_CONST | BUILTIN_NOTHROW);
build_common_builtin_nodes ();
}