Commit 821e1ea1 by Richard Kenner Committed by Richard Kenner

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
parent 45b0c94c
2004-06-07 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* 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.
2004-06-07 Robert Dewar <dewar@gnat.com> 2004-06-07 Robert Dewar <dewar@gnat.com>
* a-direct.ads, einfo.ads: Minor comment updates * a-direct.ads, einfo.ads: Minor comment updates
......
...@@ -24,21 +24,6 @@ ...@@ -24,21 +24,6 @@
* * * *
****************************************************************************/ ****************************************************************************/
/* A GNAT tree node to transform to a GCC tree. This is only used when the
node would generate code, rather then just a tree, and we are in the global
context.
The only field used is TREE_COMPLEXITY, which contains the GNAT node
number. */
DEFTREECODE (TRANSFORM_EXPR, "transform_expr", 'e', 0)
/* Dynamically allocate on the stack a number of bytes of memory given
by operand 0 at the alignment given by operand 1 and return the
address of the resulting memory. */
DEFTREECODE (ALLOCATE_EXPR, "allocate_expr", '2', 2)
/* A type that is an unconstrained array itself. This node is never passed /* A type that is an unconstrained array itself. This node is never passed
to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE
is the type of a record containing the template and data. */ is the type of a record containing the template and data. */
...@@ -54,70 +39,50 @@ DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref", 'r', 1) ...@@ -54,70 +39,50 @@ DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref", 'r', 1)
/* An expression that returns an RTL suitable for its type. Operand 0 /* An expression that returns an RTL suitable for its type. Operand 0
is an expression to be evaluated for side effects only. */ is an expression to be evaluated for side effects only. */
DEFTREECODE (NULL_EXPR, "null_expr", 'e', 1) DEFTREECODE (NULL_EXPR, "null_expr", 'e', 1)
/* An expression that emits a USE for its single operand. */
DEFTREECODE (USE_EXPR, "use_expr", 'e', 1)
/* Same as ADDR_EXPR, except that if the operand represents a bit field, /* Same as ADDR_EXPR, except that if the operand represents a bit field,
return the address of the byte containing the bit. This is used return the address of the byte containing the bit. This is used
for the 'Address attribute and never shows up in the tree. */ for the 'Address attribute and never shows up in the tree. */
DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", 'r', 1) DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", 'r', 1)
/* An expression that is treated as a conversion while generating code, but is
used to prevent infinite recursion when conversions of biased types are
involved. */
DEFTREECODE (GNAT_NOP_EXPR, "gnat_nop_expr", '1', 1)
/* This is used as a place to store the ID of a loop.
??? This should be redone at some point. */
DEFTREECODE (GNAT_LOOP_ID, "gnat_loop_id", 'x', 0)
/* Here are the tree codes for the statement types known to Ada. These /* Here are the tree codes for the statement types known to Ada. These
must be at the end of this file to allow IS_STMT to work. must be at the end of this file to allow IS_ADA_STMT to work. */
We start with an expression statement, whose only operand is an
expression, EXPR_STMT_EXPR, Execution of the statement means evaluation of
the expression (such as a MODIFY_EXPR) and discarding its result. */
DEFTREECODE (EXPR_STMT, "expr_stmt", 's', 1)
/* This is a null statement. The intent is for it not to survive very far. */
DEFTREECODE (NULL_STMT, "null_stmt", 's', 0)
/* This defines the variable in DECL_STMT_VAR and performs any initialization /* This defines the variable in DECL_STMT_VAR. */
in DECL_INITIAL. */
DEFTREECODE (DECL_STMT, "decl_stmt", 's', 1) DEFTREECODE (DECL_STMT, "decl_stmt", 's', 1)
/* This represents a list of statements. BLOCK_STMT_LIST is a list /* This is how record_code_position and insert_code_for work. The former
statement tree, chained via TREE_CHAIN. BLOCK_STMT_BLOCK, if nonzero, makes this tree node, whose operand is a statement. The latter inserts
is the BLOCK node for these statements. */ the actual statements into this node. Gimplification consists of
DEFTREECODE (BLOCK_STMT, "block_stmt", 's', 2) just returning the inner statement. */
DEFTREECODE (STMT_STMT, "stmt_stmt", 's', 1)
/* This is an IF statement. IF_STMT_COND is the condition being tested,
IF_STMT_TRUE is the statement to be executed if the condition is /* A loop. LOOP_STMT_TOP_COND and LOOP_STMT_BOT_COND are the tests to exit a
true; IF_STMT_ELSEIF, if non-null, is a list of more IF_STMT nodes (where loop at the top and bottom, respectively. LOOP_STMT_UPDATE is the statement
we only look at IF_STMT_COND and IF_STMT_TRUE) that correspond to to update the loop iterator at the continue point. LOOP_STMT_BODY are the
any "else if" parts; and IF_STMT_ELSE is the statement to be executed if statements in the body of the loop. LOOP_STMT_LABEL is used during
all conditions are. */ gimplification to point to the LABEL_DECL of the end label of the loop. */
DEFTREECODE (IF_STMT, "if_stmt", 's', 4) DEFTREECODE (LOOP_STMT, "loop_stmt", 's', 5)
/* A goto just points to the label: GOTO_STMT_LABEL. */ /* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if
DEFTREECODE (GOTO_STMT, "goto_stmt", 's', 1) true, will cause the loop to be exited. If no condition is specified,
the loop is unconditionally exited. EXIT_STMT_LOOP is the LOOP_STMT
/* A label: LABEL_STMT_LABEL is the label. */ corresponding to the loop to exit. */
DEFTREECODE (LABEL_STMT, "label_stmt", 's', 1) DEFTREECODE (EXIT_STMT, "exit_stmt", 's', 2)
/* A "return". RETURN_STMT_EXPR is the value to return if non-null. */ /* A exception region. REGION_STMT_BODY is the statement to be executed
DEFTREECODE (RETURN_STMT, "return_stmt", 's', 1) inside the region. REGION_STMT_HANDLE is a statement that represents
the exception handlers (usually a BLOCK_STMT of HANDLE_STMTs).
/* An "asm" statement. The operands are ASM_STMT_TEMPLATE, ASM_STMT_OUTPUT, REGION_STMT_BLOCK is the BLOCK node for the declarative region, if any. */
ASM_STMT_ORIG_OUT, ASM_STMT_INPUT, and ASM_STMT_CLOBBER. */ DEFTREECODE (REGION_STMT, "region_stmt", 's', 3)
DEFTREECODE (ASM_STMT, "asm_stmt", 's', 5)
/* An exception handler. HANDLER_STMT_ARG is the value to pass to
expand_start_catch, HANDLER_STMT_LIST is the list of statements for the
handler itself, and HANDLER_STMT_BLOCK is the BLOCK node for this
binding. */
DEFTREECODE (HANDLER_STMT, "handler_stmt", 's', 3)
/* A statement that emits a USE for its single operand. */
DEFTREECODE (USE_STMT, "use_expr", 's', 1)
/* An analog to the C "break" statement. */
DEFTREECODE (BREAK_STMT, "break_stmt", 's', 0)
...@@ -33,35 +33,10 @@ enum gnat_tree_code { ...@@ -33,35 +33,10 @@ enum gnat_tree_code {
}; };
#undef DEFTREECODE #undef DEFTREECODE
/* A tree to hold a loop ID. */
struct tree_loop_id GTY(())
{
struct tree_common common;
struct nesting *loop_id;
};
/* The language-specific tree. */
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == GNAT_LOOP_ID"),
chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
generic;
struct tree_loop_id GTY ((tag ("1"))) loop_id;
};
/* Ada uses the lang_decl and lang_type fields to hold more trees. */ /* Ada uses the lang_decl and lang_type fields to hold more trees. */
struct lang_decl GTY(()) union lang_tree_node GTY((desc ("0"))) {union tree_node GTY((tag ("0"))) t; };
{ struct lang_decl GTY(()) {union lang_tree_node t; };
union lang_tree_node struct lang_type GTY(()) {union lang_tree_node t; };
GTY((desc ("TREE_CODE (&%h.generic) == GNAT_LOOP_ID"))) t;
};
struct lang_type GTY(())
{
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == GNAT_LOOP_ID"))) t;
};
/* Flags added to GCC type nodes. */ /* Flags added to GCC type nodes. */
...@@ -164,28 +139,28 @@ struct lang_type GTY(()) ...@@ -164,28 +139,28 @@ struct lang_type GTY(())
by copy in copy out. It is a CONSTRUCTOR. For a full description of the by copy in copy out. It is a CONSTRUCTOR. For a full description of the
cico parameter passing mechanism refer to the routine gnat_to_gnu_entity. */ cico parameter passing mechanism refer to the routine gnat_to_gnu_entity. */
#define TYPE_CI_CO_LIST(NODE) \ #define TYPE_CI_CO_LIST(NODE) \
(&TYPE_LANG_SPECIFIC (FUNCTION_TYPE_CHECK (NODE))->t.generic) (&TYPE_LANG_SPECIFIC (FUNCTION_TYPE_CHECK (NODE))->t.t)
#define SET_TYPE_CI_CO_LIST(NODE, X) \ #define SET_TYPE_CI_CO_LIST(NODE, X) \
(TYPE_LANG_SPECIFIC (FUNCTION_TYPE_CHECK (NODE)) = (struct lang_type *)(X)) (TYPE_LANG_SPECIFIC (FUNCTION_TYPE_CHECK (NODE)) = (struct lang_type *)(X))
/* For an INTEGER_TYPE with TYPE_MODULAR_P, this is the value of the /* For an INTEGER_TYPE with TYPE_MODULAR_P, this is the value of the
modulus. */ modulus. */
#define TYPE_MODULUS(NODE) \ #define TYPE_MODULUS(NODE) \
(&TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))->t.generic) (&TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))->t.t)
#define SET_TYPE_MODULUS(NODE, X) \ #define SET_TYPE_MODULUS(NODE, X) \
(TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) = (struct lang_type *)(X)) (TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) = (struct lang_type *)(X))
/* For an INTEGER_TYPE that is the TYPE_DOMAIN of some ARRAY_TYPE, points to /* For an INTEGER_TYPE that is the TYPE_DOMAIN of some ARRAY_TYPE, points to
the type corresponding to the Ada index type. */ the type corresponding to the Ada index type. */
#define TYPE_INDEX_TYPE(NODE) \ #define TYPE_INDEX_TYPE(NODE) \
(&TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))->t.generic) (&TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))->t.t)
#define SET_TYPE_INDEX_TYPE(NODE, X) \ #define SET_TYPE_INDEX_TYPE(NODE, X) \
(TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) = (struct lang_type *) (X)) (TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) = (struct lang_type *) (X))
/* For an INTEGER_TYPE with TYPE_VAX_FLOATING_POINT_P, stores the /* For an INTEGER_TYPE with TYPE_VAX_FLOATING_POINT_P, stores the
Digits_Value. */ Digits_Value. */
#define TYPE_DIGITS_VALUE(NODE) \ #define TYPE_DIGITS_VALUE(NODE) \
(&TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))->t.generic) (&TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))->t.t)
#define SET_TYPE_DIGITS_VALUE(NODE, X) \ #define SET_TYPE_DIGITS_VALUE(NODE, X) \
(TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) = (struct lang_type *) (X)) (TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) = (struct lang_type *) (X))
...@@ -194,7 +169,7 @@ struct lang_type GTY(()) ...@@ -194,7 +169,7 @@ struct lang_type GTY(())
/* Likewise for ENUMERAL_TYPE. */ /* Likewise for ENUMERAL_TYPE. */
#define TYPE_RM_SIZE_ENUM(NODE) \ #define TYPE_RM_SIZE_ENUM(NODE) \
(&TYPE_LANG_SPECIFIC (ENUMERAL_TYPE_CHECK (NODE))->t.generic) (&TYPE_LANG_SPECIFIC (ENUMERAL_TYPE_CHECK (NODE))->t.t)
#define SET_TYPE_RM_SIZE_ENUM(NODE, X) \ #define SET_TYPE_RM_SIZE_ENUM(NODE, X) \
(TYPE_LANG_SPECIFIC (ENUMERAL_TYPE_CHECK (NODE)) = (struct lang_type *)(X)) (TYPE_LANG_SPECIFIC (ENUMERAL_TYPE_CHECK (NODE)) = (struct lang_type *)(X))
...@@ -207,21 +182,21 @@ struct lang_type GTY(()) ...@@ -207,21 +182,21 @@ struct lang_type GTY(())
unconstrained object. Likewise for a RECORD_TYPE that is pointed unconstrained object. Likewise for a RECORD_TYPE that is pointed
to by a thin pointer. */ to by a thin pointer. */
#define TYPE_UNCONSTRAINED_ARRAY(NODE) \ #define TYPE_UNCONSTRAINED_ARRAY(NODE) \
(&TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE))->t.generic) (&TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE))->t.t)
#define SET_TYPE_UNCONSTRAINED_ARRAY(NODE, X) \ #define SET_TYPE_UNCONSTRAINED_ARRAY(NODE, X) \
(TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE)) = (struct lang_type *)(X)) (TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE)) = (struct lang_type *)(X))
/* For other RECORD_TYPEs and all UNION_TYPEs and QUAL_UNION_TYPEs, the Ada /* For other RECORD_TYPEs and all UNION_TYPEs and QUAL_UNION_TYPEs, the Ada
size of the object. This differs from the GCC size in that it does not size of the object. This differs from the GCC size in that it does not
include any rounding up to the alignment of the type. */ include any rounding up to the alignment of the type. */
#define TYPE_ADA_SIZE(NODE) (&TYPE_LANG_SPECIFIC (NODE)->t.generic) #define TYPE_ADA_SIZE(NODE) (&TYPE_LANG_SPECIFIC (NODE)->t.t)
#define SET_TYPE_ADA_SIZE(NODE, X) \ #define SET_TYPE_ADA_SIZE(NODE, X) \
(TYPE_LANG_SPECIFIC (NODE) = (struct lang_type *)(X)) (TYPE_LANG_SPECIFIC (NODE) = (struct lang_type *)(X))
/* For an INTEGER_TYPE with TYPE_HAS_ACTUAL_BOUNDS_P or an ARRAY_TYPE, this is /* For an INTEGER_TYPE with TYPE_HAS_ACTUAL_BOUNDS_P or an ARRAY_TYPE, this is
the index type that should be used when the actual bounds are required for the index type that should be used when the actual bounds are required for
a template. This is used in the case of packed arrays. */ a template. This is used in the case of packed arrays. */
#define TYPE_ACTUAL_BOUNDS(NODE) (&TYPE_LANG_SPECIFIC (NODE)->t.generic) #define TYPE_ACTUAL_BOUNDS(NODE) (&TYPE_LANG_SPECIFIC (NODE)->t.t)
#define SET_TYPE_ACTUAL_BOUNDS(NODE, X) \ #define SET_TYPE_ACTUAL_BOUNDS(NODE, X) \
(TYPE_LANG_SPECIFIC (NODE) = (struct lang_type *)(X)) (TYPE_LANG_SPECIFIC (NODE) = (struct lang_type *)(X))
...@@ -238,9 +213,6 @@ struct lang_type GTY(()) ...@@ -238,9 +213,6 @@ struct lang_type GTY(())
discriminant. */ discriminant. */
#define DECL_STUBBED_P(NODE) DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE)) #define DECL_STUBBED_P(NODE) DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
/* Nonzero in a VAR_DECL if it needs to be initialized by an assignment. */
#define DECL_INIT_BY_ASSIGN_P(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
/* Nonzero if this decl is always used by reference; i.e., an INDIRECT_REF /* Nonzero if this decl is always used by reference; i.e., an INDIRECT_REF
is needed to access the object. */ is needed to access the object. */
#define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE) #define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE)
...@@ -270,14 +242,14 @@ struct lang_type GTY(()) ...@@ -270,14 +242,14 @@ struct lang_type GTY(())
memory. Used when a scalar constant is aliased or has its memory. Used when a scalar constant is aliased or has its
address taken. */ address taken. */
#define DECL_CONST_CORRESPONDING_VAR(NODE) \ #define DECL_CONST_CORRESPONDING_VAR(NODE) \
(&DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE))->t.generic) (&DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE))->t.t)
#define SET_DECL_CONST_CORRESPONDING_VAR(NODE, X) \ #define SET_DECL_CONST_CORRESPONDING_VAR(NODE, X) \
(DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE)) = (struct lang_decl *)(X)) (DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE)) = (struct lang_decl *)(X))
/* In a FIELD_DECL, points to the FIELD_DECL that was the ultimate /* In a FIELD_DECL, points to the FIELD_DECL that was the ultimate
source of the decl. */ source of the decl. */
#define DECL_ORIGINAL_FIELD(NODE) \ #define DECL_ORIGINAL_FIELD(NODE) \
(&DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))->t.generic) (&DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))->t.t)
#define SET_DECL_ORIGINAL_FIELD(NODE, X) \ #define SET_DECL_ORIGINAL_FIELD(NODE, X) \
(DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE)) = (struct lang_decl *)(X)) (DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE)) = (struct lang_decl *)(X))
...@@ -285,31 +257,25 @@ struct lang_type GTY(()) ...@@ -285,31 +257,25 @@ struct lang_type GTY(())
discriminant number. */ discriminant number. */
#define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE)) #define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE))
/* This is the loop id for a GNAT_LOOP_ID node. */
#define TREE_LOOP_ID(NODE) \
((union lang_tree_node *) GNAT_LOOP_ID_CHECK (NODE))->loop_id.loop_id
/* Define fields and macros for statements. /* Define fields and macros for statements.
Start by defining which tree codes are used for statements. */ Start by defining which tree codes are used for statements. */
#define IS_STMT(NODE) (TREE_CODE_CLASS (TREE_CODE (NODE)) == 's') #define IS_STMT(NODE) (TREE_CODE_CLASS (TREE_CODE (NODE)) == 's')
#define IS_ADA_STMT(NODE) (IS_STMT (NODE) \
&& TREE_CODE (NODE) >= DECL_STMT)
/* We store the Sloc in statement nodes. */
#define TREE_SLOC(NODE) TREE_COMPLEXITY (STMT_CHECK (NODE))
#define EXPR_STMT_EXPR(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXPR_STMT, 0)
#define DECL_STMT_VAR(NODE) TREE_OPERAND_CHECK_CODE (NODE, DECL_STMT, 0) #define DECL_STMT_VAR(NODE) TREE_OPERAND_CHECK_CODE (NODE, DECL_STMT, 0)
#define BLOCK_STMT_LIST(NODE) TREE_OPERAND_CHECK_CODE (NODE, BLOCK_STMT, 0) #define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0)
#define BLOCK_STMT_BLOCK(NODE) TREE_OPERAND_CHECK_CODE (NODE, BLOCK_STMT, 1) #define LOOP_STMT_TOP_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0)
#define IF_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, IF_STMT, 0) #define LOOP_STMT_BOT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 1)
#define IF_STMT_TRUE(NODE) TREE_OPERAND_CHECK_CODE (NODE, IF_STMT, 1) #define LOOP_STMT_UPDATE(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 2)
#define IF_STMT_ELSEIF(NODE) TREE_OPERAND_CHECK_CODE (NODE, IF_STMT, 2) #define LOOP_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 3)
#define IF_STMT_ELSE(NODE) TREE_OPERAND_CHECK_CODE (NODE, IF_STMT, 3) #define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 4)
#define GOTO_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, GOTO_STMT, 0) #define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0)
#define LABEL_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LABEL_STMT, 0) #define EXIT_STMT_LOOP(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1)
#define RETURN_STMT_EXPR(NODE) TREE_OPERAND_CHECK_CODE (NODE, RETURN_STMT, 0) #define REGION_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, REGION_STMT, 0)
#define ASM_STMT_TEMPLATE(NODE) TREE_OPERAND_CHECK_CODE (NODE, ASM_STMT, 0) #define REGION_STMT_HANDLE(NODE) TREE_OPERAND_CHECK_CODE (NODE, REGION_STMT, 1)
#define ASM_STMT_OUTPUT(NODE) TREE_OPERAND_CHECK_CODE (NODE, ASM_STMT, 1) #define REGION_STMT_BLOCK(NODE) TREE_OPERAND_CHECK_CODE (NODE, REGION_STMT, 2)
#define ASM_STMT_ORIG_OUT(NODE) TREE_OPERAND_CHECK_CODE (NODE, ASM_STMT, 2) #define HANDLER_STMT_ARG(NODE) TREE_OPERAND_CHECK_CODE (NODE, HANDLER_STMT, 0)
#define ASM_STMT_INPUT(NODE) TREE_OPERAND_CHECK_CODE (NODE, ASM_STMT, 3) #define HANDLER_STMT_LIST(NODE) TREE_OPERAND_CHECK_CODE (NODE, HANDLER_STMT, 1)
#define ASM_STMT_CLOBBER(NODE) TREE_OPERAND_CHECK_CODE (NODE, ASM_STMT, 4) #define HANDLER_STMT_BLOCK(NODE) TREE_OPERAND_CHECK_CODE (NODE, HANDLER_STMT, 2)
...@@ -36,12 +36,6 @@ extern unsigned int largest_move_alignment; ...@@ -36,12 +36,6 @@ extern unsigned int largest_move_alignment;
/* Declare all functions and types used by gigi. */ /* Declare all functions and types used by gigi. */
/* Record the current code position in GNAT_NODE. */
extern void record_code_position (Node_Id);
/* Insert the code for GNAT_NODE at the position saved for that node. */
extern void insert_code_for (Node_Id);
/* Compute the alignment of the largest mode that can be used for copying /* Compute the alignment of the largest mode that can be used for copying
objects. */ objects. */
extern void gnat_compute_largest_alignment (void); extern void gnat_compute_largest_alignment (void);
...@@ -50,9 +44,6 @@ extern void gnat_compute_largest_alignment (void); ...@@ -50,9 +44,6 @@ extern void gnat_compute_largest_alignment (void);
expression that contains the last address on the stack to check. */ expression that contains the last address on the stack to check. */
extern tree emit_stack_check (tree); extern tree emit_stack_check (tree);
/* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */
extern tree make_transform_expr (Node_Id);
/* GNU_TYPE is a type. Determine if it should be passed by reference by /* GNU_TYPE is a type. Determine if it should be passed by reference by
default. */ default. */
extern int default_pass_by_ref (tree); extern int default_pass_by_ref (tree);
...@@ -92,6 +83,12 @@ extern tree gnat_to_gnu_type (Entity_Id); ...@@ -92,6 +83,12 @@ extern tree gnat_to_gnu_type (Entity_Id);
/* Add GNU_STMT to the current BLOCK_STMT node. */ /* Add GNU_STMT to the current BLOCK_STMT node. */
extern void add_stmt (tree); extern void add_stmt (tree);
/* Similar, but set the location of GNU_STMT to that of GNAT_NODE. */
extern void add_stmt_with_node (tree, Node_Id);
/* Set the BLOCK node corresponding to the current code group to GNU_BLOCK. */
extern void set_block_for_group (tree);
/* Add a declaration statement for GNU_DECL to the current BLOCK_STMT node. /* Add a declaration statement for GNU_DECL to the current BLOCK_STMT node.
Get SLOC from Entity_Id. */ Get SLOC from Entity_Id. */
extern void add_decl_stmt (tree, Entity_Id); extern void add_decl_stmt (tree, Entity_Id);
...@@ -111,7 +108,7 @@ extern tree make_dummy_type (Entity_Id); ...@@ -111,7 +108,7 @@ extern tree make_dummy_type (Entity_Id);
extern tree get_unpadded_type (Entity_Id); extern tree get_unpadded_type (Entity_Id);
/* Called when we need to protect a variable object using a save_expr. */ /* Called when we need to protect a variable object using a save_expr. */
extern tree maybe_variable (tree, Node_Id); extern tree maybe_variable (tree);
/* Create a record type that contains a field of TYPE with a starting bit /* Create a record type that contains a field of TYPE with a starting bit
position so that it is aligned to ALIGN bits. */ position so that it is aligned to ALIGN bits. */
...@@ -147,22 +144,14 @@ extern tree get_entity_name (Entity_Id); ...@@ -147,22 +144,14 @@ extern tree get_entity_name (Entity_Id);
SUFFIX. */ SUFFIX. */
extern tree create_concat_name (Entity_Id, const char *); extern tree create_concat_name (Entity_Id, const char *);
/* Flag indicating whether file names are discarded in exception messages */ /* If true, then gigi is being called on an analyzed but unexpanded tree, and
extern int discard_file_names; the only purpose of the call is to properly annotate types with
representation information. */
/* If true, then gigi is being called on an analyzed but unexpanded
tree, and the only purpose of the call is to properly annotate
types with representation information */
extern int type_annotate_only; extern int type_annotate_only;
/* Current file name without path */ /* Current file name without path */
extern const char *ref_filename; extern const char *ref_filename;
/* List of TREE_LIST nodes representing a block stack. TREE_VALUE
of each gives the variable used for the setjmp buffer in the current
block, if any. */
extern GTY(()) tree gnu_block_stack;
/* This is the main program of the back-end. It sets up all the table /* This is the main program of the back-end. It sets up all the table
structures and then generates code. */ structures and then generates code. */
...@@ -171,11 +160,6 @@ extern void gigi (Node_Id, int, int, struct Node *, Node_Id *, Node_Id *, ...@@ -171,11 +160,6 @@ extern void gigi (Node_Id, int, int, struct Node *, Node_Id *, Node_Id *,
struct String_Entry *, Char_Code *, struct List_Header *, struct String_Entry *, Char_Code *, struct List_Header *,
Int, char *, Entity_Id, Entity_Id, Entity_Id, Int); Int, char *, Entity_Id, Entity_Id, Entity_Id, Int);
/* This function is the driver of the GNAT to GCC tree transformation process.
GNAT_NODE is the root of some gnat tree. It generates code for that
part of the tree. */
extern void gnat_to_code (Node_Id);
/* GNAT_NODE is the root of some GNAT tree. Return the root of the /* GNAT_NODE is the root of some GNAT tree. Return the root of the
GCC tree corresponding to that GNAT tree. Normally, no code is generated; GCC tree corresponding to that GNAT tree. Normally, no code is generated;
we just return an equivalent tree which is used elsewhere to generate we just return an equivalent tree which is used elsewhere to generate
...@@ -185,19 +169,23 @@ extern tree gnat_to_gnu (Node_Id); ...@@ -185,19 +169,23 @@ extern tree gnat_to_gnu (Node_Id);
/* GNU_STMT is a statement. We generate code for that statement. */ /* GNU_STMT is a statement. We generate code for that statement. */
extern void gnat_expand_stmt (tree); extern void gnat_expand_stmt (tree);
extern int gnat_gimplify_expr (tree *, tree *, tree *);
/* Expand the body of GNU_DECL, which is not a nested function. */
extern void gnat_expand_body (tree);
/* Do the processing for the declaration of a GNAT_ENTITY, a type. If /* Do the processing for the declaration of a GNAT_ENTITY, a type. If
a separate Freeze node exists, delay the bulk of the processing. Otherwise a separate Freeze node exists, delay the bulk of the processing. Otherwise
make a GCC type for GNAT_ENTITY and set up the correspondance. */ make a GCC type for GNAT_ENTITY and set up the correspondance. */
extern void process_type (Entity_Id); extern void process_type (Entity_Id);
/* Determine the input_filename and the input_line from the source location /* Convert Sloc into *LOCUS (a location_t). Return true if this Sloc
(Sloc) of GNAT_NODE node. Set the global variable input_filename and corresponds to a source code location and false if it doesn't. In the
input_line. If WRITE_NOTE_P is true, emit a line number note. */ latter case, we don't update *LOCUS. We also set the Gigi global variable
extern void set_lineno (Node_Id, int); REF_FILENAME to the reference file name as given by sinput (i.e no
directory). */
/* Likewise, but passed a Sloc. */ extern bool Sloc_to_locus (Source_Ptr, location_t *);
extern void set_lineno_from_sloc (Source_Ptr, int);
/* Post an error message. MSG is the error message, properly annotated. /* Post an error message. MSG is the error message, properly annotated.
NODE is the node at which to post the error and the node to use for the NODE is the node at which to post the error and the node to use for the
...@@ -383,10 +371,15 @@ extern int global_bindings_p (void); ...@@ -383,10 +371,15 @@ extern int global_bindings_p (void);
is in reverse order (it has to be so for back-end compatibility). */ is in reverse order (it has to be so for back-end compatibility). */
extern tree getdecls (void); extern tree getdecls (void);
/* Enter and exit a new binding level. We return the BLOCK node, if any /* Enter and exit a new binding level. */
when we exit a binding level. */
extern void gnat_pushlevel (void); extern void gnat_pushlevel (void);
extern tree gnat_poplevel (void); extern void gnat_poplevel (void);
/* Set the jmpbuf_decl for the current binding level to DECL. */
extern void set_block_jmpbuf_decl (tree);
/* Get the setjmp_decl, if any, for the current binding level. */
extern tree get_block_jmpbuf_decl (void);
/* Insert BLOCK at the end of the list of subblocks of the /* Insert BLOCK at the end of the list of subblocks of the
current binding level. This is used when a BIND_EXPR is expanded, current binding level. This is used when a BIND_EXPR is expanded,
...@@ -563,8 +556,9 @@ extern tree create_label_decl (tree); ...@@ -563,8 +556,9 @@ extern tree create_label_decl (tree);
extern void begin_subprog_body (tree); extern void begin_subprog_body (tree);
/* Finish the definition of the current subprogram and compile it all the way /* Finish the definition of the current subprogram and compile it all the way
to assembler language output. */ to assembler language output. BODY is the tree corresponding to
extern void end_subprog_body (void); the subprogram. */
extern void end_subprog_body (tree);
/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE. /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs. EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs.
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "ggc.h" #include "ggc.h"
#include "flags.h" #include "flags.h"
#include "debug.h" #include "debug.h"
#include "cgraph.h"
#include "tree-inline.h"
#include "insn-codes.h" #include "insn-codes.h"
#include "insn-flags.h" #include "insn-flags.h"
#include "insn-config.h" #include "insn-config.h"
...@@ -84,11 +86,11 @@ extern FILE *asm_out_file; ...@@ -84,11 +86,11 @@ extern FILE *asm_out_file;
move instruction. */ move instruction. */
unsigned int largest_move_alignment; unsigned int largest_move_alignment;
static size_t gnat_tree_size (enum tree_code);
static bool gnat_init (void); static bool gnat_init (void);
static void gnat_finish_incomplete_decl (tree); static void gnat_finish_incomplete_decl (tree);
static unsigned int gnat_init_options (unsigned int, const char **); static unsigned int gnat_init_options (unsigned int, const char **);
static int gnat_handle_option (size_t, const char *, int); 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 HOST_WIDE_INT gnat_get_alias_set (tree);
static void gnat_print_decl (FILE *, tree, int); static void gnat_print_decl (FILE *, tree, int);
static void gnat_print_type (FILE *, tree, int); static void gnat_print_type (FILE *, tree, int);
...@@ -107,14 +109,14 @@ static void gnat_adjust_rli (record_layout_info); ...@@ -107,14 +109,14 @@ static void gnat_adjust_rli (record_layout_info);
#define LANG_HOOKS_NAME "GNU Ada" #define LANG_HOOKS_NAME "GNU Ada"
#undef LANG_HOOKS_IDENTIFIER_SIZE #undef LANG_HOOKS_IDENTIFIER_SIZE
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) #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 #undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT gnat_init #define LANG_HOOKS_INIT gnat_init
#undef LANG_HOOKS_INIT_OPTIONS #undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS gnat_init_options #define LANG_HOOKS_INIT_OPTIONS gnat_init_options
#undef LANG_HOOKS_HANDLE_OPTION #undef LANG_HOOKS_HANDLE_OPTION
#define LANG_HOOKS_HANDLE_OPTION gnat_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 #undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE gnat_parse_file #define LANG_HOOKS_PARSE_FILE gnat_parse_file
#undef LANG_HOOKS_HONOR_READONLY #undef LANG_HOOKS_HONOR_READONLY
...@@ -143,6 +145,13 @@ static void gnat_adjust_rli (record_layout_info); ...@@ -143,6 +145,13 @@ static void gnat_adjust_rli (record_layout_info);
#define LANG_HOOKS_PRINT_TYPE gnat_print_type #define LANG_HOOKS_PRINT_TYPE gnat_print_type
#undef LANG_HOOKS_DECL_PRINTABLE_NAME #undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_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 #undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode #define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE #undef LANG_HOOKS_TYPE_FOR_SIZE
...@@ -224,10 +233,11 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -224,10 +233,11 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
/* Call the front-end elaboration procedures */ /* Call the front-end elaboration procedures */
adainit (); adainit ();
immediate_size_expand = 1;
/* Call the front end */ /* Call the front end */
_ada_gnat1drv (); _ada_gnat1drv ();
cgraph_finalize_compilation_unit ();
cgraph_optimize ();
} }
/* Decode all the language specific options that cannot be decoded by GCC. /* 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) ...@@ -332,6 +342,24 @@ gnat_init_options (unsigned int argc, const char **argv)
return CL_Ada; 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. */ /* Here is the function to handle the compiler error processing in GCC. */
static void static void
...@@ -359,21 +387,6 @@ internal_error_function (const char *msgid, va_list *ap) ...@@ -359,21 +387,6 @@ internal_error_function (const char *msgid, va_list *ap)
Compiler_Abort (fp, -1); 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. */ /* Perform all the initialization steps that are language-specific. */
static bool static bool
...@@ -559,7 +572,7 @@ gnat_printable_name (tree decl, int verbosity) ...@@ -559,7 +572,7 @@ gnat_printable_name (tree decl, int verbosity)
} }
/* Expands GNAT-specific GCC tree nodes. The only ones we support /* 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 static rtx
gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, 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, ...@@ -567,7 +580,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode,
{ {
tree type = TREE_TYPE (exp); tree type = TREE_TYPE (exp);
tree new; tree new;
rtx result;
/* If this is a statement, call the expansion routine for statements. */ /* If this is a statement, call the expansion routine for statements. */
if (IS_STMT (exp)) if (IS_STMT (exp))
...@@ -579,48 +591,14 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, ...@@ -579,48 +591,14 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode,
/* Update EXP to be the new expression to expand. */ /* Update EXP to be the new expression to expand. */
switch (TREE_CODE (exp)) switch (TREE_CODE (exp))
{ {
case TRANSFORM_EXPR: #if 0
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;
case ALLOCATE_EXPR: case ALLOCATE_EXPR:
return return
allocate_dynamic_stack_space allocate_dynamic_stack_space
(expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, TYPE_MODE (sizetype), (expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, TYPE_MODE (sizetype),
EXPAND_NORMAL), EXPAND_NORMAL),
NULL_RTX, tree_low_cst (TREE_OPERAND (exp, 1), 1)); NULL_RTX, tree_low_cst (TREE_OPERAND (exp, 1), 1));
#endif
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);
case UNCONSTRAINED_ARRAY_REF: case UNCONSTRAINED_ARRAY_REF:
/* If we are evaluating just for side-effects, just evaluate our /* If we are evaluating just for side-effects, just evaluate our
...@@ -667,18 +645,6 @@ gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED) ...@@ -667,18 +645,6 @@ gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED)
rli->record_align = record_align; rli->record_align = record_align;
#endif #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. */ /* These routines are used in conjunction with GCC exception handling. */
...@@ -704,55 +670,6 @@ gnat_eh_type_covers (tree a, tree b) ...@@ -704,55 +670,6 @@ gnat_eh_type_covers (tree a, tree b)
return (a == b || a == integer_zero_node); 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. */ /* Get the alias set corresponding to a type or expression. */
static HOST_WIDE_INT static HOST_WIDE_INT
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "coretypes.h" #include "coretypes.h"
#include "tm.h" #include "tm.h"
#include "tree.h" #include "tree.h"
#include "rtl.h"
#include "flags.h" #include "flags.h"
#include "output.h" #include "output.h"
#include "ada.h" #include "ada.h"
...@@ -1345,23 +1346,20 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) ...@@ -1345,23 +1346,20 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
/* Similar, but for COND_EXPR. */ /* Similar, but for COND_EXPR. */
tree tree
build_cond_expr (tree result_type, build_cond_expr (tree result_type, tree condition_operand,
tree condition_operand, tree true_operand, tree false_operand)
tree true_operand,
tree false_operand)
{ {
tree result; tree result;
int addr_p = 0; int addr_p = 0;
/* Front-end verifies that result, true and false operands have same base /* The front-end verifies that result, true and false operands have same base
type. Convert everything to the result type. */ type. Convert everything to the result type. */
true_operand = convert (result_type, true_operand); true_operand = convert (result_type, true_operand);
false_operand = convert (result_type, false_operand); false_operand = convert (result_type, false_operand);
/* If the result type is unconstrained, take the address of /* If the result type is unconstrained, take the address of
the operands and then dereference our result. */ the operands and then dereference our result. */
if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE
|| CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type)))
{ {
...@@ -1450,7 +1448,7 @@ tree ...@@ -1450,7 +1448,7 @@ tree
build_call_raise (int msg) build_call_raise (int msg)
{ {
tree fndecl = gnat_raise_decls[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; int len = strlen (str) + 1;
tree filename = build_string (len, str); tree filename = build_string (len, str);
...@@ -1743,7 +1741,11 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align, ...@@ -1743,7 +1741,11 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
else if (gnu_obj) else if (gnu_obj)
return build_call_1_expr (free_decl, 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 /* 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. */ 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, ...@@ -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)); build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl));
} }
else else
abort ();
#if 0
return build (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align); return build (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align);
#endif
} }
else else
{ {
...@@ -1977,7 +1982,6 @@ gnat_mark_addressable (tree expr_node) ...@@ -1977,7 +1982,6 @@ gnat_mark_addressable (tree expr_node)
case VIEW_CONVERT_EXPR: case VIEW_CONVERT_EXPR:
case CONVERT_EXPR: case CONVERT_EXPR:
case NON_LVALUE_EXPR: case NON_LVALUE_EXPR:
case GNAT_NOP_EXPR:
case NOP_EXPR: case NOP_EXPR:
expr_node = TREE_OPERAND (expr_node, 0); expr_node = TREE_OPERAND (expr_node, 0);
break; break;
...@@ -1989,7 +1993,19 @@ gnat_mark_addressable (tree expr_node) ...@@ -1989,7 +1993,19 @@ gnat_mark_addressable (tree expr_node)
case VAR_DECL: case VAR_DECL:
case PARM_DECL: case PARM_DECL:
case RESULT_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; return true;
case FUNCTION_DECL: case FUNCTION_DECL:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment