OSDN Git Service

* decl.c (init_decl_processing): Remove duplicate decl of
[pf3gnuchains/gcc-fork.git] / gcc / ch / decl.c
index 137b605..cc352d3 100644 (file)
@@ -1,5 +1,5 @@
 /* Process declarations and variables for GNU CHILL compiler.
-   Copyright (C) 1992, 93, 1994, 1998, 1999 Free Software Foundation, Inc. 
+   Copyright (C) 1992, 93, 94, 98, 99, 2000 Free Software Foundation, Inc. 
    
    This file is part of GNU CC.
    
@@ -205,12 +205,12 @@ extern struct obstack *saveable_obstack;
 extern tree signal_code;
 extern int special_UC;
 
-static tree get_next_decl             PROTO((void));
-static tree lookup_name_for_seizing   PROTO((tree));
+static tree get_next_decl             PARAMS ((void));
+static tree lookup_name_for_seizing   PARAMS ((tree));
 #if 0
-static tree lookup_name_current_level PROTO((tree));
+static tree lookup_name_current_level PARAMS ((tree));
 #endif
-static void save_decl                 PROTO((tree));
+static void save_decl                 PARAMS ((tree));
 
 extern struct obstack permanent_obstack;
 extern int in_pseudo_module;
@@ -240,9 +240,21 @@ tree chill_result_decl;
 int result_never_set;
 
 /* forward declarations */
-static void pushdecllist                     PROTO((tree, int));
-static int  init_nonvalue_struct             PROTO((tree));
-static int  init_nonvalue_array              PROTO((tree));
+static void pushdecllist                     PARAMS ((tree, int));
+static int  init_nonvalue_struct             PARAMS ((tree));
+static int  init_nonvalue_array              PARAMS ((tree));
+static void set_nesting_level                PARAMS ((tree, int));
+static tree make_chill_variants              PARAMS ((tree, tree, tree));
+static tree fix_identifier                   PARAMS ((tree));
+static void proclaim_decl                    PARAMS ((tree, int));
+static tree maybe_acons                      PARAMS ((tree, tree));
+static void push_scope_decls                 PARAMS ((int));
+static void pop_scope_decls                  PARAMS ((tree, tree));
+static tree build_implied_names              PARAMS ((tree));
+static void bind_sub_modules                 PARAMS ((int));
+static void layout_array_type                PARAMS ((tree));
+static void do_based_decl                    PARAMS ((tree, tree, tree));
+static void handle_one_level                 PARAMS ((tree, tree));
 
 int current_nesting_level = BUILTIN_NESTING_LEVEL;
 int current_module_nesting_level = 0;
@@ -312,68 +324,12 @@ enum decl_context
 #define WCHAR_TYPE "int"
 #endif
 \f
-/* a node which has tree code ERROR_MARK, and whose type is itself.
-   All erroneous expressions are replaced with this node.  All functions
-   that accept nodes as arguments should avoid generating error messages
-   if this node is one of the arguments, since it is undesirable to get
-   multiple error messages from one error in the input.  */
-
-tree error_mark_node;
-
-/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */
-
-tree short_integer_type_node;
-tree integer_type_node;
-tree long_integer_type_node;
-tree long_long_integer_type_node;
-
-tree short_unsigned_type_node;
-tree unsigned_type_node;
-tree long_unsigned_type_node;
-tree long_long_unsigned_type_node;
-
-tree ptrdiff_type_node;
-
-tree unsigned_char_type_node;
-tree signed_char_type_node;
-tree char_type_node;
 tree wchar_type_node;
 tree signed_wchar_type_node;
 tree unsigned_wchar_type_node;
 
-tree float_type_node;
-tree double_type_node;
-tree long_double_type_node;
-
-tree complex_integer_type_node;
-tree complex_float_type_node;
-tree complex_double_type_node;
-tree complex_long_double_type_node;
-
-tree intQI_type_node;
-tree intHI_type_node;
-tree intSI_type_node;
-tree intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-tree intTI_type_node;
-#endif
-
-tree unsigned_intQI_type_node;
-tree unsigned_intHI_type_node;
-tree unsigned_intSI_type_node;
-tree unsigned_intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-tree unsigned_intTI_type_node;
-#endif
-
-/* a VOID_TYPE node.  */
-
-tree void_type_node;
 tree void_list_node;
 
-/* Nodes for types `void *' and `const void *'.  */
-tree ptr_type_node, const_ptr_type_node;
-
 /* type of initializer structure, which points to
    a module's module-level code, and to the next
    such structure. */
@@ -386,33 +342,7 @@ tree chill_predefined_function_type;
 
 tree default_function_type;
 
-#if 0
-/* function types `double (double)' and `double (double, double)', etc.  */
-
-tree double_ftype_double, double_ftype_double_double;
-tree int_ftype_int, long_ftype_long;
-
-/* Function type `void (void *, void *, int)' and similar ones */
-
-tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int, void_ftype_ptr_int_int;
-
-/* Function type `char *(char *, char *)' and similar ones */
-tree string_ftype_ptr_ptr, int_ftype_string_string;
-
-/* Function type `int (const void *, const void *, size_t)' */
-tree int_ftype_cptr_cptr_sizet;
-#endif
-
-char **boolean_code_name;
-
-/* Two expressions that are constants with value zero.
-   The first is of type `int', the second of type `void *'.  */
-
-tree integer_zero_node;
-tree null_pointer_node;
-
-/* A node for the integer constant 1.  */
-tree integer_one_node;
+const char **boolean_code_name;
 
 /* A node for the integer constant -1.  */
 tree integer_minus_one_node;
@@ -596,10 +526,6 @@ int flag_allow_single_precision = 0;
 int flag_signed_bitfields = 1;
 int explicit_flag_signed_bitfields = 0;
 
-/* Nonzero means handle `#ident' directives.  0 means ignore them.  */
-
-int flag_no_ident = 0;
-
 /* Nonzero means warn about implicit declarations.  */
 
 int warn_implicit;
@@ -667,7 +593,7 @@ int warn_missing_braces;
 
 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
   
-  char chill_tree_code_type[] = {
+  const char chill_tree_code_type[] = {
     'x',
 #include "ch-tree.def"
   };
@@ -690,7 +616,7 @@ int chill_tree_code_length[] = {
    Used for printing out the tree and error messages.  */
 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
   
-char *chill_tree_code_name[] = {
+const char *chill_tree_code_name[] = {
     "@@dummy",
 #include "ch-tree.def"
   };
@@ -798,10 +724,6 @@ c_decode_option (argc, argv)
     flag_no_builtin = 0;
   else if (!strcmp (p, "-fno-builtin"))
     flag_no_builtin = 1;
-  else if (!strcmp (p, "-fno-ident"))
-    flag_no_ident = 1;
-  else if (!strcmp (p, "-fident"))
-    flag_no_ident = 0;
   else if (!strcmp (p, "-ansi"))
     flag_no_asm = 1, flag_no_nonansi_builtin = 1, dollars_in_ident = 0;
   else if (!strcmp (p, "-Wimplicit"))
@@ -1043,7 +965,7 @@ init_nonvalue_array (expr)
 \f
 /* This excessive piece of code sets DECL_NESTING_LEVEL (DECL) to LEVEL. */
 
-void
+static void
 set_nesting_level (decl, level)
      tree decl;
      int level;
@@ -1623,6 +1545,8 @@ struct tree_pair
   tree decl;
 };
 
+static int  label_value_cmp                  PARAMS ((struct tree_pair *,
+                                                   struct tree_pair *));
 
 /* Function to help qsort sort variant labels by value order.  */
 static int
@@ -1632,7 +1556,7 @@ label_value_cmp (x, y)
   return TREE_INT_CST_LOW (x->value) - TREE_INT_CST_LOW (y->value);
 }
 \f
-tree
+static tree
 make_chill_variants (tagfields, body, variantelse)
      tree tagfields;
      tree body;
@@ -1814,7 +1738,8 @@ layout_chill_variants (utype)
     {
       int limit;
       qsort (label_value_array,
-            label_index, sizeof (struct tree_pair), label_value_cmp);
+            label_index, sizeof (struct tree_pair),
+            (int (*) PARAMS ((const void *, const void *))) label_value_cmp);
       limit = label_index - 1;
       for (label_index = 0; label_index < limit; label_index++)
        {
@@ -2040,7 +1965,8 @@ start_chill_function (label, rtype, parms, exceptlist, attrs)
     {
       /* We use the same name as the keyword.
         This makes it easy to print and change the RESULT from gdb. */
-      char *result_str = (ignore_case || ! special_UC) ? "result" : "RESULT";
+      const char *result_str =
+       (ignore_case || ! special_UC) ? "result" : "RESULT";
       if (pass == 2 && TREE_CODE (result_type) == ERROR_MARK)
        TREE_TYPE (current_scope->remembered_decls) = result_type;
       chill_result_decl = do_decl (get_identifier (result_str),
@@ -2336,14 +2262,14 @@ push_module (name, is_spec_module)
   return name;   /* may have generated a name */
 }
 /* Make a copy of the identifier NAME, replacing each '!' by '__'. */
-tree
+static tree
 fix_identifier (name)
      tree name;
 {
   char *buf = (char*)alloca (2 * IDENTIFIER_LENGTH (name) + 1);
   int fixed = 0;
   register char *dptr = buf;
-  register char *sptr = IDENTIFIER_POINTER (name);
+  register const char *sptr = IDENTIFIER_POINTER (name);
   for (; *sptr; sptr++)
     {
       if (*sptr == '!')
@@ -2497,7 +2423,7 @@ kept_level_p ()
    Check redefinitions at the same level.
    Suppress error messages if QUIET is true. */
 
-void
+static void
 proclaim_decl (decl, quiet)
      tree decl;
      int quiet;
@@ -2566,12 +2492,14 @@ struct path
   struct path *prev;
   tree node;
 };
+
+static tree find_implied_types            PARAMS ((tree, struct path *, tree));
 \f
 /* Look for implied types (enumeral types) implied by TYPE (a decl or type).
    Add these to list.
    Use old_path to guard against cycles. */
 
-tree
+static tree
 find_implied_types (type, old_path, list)
      tree type;
      struct path *old_path;
@@ -3012,7 +2940,6 @@ poplevel (keep, reverse, functionbody)
            }
 
          BLOCK_SUBBLOCKS (block) = subblocks;
-         remember_end_note (block);
        }
 
       /* In each subblock, record that this is its superior.  */
@@ -3473,8 +3400,6 @@ init_decl_processing ()
   tree ptr_ftype_luns_ptr_int;
   tree double_ftype_double;
 
-  extern int set_alignment;
-
   /* allow 0-255 enums to occupy only a byte */
   flag_short_enums = 1;
 
@@ -3488,124 +3413,46 @@ init_decl_processing ()
   var_length_id = get_identifier (VAR_LENGTH);
   var_data_id = get_identifier (VAR_DATA);
 
-  /* This is the *C* int type. */
-  integer_type_node = make_signed_type (INT_TYPE_SIZE);
+  build_common_tree_nodes (1);
 
   if (CHILL_INT_IS_SHORT)
     long_integer_type_node = integer_type_node;
   else
     long_integer_type_node = make_signed_type (LONG_TYPE_SIZE);
 
-  unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
-  long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE);
-  long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE);
-  long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
-
   /* `unsigned long' is the standard type for sizeof.
      Note that stddef.h uses `unsigned long',
      and this must agree, even of long and int are the same size.  */
 #ifndef SIZE_TYPE
-    sizetype = long_unsigned_type_node;
+  set_sizetype (long_unsigned_type_node);
 #else
   {
-    char *size_type_c_name = SIZE_TYPE;
+    const char *size_type_c_name = SIZE_TYPE;
     if (strncmp (size_type_c_name, "long long ", 10) == 0)
-      sizetype = long_long_unsigned_type_node;
+      set_sizetype (long_long_unsigned_type_node);
     else if (strncmp (size_type_c_name, "long ", 5) == 0)
-      sizetype = long_unsigned_type_node;
+      set_sizetype (long_unsigned_type_node);
     else
-      sizetype = unsigned_type_node;
+      set_sizetype (unsigned_type_node);
   }
 #endif
 
-  TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype;
-  TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype;
-
-  error_mark_node = make_node (ERROR_MARK);
-  TREE_TYPE (error_mark_node) = error_mark_node;
-
-  short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);
-  short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE);
-  signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
-  unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
-  intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
-  intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
-  intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
-  intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
-#if HOST_BITS_PER_WIDE_INT >= 64
-  intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode));
-#endif
-  unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
-  unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
-  unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
-  unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
-#if HOST_BITS_PER_WIDE_INT >= 64
-  unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
-#endif
-
-  float_type_node = make_node (REAL_TYPE);
-  TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
   pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT],
                        float_type_node));
-  layout_type (float_type_node);
-
-  double_type_node = make_node (REAL_TYPE);
-  if (flag_short_double)
-    TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE;
-  else
-    TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE;
   pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE],
                        double_type_node));
-  layout_type (double_type_node);
-
-  long_double_type_node = make_node (REAL_TYPE);
-  TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE;
-  layout_type (long_double_type_node);
-
-  complex_integer_type_node = make_node (COMPLEX_TYPE);
-  TREE_TYPE (complex_integer_type_node) = integer_type_node;
-  layout_type (complex_integer_type_node);
-
-  complex_float_type_node = make_node (COMPLEX_TYPE);
-  TREE_TYPE (complex_float_type_node) = float_type_node;
-  layout_type (complex_float_type_node);
-
-  complex_double_type_node = make_node (COMPLEX_TYPE);
-  TREE_TYPE (complex_double_type_node) = double_type_node;
-  layout_type (complex_double_type_node);
 
-  complex_long_double_type_node = make_node (COMPLEX_TYPE);
-  TREE_TYPE (complex_long_double_type_node) = long_double_type_node;
-  layout_type (complex_long_double_type_node);
-
-  integer_zero_node = build_int_2 (0, 0);
-  TREE_TYPE (integer_zero_node) = integer_type_node;
-  integer_one_node = build_int_2 (1, 0);
-  TREE_TYPE (integer_one_node) = integer_type_node;
   integer_minus_one_node = build_int_2 (-1, -1);
   TREE_TYPE (integer_minus_one_node) = integer_type_node;
 
-  size_zero_node = build_int_2 (0, 0);
-  TREE_TYPE (size_zero_node) = sizetype;
-  size_one_node = build_int_2 (1, 0);
-  TREE_TYPE (size_one_node) = sizetype;
+  build_common_tree_nodes_2 (flag_short_double);
 
-  void_type_node = make_node (VOID_TYPE);
   pushdecl (build_decl (TYPE_DECL,
                        ridpointers[(int) RID_VOID], void_type_node));
-  layout_type (void_type_node);        /* Uses integer_zero_node */
   /* We are not going to have real types in C with less than byte alignment,
      so we might as well not have any types that claim to have it.  */
   TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
 
-  null_pointer_node = build_int_2 (0, 0);
-  TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
-  layout_type (TREE_TYPE (null_pointer_node));
-
   /* This is for wide string constants.  */
   wchar_type_node = short_unsigned_type_node;
   wchar_type_size = TYPE_PRECISION (wchar_type_node);
@@ -3649,9 +3496,6 @@ init_decl_processing ()
   bit_one_node = build (CONSTRUCTOR, bitstring_one_type_node, NULL_TREE,
                        build_tree_list (NULL_TREE, integer_zero_node));
 
-  char_type_node = make_node (CHAR_TYPE);
-  TYPE_PRECISION (char_type_node) = CHAR_TYPE_SIZE;
-  fixup_unsigned_type (char_type_node);
   pushdecl (build_decl (TYPE_DECL, ridpointers[(int)RID_CHAR],
                        char_type_node));
 
@@ -3682,7 +3526,7 @@ init_decl_processing ()
   pushdecl (build_decl (TYPE_DECL, ridpointers[(int)RID_LONG],
                         long_integer_type_node));
 
-  sizetype = long_integer_type_node;
+  set_sizetype (long_integer_type_node);
 #if 0
   ptrdiff_type_node
     = TREE_TYPE (IDENTIFIER_LOCAL_VALUE (get_identifier (PTRDIFF_TYPE)));
@@ -3714,20 +3558,20 @@ init_decl_processing ()
   DECL_SOURCE_LINE (temp) = 0;
   initializer_type = TREE_TYPE (temp);
 
-  bcopy (chill_tree_code_type,
-         tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
-         (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
-          * sizeof (char)));
-  bcopy ((char *) chill_tree_code_length,
-         (char *) (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
-         (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
-          * sizeof (int)));
-  bcopy ((char *) chill_tree_code_name,
-         (char *) (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
-         (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
-          * sizeof (char *)));
-  boolean_code_name = (char **) xmalloc (sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
-  bzero ((char *) boolean_code_name, sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
+  memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
+         chill_tree_code_type,
+         (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
+          * sizeof (char)));
+  memcpy (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE,
+         chill_tree_code_length,
+         (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
+          * sizeof (int)));
+  memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
+         chill_tree_code_name,
+         (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
+          * sizeof (char *)));
+  boolean_code_name = (const char **) xcalloc (sizeof (char *),
+                                              (int) LAST_CHILL_TREE_CODE);
 
   boolean_code_name[EQ_EXPR] = "=";
   boolean_code_name[NE_EXPR] = "/=";
@@ -4051,48 +3895,48 @@ init_decl_processing ()
 /* These are compiler-internal function calls, not intended
    to be directly called by user code */
   builtin_function ("__allocate", ptr_ftype_luns_ptr_int,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("_allocate_global_memory", void_ftype_refptr_int_ptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("_allocate_memory", void_ftype_refptr_int_ptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__andpowerset", bool_ftype_ptr_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__bitsetpowerset", void_ftype_ptr_int_int_int_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__cardpowerset", long_ftype_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__cause_ex1", void_ftype_cptr_cptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__concatstring", ptr_ftype_ptr_ptr_int_ptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__continue", void_ftype_ptr_ptr_int,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__diffpowerset", void_ftype_ptr_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__eqpowerset", bool_ftype_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__ffsetclrpowerset", find_bit_ftype,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__flsetclrpowerset", find_bit_ftype,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__flsetpowerset", int_ftype_ptr_luns_long_ptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__ffsetpowerset", int_ftype_ptr_luns_long_ptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__inbitstring", bool_ftype_luns_ptr_luns_long_ptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__inpowerset", bool_ftype_luns_ptr_luns_long, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__lepowerset", bool_ftype_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__ltpowerset", bool_ftype_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   /* Currently under experimentation.  */
   builtin_function ("memmove", memcpy_ftype,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("memcmp", memcmp_ftype,
-                    NOT_BUILT_IN, NULL_PTR);
+                    0, NOT_BUILT_IN, NULL_PTR);
 
   /* this comes from c-decl.c (init_decl_processing) */
   builtin_function ("__builtin_alloca",
@@ -4100,40 +3944,40 @@ init_decl_processing ()
                                         tree_cons (NULL_TREE,
                                                    sizetype,
                                                    endlink)),
-                   BUILT_IN_ALLOCA, "alloca");
+                   BUILT_IN_ALLOCA, BUILT_IN_NORMAL, "alloca");
 
   builtin_function ("memset", ptr_ftype_ptr_int_int,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__notpowerset", bool_ftype_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__orpowerset", bool_ftype_ptr_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__psslice", void_ftype_ptr_int_ptr_int_int_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__pscpy", void_ftype_ptr_luns_luns_cptr_luns_luns_luns,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("_return_memory", void_ftype_ptr_ptr_int,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__setbitpowerset", void_ftype_ptr_luns_long_long_bool_ptr_int,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__terminate", void_ftype_ptr_ptr_int,
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__unhandled_ex", void_ftype_cptr_cptr_int, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
   builtin_function ("__xorpowerset", bool_ftype_ptr_ptr_ptr_luns, 
-                   NOT_BUILT_IN, NULL_PTR);
+                   0, NOT_BUILT_IN, NULL_PTR);
 
   /* declare floating point functions */
-  builtin_function ("__sin", double_ftype_double, NOT_BUILT_IN, "sin");
-  builtin_function ("__cos", double_ftype_double, NOT_BUILT_IN, "cos");
-  builtin_function ("__tan", double_ftype_double, NOT_BUILT_IN, "tan");
-  builtin_function ("__asin", double_ftype_double, NOT_BUILT_IN, "asin");
-  builtin_function ("__acos", double_ftype_double, NOT_BUILT_IN, "acos");
-  builtin_function ("__atan", double_ftype_double, NOT_BUILT_IN, "atan");
-  builtin_function ("__exp", double_ftype_double, NOT_BUILT_IN, "exp");
-  builtin_function ("__log", double_ftype_double, NOT_BUILT_IN, "log");
-  builtin_function ("__log10", double_ftype_double, NOT_BUILT_IN, "log10");
-  builtin_function ("__sqrt", double_ftype_double, NOT_BUILT_IN, "sqrt");
+  builtin_function ("__sin", double_ftype_double, 0, NOT_BUILT_IN, "sin");
+  builtin_function ("__cos", double_ftype_double, 0, NOT_BUILT_IN, "cos");
+  builtin_function ("__tan", double_ftype_double, 0, NOT_BUILT_IN, "tan");
+  builtin_function ("__asin", double_ftype_double, 0, NOT_BUILT_IN, "asin");
+  builtin_function ("__acos", double_ftype_double, 0, NOT_BUILT_IN, "acos");
+  builtin_function ("__atan", double_ftype_double, 0, NOT_BUILT_IN, "atan");
+  builtin_function ("__exp", double_ftype_double, 0, NOT_BUILT_IN, "exp");
+  builtin_function ("__log", double_ftype_double, 0, NOT_BUILT_IN, "log");
+  builtin_function ("__log10", double_ftype_double, 0, NOT_BUILT_IN, "log10");
+  builtin_function ("__sqrt", double_ftype_double, 0, NOT_BUILT_IN, "sqrt");
 
   tasking_init ();
   timing_init ();
@@ -4144,114 +3988,114 @@ init_decl_processing ()
      the same names.  Note the lack of a leading underscore. */
   builtin_function ((ignore_case || ! special_UC) ?  "abs" : "ABS",
                    chill_predefined_function_type,
-                   BUILT_IN_CH_ABS, NULL_PTR);
+                   BUILT_IN_CH_ABS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "abstime" : "ABSTIME",
                    chill_predefined_function_type,
-                   BUILT_IN_ABSTIME, NULL_PTR);
+                   BUILT_IN_ABSTIME, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "allocate" : "ALLOCATE",
                    chill_predefined_function_type,
-                   BUILT_IN_ALLOCATE, NULL_PTR);
+                   BUILT_IN_ALLOCATE, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "allocate_memory" : "ALLOCATE_MEMORY",
                    chill_predefined_function_type,
-                   BUILT_IN_ALLOCATE_MEMORY, NULL_PTR);
+                   BUILT_IN_ALLOCATE_MEMORY, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "addr" : "ADDR",
                    chill_predefined_function_type,
-                   BUILT_IN_ADDR, NULL_PTR);
+                   BUILT_IN_ADDR, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "allocate_global_memory" : "ALLOCATE_GLOBAL_MEMORY",
                    chill_predefined_function_type,
-                   BUILT_IN_ALLOCATE_GLOBAL_MEMORY, NULL_PTR);
+                   BUILT_IN_ALLOCATE_GLOBAL_MEMORY, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "arccos" : "ARCCOS",
                    chill_predefined_function_type,
-                   BUILT_IN_ARCCOS, NULL_PTR);
+                   BUILT_IN_ARCCOS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "arcsin" : "ARCSIN",
                    chill_predefined_function_type,
-                   BUILT_IN_ARCSIN, NULL_PTR);
+                   BUILT_IN_ARCSIN, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "arctan" : "ARCTAN",
                    chill_predefined_function_type,
-                   BUILT_IN_ARCTAN, NULL_PTR);
+                   BUILT_IN_ARCTAN, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "card" : "CARD",
                    chill_predefined_function_type,
-                   BUILT_IN_CARD, NULL_PTR);
+                   BUILT_IN_CARD, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "cos" : "COS",
                    chill_predefined_function_type,
-                   BUILT_IN_CH_COS, NULL_PTR);
+                   BUILT_IN_CH_COS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "days" : "DAYS",
                    chill_predefined_function_type,
-                   BUILT_IN_DAYS, NULL_PTR);
+                   BUILT_IN_DAYS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "descr" : "DESCR",
                    chill_predefined_function_type,
-                   BUILT_IN_DESCR, NULL_PTR);
+                   BUILT_IN_DESCR, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "getstack" : "GETSTACK",
                    chill_predefined_function_type,
-                   BUILT_IN_GETSTACK, NULL_PTR);
+                   BUILT_IN_GETSTACK, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "exp" : "EXP",
                    chill_predefined_function_type,
-                   BUILT_IN_EXP, NULL_PTR);
+                   BUILT_IN_EXP, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "hours" : "HOURS",
                    chill_predefined_function_type,
-                   BUILT_IN_HOURS, NULL_PTR);
+                   BUILT_IN_HOURS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "inttime" : "INTTIME",
                    chill_predefined_function_type,
-                   BUILT_IN_INTTIME, NULL_PTR);
+                   BUILT_IN_INTTIME, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "length" : "LENGTH",
                    chill_predefined_function_type,
-                   BUILT_IN_LENGTH, NULL_PTR);
+                   BUILT_IN_LENGTH, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "log" : "LOG",
                    chill_predefined_function_type,
-                   BUILT_IN_LOG, NULL_PTR);
+                   BUILT_IN_LOG, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "lower" : "LOWER",
                    chill_predefined_function_type,
-                   BUILT_IN_LOWER, NULL_PTR);
+                   BUILT_IN_LOWER, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "ln" : "LN",
                    chill_predefined_function_type,
-                   BUILT_IN_LN, NULL_PTR);
+                   BUILT_IN_LN, BUILT_IN_NORMAL, NULL_PTR);
   /* Note: these are *not* the C integer MAX and MIN.  They're
      for powerset arguments. */
   builtin_function ((ignore_case || ! special_UC) ?  "max" : "MAX",
                    chill_predefined_function_type,
-                   BUILT_IN_MAX, NULL_PTR);
+                   BUILT_IN_MAX, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "millisecs" : "MILLISECS",
                    chill_predefined_function_type,
-                   BUILT_IN_MILLISECS, NULL_PTR);
+                   BUILT_IN_MILLISECS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "min" : "MIN",
                    chill_predefined_function_type,
-                   BUILT_IN_MIN, NULL_PTR);
+                   BUILT_IN_MIN, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "minutes" : "MINUTES",
                    chill_predefined_function_type,
-                   BUILT_IN_MINUTES, NULL_PTR);
+                   BUILT_IN_MINUTES, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "num" : "NUM",
                    chill_predefined_function_type,
-                   BUILT_IN_NUM, NULL_PTR);
+                   BUILT_IN_NUM, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "pred" : "PRED",
                    chill_predefined_function_type,
-                   BUILT_IN_PRED, NULL_PTR);
+                   BUILT_IN_PRED, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "return_memory" : "RETURN_MEMORY",
                    chill_predefined_function_type,
-                   BUILT_IN_RETURN_MEMORY, NULL_PTR);
+                   BUILT_IN_RETURN_MEMORY, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "secs" : "SECS",
                    chill_predefined_function_type,
-                   BUILT_IN_SECS, NULL_PTR);
+                   BUILT_IN_SECS, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "sin" : "SIN",
                    chill_predefined_function_type,
-                   BUILT_IN_CH_SIN, NULL_PTR);
+                   BUILT_IN_CH_SIN, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "size" : "SIZE",
                    chill_predefined_function_type,
-                   BUILT_IN_SIZE, NULL_PTR);
+                   BUILT_IN_SIZE, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "sqrt" : "SQRT",
                    chill_predefined_function_type,
-                   BUILT_IN_SQRT, NULL_PTR);
+                   BUILT_IN_SQRT, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "succ" : "SUCC",
                    chill_predefined_function_type,
-                   BUILT_IN_SUCC, NULL_PTR);
+                   BUILT_IN_SUCC, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "tan" : "TAN",
                    chill_predefined_function_type,
-                   BUILT_IN_TAN, NULL_PTR);
+                   BUILT_IN_TAN, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ? "terminate" : "TERMINATE",
                    chill_predefined_function_type,
-                   BUILT_IN_TERMINATE, NULL_PTR);
+                   BUILT_IN_TERMINATE, BUILT_IN_NORMAL, NULL_PTR);
   builtin_function ((ignore_case || ! special_UC) ?  "upper" : "UPPER",
                    chill_predefined_function_type,
-                   BUILT_IN_UPPER, NULL_PTR);
+                   BUILT_IN_UPPER, BUILT_IN_NORMAL, NULL_PTR);
 
   build_chill_descr_type ();
   build_chill_inttime_type ();
@@ -4272,11 +4116,12 @@ init_decl_processing ()
    the name to be called if we can't opencode the function.  */
 
 tree
-builtin_function (name, type, function_code, library_name)
-     char *name;
+builtin_function (name, type, function_code, class, library_name)
+     const char *name;
      tree type;
-     enum built_in_function function_code;
-     char *library_name;
+     int function_code;
+     enum built_in_class class;
+     const char *library_name;
 {
   tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
   DECL_EXTERNAL (decl) = 1;
@@ -4290,11 +4135,8 @@ builtin_function (name, type, function_code, library_name)
     DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
   make_decl_rtl (decl, NULL_PTR, 1);
   pushdecl (decl);
-  if (function_code != NOT_BUILT_IN)
-    {
-      DECL_BUILT_IN (decl) = 1;
-      DECL_SET_FUNCTION_CODE (decl, function_code);
-    }
+  DECL_BUILT_IN_CLASS (decl) = class;
+  DECL_FUNCTION_CODE (decl) = function_code;
 
   return decl;
 }
@@ -4985,7 +4827,7 @@ save_expr_under_name (name, expr)
   pushdecllist (alias, 0);
 }
 
-void
+static void
 do_based_decl (name, mode, base_var)
      tree name, mode, base_var;
 {
@@ -5086,7 +4928,7 @@ static char exception_prefix [] = "__Ex_";
 
 tree
 build_chill_exception_decl (name)
-     char *name;
+     const char *name;
 {
   tree decl, ex_name, ex_init, ex_type;
   int  name_len = strlen (name);
@@ -5147,7 +4989,7 @@ finish_outer_function ()
      and fill in the module's function's address. */
 
   extern tree initializer_type;
-  char *fname_str = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
+  const char *fname_str = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
   char *init_entry_name = (char *)xmalloc ((unsigned)(strlen (fname_str) + 20));
   tree  init_entry_id;
   tree  init_entry_decl;