aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/misc.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-06-07 19:52:53 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-06-07 15:52:53 -0400
commit821e1ea1b155e9ca33f12e8e7af447042822c66b (patch)
treeb12eaf8066a9e3f36a310863af9847788fd50cf0 /gcc/ada/misc.c
parent45b0c94cb45aefa68b1627f8a76a84bad2d5b717 (diff)
downloadgcc-821e1ea1b155e9ca33f12e8e7af447042822c66b.zip
gcc-821e1ea1b155e9ca33f12e8e7af447042822c66b.tar.gz
gcc-821e1ea1b155e9ca33f12e8e7af447042822c66b.tar.bz2
ada-tree.def (TRANSFORM_EXPR, [...]): Deleted.
* ada-tree.def (TRANSFORM_EXPR, ALLOCATE_EXPR, USE_EXPR): Deleted. (GNAT_NOP_EXPR, GNAT_LOOP_ID, EXPR_STMT, NULL_STMT): Likewise. (BLOCK_STMT, IF_STMT, GOTO_STMT, LABEL_STMT, RETURN_STMT): Likewise. (ASM_STMT, BREAK_STMT, REGION_STMT,HANDLER_STMT): Likewise. (STMT_STMT, USE_STMT): New statement codes. (LOOP_STMT, EXIT_STMT): Make slight semantic changes. * ada-tree.h: Reflect above changes. (struct tree_loop_id): Deleted. (union lang_tree_node, struct lang_decl, struct lang_type): Now just contains a tree node; update macros using TYPE_LANG_SPECIFIC and DECL_LANGUAGE_SPECIFIC to reflect these changes. (DECL_INIT_BY_ASSIGN_P, TRE_LOOP_NODE_ID, TREE_SLOC): Deleted. (IS_ADA_STMT): New macro. * decl.c (annotate_decl_with_node): New function. (gnat_to_gnu_entity): Use it and Sloc_to_locus instead of set_lineno. (gnat_to_gnu_entity, case object): Remove call to expand CONVERT_EXPR. Call add_stmt_with_node to do needed assignments. Add call to update setjmp buffer directly, not via EXPR_STMT. (maybe_variable): Argment GNAT_NODE deleted. * gigi.h (maybe_variable): Likewise. (make_transform, add_stmt_with_node, set_block_for_group): New. (gnat_gimplify_expr, gnat_expand_body, Sloc_to_locus): Likewise. (set_block_jmpbuf_decl, get_block_jmpbuf_decl): Likewise. (discard_file_names, gnu_block_stack, gnat_to_code): Deleted. (set_lineno, set_lineno_from_sloc): Likewise. (record_code_position, insert_code_for): Likewise. (gnat_poplevel): Now returns void. (end_subprog_body): Now takes argument. * misc.c (cgraph.h, tree-inline.h): New includes. (gnat_tree_size, LANG_HOOKS_TREE_SIZE): Deleted. (gnat_post_options, LANG_HOOKS_POST_OPTIONS): New. (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION): Likewise. (LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_GIMPLIFY_EXPR): Likewise. (gnat_parse_file): Don't set immediate_size_expand. Call cgraph functions. (gnat_expand_expr): Remove most cases. (record_code_position, insert_code_for): Remove from here. * trans.c (toplev.h, tree-gimple.h): Now included. (discard_file_names): Deleted. (gnu_block_stack, gnu_block_stmt_node, gnu_block_stmt_free_list): Del. (first_nondeleted_insn, make_expr_stmt_from_rtl): Likewise. (struct stmt_group, current_stmt_group, stmt_group_free_list): New. (gnu_stack_free_list, record_cost_position, insert_code_for): Likewise. (add_cleanup, push_stack, gnat_gimplify_stmt, add_cleanup): Likewise. (gnat_gimplify_type_sizes, gnat_gimplify_one_sizepos): Likewise. (gnat_expand_body_1, gnat_gimplify_expr, annotate_with_node): Likewise. (set_block_for_group, add_stmt_list): Likewise. (start_stmt_group): Renamed from start_block_stmt. (end_stmt_group): Likewise, from end_block_stmt. (build_stmt_group): Likewise, from build_block_stmt, also add arg. (gigi): Don't set discard_file_names or call set_lineno. Disallow front end ZCX; call gnat_to_gnu, not gnat_to_code. (tree_transform): Deleted, now renamed to be gnat_to_gnu. Numerous changes throughout to reflect new names and complete function-at-a-time implementation. (gnat_expand_stmt): Delete or comment out all cases. (process_inlined_subprograms): Use add_stmt. (process_decls): Use gnat_to_gnu, not gnat_to_code, and don't call set_lineno; also remove unneeded block handling. (process_type): Remove unneeded block handling. (build_unit_elab): Remove calls to deleted functions. * utils.c (cgraph.h, tree-inline.h, tree-gimple.h): Now include. (tree-dump.h): Likewise. (struct ada_binding_level): Add field jmpbuf_decl. (gnat_define_builtin, gnat_install_builtins): New. (gnat_gimplify_function, gnat_finalize): Likewise. (gnat_poplevel): No longer return BLOCK, set it instead. Remove code dealing with nested functions. (gnat_init_decl_processing): Also set size_type_node. Call gnat_install_builtins. (create_var_decl): Don't set DECL_INIT_BY_ASSIGN. (create_subprog_decl): Change handling of inline_flag; set TREE_STATIC. Remove special-case for "main". (end_subprog_body): Add arg and rework for tree-ssa. (convert): Don't use GNAT_NOP_EXPR or look for TRANSFORM_EXPR. Add case for BOOLEAN_TYPE. * utils2.c (rtl.h): Now include. (build_call_raise): Test Debug_Flag_NN directly. (build_call_alloc_dealloc): Don't use local stack allocation for now. (gnat_mark_addressable, case GNAT_NOP_EXPR): Deleted. (gnat_mark_addressable, case VAR_DECL): Handle both early & late cases. From-SVN: r82714
Diffstat (limited to 'gcc/ada/misc.c')
-rw-r--r--gcc/ada/misc.c155
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