diff options
Diffstat (limited to 'gcc/java/decl.c')
-rw-r--r-- | gcc/java/decl.c | 203 |
1 files changed, 88 insertions, 115 deletions
diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 4fcc6c0..912f854 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -49,6 +49,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "target.h" #include "version.h" #include "tree-iterator.h" +#include "langhooks.h" #if defined (DEBUG_JAVA_BINDING_LEVELS) extern void indent (void); @@ -465,34 +466,6 @@ push_promoted_type (const char *name, tree actual_type) return type; } -/* Return a definition for a builtin function named NAME and whose data type - is TYPE. TYPE should be a function type with argument types. - FUNCTION_CODE tells later passes how to compile calls to this function. - See tree.h for its possible values. - - If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME, - the name to be called if we can't opencode the function. If - ATTRS is nonzero, use that for the function's attribute list. */ - -tree -builtin_function (const char *name, - tree type, - int function_code, - enum built_in_class cl, - const char *library_name, - tree ARG_UNUSED (attrs)) -{ - tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type); - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - if (library_name) - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name)); - pushdecl (decl); - DECL_BUILT_IN_CLASS (decl) = cl; - DECL_FUNCTION_CODE (decl) = function_code; - return decl; -} - /* Return tree that represents a vtable for a primitive array. */ static tree create_primitive_vtable (const char *name) @@ -942,50 +915,50 @@ java_init_decl_processing (void) endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE); t = tree_cons (NULL_TREE, class_ptr_type, endlink); - alloc_object_node = builtin_function ("_Jv_AllocObject", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + alloc_object_node = add_builtin_function ("_Jv_AllocObject", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_MALLOC (alloc_object_node) = 1; - alloc_no_finalizer_node = - builtin_function ("_Jv_AllocObjectNoFinalizer", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + alloc_no_finalizer_node = + add_builtin_function ("_Jv_AllocObjectNoFinalizer", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_MALLOC (alloc_no_finalizer_node) = 1; t = tree_cons (NULL_TREE, ptr_type_node, endlink); - soft_initclass_node = builtin_function ("_Jv_InitClass", - build_function_type (void_type_node, - t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + soft_initclass_node = add_builtin_function ("_Jv_InitClass", + build_function_type (void_type_node, + t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, class_ptr_type, tree_cons (NULL_TREE, int_type_node, endlink)); - soft_resolvepoolentry_node - = builtin_function ("_Jv_ResolvePoolEntry", - build_function_type (ptr_type_node, t), - 0,NOT_BUILT_IN, NULL, NULL_TREE); + soft_resolvepoolentry_node + = add_builtin_function ("_Jv_ResolvePoolEntry", + build_function_type (ptr_type_node, t), + 0,NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_PURE (soft_resolvepoolentry_node) = 1; - throw_node = builtin_function ("_Jv_Throw", - build_function_type (void_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + throw_node = add_builtin_function ("_Jv_Throw", + build_function_type (void_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); /* Mark throw_nodes as `noreturn' functions with side effects. */ TREE_THIS_VOLATILE (throw_node) = 1; TREE_SIDE_EFFECTS (throw_node) = 1; t = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node, endlink)); - soft_monitorenter_node - = builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN, - NULL, NULL_TREE); - soft_monitorexit_node - = builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN, - NULL, NULL_TREE); - - t = tree_cons (NULL_TREE, ptr_type_node, + soft_monitorenter_node + = add_builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + soft_monitorexit_node + = add_builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + + t = tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, int_type_node, endlink)); soft_newarray_node - = builtin_function ("_Jv_NewPrimArray", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_NewPrimArray", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_MALLOC (soft_newarray_node) = 1; t = tree_cons (NULL_TREE, int_type_node, @@ -993,9 +966,9 @@ java_init_decl_processing (void) tree_cons (NULL_TREE, object_ptr_type_node, endlink))); soft_anewarray_node - = builtin_function ("_Jv_NewObjectArray", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_NewObjectArray", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_MALLOC (soft_anewarray_node) = 1; /* There is no endlink here because _Jv_NewMultiArray is a varargs @@ -1003,43 +976,43 @@ java_init_decl_processing (void) t = tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, int_type_node, NULL_TREE)); soft_multianewarray_node - = builtin_function ("_Jv_NewMultiArray", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_NewMultiArray", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_MALLOC (soft_multianewarray_node) = 1; t = build_function_type (void_type_node, tree_cons (NULL_TREE, int_type_node, endlink)); soft_badarrayindex_node - = builtin_function ("_Jv_ThrowBadArrayIndex", t, - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_ThrowBadArrayIndex", t, + 0, NOT_BUILT_IN, NULL, NULL_TREE); /* Mark soft_badarrayindex_node as a `noreturn' function with side effects. */ TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1; TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1; soft_nullpointer_node - = builtin_function ("_Jv_ThrowNullPointerException", - build_function_type (void_type_node, endlink), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_ThrowNullPointerException", + build_function_type (void_type_node, endlink), + 0, NOT_BUILT_IN, NULL, NULL_TREE); /* Mark soft_nullpointer_node as a `noreturn' function with side effects. */ TREE_THIS_VOLATILE (soft_nullpointer_node) = 1; TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1; soft_abstractmethod_node - = builtin_function ("_Jv_ThrowAbstractMethodError", - build_function_type (void_type_node, endlink), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_ThrowAbstractMethodError", + build_function_type (void_type_node, endlink), + 0, NOT_BUILT_IN, NULL, NULL_TREE); /* Mark soft_abstractmethod_node as a `noreturn' function with side effects. */ TREE_THIS_VOLATILE (soft_abstractmethod_node) = 1; TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1; soft_nosuchfield_node - = builtin_function ("_Jv_ThrowNoSuchFieldError", - build_function_type (void_type_node, endlink), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_ThrowNoSuchFieldError", + build_function_type (void_type_node, endlink), + 0, NOT_BUILT_IN, NULL, NULL_TREE); /* Mark soft_nosuchfield_node as a `noreturn' function with side effects. */ TREE_THIS_VOLATILE (soft_nosuchfield_node) = 1; @@ -1048,85 +1021,85 @@ java_init_decl_processing (void) t = tree_cons (NULL_TREE, class_ptr_type, tree_cons (NULL_TREE, object_ptr_type_node, endlink)); soft_checkcast_node - = builtin_function ("_Jv_CheckCast", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_CheckCast", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, object_ptr_type_node, tree_cons (NULL_TREE, class_ptr_type, endlink)); soft_instanceof_node - = builtin_function ("_Jv_IsInstanceOf", - build_function_type (boolean_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_IsInstanceOf", + build_function_type (boolean_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_PURE (soft_instanceof_node) = 1; t = tree_cons (NULL_TREE, object_ptr_type_node, tree_cons (NULL_TREE, object_ptr_type_node, endlink)); soft_checkarraystore_node - = builtin_function ("_Jv_CheckArrayStore", - build_function_type (void_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_CheckArrayStore", + build_function_type (void_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, int_type_node, endlink))); - soft_lookupinterfacemethod_node - = builtin_function ("_Jv_LookupInterfaceMethodIdx", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + soft_lookupinterfacemethod_node + = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); DECL_IS_PURE (soft_lookupinterfacemethod_node) = 1; t = tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, endlink))); - soft_lookupinterfacemethodbyname_node - = builtin_function ("_Jv_LookupInterfaceMethod", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + soft_lookupinterfacemethodbyname_node + = add_builtin_function ("_Jv_LookupInterfaceMethod", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, object_ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, int_type_node, endlink)))); soft_lookupjnimethod_node - = builtin_function ("_Jv_LookupJNIMethod", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_LookupJNIMethod", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, ptr_type_node, endlink); soft_getjnienvnewframe_node - = builtin_function ("_Jv_GetJNIEnvNewFrame", - build_function_type (ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_GetJNIEnvNewFrame", + build_function_type (ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); soft_jnipopsystemframe_node - = builtin_function ("_Jv_JNI_PopSystemFrame", - build_function_type (void_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_JNI_PopSystemFrame", + build_function_type (void_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, object_ptr_type_node, endlink); soft_unwrapjni_node - = builtin_function ("_Jv_UnwrapJNIweakReference", - build_function_type (object_ptr_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_UnwrapJNIweakReference", + build_function_type (object_ptr_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, int_type_node, tree_cons (NULL_TREE, int_type_node, endlink)); soft_idiv_node - = builtin_function ("_Jv_divI", - build_function_type (int_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_divI", + build_function_type (int_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); soft_irem_node - = builtin_function ("_Jv_remI", - build_function_type (int_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_remI", + build_function_type (int_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); t = tree_cons (NULL_TREE, long_type_node, tree_cons (NULL_TREE, long_type_node, endlink)); soft_ldiv_node - = builtin_function ("_Jv_divJ", - build_function_type (long_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_divJ", + build_function_type (long_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); soft_lrem_node - = builtin_function ("_Jv_remJ", - build_function_type (long_type_node, t), - 0, NOT_BUILT_IN, NULL, NULL_TREE); + = add_builtin_function ("_Jv_remJ", + build_function_type (long_type_node, t), + 0, NOT_BUILT_IN, NULL, NULL_TREE); /* Initialize variables for except.c. */ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS |