OSDN Git Service

* gcc-interface/trans.c (gigi): Do not start statement group.
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Apr 2010 10:38:36 +0000 (10:38 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:32:40 +0000 (14:32 +0900)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158370 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/trans.c
gcc/ada/gcc-interface/utils.c

index 3796319..7c97b6c 100644 (file)
@@ -1,5 +1,18 @@
 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.
 
index 678f5b1..c0c11bb 100644 (file)
@@ -2984,8 +2984,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
      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);
 
@@ -3025,8 +3025,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
              = 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
@@ -3507,7 +3506,11 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
 
   /* 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;
 
@@ -5476,23 +5479,6 @@ gnat_to_gnu (Node_Id gnat_node)
   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
index 24bf3f7..1258c02 100644 (file)
@@ -514,6 +514,34 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
     }
 }
 \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