void
java_init_decl_processing (void)
{
- tree endlink;
tree field = NULL_TREE;
tree t;
pushlevel (0); /* make the binding_level structure for global names */
global_binding_level = current_binding_level;
- /* The code here must be similar to build_common_tree_nodes{,_2} in
- tree.c, especially as to the order of initializing common nodes. */
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
+ /* Build common tree nodes, Java has an unsigned char. */
+ build_common_tree_nodes (false, false);
- /* Create sizetype first - needed for other types. */
- initialize_sizetypes ();
+ /* ??? Now we continue and override some of the built types again
+ with Java specific types. As the above generated types are
+ supposed to match the targets C ABI this isn't really the way
+ to go and any Java specifics should _not_ use those global types
+ if the Java ABI does not match the C one. */
byte_type_node = make_signed_type (8);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("unsigned long"),
unsigned_long_type_node));
- /* This is not a java type, however tree-dfa requires a definition for
- size_type_node. */
- size_type_node = make_unsigned_type (POINTER_SIZE);
- set_sizetype (size_type_node);
-
/* Define these next since types below may used them. */
integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
integer_zero_node = build_int_cst (NULL_TREE, 0);
integer_one_node = build_int_cst (NULL_TREE, 1);
integer_two_node = build_int_cst (NULL_TREE, 2);
+ integer_three_node = build_int_cst (NULL_TREE, 3);
integer_four_node = build_int_cst (NULL_TREE, 4);
integer_minus_one_node = build_int_cst (NULL_TREE, -1);
= double_int_to_tree (unsigned_long_type_node,
double_int_setbit (double_int_zero, 64));
- size_zero_node = size_int (0);
- size_one_node = size_int (1);
- bitsize_zero_node = bitsize_int (0);
- bitsize_one_node = bitsize_int (1);
- bitsize_unit_node = bitsize_int (BITS_PER_UNIT);
-
long_zero_node = build_int_cst (long_type_node, 0);
- void_type_node = make_node (VOID_TYPE);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("void"), void_type_node));
- layout_type (void_type_node); /* Uses size_zero_node */
-
- ptr_type_node = build_pointer_type (void_type_node);
- const_ptr_type_node
- = build_pointer_type (build_type_variant (void_type_node, 1, 0));
t = make_node (VOID_TYPE);
layout_type (t); /* Uses size_zero_node */
return_address_type_node = build_pointer_type (t);
- null_pointer_node = build_int_cst (ptr_type_node, 0);
-
- char_type_node = make_node (INTEGER_TYPE);
+ char_type_node = make_unsigned_type (16);
TYPE_STRING_FLAG (char_type_node) = 1;
- TYPE_PRECISION (char_type_node) = 16;
- fixup_unsigned_type (char_type_node);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("char"), char_type_node));
- boolean_type_node = make_node (BOOLEAN_TYPE);
- TYPE_PRECISION (boolean_type_node) = 1;
- fixup_unsigned_type (boolean_type_node);
+ boolean_type_node = make_unsigned_type (1);
+ TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
pushdecl (build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("boolean"),
boolean_type_node));
build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("Method"), method_type_node);
- endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
+ end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
- t = tree_cons (NULL_TREE, class_ptr_type, endlink);
- alloc_object_node = add_builtin_function ("_Jv_AllocObject",
- build_function_type (ptr_type_node, t),
+ t = build_function_type_list (ptr_type_node, class_ptr_type, NULL_TREE);
+ alloc_object_node = add_builtin_function ("_Jv_AllocObject", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (alloc_object_node) = 1;
alloc_no_finalizer_node =
- add_builtin_function ("_Jv_AllocObjectNoFinalizer",
- build_function_type (ptr_type_node, t),
+ add_builtin_function ("_Jv_AllocObjectNoFinalizer", 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 = add_builtin_function ("_Jv_InitClass",
- build_function_type (void_type_node,
- t),
+ t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
+ soft_initclass_node = add_builtin_function ("_Jv_InitClass", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, int_type_node, endlink));
+ t = build_function_type_list (ptr_type_node,
+ class_ptr_type, int_type_node, NULL_TREE);
soft_resolvepoolentry_node
- = add_builtin_function ("_Jv_ResolvePoolEntry",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_ResolvePoolEntry", t,
0,NOT_BUILT_IN, NULL, NULL_TREE);
DECL_PURE_P (soft_resolvepoolentry_node) = 1;
- throw_node = add_builtin_function ("_Jv_Throw",
- build_function_type (void_type_node, t),
+ t = build_function_type_list (void_type_node,
+ class_ptr_type, int_type_node, NULL_TREE);
+ throw_node = add_builtin_function ("_Jv_Throw", 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));
+ t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
soft_monitorenter_node
= add_builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
= 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));
+ t = build_function_type_list (ptr_type_node,
+ ptr_type_node, int_type_node, NULL_TREE);
soft_newarray_node
- = add_builtin_function ("_Jv_NewPrimArray",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_NewPrimArray", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (soft_newarray_node) = 1;
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, object_ptr_type_node,
- endlink)));
+ t = build_function_type_list (ptr_type_node,
+ int_type_node, class_ptr_type,
+ object_ptr_type_node, NULL_TREE);
soft_anewarray_node
- = add_builtin_function ("_Jv_NewObjectArray",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_NewObjectArray", 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
- function. */
- t = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, int_type_node, NULL_TREE));
+ t = build_varargs_function_type_list (ptr_type_node,
+ ptr_type_node, int_type_node,
+ NULL_TREE);
soft_multianewarray_node
- = add_builtin_function ("_Jv_NewMultiArray",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_NewMultiArray", 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));
+ t = build_function_type_list (void_type_node, int_type_node, NULL_TREE);
soft_badarrayindex_node
= add_builtin_function ("_Jv_ThrowBadArrayIndex", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
+ t = build_function_type_list (void_type_node, NULL_TREE);
soft_nullpointer_node
- = add_builtin_function ("_Jv_ThrowNullPointerException",
- build_function_type (void_type_node, endlink),
+ = add_builtin_function ("_Jv_ThrowNullPointerException", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_nullpointer_node as a `noreturn' function with side
effects. */
TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
soft_abstractmethod_node
- = add_builtin_function ("_Jv_ThrowAbstractMethodError",
- build_function_type (void_type_node, endlink),
+ = add_builtin_function ("_Jv_ThrowAbstractMethodError", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_abstractmethod_node as a `noreturn' function with side
effects. */
TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
soft_nosuchfield_node
- = add_builtin_function ("_Jv_ThrowNoSuchFieldError",
- build_function_type (void_type_node, endlink),
+ = add_builtin_function ("_Jv_ThrowNoSuchFieldError", t,
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;
TREE_SIDE_EFFECTS (soft_nosuchfield_node) = 1;
- t = tree_cons (NULL_TREE, class_ptr_type,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink));
+ t = build_function_type_list (ptr_type_node,
+ class_ptr_type, object_ptr_type_node,
+ NULL_TREE);
soft_checkcast_node
- = add_builtin_function ("_Jv_CheckCast",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_CheckCast", 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));
+ t = build_function_type_list (boolean_type_node,
+ object_ptr_type_node, class_ptr_type,
+ NULL_TREE);
soft_instanceof_node
- = add_builtin_function ("_Jv_IsInstanceOf",
- build_function_type (boolean_type_node, t),
+ = add_builtin_function ("_Jv_IsInstanceOf", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_PURE_P (soft_instanceof_node) = 1;
- t = tree_cons (NULL_TREE, object_ptr_type_node,
- tree_cons (NULL_TREE, object_ptr_type_node, endlink));
+ t = build_function_type_list (void_type_node,
+ object_ptr_type_node, object_ptr_type_node,
+ NULL_TREE);
soft_checkarraystore_node
- = add_builtin_function ("_Jv_CheckArrayStore",
- build_function_type (void_type_node, t),
+ = add_builtin_function ("_Jv_CheckArrayStore", 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)));
+ t = build_function_type_list (ptr_type_node,
+ ptr_type_node, ptr_type_node, int_type_node,
+ NULL_TREE);
soft_lookupinterfacemethod_node
- = add_builtin_function ("_Jv_LookupInterfaceMethodIdx",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_PURE_P (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)));
+
+ t = build_function_type_list (ptr_type_node,
+ ptr_type_node, ptr_type_node, ptr_type_node,
+ NULL_TREE);
soft_lookupinterfacemethodbyname_node
- = add_builtin_function ("_Jv_LookupInterfaceMethod",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupInterfaceMethod", 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))));
+ t = build_function_type_list (ptr_type_node,
+ object_ptr_type_node, ptr_type_node,
+ ptr_type_node, int_type_node, NULL_TREE);
soft_lookupjnimethod_node
- = add_builtin_function ("_Jv_LookupJNIMethod",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_LookupJNIMethod", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, ptr_type_node, endlink);
+ t = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
soft_getjnienvnewframe_node
- = add_builtin_function ("_Jv_GetJNIEnvNewFrame",
- build_function_type (ptr_type_node, t),
+ = add_builtin_function ("_Jv_GetJNIEnvNewFrame", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
+ t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
soft_jnipopsystemframe_node
- = add_builtin_function ("_Jv_JNI_PopSystemFrame",
- build_function_type (void_type_node, t),
+ = add_builtin_function ("_Jv_JNI_PopSystemFrame", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, object_ptr_type_node, endlink);
+ t = build_function_type_list (object_ptr_type_node,
+ object_ptr_type_node, NULL_TREE);
soft_unwrapjni_node
- = add_builtin_function ("_Jv_UnwrapJNIweakReference",
- build_function_type (object_ptr_type_node, t),
+ = add_builtin_function ("_Jv_UnwrapJNIweakReference", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, int_type_node,
- tree_cons (NULL_TREE, int_type_node, endlink));
+ t = build_function_type_list (int_type_node,
+ int_type_node, int_type_node, NULL_TREE);
soft_idiv_node
- = add_builtin_function ("_Jv_divI",
- build_function_type (int_type_node, t),
+ = add_builtin_function ("_Jv_divI", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
soft_irem_node
- = add_builtin_function ("_Jv_remI",
- build_function_type (int_type_node, t),
+ = add_builtin_function ("_Jv_remI", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
- t = tree_cons (NULL_TREE, long_type_node,
- tree_cons (NULL_TREE, long_type_node, endlink));
+ t = build_function_type_list (long_type_node,
+ long_type_node, long_type_node, NULL_TREE);
soft_ldiv_node
- = add_builtin_function ("_Jv_divJ",
- build_function_type (long_type_node, t),
+ = add_builtin_function ("_Jv_divJ", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
soft_lrem_node
- = add_builtin_function ("_Jv_remJ",
- build_function_type (long_type_node, t),
+ = add_builtin_function ("_Jv_remJ", t,
0, NOT_BUILT_IN, NULL, NULL_TREE);
initialize_builtins ();
- soft_fmod_node = built_in_decls[BUILT_IN_FMOD];
+ soft_fmod_node = builtin_decl_explicit (BUILT_IN_FMOD);
parse_version ();
}
return t;
}
-/* Nonzero if we are currently in the global binding level. */
+/* Return true if we are in the global binding level. */
-int
+bool
global_bindings_p (void)
{
return current_binding_level == global_binding_level;
block = 0;
if (keep || functionbody)
- {
- block = make_node (BLOCK);
- TREE_TYPE (block) = void_type_node;
- }
+ block = make_node (BLOCK);
if (current_binding_level->exception_range)
expand_end_java_handler (current_binding_level->exception_range);
}
*var = NULL;
- bind = build3 (BIND_EXPR, TREE_TYPE (block), BLOCK_VARS (block),
+ bind = build3 (BIND_EXPR, void_type_node, BLOCK_VARS (block),
BLOCK_EXPR_BODY (block), block);
BIND_EXPR_BODY (bind) = current_binding_level->stmts;
/* In each subblock, record that this is its superior. */
- for (link = subblocks; link; link = TREE_CHAIN (link))
+ for (link = subblocks; link; link = BLOCK_CHAIN (link))
BLOCK_SUPERCONTEXT (link) = block;
/* Clear out the meanings of the local variables of this level. */
if (block)
{
current_binding_level->blocks
- = chainon (current_binding_level->blocks, block);
+ = block_chainon (current_binding_level->blocks, block);
}
/* If we did not make a block for the level just exited,
any blocks made for inner levels
of something else. */
else if (subblocks)
current_binding_level->blocks
- = chainon (current_binding_level->blocks, subblocks);
+ = block_chainon (current_binding_level->blocks, subblocks);
if (bind)
java_add_stmt (bind);
#ifdef ENABLE_CHECKING
/* Double check that we didn't pass the function to the callgraph early. */
if (TREE_CODE (decl) == FUNCTION_DECL)
- gcc_assert (!cgraph_node (decl)->local.finalized);
+ {
+ struct cgraph_node *node = cgraph_get_node (decl);
+ gcc_assert (!node || !node->local.finalized);
+ }
#endif
gcc_assert (!DECL_RTL_SET_P (decl));
}