This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tuples] Ada front-end changes for tuples



I've started working on converting the Ada FE to work with tuples but I'm running into some errors that I need some help with.


The attached patch is what I have converted. With it, I'm getting this failure during Ada bootstrap:

/home/dnovillo/tuples/native.checking/bld/./prev-gcc/xgcc -B/home/dnovillo/tuples/native.checking/bld/./prev-gcc/ -B/home/dnovillo/tuples/native.checking/x86_64-unknown-linux-gnu/bin/ -c -g -O2 -gnatpg -gnata -gnatwns -nostdinc -I- -I. -Iada -I/home/dnovillo/tuples/src.checking/gcc/ada /home/dnovillo/tuples/src.checking/gcc/ada/gnat1drv.adb -o ada/gnat1drv.o
gnatbind -C -nostdinc -I- -I. -Iada -I/home/dnovillo/tuples/src.checking/gcc/ada -o ada/b_gnat1.c -n ada/gnat1drv.ali
fatal error: file gnat1drv.ali is incorrectly formatted make sure you are using consistent versions of gcc/gnatbind
13. R nnnnnnnvnnnnnnnvnnvnnnnvnnnnnnnnnnnnnnvnnvnnnnnnnnnnnnnnnnnvnnnnnnnnnnnnnnnn
|
make: *** [ada/b_gnat1.c] Error 4




Thanks. Diego.
Index: ada/trans.c
===================================================================
--- ada/trans.c	(revision 136905)
+++ ada/trans.c	(working copy)
@@ -356,7 +356,8 @@ gigi (Node_Id gnat_root, int max_gnat_no
   for (info = elab_info_list; info; info = info->next)
     {
       tree gnu_body = DECL_SAVED_TREE (info->elab_proc);
-      tree gnu_stmts;
+      gimple body;
+      gimple_seq gnu_stmts;
 
       /* Unshare SAVE_EXPRs between subprograms.  These are not unshared by
 	 the gimplifier for obvious reasons, but it turns out that we need to
@@ -371,16 +372,17 @@ gigi (Node_Id gnat_root, int max_gnat_no
       /* Set the current function to be the elaboration procedure and gimplify
 	 what we have.  */
       current_function_decl = info->elab_proc;
-      gimplify_body (&gnu_body, info->elab_proc, true);
+      body = gimplify_body (&gnu_body, info->elab_proc, true);
 
-      /* We should have a BIND_EXPR, but it may or may not have any statements
-	 in it.  If it doesn't have any, we have nothing to do.  */
-      gnu_stmts = gnu_body;
-      if (TREE_CODE (gnu_stmts) == BIND_EXPR)
-	gnu_stmts = BIND_EXPR_BODY (gnu_stmts);
+      /* We should have a GIMPLE_BIND, but it may or may not have any
+	 statements in it.  If it doesn't have any, we have nothing to do.  */
+      if (gimple_code (body) == GIMPLE_BIND)
+	gnu_stmts = gimple_bind_body (body);
+      else
+	gnu_stmts = NULL;
 
       /* If there are no statements, there is no elaboration code.  */
-      if (!gnu_stmts || !STATEMENT_LIST_HEAD (gnu_stmts))
+      if (gimple_seq_empty_p (gnu_stmts))
 	{
 	  Set_Has_No_Elaboration_Code (info->gnat_node, 1);
 	  cgraph_remove_node (cgraph_node (info->elab_proc));
@@ -390,7 +392,7 @@ gigi (Node_Id gnat_root, int max_gnat_no
 	  /* Otherwise, compile the function.  Note that we'll be gimplifying
 	     it twice, but that's fine for the nodes we use.  */
 	  begin_subprog_body (info->elab_proc);
-	  end_subprog_body (gnu_body);
+	  end_subprog_body (body);
 	}
     }
 
@@ -1848,6 +1850,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod
   tree gnu_cico_list;
   tree gnu_result;
   VEC(parm_attr,gc) *cache;
+  gimple result;
 
   /* If this is a generic object or if it has been eliminated,
      ignore it.  */
@@ -2003,7 +2006,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod
       : Sloc (gnat_node)),
      &DECL_STRUCT_FUNCTION (gnu_subprog_decl)->function_end_locus);
 
-  end_subprog_body (gnu_result);
+  result = gimplify_body (&gnu_result, gnu_subprog_decl, false);
+  end_subprog_body (result);
 
   /* Disconnect the trees for parameters that we made variables for from the
      GNAT entities since these are unusable after we end the function.  */
@@ -5334,7 +5338,8 @@ pop_stack (tree *gnu_stack_ptr)
 /* Generate GIMPLE in place for the expression at *EXPR_P.  */
 
 int
-gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
+gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
+		    gimple_seq *post_p ATTRIBUTE_UNUSED)
 {
   tree expr = *expr_p;
   tree op;
Index: ada/utils.c
===================================================================
--- ada/utils.c	(revision 136905)
+++ ada/utils.c	(working copy)
@@ -2202,8 +2202,9 @@ gnat_genericize (tree fndecl)
    the subprogram.  */
 
 void
-end_subprog_body (tree body)
+end_subprog_body (gimple body)
 {
+  gimple_seq seq;
   tree fndecl = current_function_decl;
 
   /* Mark the BLOCK for this level as being for this function and pop the
@@ -2225,7 +2226,10 @@ end_subprog_body (tree body)
   /* Mark the RESULT_DECL as being in this subprogram. */
   DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl;
 
-  DECL_SAVED_TREE (fndecl) = body;
+  seq = gimple_seq_alloc ();
+  gimple_seq_add_stmt (&seq, body);
+  gimple_set_body (fndecl, seq);
+  DECL_SAVED_TREE (fndecl) = NULL_TREE;
 
   current_function_decl = DECL_CONTEXT (fndecl);
   set_cfun (NULL);
@@ -3070,6 +3074,7 @@ build_function_stub (tree gnu_subprog, E
   tree gnu_stub_param, gnu_param_list, gnu_arg_types, gnu_param;
   tree gnu_stub_decl = DECL_FUNCTION_STUB (gnu_subprog);
   tree gnu_body;
+  gimple body;
 
   gnu_subprog_type = TREE_TYPE (gnu_subprog);
   gnu_param_list = NULL_TREE;
@@ -3116,7 +3121,8 @@ build_function_stub (tree gnu_subprog, E
   gnat_poplevel ();
 
   allocate_struct_function (gnu_stub_decl, false);
-  end_subprog_body (gnu_body);
+  body = gimplify_body (&gnu_body, gnu_stub_decl, true);
+  end_subprog_body (body);
 }
 
 /* Build a type to be used to represent an aliased object whose nominal
Index: ada/gigi.h
===================================================================
--- ada/gigi.h	(revision 136905)
+++ ada/gigi.h	(working copy)
@@ -233,8 +233,8 @@ extern tree gnat_to_gnu (Node_Id gnat_no
 extern void gnat_expand_stmt (tree gnu_stmt);
 
 /* ??? missing documentation */
-extern int gnat_gimplify_expr (tree *expr_p, tree *pre_p,
-                               tree *post_p ATTRIBUTE_UNUSED);
+extern int gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
+                               gimple_seq *post_p ATTRIBUTE_UNUSED);
 
 /* 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
@@ -669,9 +669,9 @@ extern tree create_label_decl (tree labe
 extern void begin_subprog_body (tree subprog_decl);
 
 /* Finish the definition of the current subprogram and compile it all the way
-   to assembler language output.  BODY is the tree corresponding to
+   to assembler language output.  BODY is the GIMPLE_BIND corresponding to
    the subprogram.  */
-extern void end_subprog_body (tree body);
+extern void end_subprog_body (gimple body);
 
 /* 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]