2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (gigi): Do not start statement group.
+ (Compilation_Unit_to_gnu): Set current_function_decl to NULL.
+ Start statement group and push binding level here...
+ (gnat_to_gnu) <N_Compilation_Unit>: ...and not here.
+ Do not push fake contexts at top level. Remove redundant code.
+ (call_to_gnu): Rename a local variable and constify another.
+ * gcc-interface/utils.c (gnat_pushlevel): Fix formatting nits.
+ (set_current_block_context): Set it as the group's block.
+ (gnat_init_decl_processing): Delete unrelated init code.
+ (end_subprog_body): Use NULL_TREE.
+
+2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/trans.c (call_to_gnu): Do not unnecessarily force
side-effects of actual parameters before the call.
passing mechanism must be used. */
if (TYPE_CI_CO_LIST (gnu_subprog_type))
{
- /* List of FIELD_DECLs associated with the PARM_DECLs of the copy-in/
- copy-out parameters. */
+ /* List of FIELD_DECLs associated with the PARM_DECLs of the copy
+ in copy out parameters. */
tree gnu_cico_list = TYPE_CI_CO_LIST (gnu_subprog_type);
const int length = list_length (gnu_cico_list);
= length == 1
? gnu_call
: build_component_ref (gnu_call, NULL_TREE,
- TREE_PURPOSE (scalar_return_list),
- false);
+ TREE_PURPOSE (gnu_cico_list), false);
/* If the actual is a conversion, get the inner expression, which
will be the real destination, and convert the result to the
/* Initialize the information structure for the function. */
allocate_struct_function (gnu_elab_proc_decl, false);
+ Sloc_to_locus (Sloc (gnat_unit_entity), &cfun->function_end_locus);
+ current_function_decl = NULL_TREE;
set_cfun (NULL);
+ start_stmt_group ();
+ gnat_pushlevel ();
current_function_decl = NULL_TREE;
if (went_into_elab_proc)
current_function_decl = NULL_TREE;
- /* When not optimizing, turn boolean rvalues B into B != false tests
- so that the code just below can put the location information of the
- reference to B on the inequality operator for better debug info. */
- if (!optimize
- && (kind == N_Identifier
- || kind == N_Expanded_Name
- || kind == N_Explicit_Dereference
- || kind == N_Function_Call
- || kind == N_Indexed_Component
- || kind == N_Selected_Component)
- && TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE
- && !lvalue_required_p (gnat_node, gnu_result_type, false, false, false))
- gnu_result = build_binary_op (NE_EXPR, gnu_result_type,
- convert (gnu_result_type, gnu_result),
- convert (gnu_result_type,
- boolean_false_node));
-
/* Set the location information on the result if it is a real expression.
References can be reused for multiple GNAT nodes and they would get
the location information of their last use. Note that we may have
}
}
\f
+/* Do little here. Set up the standard declarations later after the
+ front end has been run. */
+
+void
+gnat_init_decl_processing (void)
+{
+ build_common_tree_nodes (true, true);
+
+ /* In Ada, we use a signed type for SIZETYPE. Use the signed type
+ corresponding to the width of Pmode. In most cases when ptr_mode
+ and Pmode differ, C will use the width of ptr_mode for SIZETYPE.
+ But we get far better code using the width of Pmode. */
+ size_type_node = gnat_type_for_mode (Pmode, 0);
+ set_sizetype (size_type_node);
+
+ /* In Ada, we use an unsigned 8-bit type for the default boolean type. */
+ boolean_type_node = make_unsigned_type (8);
+ TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
+ SET_TYPE_RM_MAX_VALUE (boolean_type_node,
+ build_int_cst (boolean_type_node, 1));
+ SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1));
+
+ build_common_tree_nodes_2 (0);
+ boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
+
+ ptr_void_type_node = build_pointer_type (void_type_node);
+}
+\f
/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */
void