static tree handle_const_attribute (tree *node, tree ARG_UNUSED (name), tree ARG_UNUSED (args), int ARG_UNUSED (flags), bool * ARG_UNUSED (no_add_attrs)) { if (TREE_CODE (*node) != FUNCTION_DECL || !DECL_BUILT_IN (*node)) inform (UNKNOWN_LOCATION, "%s:%s: %E: %E", __FILE__, __func__, *node, name); tree type = TREE_TYPE (*node); /* See FIXME comment on noreturn in c_common_attribute_table. */ if (TREE_CODE (*node) == FUNCTION_DECL) TREE_READONLY (*node) = 1; else if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) TREE_TYPE (*node) = build_pointer_type (build_type_variant (TREE_TYPE (type), 1, TREE_THIS_VOLATILE (TREE_TYPE (type)))); else gcc_unreachable (); return NULL_TREE; }
static tree getVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED, tree orig_call) { tree addr, stmt, modify_stmt, tmp; UNMARSHAL3 (orig_call); (void) this_arg; /* Avoid set but not used warning. */ addr = build_addr_sum (method_return_type, obj_arg, offset_arg); addr = fold_convert (build_pointer_type (build_type_variant (method_return_type, 0, 1)), addr); stmt = build_call_expr (builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE), 0); tmp = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL, method_return_type); DECL_IGNORED_P (tmp) = 1; DECL_ARTIFICIAL (tmp) = 1; pushdecl (tmp); modify_stmt = fold_build2 (MODIFY_EXPR, method_return_type, tmp, build_java_indirect_ref (method_return_type, addr, flag_check_references)); stmt = build2 (COMPOUND_EXPR, void_type_node, modify_stmt, stmt); stmt = build2 (COMPOUND_EXPR, method_return_type, stmt, tmp); return stmt; }
static tree make_fname_decl () { const char *name = lang_hooks.decl_printable_name (current_function_decl, 0); tree decl, type, init; size_t length = strlen (name); type = build_array_type (build_type_variant (char_type_node, true, false), build_index_type (size_int (length))); decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier ("__function_name__"), type); TREE_STATIC (decl) = 1; TREE_READONLY (decl) = 1; DECL_ARTIFICIAL (decl) = 1; init = build_string (length + 1, name); TREE_TYPE (init) = type; TREE_READONLY (init) = 1; DECL_READ_P (decl) = 1; DECL_INITIAL (decl) = init; TREE_USED (decl) = 1; TREE_ADDRESSABLE (decl) = 1; DECL_CONTEXT (decl) = current_function_decl; return decl; }
static tree handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name), tree ARG_UNUSED (args), int ARG_UNUSED (flags), bool * ARG_UNUSED (no_add_attrs)) { tree type = TREE_TYPE (*node); if (TREE_CODE (*node) == FUNCTION_DECL) TREE_THIS_VOLATILE (*node) = 1; else if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) TREE_TYPE (*node) = build_pointer_type (build_type_variant (TREE_TYPE (type), TYPE_READONLY (TREE_TYPE (type)), 1)); else gcc_unreachable (); return NULL_TREE; }
static tree build_function_decl (const char *name, tree param_type) { tree func_decl, function_type_list; function_type_list = build_function_type_list ( void_type_node, build_pointer_type (param_type), build_pointer_type (build_type_variant (char_type_node, true, false)), NULL_TREE); func_decl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, get_identifier (name), function_type_list); if (dump_file) { fprintf (dump_file, "begin print built function type %s:\n", name); print_generic_decl (dump_file, func_decl, TDF_VERBOSE); fprintf (dump_file, "end print built function type %s:\n", name); } TREE_USED (func_decl) = 1; return func_decl; }
static tree putVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED, tree orig_call) { tree addr, stmt, modify_stmt; UNMARSHAL4 (orig_call); addr = build_addr_sum (value_type, obj_arg, offset_arg); addr = fold_convert (build_pointer_type (build_type_variant (value_type, 0, 1)), addr); stmt = build_call_expr (builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE), 0); modify_stmt = fold_build2 (MODIFY_EXPR, value_type, build_java_indirect_ref (value_type, addr, flag_check_references), value_arg); stmt = build2 (COMPOUND_EXPR, TREE_TYPE (modify_stmt), stmt, modify_stmt); return build_check_this (stmt, this_arg); }
void gfc_init_types (void) { char name_buf[16]; int index; tree type; unsigned n; unsigned HOST_WIDE_INT hi; unsigned HOST_WIDE_INT lo; /* Create and name the types. */ #define PUSH_TYPE(name, node) \ pushdecl (build_decl (TYPE_DECL, get_identifier (name), node)) for (index = 0; gfc_integer_kinds[index].kind != 0; ++index) { type = gfc_build_int_type (&gfc_integer_kinds[index]); gfc_integer_types[index] = type; snprintf (name_buf, sizeof(name_buf), "int%d", gfc_integer_kinds[index].kind); PUSH_TYPE (name_buf, type); } for (index = 0; gfc_logical_kinds[index].kind != 0; ++index) { type = gfc_build_logical_type (&gfc_logical_kinds[index]); gfc_logical_types[index] = type; snprintf (name_buf, sizeof(name_buf), "logical%d", gfc_logical_kinds[index].kind); PUSH_TYPE (name_buf, type); } for (index = 0; gfc_real_kinds[index].kind != 0; index++) { type = gfc_build_real_type (&gfc_real_kinds[index]); gfc_real_types[index] = type; snprintf (name_buf, sizeof(name_buf), "real%d", gfc_real_kinds[index].kind); PUSH_TYPE (name_buf, type); type = gfc_build_complex_type (type); gfc_complex_types[index] = type; snprintf (name_buf, sizeof(name_buf), "complex%d", gfc_real_kinds[index].kind); PUSH_TYPE (name_buf, type); } gfc_character1_type_node = build_type_variant (unsigned_char_type_node, 0, 0); PUSH_TYPE ("char", gfc_character1_type_node); PUSH_TYPE ("byte", unsigned_char_type_node); PUSH_TYPE ("void", void_type_node); /* DBX debugging output gets upset if these aren't set. */ if (!TYPE_NAME (integer_type_node)) PUSH_TYPE ("c_integer", integer_type_node); if (!TYPE_NAME (char_type_node)) PUSH_TYPE ("c_char", char_type_node); #undef PUSH_TYPE pvoid_type_node = build_pointer_type (void_type_node); ppvoid_type_node = build_pointer_type (pvoid_type_node); pchar_type_node = build_pointer_type (gfc_character1_type_node); gfc_array_index_type = gfc_get_int_type (gfc_index_integer_kind); gfc_array_range_type = build_range_type (gfc_array_index_type, build_int_cst (gfc_array_index_type, 0), NULL_TREE); /* The maximum array element size that can be handled is determined by the number of bits available to store this field in the array descriptor. */ n = TYPE_PRECISION (gfc_array_index_type) - GFC_DTYPE_SIZE_SHIFT; lo = ~ (unsigned HOST_WIDE_INT) 0; if (n > HOST_BITS_PER_WIDE_INT) hi = lo >> (2*HOST_BITS_PER_WIDE_INT - n); else