aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils2.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/utils2.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/utils2.c')
-rw-r--r--gcc/ada/utils2.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index cafbf7d..ed99531 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -29,6 +29,7 @@
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
+#include "rtl.h"
#include "flags.h"
#include "output.h"
#include "ada.h"
@@ -1345,23 +1346,20 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
/* Similar, but for COND_EXPR. */
tree
-build_cond_expr (tree result_type,
- tree condition_operand,
- tree true_operand,
- tree false_operand)
+build_cond_expr (tree result_type, tree condition_operand,
+ tree true_operand, tree false_operand)
{
tree result;
int addr_p = 0;
- /* Front-end verifies that result, true and false operands have same base
- type. Convert everything to the result type. */
+ /* The front-end verifies that result, true and false operands have same base
+ type. Convert everything to the result type. */
true_operand = convert (result_type, true_operand);
false_operand = convert (result_type, false_operand);
/* If the result type is unconstrained, take the address of
the operands and then dereference our result. */
-
if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE
|| CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type)))
{
@@ -1450,7 +1448,7 @@ tree
build_call_raise (int msg)
{
tree fndecl = gnat_raise_decls[msg];
- const char *str = discard_file_names ? "" : ref_filename;
+ const char *str = Debug_Flag_NN ? "" : ref_filename;
int len = strlen (str) + 1;
tree filename = build_string (len, str);
@@ -1743,7 +1741,11 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
else if (gnu_obj)
return build_call_1_expr (free_decl, gnu_obj);
- else if (gnat_pool == -1)
+
+ /* ??? For now, disable variable-sized allocators in the stack since
+ we can't yet gimplify an ALLOCATE_EXPR. */
+ else if (gnat_pool == -1
+ && TREE_CODE (gnu_size) == INTEGER_CST && !flag_stack_check)
{
/* If the size is a constant, we can put it in the fixed portion of
the stack frame to avoid the need to adjust the stack pointer. */
@@ -1760,7 +1762,10 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl));
}
else
+ abort ();
+#if 0
return build (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align);
+#endif
}
else
{
@@ -1977,7 +1982,6 @@ gnat_mark_addressable (tree expr_node)
case VIEW_CONVERT_EXPR:
case CONVERT_EXPR:
case NON_LVALUE_EXPR:
- case GNAT_NOP_EXPR:
case NOP_EXPR:
expr_node = TREE_OPERAND (expr_node, 0);
break;
@@ -1989,7 +1993,19 @@ gnat_mark_addressable (tree expr_node)
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
- put_var_into_stack (expr_node, true);
+ /* If we have already made a REG for this decl, we must put it
+ directly into the stack. Likewise for a MEM whose address is a
+ pseudo. Otherwise, set a flag to mark us to do it later. */
+ if (DECL_RTL_SET_P (expr_node)
+ && (GET_CODE (DECL_RTL (expr_node)) == REG
+ || (GET_CODE (DECL_RTL (expr_node)) == MEM
+ && GET_CODE (XEXP (DECL_RTL (expr_node), 0)) == REG
+ && (REGNO (XEXP (DECL_RTL (expr_node), 0))
+ > LAST_VIRTUAL_REGISTER))))
+ put_var_into_stack (expr_node, 1);
+ else
+ TREE_ADDRESSABLE (expr_node) = 1;
+
return true;
case FUNCTION_DECL: