[m-dev.] diff: update GCC back-end interface

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 30 23:51:55 AEDT 2001


Estimated hours taken: 1

gcc/mercury/mercury-gcc.c:
	Update to handle recent changes to the gcc back-end interface:
		- make_function_rtl() has been replaced by make_decl_rtl()
		- some of the hook functions are defined as function
		  pointers in the `lang_hooks' structure, rather than
		  being global  functions
	Also delete some old code which is no longer needed.

Index: mercury-gcc.c
===================================================================
RCS file: /home/mercury1/repository/gcc/mercury/mercury-gcc.c,v
retrieving revision 1.25
diff -u -d -u -r1.25 mercury-gcc.c
--- mercury-gcc.c	2001/01/22 16:08:44	1.25
+++ mercury-gcc.c	2001/01/30 12:41:46
@@ -39,7 +39,6 @@
 #include "gansidecl.h"
 #include "tree.h"
 #include "flags.h"
-#include "output.h"		/* For make_function_rtl().  */
 /* XXX we should avoid the dependency on `c-*.h'. */
 #include "c-lex.h"
 #include "c-tree.h"
@@ -57,7 +56,7 @@
 /*---------------------------------------------------------------------------*/
 
 static const char * snapshot_version ATTRIBUTE_UNUSED
-  = "for GCC weekly snapshot 20001030";
+  = "for GCC weekly snapshot 20010129";
 
 /*---------------------------------------------------------------------------*/
 
@@ -75,6 +74,11 @@
 static void merc_push_type_decl PARAMS((tree id, tree type));
 static void merc_push_atomic_type_decl PARAMS((tree id, tree type));
 
+static void merc_lang_init PARAMS((void));
+static void merc_lang_finish PARAMS((void));
+static void merc_lang_init_options PARAMS((void));
+static int merc_lang_decode_option PARAMS((int argc, char **argv));
+
 /*---------------------------------------------------------------------------*/
 
 /* Global variables defined elsewhere.  */
@@ -122,6 +126,15 @@
 
 const char * const language_string = "Mercury";
 
+/* The `lang_hooks' struct is a table of function pointers.
+   These are "hook" functions which are called by the gcc back-end.
+   NULL values can be used if the function does nothing.  */
+struct lang_hooks lang_hooks = {merc_lang_init,
+				merc_lang_finish,
+				merc_lang_init_options,
+				merc_lang_decode_option,
+				NULL /* post_options */};
+
 int flag_traditional;		/* Used by dwarfout.c.  */
 
 #define NULL_BINDING_LEVEL (struct binding_level *) NULL
@@ -135,8 +148,6 @@
 tree c_global_trees[CTI_MAX];
 tree current_function_decl;
 
-int ggc_p = 1; /* yes - garbage collection */
-
 /*---------------------------------------------------------------------------*/
 /*---------------------------------------------------------------------------*/
 
@@ -366,17 +377,6 @@
     DECL_CONTEXT (field) = type;
   TYPE_FIELDS (type) = field_decls;
 
-#if 0
-  /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE will be the
-     tagged type we just added to the current binding level.  This fake
-     NULL-named TYPE_DECL node helps dwarfout.c to know when it needs
-     to output a representation of a tagged type, and it also gives
-     us a convenient place to record the "scope start" address for the
-     tagged type.  */
-
-  TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL_TREE, type));
-#endif
-
   decl = build_decl (TYPE_DECL, get_identifier (name), type);
 
   TYPE_NAME (type) = decl;
@@ -602,7 +602,7 @@
   /* GGC
      temporary_allocation ();
   */
-  make_function_rtl (fndecl);
+  make_decl_rtl (fndecl, NULL_PTR);
   
   init_function_start (fndecl, input_filename, lineno);
   expand_function_start (fndecl, 0);
@@ -782,8 +782,8 @@
   return;
 }
 
-void 
-lang_init_options (void)
+static void 
+merc_lang_init_options (void)
 {
   return;
 }
@@ -802,8 +802,8 @@
    option decoding phase of GCC calls this routine on the flags that it cannot
    decode.  Return 1 if successful, otherwise return 0. */
 
-int
-lang_decode_option (argc, argv)
+static int
+merc_lang_decode_option (argc, argv)
      int argc ATTRIBUTE_UNUSED;
      char **argv;
 {
@@ -835,16 +835,16 @@
 
 /* Perform all the initialization steps that are language-specific.  */
 
-void
-lang_init ()
+static void
+merc_lang_init ()
 {
   set_fatal_function (merc_handle_fatal_error);
 }
 
 /* Perform all the finalization steps that are language-specific.  */
 
-void
-lang_finish ()
+static void
+merc_lang_finish ()
 {}
 
 /* Return a short string identifying this language to the debugger.  */
@@ -1202,17 +1202,7 @@
   return decl;
 }
 

-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
 
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "long unsigned int"
-
 static void
 merc_push_type_decl(id, type_node)
      tree id;
@@ -1362,20 +1352,12 @@
   				    ? "short unsigned int"
 				    : WCHAR_TYPE);
 
-#if 0
-  /* XXX This is wrong, I think.
-     The boolean type should be marked as a BOOLEAN_TYPE.  */
-  boolean_type_node = integer_type_node;
-  boolean_true_node = integer_one_node;
-  boolean_false_node = integer_zero_node;
-#else
   boolean_type_node = make_node (BOOLEAN_TYPE);
   TYPE_PRECISION (boolean_type_node) = 1;
   fixup_unsigned_type (boolean_type_node);
   merc_push_atomic_type_decl (get_identifier ("boolean"), boolean_type_node);
   boolean_false_node = TYPE_MIN_VALUE (boolean_type_node);
   boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
-#endif
 
   string_type_node = build_pointer_type (char_type_node);
   const_string_type_node
@@ -1739,7 +1721,7 @@
     DECL_BUILT_IN_NONANSI (decl) = 1;
   if (library_name)
     DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
-  make_decl_rtl (decl, NULL_PTR, 1);
+  make_decl_rtl (decl, NULL_PTR);
   pushdecl (decl);
   DECL_BUILT_IN_CLASS (decl) = class;
   DECL_FUNCTION_CODE (decl) = function_code;

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list