2001-11-06 22:12:14 +01:00
|
|
|
/* The lang_hooks data structure.
|
Makefile.in (fold-const.o, [...]): Update.
* Makefile.in (fold-const.o, stor-layout.o, stmt.o,
sdbout.o, profile.o): Update.
* c-common.c (c_common_nodes_and_builtins): Use pushdecl
langhook.
* c-common.h (gettags): Move here from tree.h.
* c-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
* dbxout.c (dbxout_init): Use getdecls langhook.
* expr.c (expand_expr): Use insert_block langhook.
* fold-const.c: Include langhooks.h.
(fold_range_test, fold_binary_op_with_conditional_arg,
fold): Use global_bindings_p langhook.
* integrate.c (expand_inline_function): Use insert_block langhook.
* langhooks-def.h (LANG_HOOKS_DECLS, LANG_HOOKS_PUSHLEVEL,
LANG_HOOKS_POPLEVEL, LANG_HOOKS_GLOBAL_BINDINGS_P,
LANG_HOOKS_INSERT_BLOCK, LANG_HOOKS_SET_BLOCK, LANG_HOOKS_PUSHDECL,
LANG_HOOKS_GETDECLS): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
langhook.
* langhooks.h (struct lang_hooks_for_decls): New.
(struct lang_hooks): Update.
* profile.c: Include langhooks.h.
(output_func_start_profiler): Use new langhooks.
* sdbout.c: Include langhooks.h.
(sdbout_init, sdbout_finish): Use getdecls langhook.
* stmt.c: Include langhooks.h.
(expand_fixup, fixup_gotos): Use new langhooks.
* stor-layout.c: Include langhooks.h.
(variable_size): Use global_bindings_p langhook.
* toplev.c (compile_file): Use getdecls langhook.
* tree-inline.c (remap_block): Use insert_block langhook.
* tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
cp:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
java:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
f:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
From-SVN: r51136
2002-03-21 19:39:29 +01:00
|
|
|
Copyright 2001, 2002 Free Software Foundation, Inc.
|
2001-10-08 22:54:07 +02:00
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
#ifndef GCC_LANG_HOOKS_H
|
|
|
|
#define GCC_LANG_HOOKS_H
|
|
|
|
|
Makefile.in: Update.
* Makefile.in: Update.
* c-decl.c (print_lang_decl, print_lang_type): Remove.
(print_lang_identifier): Rename c_print_identifier.
* c-lang.c (LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New.
(print_lang_statistics, lang_print_xnode): Remove.
* c-parse.in (set_yydebug): Rename c_set_yydebug.
* c-tree.h (c_set_yydebug, c_print_identifier): New.
* langhooks-def.h (lhd_print_tree_nothing, lhd_set_yydebug): New.
LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): New members.
(lang_print_tree_hook): New.
* langhooks.c (lhd_print_tree_nothing, lhd_set_yydebug): New.
* print-tree.c: Include langhooks.h.
(print_node): Update.
* toplev.c (decode_d_option): Update.
* tree.c: Include langhooks.h.
(dump_tree_statistics): Update.
* tree.h (print_lang_statistics, print_lang_decl, print_lang_type,
print_lang_identifier, set_yydebug, lang_print_xnode): Remove.
ada:
* misc.c (gnat_print_decl, gnat_print_type): Renamed.
(LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE): Override.
(print_lang_statistics, lang_print_xnode, print_lang_identifier,
set_yydebug): Remove.
cp:
* cp-lang.c (LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): Override.
* cp-tree.h (print_class_statistics): Remove.
(cxx_print_statistics, cxx_print_xnode, cxx_print_decl, cxx_print_type,
cxx_print_identifier, cxx_set_yydebug): New.
* lex.c (set_yydebug): Rename c_set_yydebug.
* ptree.c (print_lang_decl, print_lang_type, print_lang_identifier,
lang_print_xnode): Rename.
* tree.c (print_lang_statistics): Rename.
f:
* com.c (ffe_print_identifier): Rename.
(LANG_HOOKS_PRINT_IDENTIFIER): Override.
(lang_print_xnode, print_lang_decl, print_lang_statistics,
print_lang_type, set_yydebug): Remove.
java:
* java-tree.h (java_set_yydebug): New.
* jcf-parse.c (set_yydebug): Rename java_set_yydebug.
* lang.c (LANG_HOOKS_SET_YYDEBUG): Override.
(print_lang_decl, print_lang_type, print_lang_identifier,
print_lang_statistics, lang_print_xnode): Remove.
objc:
* objc-act.c (LANG_HOOKS_PRINT_IDENTIFIER,
LANG_HOOKS_SET_YYDEBUG): Override.
(lang_print_xnode, print_lang_statistics): Remove.
From-SVN: r46907
2001-11-10 00:30:44 +01:00
|
|
|
/* A print hook for print_tree (). */
|
|
|
|
typedef void (*lang_print_tree_hook) PARAMS ((FILE *, tree, int indent));
|
|
|
|
|
2001-11-06 22:12:14 +01:00
|
|
|
/* The following hooks are documented in langhooks.c. Must not be
|
|
|
|
NULL. */
|
|
|
|
|
|
|
|
struct lang_hooks_for_tree_inlining
|
|
|
|
{
|
|
|
|
union tree_node *(*walk_subtrees) PARAMS ((union tree_node **, int *,
|
|
|
|
union tree_node *(*)
|
|
|
|
(union tree_node **,
|
|
|
|
int *, void *),
|
|
|
|
void *, void *));
|
|
|
|
int (*cannot_inline_tree_fn) PARAMS ((union tree_node **));
|
|
|
|
int (*disregard_inline_limits) PARAMS ((union tree_node *));
|
|
|
|
union tree_node *(*add_pending_fn_decls) PARAMS ((void *,
|
|
|
|
union tree_node *));
|
|
|
|
int (*tree_chain_matters_p) PARAMS ((union tree_node *));
|
|
|
|
int (*auto_var_in_fn_p) PARAMS ((union tree_node *, union tree_node *));
|
|
|
|
union tree_node *(*copy_res_decl_for_inlining) PARAMS ((union tree_node *,
|
|
|
|
union tree_node *,
|
|
|
|
union tree_node *,
|
|
|
|
void *, int *,
|
|
|
|
void *));
|
|
|
|
int (*anon_aggr_type_p) PARAMS ((union tree_node *));
|
2001-12-06 00:48:19 +01:00
|
|
|
int (*start_inlining) PARAMS ((union tree_node *));
|
|
|
|
void (*end_inlining) PARAMS ((union tree_node *));
|
2002-03-19 09:47:14 +01:00
|
|
|
union tree_node *(*convert_parm_for_inlining) PARAMS ((union tree_node *,
|
|
|
|
union tree_node *,
|
|
|
|
union tree_node *));
|
2001-11-06 22:12:14 +01:00
|
|
|
};
|
|
|
|
|
tree-dump.c: Rename from c-dump.c.
* tree-dump.c: Rename from c-dump.c. Include c-tree.h, not c-common.h.
(lang_type_quals): Declare.
(dequeue_and_dump): Use lang_hooks.tree_dump.type_quals function to
retrieve language-specific qualifiers for a type node, instead of
C_TYPE_QUALS. Likewise for lang_hooks.tree_dump.dump_tree instead of
lang_dump_tree.
* tree-dump.h: Rename from c-dump.h.
* c-common.h (C_TYPE_QUALS): Removed.
Move declarations for tree-dump.c interface to...
* tree.h: ... here. Remove lang_dump_tree.
* langhooks.h (struct lang_hooks_for_tree_dump): New.
(struct lang_hooks): Add tree_dump hooks.
* langhooks.c (lhd_tree_dump_dump_tree): New function.
(lhd_tree_dump_type_quals): New function.
* langhooks-def.h (lhd_tree_dump_dump_tree, lhd_tree_dump_type_quals):
Declare.
(LANG_HOOKS_INITIALIZER): Add tree_dump hooks.
* Makefile.in: Move tree-dump.o to language-independent back-end.
cp:
* cp-tree.h (CP_TYPE_QUALS): Removed.
* decl.c (cxx_init_decl_processing): Don't set lang_dump_tree.
* cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and
LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN.
* dump.c (cp_dump_tree): Use void* dump_info argument to match
lang-hooks prototype.
* call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c,
rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to
CP_TYPE_QUALS changed to cp_type_quals.
* Make-lang.in: References to c-dump.h changed to tree-dump.h.
(CXX_C_OBJS): Remove c-dump.o.
From-SVN: r47257
2001-11-22 03:33:02 +01:00
|
|
|
/* The following hooks are used by tree-dump.c. */
|
|
|
|
|
|
|
|
struct lang_hooks_for_tree_dump
|
|
|
|
{
|
|
|
|
/* Dump language-specific parts of tree nodes. Returns non-zero if it
|
|
|
|
does not want the usual dumping of the second argument. */
|
|
|
|
int (*dump_tree) PARAMS ((void *, tree));
|
|
|
|
|
|
|
|
/* Determine type qualifiers in a language-specific way. */
|
|
|
|
int (*type_quals) PARAMS ((tree));
|
|
|
|
};
|
|
|
|
|
Makefile.in (fold-const.o, [...]): Update.
* Makefile.in (fold-const.o, stor-layout.o, stmt.o,
sdbout.o, profile.o): Update.
* c-common.c (c_common_nodes_and_builtins): Use pushdecl
langhook.
* c-common.h (gettags): Move here from tree.h.
* c-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
* dbxout.c (dbxout_init): Use getdecls langhook.
* expr.c (expand_expr): Use insert_block langhook.
* fold-const.c: Include langhooks.h.
(fold_range_test, fold_binary_op_with_conditional_arg,
fold): Use global_bindings_p langhook.
* integrate.c (expand_inline_function): Use insert_block langhook.
* langhooks-def.h (LANG_HOOKS_DECLS, LANG_HOOKS_PUSHLEVEL,
LANG_HOOKS_POPLEVEL, LANG_HOOKS_GLOBAL_BINDINGS_P,
LANG_HOOKS_INSERT_BLOCK, LANG_HOOKS_SET_BLOCK, LANG_HOOKS_PUSHDECL,
LANG_HOOKS_GETDECLS): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
langhook.
* langhooks.h (struct lang_hooks_for_decls): New.
(struct lang_hooks): Update.
* profile.c: Include langhooks.h.
(output_func_start_profiler): Use new langhooks.
* sdbout.c: Include langhooks.h.
(sdbout_init, sdbout_finish): Use getdecls langhook.
* stmt.c: Include langhooks.h.
(expand_fixup, fixup_gotos): Use new langhooks.
* stor-layout.c: Include langhooks.h.
(variable_size): Use global_bindings_p langhook.
* toplev.c (compile_file): Use getdecls langhook.
* tree-inline.c (remap_block): Use insert_block langhook.
* tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
cp:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
java:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
f:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
From-SVN: r51136
2002-03-21 19:39:29 +01:00
|
|
|
/* Language hooks related to decls and the symbol table. */
|
|
|
|
|
|
|
|
struct lang_hooks_for_decls
|
|
|
|
{
|
|
|
|
/* Enter a new lexical scope. Argument is always zero when called
|
|
|
|
from outside the front end. */
|
|
|
|
void (*pushlevel) PARAMS ((int));
|
|
|
|
|
|
|
|
/* Exit a lexical scope and return a BINDING for that scope.
|
|
|
|
Takes three arguments:
|
|
|
|
KEEP -- nonzero if there were declarations in this scope.
|
|
|
|
REVERSE -- reverse the order of decls before returning them.
|
|
|
|
FUNCTIONBODY -- nonzero if this level is the body of a function. */
|
|
|
|
tree (*poplevel) PARAMS ((int, int, int));
|
|
|
|
|
|
|
|
/* Returns non-zero if we are in the global binding level. Ada
|
|
|
|
returns -1 for an undocumented reason used in stor-layout.c. */
|
|
|
|
int (*global_bindings_p) PARAMS ((void));
|
|
|
|
|
|
|
|
/* Insert BLOCK at the end of the list of subblocks of the
|
|
|
|
current binding level. This is used when a BIND_EXPR is expanded,
|
|
|
|
to handle the BLOCK node inside the BIND_EXPR. */
|
|
|
|
void (*insert_block) PARAMS ((tree));
|
|
|
|
|
|
|
|
/* Set the BLOCK node for the current scope level. */
|
|
|
|
void (*set_block) PARAMS ((tree));
|
|
|
|
|
|
|
|
/* Function to add a decl to the current scope level. Takes one
|
|
|
|
argument, a decl to add. Returns that decl, or, if the same
|
|
|
|
symbol is already declared, may return a different decl for that
|
|
|
|
name. */
|
|
|
|
tree (*pushdecl) PARAMS ((tree));
|
|
|
|
|
|
|
|
/* Returns the chain of decls so far in the current scope level. */
|
|
|
|
tree (*getdecls) PARAMS ((void));
|
|
|
|
};
|
|
|
|
|
2001-11-06 22:12:14 +01:00
|
|
|
/* Language-specific hooks. See langhooks-def.h for defaults. */
|
|
|
|
|
|
|
|
struct lang_hooks
|
|
|
|
{
|
2001-11-09 08:14:20 +01:00
|
|
|
/* String identifying the front end. e.g. "GNU C++". */
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/* sizeof (struct lang_identifier), so make_node () creates
|
|
|
|
identifier nodes long enough for the language-specific slots. */
|
|
|
|
size_t identifier_size;
|
|
|
|
|
cppfiles.c (stack_include_file): Don't optimize zero-length files.
* cppfiles.c (stack_include_file): Don't optimize zero-length
files.
(read_include_file): NUL-terminate read files.
* cpplex.c (handle_newline, skip_escaped_newlines,
get_effective_char, skip_whitespace, parse_identifier,
parse_identifier_slow, parse_number, parse_string,
_cpp_lex_direct): Optimize for the fact that buffers are guaranteed
NUL-terminated.
* cpplib.c (destringize_and_run, cpp_define, handle_assertion):
Be sure buffers are NUL terminated.
* cppmacro.c (warn_of_redefinition): Kill compile warning.
* c-common.c: Include tree-inline.h.
(c_language): Move separate definitions here.
(c_common_init_options, c_common_post_options): New.
(c_common_lang_init): Rename c_common_init.
* c-common.h (c_common_lang_init): Similarly.
(c_common_init_options, c_common_post_options): New.
* c-lang.c (c_post_options): Move body to c_common_post_options.
(c_init_options): Use c_common_init_options.
(c_init): Update.
* langhooks.def: Rearrange.
* langhooks.h: Rearrange, and improve comments.
* toplev.c (do_compile): New function.
(toplev_main): Use it.
(lang_independent_f_options, parse_options_and_default_flags,
process_options): Remove trailing periods.
* Makefile.in: Update.
cp: * decl2.c (c_language): Move to c-common.c.
* lex.c (cxx_post_options, cxx_init_options): Use c-common.c
functions.
(cxx_init): Update.
objc: * objc-act.c (objc_post_options, objc_init_options): Use c-common.c
functions.
(ojbc_init): Update.
From-SVN: r47362
2001-11-27 00:44:54 +01:00
|
|
|
/* The first callback made to the front end, for simple
|
|
|
|
initialization needed before any calls to decode_option. */
|
2001-11-06 22:12:14 +01:00
|
|
|
void (*init_options) PARAMS ((void));
|
|
|
|
|
|
|
|
/* Function called with an option vector as argument, to decode a
|
|
|
|
single option (typically starting with -f or -W or +). It should
|
|
|
|
return the number of command-line arguments it uses if it handles
|
|
|
|
the option, or 0 and not complain if it does not recognise the
|
|
|
|
option. If this function returns a negative number, then its
|
|
|
|
absolute value is the number of command-line arguments used, but,
|
|
|
|
in addition, no language-independent option processing should be
|
|
|
|
done for this option. */
|
|
|
|
int (*decode_option) PARAMS ((int, char **));
|
|
|
|
|
cppfiles.c (stack_include_file): Don't optimize zero-length files.
* cppfiles.c (stack_include_file): Don't optimize zero-length
files.
(read_include_file): NUL-terminate read files.
* cpplex.c (handle_newline, skip_escaped_newlines,
get_effective_char, skip_whitespace, parse_identifier,
parse_identifier_slow, parse_number, parse_string,
_cpp_lex_direct): Optimize for the fact that buffers are guaranteed
NUL-terminated.
* cpplib.c (destringize_and_run, cpp_define, handle_assertion):
Be sure buffers are NUL terminated.
* cppmacro.c (warn_of_redefinition): Kill compile warning.
* c-common.c: Include tree-inline.h.
(c_language): Move separate definitions here.
(c_common_init_options, c_common_post_options): New.
(c_common_lang_init): Rename c_common_init.
* c-common.h (c_common_lang_init): Similarly.
(c_common_init_options, c_common_post_options): New.
* c-lang.c (c_post_options): Move body to c_common_post_options.
(c_init_options): Use c_common_init_options.
(c_init): Update.
* langhooks.def: Rearrange.
* langhooks.h: Rearrange, and improve comments.
* toplev.c (do_compile): New function.
(toplev_main): Use it.
(lang_independent_f_options, parse_options_and_default_flags,
process_options): Remove trailing periods.
* Makefile.in: Update.
cp: * decl2.c (c_language): Move to c-common.c.
* lex.c (cxx_post_options, cxx_init_options): Use c-common.c
functions.
(cxx_init): Update.
objc: * objc-act.c (objc_post_options, objc_init_options): Use c-common.c
functions.
(ojbc_init): Update.
From-SVN: r47362
2001-11-27 00:44:54 +01:00
|
|
|
/* Called when all command line options have been parsed. Should do
|
|
|
|
any required consistency checks, modifications etc. Complex
|
|
|
|
initialization should be left to the "init" callback, since GC
|
|
|
|
and the identifier hashes are set up between now and then. */
|
2001-11-06 22:12:14 +01:00
|
|
|
void (*post_options) PARAMS ((void));
|
|
|
|
|
cppfiles.c (stack_include_file): Don't optimize zero-length files.
* cppfiles.c (stack_include_file): Don't optimize zero-length
files.
(read_include_file): NUL-terminate read files.
* cpplex.c (handle_newline, skip_escaped_newlines,
get_effective_char, skip_whitespace, parse_identifier,
parse_identifier_slow, parse_number, parse_string,
_cpp_lex_direct): Optimize for the fact that buffers are guaranteed
NUL-terminated.
* cpplib.c (destringize_and_run, cpp_define, handle_assertion):
Be sure buffers are NUL terminated.
* cppmacro.c (warn_of_redefinition): Kill compile warning.
* c-common.c: Include tree-inline.h.
(c_language): Move separate definitions here.
(c_common_init_options, c_common_post_options): New.
(c_common_lang_init): Rename c_common_init.
* c-common.h (c_common_lang_init): Similarly.
(c_common_init_options, c_common_post_options): New.
* c-lang.c (c_post_options): Move body to c_common_post_options.
(c_init_options): Use c_common_init_options.
(c_init): Update.
* langhooks.def: Rearrange.
* langhooks.h: Rearrange, and improve comments.
* toplev.c (do_compile): New function.
(toplev_main): Use it.
(lang_independent_f_options, parse_options_and_default_flags,
process_options): Remove trailing periods.
* Makefile.in: Update.
cp: * decl2.c (c_language): Move to c-common.c.
* lex.c (cxx_post_options, cxx_init_options): Use c-common.c
functions.
(cxx_init): Update.
objc: * objc-act.c (objc_post_options, objc_init_options): Use c-common.c
functions.
(ojbc_init): Update.
From-SVN: r47362
2001-11-27 00:44:54 +01:00
|
|
|
/* Called after post_options, to initialize the front end. The main
|
|
|
|
input filename is passed, which may be NULL; the front end should
|
|
|
|
return the original filename (e.g. foo.i -> foo.c). Return NULL
|
|
|
|
to indicate a serious error of some sort; in that case no
|
|
|
|
compilation is performed, and the finish hook is called
|
|
|
|
immediately. */
|
|
|
|
const char * (*init) PARAMS ((const char *));
|
|
|
|
|
|
|
|
/* Called at the end of compilation, as a finalizer. */
|
|
|
|
void (*finish) PARAMS ((void));
|
|
|
|
|
2002-03-17 21:41:46 +01:00
|
|
|
/* Parses the entire file. */
|
|
|
|
void (*parse_file) PARAMS ((void));
|
|
|
|
|
cppfiles.c (stack_include_file): Don't optimize zero-length files.
* cppfiles.c (stack_include_file): Don't optimize zero-length
files.
(read_include_file): NUL-terminate read files.
* cpplex.c (handle_newline, skip_escaped_newlines,
get_effective_char, skip_whitespace, parse_identifier,
parse_identifier_slow, parse_number, parse_string,
_cpp_lex_direct): Optimize for the fact that buffers are guaranteed
NUL-terminated.
* cpplib.c (destringize_and_run, cpp_define, handle_assertion):
Be sure buffers are NUL terminated.
* cppmacro.c (warn_of_redefinition): Kill compile warning.
* c-common.c: Include tree-inline.h.
(c_language): Move separate definitions here.
(c_common_init_options, c_common_post_options): New.
(c_common_lang_init): Rename c_common_init.
* c-common.h (c_common_lang_init): Similarly.
(c_common_init_options, c_common_post_options): New.
* c-lang.c (c_post_options): Move body to c_common_post_options.
(c_init_options): Use c_common_init_options.
(c_init): Update.
* langhooks.def: Rearrange.
* langhooks.h: Rearrange, and improve comments.
* toplev.c (do_compile): New function.
(toplev_main): Use it.
(lang_independent_f_options, parse_options_and_default_flags,
process_options): Remove trailing periods.
* Makefile.in: Update.
cp: * decl2.c (c_language): Move to c-common.c.
* lex.c (cxx_post_options, cxx_init_options): Use c-common.c
functions.
(cxx_init): Update.
objc: * objc-act.c (objc_post_options, objc_init_options): Use c-common.c
functions.
(ojbc_init): Update.
From-SVN: r47362
2001-11-27 00:44:54 +01:00
|
|
|
/* Called immediately after parsing to clear the binding stack. */
|
|
|
|
void (*clear_binding_stack) PARAMS ((void));
|
|
|
|
|
2001-11-06 22:12:14 +01:00
|
|
|
/* Called to obtain the alias set to be used for an expression or type.
|
|
|
|
Returns -1 if the language does nothing special for it. */
|
|
|
|
HOST_WIDE_INT (*get_alias_set) PARAMS ((tree));
|
|
|
|
|
Makefile.in (c-lang.o): Depends on langhooks-def.h.
* Makefile.in (c-lang.o): Depends on langhooks-def.h.
(expr.o, varasm.o): Depends on langhooks.h.
* c-common.c (c_safe_from_p): Always declare.
(c_expand_expr): Refine when declared.
* c-lang.c (c-common.h): Now include.
(LANG_HOOKS_SAFE_FROM_P): Define new hook.
(c_init): Don't set lang_safe_from_expr.
* expr.c (langhooks.h): Now include.
(lang_safe_from_p): No longer define.
(safe_from_p): Use lang hook.
(expand_expr): Set IGNORE if VOID_TYPE result of VIEW_CONVERT_EXPR too.
(expand_expr, case VIEW_CONVERT_EXPR): Pass ro_modifier down.
* expr.h (lang_expand_constant, lang_safe_from_p): Delete.
* langhooks-def.h (lhd_return_tree, lhd_safe_from_p): New decls.
(LANG_HOOKS_EXPAND_CONSTANT, LANG_HOOKS_SAFE_FROM_P): New hooks.
* langhooks.c (lhd_return_tree, lhd_safe_from_p): New functions.
* langhooks.h (struct lang_hooks): New fields expand_constant
and safe_from_p.
* output.h (output_constant): Size arg is HOST_WIDE_INT.
* stmt.c (expand_decl_init): No longer need to expand constant
for CONST_DECL.
* stor-layout.c (put_pending_size): Don't check for SAVE_EXPR.
* toplev.c (lang_expand_constant): Delete var.
* tree.c (save_expr): Don't put another SAVE_EXPR around simple
operations on SAVE_EXPR.
* varasm.c (langhooks.h): Now include.
(compare_constant_1): Use lang_hooks, not lang_expand_constant.
(record_constant_1, output_addressed_constants): Likewise.
(initializer_constant_valid_p, output_constant): Likewise.
(output_constant_def): Process no-defer of string constant.
(output_addressed_constants, case ADDR_EXPR): Use handled_component_p.
(output_constant): Strip more conversions.
Track our size and pad for the rest.
(array_size_for_constructor): Remove code for non-byte STRING_CST.
(output_constructor): SIZE now HOST_WIDE_INT.
* cp/Make-lang.in (cp-lang.o): Depends on c-common.h.
* cp/cp-lang.c (c-common.h): Include.
(LANG_HOOKS_EXPAND_CONSTANT, LANG_HOOKS_SAFE_FROM_P): New hooks.
* cp/decl.c (cxx_init_decl_processing): Don't set lang_safe_from_p.
* cp/expr.c (init_cplus_expand): Don't set lang_expand_constant.
From-SVN: r47376
2001-11-27 15:31:29 +01:00
|
|
|
/* Called with an expression that is to be processed as a constant.
|
|
|
|
Returns either the same expression or a language-independent
|
|
|
|
constant equivalent to its input. */
|
|
|
|
tree (*expand_constant) PARAMS ((tree));
|
|
|
|
|
|
|
|
/* Hook called by safe_from_p for language-specific tree codes. It is
|
|
|
|
up to the language front-end to install a hook if it has any such
|
|
|
|
codes that safe_from_p needs to know about. Since same_from_p will
|
|
|
|
recursively explore the TREE_OPERANDs of an expression, this hook
|
|
|
|
should not reexamine those pieces. This routine may recursively
|
|
|
|
call safe_from_p; it should always pass `0' as the TOP_P
|
|
|
|
parameter. */
|
|
|
|
int (*safe_from_p) PARAMS ((rtx, tree));
|
|
|
|
|
2001-12-04 23:49:20 +01:00
|
|
|
/* Hook called by staticp for language-specific tree codes. */
|
|
|
|
int (*staticp) PARAMS ((tree));
|
|
|
|
|
2002-02-28 08:39:44 +01:00
|
|
|
/* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the
|
|
|
|
DECL_NODE with a newly GC-allocated copy. */
|
|
|
|
void (*dup_lang_specific_decl) PARAMS ((tree));
|
|
|
|
|
2002-03-08 20:21:04 +01:00
|
|
|
/* Called before its argument, an UNSAVE_EXPR, is to be
|
|
|
|
unsaved. Modify it in-place so that all the evaluate only once
|
|
|
|
things are cleared out. */
|
|
|
|
tree (*unsave_expr_now) PARAMS ((tree));
|
|
|
|
|
2002-03-25 20:11:13 +01:00
|
|
|
/* Called by expand_expr to build and return the cleanup-expression
|
|
|
|
for the passed TARGET_EXPR. Return NULL if there is none. */
|
|
|
|
tree (*maybe_build_cleanup) PARAMS ((tree));
|
|
|
|
|
2002-03-26 08:16:01 +01:00
|
|
|
/* Mark nodes held through the lang_specific hooks in the tree. */
|
|
|
|
void (*mark_tree) PARAMS ((tree));
|
|
|
|
|
2001-11-06 22:12:14 +01:00
|
|
|
/* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */
|
|
|
|
bool honor_readonly;
|
|
|
|
|
Makefile.in: Update.
* Makefile.in: Update.
* c-decl.c (print_lang_decl, print_lang_type): Remove.
(print_lang_identifier): Rename c_print_identifier.
* c-lang.c (LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New.
(print_lang_statistics, lang_print_xnode): Remove.
* c-parse.in (set_yydebug): Rename c_set_yydebug.
* c-tree.h (c_set_yydebug, c_print_identifier): New.
* langhooks-def.h (lhd_print_tree_nothing, lhd_set_yydebug): New.
LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): New members.
(lang_print_tree_hook): New.
* langhooks.c (lhd_print_tree_nothing, lhd_set_yydebug): New.
* print-tree.c: Include langhooks.h.
(print_node): Update.
* toplev.c (decode_d_option): Update.
* tree.c: Include langhooks.h.
(dump_tree_statistics): Update.
* tree.h (print_lang_statistics, print_lang_decl, print_lang_type,
print_lang_identifier, set_yydebug, lang_print_xnode): Remove.
ada:
* misc.c (gnat_print_decl, gnat_print_type): Renamed.
(LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE): Override.
(print_lang_statistics, lang_print_xnode, print_lang_identifier,
set_yydebug): Remove.
cp:
* cp-lang.c (LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): Override.
* cp-tree.h (print_class_statistics): Remove.
(cxx_print_statistics, cxx_print_xnode, cxx_print_decl, cxx_print_type,
cxx_print_identifier, cxx_set_yydebug): New.
* lex.c (set_yydebug): Rename c_set_yydebug.
* ptree.c (print_lang_decl, print_lang_type, print_lang_identifier,
lang_print_xnode): Rename.
* tree.c (print_lang_statistics): Rename.
f:
* com.c (ffe_print_identifier): Rename.
(LANG_HOOKS_PRINT_IDENTIFIER): Override.
(lang_print_xnode, print_lang_decl, print_lang_statistics,
print_lang_type, set_yydebug): Remove.
java:
* java-tree.h (java_set_yydebug): New.
* jcf-parse.c (set_yydebug): Rename java_set_yydebug.
* lang.c (LANG_HOOKS_SET_YYDEBUG): Override.
(print_lang_decl, print_lang_type, print_lang_identifier,
print_lang_statistics, lang_print_xnode): Remove.
objc:
* objc-act.c (LANG_HOOKS_PRINT_IDENTIFIER,
LANG_HOOKS_SET_YYDEBUG): Override.
(lang_print_xnode, print_lang_statistics): Remove.
From-SVN: r46907
2001-11-10 00:30:44 +01:00
|
|
|
/* The front end can add its own statistics to -fmem-report with
|
|
|
|
this hook. It should output to stderr. */
|
|
|
|
void (*print_statistics) PARAMS ((void));
|
|
|
|
|
|
|
|
/* Called by print_tree when there is a tree of class 'x' that it
|
|
|
|
doesn't know how to display. */
|
|
|
|
lang_print_tree_hook print_xnode;
|
|
|
|
|
|
|
|
/* Called to print language-dependent parts of a class 'd', class
|
|
|
|
't', and IDENTIFIER_NODE nodes. */
|
|
|
|
lang_print_tree_hook print_decl;
|
|
|
|
lang_print_tree_hook print_type;
|
|
|
|
lang_print_tree_hook print_identifier;
|
|
|
|
|
2002-03-20 08:58:41 +01:00
|
|
|
/* Computes the name to use to print a declaration. DECL is the
|
|
|
|
non-NULL declaration in question. VERBOSITY determines what
|
|
|
|
information will be printed: 0: DECL_NAME, demangled as
|
|
|
|
necessary. 1: and scope information. 2: and any other
|
|
|
|
information that might be interesting, such as function parameter
|
|
|
|
types in C++. */
|
|
|
|
const char *(*decl_printable_name) PARAMS ((tree decl, int verbosity));
|
|
|
|
|
Makefile.in: Update.
* Makefile.in: Update.
* c-decl.c (print_lang_decl, print_lang_type): Remove.
(print_lang_identifier): Rename c_print_identifier.
* c-lang.c (LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New.
(print_lang_statistics, lang_print_xnode): Remove.
* c-parse.in (set_yydebug): Rename c_set_yydebug.
* c-tree.h (c_set_yydebug, c_print_identifier): New.
* langhooks-def.h (lhd_print_tree_nothing, lhd_set_yydebug): New.
LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): New members.
(lang_print_tree_hook): New.
* langhooks.c (lhd_print_tree_nothing, lhd_set_yydebug): New.
* print-tree.c: Include langhooks.h.
(print_node): Update.
* toplev.c (decode_d_option): Update.
* tree.c: Include langhooks.h.
(dump_tree_statistics): Update.
* tree.h (print_lang_statistics, print_lang_decl, print_lang_type,
print_lang_identifier, set_yydebug, lang_print_xnode): Remove.
ada:
* misc.c (gnat_print_decl, gnat_print_type): Renamed.
(LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE): Override.
(print_lang_statistics, lang_print_xnode, print_lang_identifier,
set_yydebug): Remove.
cp:
* cp-lang.c (LANG_HOOKS_PRINT_DECL, LANG_HOOKS_PRINT_TYPE,
LANG_HOOKS_PRINT_STATISTICS, LANG_HOOKS_PRINT_XNODE,
LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_SET_YYDEBUG): Override.
* cp-tree.h (print_class_statistics): Remove.
(cxx_print_statistics, cxx_print_xnode, cxx_print_decl, cxx_print_type,
cxx_print_identifier, cxx_set_yydebug): New.
* lex.c (set_yydebug): Rename c_set_yydebug.
* ptree.c (print_lang_decl, print_lang_type, print_lang_identifier,
lang_print_xnode): Rename.
* tree.c (print_lang_statistics): Rename.
f:
* com.c (ffe_print_identifier): Rename.
(LANG_HOOKS_PRINT_IDENTIFIER): Override.
(lang_print_xnode, print_lang_decl, print_lang_statistics,
print_lang_type, set_yydebug): Remove.
java:
* java-tree.h (java_set_yydebug): New.
* jcf-parse.c (set_yydebug): Rename java_set_yydebug.
* lang.c (LANG_HOOKS_SET_YYDEBUG): Override.
(print_lang_decl, print_lang_type, print_lang_identifier,
print_lang_statistics, lang_print_xnode): Remove.
objc:
* objc-act.c (LANG_HOOKS_PRINT_IDENTIFIER,
LANG_HOOKS_SET_YYDEBUG): Override.
(lang_print_xnode, print_lang_statistics): Remove.
From-SVN: r46907
2001-11-10 00:30:44 +01:00
|
|
|
/* Set yydebug for bison-based parsers, when -dy is given on the
|
|
|
|
command line. By default, if the parameter is non-zero, prints a
|
|
|
|
warning that the front end does not use such a parser. */
|
|
|
|
void (*set_yydebug) PARAMS ((int));
|
|
|
|
|
2001-11-06 22:12:14 +01:00
|
|
|
struct lang_hooks_for_tree_inlining tree_inlining;
|
tree-dump.c: Rename from c-dump.c.
* tree-dump.c: Rename from c-dump.c. Include c-tree.h, not c-common.h.
(lang_type_quals): Declare.
(dequeue_and_dump): Use lang_hooks.tree_dump.type_quals function to
retrieve language-specific qualifiers for a type node, instead of
C_TYPE_QUALS. Likewise for lang_hooks.tree_dump.dump_tree instead of
lang_dump_tree.
* tree-dump.h: Rename from c-dump.h.
* c-common.h (C_TYPE_QUALS): Removed.
Move declarations for tree-dump.c interface to...
* tree.h: ... here. Remove lang_dump_tree.
* langhooks.h (struct lang_hooks_for_tree_dump): New.
(struct lang_hooks): Add tree_dump hooks.
* langhooks.c (lhd_tree_dump_dump_tree): New function.
(lhd_tree_dump_type_quals): New function.
* langhooks-def.h (lhd_tree_dump_dump_tree, lhd_tree_dump_type_quals):
Declare.
(LANG_HOOKS_INITIALIZER): Add tree_dump hooks.
* Makefile.in: Move tree-dump.o to language-independent back-end.
cp:
* cp-tree.h (CP_TYPE_QUALS): Removed.
* decl.c (cxx_init_decl_processing): Don't set lang_dump_tree.
* cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and
LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN.
* dump.c (cp_dump_tree): Use void* dump_info argument to match
lang-hooks prototype.
* call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c,
rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to
CP_TYPE_QUALS changed to cp_type_quals.
* Make-lang.in: References to c-dump.h changed to tree-dump.h.
(CXX_C_OBJS): Remove c-dump.o.
From-SVN: r47257
2001-11-22 03:33:02 +01:00
|
|
|
|
|
|
|
struct lang_hooks_for_tree_dump tree_dump;
|
2001-11-06 22:12:14 +01:00
|
|
|
|
Makefile.in (fold-const.o, [...]): Update.
* Makefile.in (fold-const.o, stor-layout.o, stmt.o,
sdbout.o, profile.o): Update.
* c-common.c (c_common_nodes_and_builtins): Use pushdecl
langhook.
* c-common.h (gettags): Move here from tree.h.
* c-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
* dbxout.c (dbxout_init): Use getdecls langhook.
* expr.c (expand_expr): Use insert_block langhook.
* fold-const.c: Include langhooks.h.
(fold_range_test, fold_binary_op_with_conditional_arg,
fold): Use global_bindings_p langhook.
* integrate.c (expand_inline_function): Use insert_block langhook.
* langhooks-def.h (LANG_HOOKS_DECLS, LANG_HOOKS_PUSHLEVEL,
LANG_HOOKS_POPLEVEL, LANG_HOOKS_GLOBAL_BINDINGS_P,
LANG_HOOKS_INSERT_BLOCK, LANG_HOOKS_SET_BLOCK, LANG_HOOKS_PUSHDECL,
LANG_HOOKS_GETDECLS): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
langhook.
* langhooks.h (struct lang_hooks_for_decls): New.
(struct lang_hooks): Update.
* profile.c: Include langhooks.h.
(output_func_start_profiler): Use new langhooks.
* sdbout.c: Include langhooks.h.
(sdbout_init, sdbout_finish): Use getdecls langhook.
* stmt.c: Include langhooks.h.
(expand_fixup, fixup_gotos): Use new langhooks.
* stor-layout.c: Include langhooks.h.
(variable_size): Use global_bindings_p langhook.
* toplev.c (compile_file): Use getdecls langhook.
* tree-inline.c (remap_block): Use insert_block langhook.
* tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
cp:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
java:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
f:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
From-SVN: r51136
2002-03-21 19:39:29 +01:00
|
|
|
struct lang_hooks_for_decls decls;
|
|
|
|
|
tree-dump.c: Rename from c-dump.c.
* tree-dump.c: Rename from c-dump.c. Include c-tree.h, not c-common.h.
(lang_type_quals): Declare.
(dequeue_and_dump): Use lang_hooks.tree_dump.type_quals function to
retrieve language-specific qualifiers for a type node, instead of
C_TYPE_QUALS. Likewise for lang_hooks.tree_dump.dump_tree instead of
lang_dump_tree.
* tree-dump.h: Rename from c-dump.h.
* c-common.h (C_TYPE_QUALS): Removed.
Move declarations for tree-dump.c interface to...
* tree.h: ... here. Remove lang_dump_tree.
* langhooks.h (struct lang_hooks_for_tree_dump): New.
(struct lang_hooks): Add tree_dump hooks.
* langhooks.c (lhd_tree_dump_dump_tree): New function.
(lhd_tree_dump_type_quals): New function.
* langhooks-def.h (lhd_tree_dump_dump_tree, lhd_tree_dump_type_quals):
Declare.
(LANG_HOOKS_INITIALIZER): Add tree_dump hooks.
* Makefile.in: Move tree-dump.o to language-independent back-end.
cp:
* cp-tree.h (CP_TYPE_QUALS): Removed.
* decl.c (cxx_init_decl_processing): Don't set lang_dump_tree.
* cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and
LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN.
* dump.c (cp_dump_tree): Use void* dump_info argument to match
lang-hooks prototype.
* call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c,
rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to
CP_TYPE_QUALS changed to cp_type_quals.
* Make-lang.in: References to c-dump.h changed to tree-dump.h.
(CXX_C_OBJS): Remove c-dump.o.
From-SVN: r47257
2001-11-22 03:33:02 +01:00
|
|
|
/* Whenever you add entries here, make sure you adjust langhooks-def.h
|
2001-11-06 22:12:14 +01:00
|
|
|
and langhooks.c accordingly. */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Each front end provides its own. */
|
2001-11-09 08:14:20 +01:00
|
|
|
extern const struct lang_hooks lang_hooks;
|
2001-10-08 22:54:07 +02:00
|
|
|
|
|
|
|
#endif /* GCC_LANG_HOOKS_H */
|