diff options
Diffstat (limited to 'gcc/ada/misc.c')
-rw-r--r-- | gcc/ada/misc.c | 155 |
1 files changed, 36 insertions, 119 deletions
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index f8fe4de..0cb8905 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -48,6 +48,8 @@ #include "ggc.h" #include "flags.h" #include "debug.h" +#include "cgraph.h" +#include "tree-inline.h" #include "insn-codes.h" #include "insn-flags.h" #include "insn-config.h" @@ -84,11 +86,11 @@ extern FILE *asm_out_file; move instruction. */ unsigned int largest_move_alignment; -static size_t gnat_tree_size (enum tree_code); static bool gnat_init (void); static void gnat_finish_incomplete_decl (tree); static unsigned int gnat_init_options (unsigned int, const char **); static int gnat_handle_option (size_t, const char *, int); +static bool gnat_post_options (const char **); static HOST_WIDE_INT gnat_get_alias_set (tree); static void gnat_print_decl (FILE *, tree, int); static void gnat_print_type (FILE *, tree, int); @@ -107,14 +109,14 @@ static void gnat_adjust_rli (record_layout_info); #define LANG_HOOKS_NAME "GNU Ada" #undef LANG_HOOKS_IDENTIFIER_SIZE #define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) -#undef LANG_HOOKS_TREE_SIZE -#define LANG_HOOKS_TREE_SIZE gnat_tree_size #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT gnat_init #undef LANG_HOOKS_INIT_OPTIONS #define LANG_HOOKS_INIT_OPTIONS gnat_init_options #undef LANG_HOOKS_HANDLE_OPTION #define LANG_HOOKS_HANDLE_OPTION gnat_handle_option +#undef LANG_HOOKS_POST_OPTIONS +#define LANG_HOOKS_POST_OPTIONS gnat_post_options #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE gnat_parse_file #undef LANG_HOOKS_HONOR_READONLY @@ -143,6 +145,13 @@ static void gnat_adjust_rli (record_layout_info); #define LANG_HOOKS_PRINT_TYPE gnat_print_type #undef LANG_HOOKS_DECL_PRINTABLE_NAME #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name +#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION +#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gnat_expand_body +#undef LANG_HOOKS_RTL_EXPAND_STMT +#define LANG_HOOKS_RTL_EXPAND_STMT gnat_expand_stmt +#undef LANG_HOOKS_GIMPLIFY_EXPR +#define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr + #undef LANG_HOOKS_TYPE_FOR_MODE #define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE @@ -224,10 +233,11 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) /* Call the front-end elaboration procedures */ adainit (); - immediate_size_expand = 1; - /* Call the front end */ _ada_gnat1drv (); + + cgraph_finalize_compilation_unit (); + cgraph_optimize (); } /* Decode all the language specific options that cannot be decoded by GCC. @@ -332,6 +342,24 @@ gnat_init_options (unsigned int argc, const char **argv) return CL_Ada; } +/* Post-switch processing. */ + +bool +gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) +{ + flag_inline_trees = 1; + + if (!flag_no_inline) + flag_no_inline = 1; + if (flag_inline_functions) + { + flag_inline_trees = 2; + flag_inline_functions = 0; + } + + return false; +} + /* Here is the function to handle the compiler error processing in GCC. */ static void @@ -359,21 +387,6 @@ internal_error_function (const char *msgid, va_list *ap) Compiler_Abort (fp, -1); } -/* Langhook for tree_size: Determine size of our 'x' and 'c' nodes. */ - -static size_t -gnat_tree_size (enum tree_code code) -{ - switch (code) - { - case GNAT_LOOP_ID: - return sizeof (struct tree_loop_id); - default: - abort (); - } - /* NOTREACHED */ -} - /* Perform all the initialization steps that are language-specific. */ static bool @@ -559,7 +572,7 @@ gnat_printable_name (tree decl, int verbosity) } /* Expands GNAT-specific GCC tree nodes. The only ones we support - here are TRANSFORM_EXPR, ALLOCATE_EXPR, USE_EXPR and NULL_EXPR. */ + here are and NULL_EXPR. */ static rtx gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, @@ -567,7 +580,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, { tree type = TREE_TYPE (exp); tree new; - rtx result; /* If this is a statement, call the expansion routine for statements. */ if (IS_STMT (exp)) @@ -579,48 +591,14 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, /* Update EXP to be the new expression to expand. */ switch (TREE_CODE (exp)) { - case TRANSFORM_EXPR: - gnat_to_code (TREE_COMPLEXITY (exp)); - return const0_rtx; - break; - - case NULL_EXPR: - expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0); - - /* We aren't going to be doing anything with this memory, but allocate - it anyway. If it's variable size, make a bogus address. */ - if (! host_integerp (TYPE_SIZE_UNIT (type), 1)) - result = gen_rtx_MEM (BLKmode, virtual_stack_vars_rtx); - else - result = assign_temp (type, 0, TREE_ADDRESSABLE (exp), 1); - - return result; - +#if 0 case ALLOCATE_EXPR: return allocate_dynamic_stack_space (expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, TYPE_MODE (sizetype), EXPAND_NORMAL), NULL_RTX, tree_low_cst (TREE_OPERAND (exp, 1), 1)); - - case USE_EXPR: - if (target != const0_rtx) - gigi_abort (203); - - /* First write a volatile ASM_INPUT to prevent anything from being - moved. */ - result = gen_rtx_ASM_INPUT (VOIDmode, ""); - MEM_VOLATILE_P (result) = 1; - emit_insn (result); - - result = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, - modifier); - emit_insn (gen_rtx_USE (VOIDmode, result)); - return target; - - case GNAT_NOP_EXPR: - return expand_expr_real (build1 (NOP_EXPR, type, TREE_OPERAND (exp, 0)), - target, tmode, modifier, alt_rtl); +#endif case UNCONSTRAINED_ARRAY_REF: /* If we are evaluating just for side-effects, just evaluate our @@ -667,18 +645,6 @@ gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED) rli->record_align = record_align; #endif } - -/* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */ - -tree -make_transform_expr (Node_Id gnat_node) -{ - tree gnu_result = build (TRANSFORM_EXPR, void_type_node); - - TREE_SIDE_EFFECTS (gnu_result) = 1; - TREE_COMPLEXITY (gnu_result) = gnat_node; - return gnu_result; -} /* These routines are used in conjunction with GCC exception handling. */ @@ -704,55 +670,6 @@ gnat_eh_type_covers (tree a, tree b) return (a == b || a == integer_zero_node); } -/* Record the current code position in GNAT_NODE. */ - -void -record_code_position (Node_Id gnat_node) -{ - if (global_bindings_p ()) - { - /* Make a dummy entry so multiple things at the same location don't - end up in the same place. */ - add_pending_elaborations (NULL_TREE, NULL_TREE); - save_gnu_tree (gnat_node, get_elaboration_location (), 1); - } - else - /* Always emit another insn in case marking the last insn - addressable needs some fixups and also for above reason. */ - save_gnu_tree (gnat_node, - build (RTL_EXPR, void_type_node, NULL_TREE, - (tree) emit_note (NOTE_INSN_DELETED), NULL_TREE), - 1); -} - -/* Insert the code for GNAT_NODE at the position saved for that node. */ - -void -insert_code_for (Node_Id gnat_node) -{ - if (global_bindings_p ()) - { - push_pending_elaborations (); - gnat_to_code (gnat_node); - Check_Elaboration_Code_Allowed (gnat_node); - insert_elaboration_list (get_gnu_tree (gnat_node)); - pop_pending_elaborations (); - } - else - { - rtx insns; - - do_pending_stack_adjust (); - start_sequence (); - mark_all_temps_used (); - gnat_to_code (gnat_node); - do_pending_stack_adjust (); - insns = get_insns (); - end_sequence (); - emit_insn_after (insns, RTL_EXPR_RTL (get_gnu_tree (gnat_node))); - } -} - /* Get the alias set corresponding to a type or expression. */ static HOST_WIDE_INT |