OSDN Git Service

* config/sh/sh.c (sh_use_dfa_interface): Add TARGET_SH1.
[pf3gnuchains/gcc-fork.git] / gcc / langhooks.c
index 124f38b..13be0aa 100644 (file)
@@ -1,5 +1,5 @@
 /* Default language-specific hooks.
-   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GCC.
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "tree.h"
 #include "tree-inline.h"
+#include "tree-gimple.h"
 #include "rtl.h"
 #include "insn-config.h"
 #include "integrate.h"
@@ -33,6 +34,7 @@ Boston, MA 02111-1307, USA.  */
 #include "langhooks.h"
 #include "langhooks-def.h"
 #include "ggc.h"
+#include "diagnostic.h"
 
 /* Do nothing; in many cases the default hook.  */
 
@@ -55,6 +57,16 @@ lhd_do_nothing_i (int i ATTRIBUTE_UNUSED)
 {
 }
 
+/* Do nothing (int, int, int).  Return NULL_TREE.  */
+
+tree
+lhd_do_nothing_iii_return_null_tree (int i ATTRIBUTE_UNUSED, 
+                                    int j ATTRIBUTE_UNUSED,
+                                    int k ATTRIBUTE_UNUSED)
+{
+  return NULL_TREE;
+}
+
 /* Do nothing (function).  */
 
 void
@@ -73,6 +85,14 @@ lhd_return_tree (tree t)
 /* Do nothing (return NULL_TREE).  */
 
 tree
+lhd_return_null_tree_v (void)
+{
+  return NULL_TREE;
+}
+
+/* Do nothing (return NULL_TREE).  */
+
+tree
 lhd_return_null_tree (tree t ATTRIBUTE_UNUSED)
 {
   return NULL_TREE;
@@ -196,8 +216,8 @@ lhd_can_use_bit_fields_p (void)
 void
 lhd_clear_binding_stack (void)
 {
-  while (! (*lang_hooks.decls.global_bindings_p) ())
-    poplevel (0, 0, 0);
+  while (! lang_hooks.decls.global_bindings_p ())
+    lang_hooks.decls.poplevel (0, 0, 0);
 }
 
 /* Type promotion for variable arguments.  */
@@ -207,6 +227,13 @@ lhd_type_promotes_to (tree type ATTRIBUTE_UNUSED)
   abort ();
 }
 
+/* Registration of machine- or os-specific builtin types.  */
+void
+lhd_register_builtin_type (tree type ATTRIBUTE_UNUSED, 
+                          const char* name ATTRIBUTE_UNUSED)
+{
+}
+
 /* Invalid use of an incomplete type.  */
 void
 lhd_incomplete_type_error (tree value ATTRIBUTE_UNUSED, tree type)
@@ -240,11 +267,24 @@ hook_get_alias_set_0 (tree t ATTRIBUTE_UNUSED)
 rtx
 lhd_expand_expr (tree t ATTRIBUTE_UNUSED, rtx r ATTRIBUTE_UNUSED,
                 enum machine_mode mm ATTRIBUTE_UNUSED,
-                int em ATTRIBUTE_UNUSED)
+                int em ATTRIBUTE_UNUSED,
+                rtx *a ATTRIBUTE_UNUSED)
 {
   abort ();
 }
 
+/* The default language-specific function for expanding a decl.  After
+   the language-independent cases are handled, this function will be
+   called.  If this function is not defined, it is assumed that
+   declarations other than those for variables and labels do not require
+   any RTL generation.  */
+
+int
+lhd_expand_decl (tree t ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
 /* This is the default decl_printable_name function.  */
 
 const char *
@@ -253,6 +293,16 @@ lhd_decl_printable_name (tree decl, int verbosity ATTRIBUTE_UNUSED)
   return IDENTIFIER_POINTER (DECL_NAME (decl));
 }
 
+/* This compares two types for equivalence ("compatible" in C-based languages).
+   This routine should only return 1 if it is sure.  It should not be used
+   in contexts where erroneously returning 0 causes problems.  */
+
+int
+lhd_types_compatible_p (tree x, tree y)
+{
+  return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
+}
+
 /* lang_hooks.tree_inlining.walk_subtrees is called by walk_tree()
    after handling common cases, but before walking code-specific
    sub-trees.  If this hook is overridden for a language, it should
@@ -314,16 +364,6 @@ lhd_tree_inlining_add_pending_fn_decls (void *vafnp ATTRIBUTE_UNUSED, tree pfn)
   return pfn;
 }
 
-/* lang_hooks.tree_inlining.tree_chain_matters_p indicates whether the
-   TREE_CHAIN of a language-specific tree node is relevant, i.e.,
-   whether it should be walked, copied and preserved across copies.  */
-
-int
-lhd_tree_inlining_tree_chain_matters_p (tree t ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
 /* lang_hooks.tree_inlining.auto_var_in_fn_p is called to determine
    whether VT is an automatic variable defined in function FT.  */
 
@@ -394,7 +434,8 @@ lhd_tree_inlining_end_inlining (tree fn ATTRIBUTE_UNUSED)
 tree
 lhd_tree_inlining_convert_parm_for_inlining (tree parm ATTRIBUTE_UNUSED,
                                             tree value,
-                                            tree fndecl ATTRIBUTE_UNUSED)
+                                            tree fndecl ATTRIBUTE_UNUSED,
+                                            int argnum ATTRIBUTE_UNUSED)
 {
   return value;
 }
@@ -431,6 +472,15 @@ lhd_expr_size (tree exp)
     return size_in_bytes (TREE_TYPE (exp));
 }
 
+/* lang_hooks.gimplify_expr re-writes *EXPR_P into GIMPLE form.  */
+
+int
+lhd_gimplify_expr (tree *expr_p ATTRIBUTE_UNUSED, tree *pre_p ATTRIBUTE_UNUSED,
+                  tree *post_p ATTRIBUTE_UNUSED)
+{
+  return GS_UNHANDLED;
+}
+
 /* lang_hooks.tree_size: Determine the size of a tree with code C,
    which is a language-specific tree code in category 'x'.  The
    default expects never to be called.  */
@@ -459,7 +509,7 @@ write_global_declarations (void)
      Really output inline functions that must actually be callable
      and have not been output so far.  */
 
-  tree globals = (*lang_hooks.decls.getdecls) ();
+  tree globals = lang_hooks.decls.getdecls ();
   int len = list_length (globals);
   tree *vec = xmalloc (sizeof (tree) * len);
   int i;
@@ -479,4 +529,57 @@ write_global_declarations (void)
   free (vec);
 }
 
+/* Called to perform language-specific initialization of CTX.  */
+void
+lhd_initialize_diagnostics (struct diagnostic_context *ctx ATTRIBUTE_UNUSED)
+{
+}
+
+/* The default function to print out name of current function that caused
+   an error.  */
+void
+lhd_print_error_function (diagnostic_context *context, const char *file)
+{
+  if (diagnostic_last_function_changed (context))
+    {
+      const char *old_prefix = context->printer->prefix;
+      char *new_prefix = file ? file_name_as_prefix (file) : NULL;
+
+      pp_set_prefix (context->printer, new_prefix);
+
+      if (current_function_decl == NULL)
+       pp_printf (context->printer, "At top level:");
+      else
+       {
+         if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
+           pp_printf
+             (context->printer, "In member function `%s':",
+              lang_hooks.decl_printable_name (current_function_decl, 2));
+         else
+           pp_printf
+             (context->printer, "In function `%s':",
+              lang_hooks.decl_printable_name (current_function_decl, 2));
+       }
+
+      diagnostic_set_last_function (context);
+      pp_flush (context->printer);
+      context->printer->prefix = old_prefix;
+      free ((char*) new_prefix);
+    }
+}
+
+tree
+lhd_callgraph_analyze_expr (tree *tp ATTRIBUTE_UNUSED,
+                           int *walk_subtrees ATTRIBUTE_UNUSED,
+                           tree decl ATTRIBUTE_UNUSED)
+{
+  return NULL;
+}
+
+tree
+lhd_make_node (enum tree_code code)
+{
+  return make_node (code);
+}
+
 #include "gt-langhooks.h"