This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFC: Use tree/rtx/rtvec instead of "union ...*'" in headers.
- From: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 20 Jun 2003 00:14:56 +0200
- Subject: RFC: Use tree/rtx/rtvec instead of "union ...*'" in headers.
Hi,
The idea behind this patch is that since the introduction of
coretypes.h, tree, rtx, and rtvec are defined in most files, so the
headers can use them too. I have tried to make sure that all files that
include the headers this patch touches first include coretypes.h.
This has been hanging around in my tree now for a week or so, but
mainline _still_ doesn't build on Cygwin, even with an updated gawk (now
it is OPT__version that is missing for some silly reason <sigh>...).
Ergo, completely untested, though it seems to compile just fine.
I'd like to hear if this change is a good idea. And maybe someone can
pick it up and finish it while I'm still search for a computer with a
decent OS...
Gr.
Steven
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.432
diff -c -3 -p -r1.432 dwarf2out.c
*** dwarf2out.c 16 Jun 2003 21:41:01 -0000 1.432
--- dwarf2out.c 17 Jun 2003 19:55:36 -0000
*************** add_subscript_info (type_die, type)
*** 10030,10042 ****
}
static void
! add_byte_size_attribute (die, tree_node)
dw_die_ref die;
! tree tree_node;
{
unsigned size;
! switch (TREE_CODE (tree_node))
{
case ERROR_MARK:
size = 0;
--- 10030,10042 ----
}
static void
! add_byte_size_attribute (die, t)
dw_die_ref die;
! tree t;
{
unsigned size;
! switch (TREE_CODE (t))
{
case ERROR_MARK:
size = 0;
*************** add_byte_size_attribute (die, tree_node)
*** 10045,10058 ****
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
! size = int_size_in_bytes (tree_node);
break;
case FIELD_DECL:
/* For a data member of a struct or union, the DW_AT_byte_size is
generally given as the number of bytes normally allocated for an
object of the *declared* type of the member itself. This is true
even for bit-fields. */
! size = simple_type_size_in_bits (field_type (tree_node)) / BITS_PER_UNIT;
break;
default:
abort ();
--- 10045,10058 ----
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
! size = int_size_in_bytes (t);
break;
case FIELD_DECL:
/* For a data member of a struct or union, the DW_AT_byte_size is
generally given as the number of bytes normally allocated for an
object of the *declared* type of the member itself. This is true
even for bit-fields. */
! size = simple_type_size_in_bits (field_type (t)) / BITS_PER_UNIT;
break;
default:
abort ();
Index: dwarfout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarfout.c,v
retrieving revision 1.126
diff -c -3 -p -r1.126 dwarfout.c
*** dwarfout.c 16 Jun 2003 21:41:01 -0000 1.126
--- dwarfout.c 17 Jun 2003 19:56:03 -0000
*************** subscript_data_attribute (type)
*** 3069,3081 ****
}
static void
! byte_size_attribute (tree_node)
! tree tree_node;
{
unsigned size;
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_byte_size);
! switch (TREE_CODE (tree_node))
{
case ERROR_MARK:
size = 0;
--- 3069,3081 ----
}
static void
! byte_size_attribute (t)
! tree t;
{
unsigned size;
ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_byte_size);
! switch (TREE_CODE (t))
{
case ERROR_MARK:
size = 0;
*************** byte_size_attribute (tree_node)
*** 3086,3092 ****
case UNION_TYPE:
case QUAL_UNION_TYPE:
case ARRAY_TYPE:
! size = int_size_in_bytes (tree_node);
break;
case FIELD_DECL:
--- 3086,3092 ----
case UNION_TYPE:
case QUAL_UNION_TYPE:
case ARRAY_TYPE:
! size = int_size_in_bytes (t);
break;
case FIELD_DECL:
*************** byte_size_attribute (tree_node)
*** 3094,3100 ****
generally given as the number of bytes normally allocated for
an object of the *declared* type of the member itself. This
is true even for bit-fields. */
! size = simple_type_size_in_bits (field_type (tree_node))
/ BITS_PER_UNIT;
break;
--- 3094,3100 ----
generally given as the number of bytes normally allocated for
an object of the *declared* type of the member itself. This
is true even for bit-fields. */
! size = simple_type_size_in_bits (field_type (t))
/ BITS_PER_UNIT;
break;
Index: ggc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc.h,v
retrieving revision 1.52
diff -c -3 -p -r1.52 ggc.h
*** ggc.h 12 Jun 2003 19:01:07 -0000 1.52
--- ggc.h 17 Jun 2003 19:56:04 -0000
*************** extern void *ggc_realloc (void *, size_t
*** 196,210 ****
/* Like ggc_alloc_cleared, but performs a multiplication. */
extern void *ggc_calloc (size_t, size_t);
! #define ggc_alloc_rtx(NSLOTS) \
! ((struct rtx_def *) ggc_alloc (sizeof (struct rtx_def) \
! + ((NSLOTS) - 1) * sizeof (rtunion)))
! #define ggc_alloc_rtvec(NELT) \
! ((struct rtvec_def *) ggc_alloc (sizeof (struct rtvec_def) \
! + ((NELT) - 1) * sizeof (rtx)))
! #define ggc_alloc_tree(LENGTH) ((union tree_node *) ggc_alloc (LENGTH))
#define htab_create_ggc(SIZE, HASH, EQ, DEL) \
htab_create_alloc (SIZE, HASH, EQ, DEL, ggc_calloc, NULL)
--- 196,210 ----
/* Like ggc_alloc_cleared, but performs a multiplication. */
extern void *ggc_calloc (size_t, size_t);
! #define ggc_alloc_rtx(NSLOTS) \
! ((rtx) ggc_alloc (sizeof (struct rtx_def) \
! + ((NSLOTS) - 1) * sizeof (rtunion)))
! #define ggc_alloc_rtvec(NELT) \
! ((rtvec) ggc_alloc (sizeof (struct rtvec_def) \
! + ((NELT) - 1) * sizeof (rtx)))
! #define ggc_alloc_tree(LENGTH) ((tree) ggc_alloc (LENGTH))
#define htab_create_ggc(SIZE, HASH, EQ, DEL) \
htab_create_alloc (SIZE, HASH, EQ, DEL, ggc_calloc, NULL)
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.226
diff -c -3 -p -r1.226 integrate.c
*** integrate.c 16 Jun 2003 21:41:05 -0000 1.226
--- integrate.c 17 Jun 2003 19:56:16 -0000
*************** find_block (v1, v2)
*** 634,640 ****
const void *v1;
const void *v2;
{
! const union tree_node *b1 = (const union tree_node *) v1;
tree b2 = *((const tree *) v2);
char *p1 = (char *) b1;
char *p2 = (char *) BLOCK_ABSTRACT_ORIGIN (b2);
--- 634,640 ----
const void *v1;
const void *v2;
{
! tree b1 = *((const tree *) v1);
tree b2 = *((const tree *) v2);
char *p1 = (char *) b1;
char *p2 = (char *) BLOCK_ABSTRACT_ORIGIN (b2);
Index: integrate.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.h,v
retrieving revision 1.26
diff -c -3 -p -r1.26 integrate.h
*** integrate.h 16 Jun 2003 11:30:14 -0000 1.26
--- integrate.h 17 Jun 2003 19:56:17 -0000
***************
*** 1,5 ****
/* Function integration definitions for GCC
! Copyright (C) 1990, 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GCC.
--- 1,6 ----
/* Function integration definitions for GCC
! Copyright (C) 1990, 1995, 1998, 1999, 2000, 2001, 2003
! Free Software Foundation, Inc.
This file is part of GCC.
*************** struct inline_remap
*** 39,45 ****
copy_rtx_and_substitute. */
int integrating;
/* Definition of function be inlined. */
! union tree_node *fndecl;
/* Place to put insns needed at start of function. */
rtx insns_at_start;
/* Mapping from old BLOCKs to new BLOCKs. */
--- 40,46 ----
copy_rtx_and_substitute. */
int integrating;
/* Definition of function be inlined. */
! tree fndecl;
/* Place to put insns needed at start of function. */
rtx insns_at_start;
/* Mapping from old BLOCKs to new BLOCKs. */
*************** extern void allocate_initial_values PAR
*** 149,162 ****
/* Copy a declaration when one function is substituted inline into
another. */
! extern union tree_node *copy_decl_for_inlining PARAMS ((union tree_node *,
! union tree_node *,
! union tree_node *));
/* Check whether there's any attribute in a function declaration that
makes the function uninlinable. Returns false if it finds any,
true otherwise. */
! extern bool function_attribute_inlinable_p PARAMS ((union tree_node *));
extern void try_constants PARAMS ((rtx, struct inline_remap *));
--- 150,161 ----
/* Copy a declaration when one function is substituted inline into
another. */
! extern tree copy_decl_for_inlining PARAMS ((tree, tree, tree));
/* Check whether there's any attribute in a function declaration that
makes the function uninlinable. Returns false if it finds any,
true otherwise. */
! extern bool function_attribute_inlinable_p PARAMS ((tree));
extern void try_constants PARAMS ((rtx, struct inline_remap *));
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.58
diff -c -3 -p -r1.58 langhooks.h
*** langhooks.h 11 Jun 2003 22:21:07 -0000 1.58
--- langhooks.h 17 Jun 2003 19:56:17 -0000
*************** typedef void (*lang_print_tree_hook) PAR
*** 33,70 ****
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 *,
! tree));
! int (*anon_aggr_type_p) PARAMS ((union tree_node *));
! bool (*var_mod_type_p) PARAMS ((union tree_node *));
! int (*start_inlining) PARAMS ((union tree_node *));
! void (*end_inlining) PARAMS ((union tree_node *));
! union tree_node *(*convert_parm_for_inlining) PARAMS ((union tree_node *,
! union tree_node *,
! union tree_node *));
};
struct lang_hooks_for_callgraph
{
/* Function passed as argument is needed and will be compiled.
Lower the representation so the calls are explicit. */
! void (*lower_function) PARAMS ((union tree_node *));
/* Produce RTL for function passed as argument. */
! void (*expand_function) PARAMS ((union tree_node *));
};
/* Lang hooks for management of language-specific data or status
--- 33,62 ----
struct lang_hooks_for_tree_inlining
{
! tree (*walk_subtrees) PARAMS ((tree *, int *,
! tree (*) (tree *, int *, void *),
! void *, void *));
! int (*cannot_inline_tree_fn) PARAMS ((tree *));
! int (*disregard_inline_limits) PARAMS ((tree));
! tree (*add_pending_fn_decls) PARAMS ((void *, tree));
! int (*tree_chain_matters_p) PARAMS ((tree));
! int (*auto_var_in_fn_p) PARAMS ((tree, tree));
! tree (*copy_res_decl_for_inlining) PARAMS ((tree, tree, tree,
! void *, int *, tree));
! int (*anon_aggr_type_p) PARAMS ((tree));
! bool (*var_mod_type_p) PARAMS ((tree));
! int (*start_inlining) PARAMS ((tree));
! void (*end_inlining) PARAMS ((tree));
! tree (*convert_parm_for_inlining) PARAMS ((tree, tree, tree));
};
struct lang_hooks_for_callgraph
{
/* Function passed as argument is needed and will be compiled.
Lower the representation so the calls are explicit. */
! void (*lower_function) PARAMS ((tree));
/* Produce RTL for function passed as argument. */
! void (*expand_function) PARAMS ((tree));
};
/* Lang hooks for management of language-specific data or status
Index: output.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/output.h,v
retrieving revision 1.127
diff -c -3 -p -r1.127 output.h
*** output.h 7 Jun 2003 17:11:37 -0000 1.127
--- output.h 17 Jun 2003 19:56:20 -0000
*************** extern FILE *rtl_dump_file;
*** 425,434 ****
#endif
/* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */
! extern struct rtx_def *current_insn_predicate;
/* Last insn processed by final_scan_insn. */
! extern struct rtx_def *current_output_insn;
/* Nonzero while outputting an `asm' with operands.
This means that inconsistencies are the user's fault, so don't abort.
--- 425,434 ----
#endif
/* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */
! extern rtx current_insn_predicate;
/* Last insn processed by final_scan_insn. */
! extern rtx current_output_insn;
/* Nonzero while outputting an `asm' with operands.
This means that inconsistencies are the user's fault, so don't abort.
*************** extern bool set_named_section_flags PARA
*** 477,486 ****
extern void named_section_flags PARAMS ((const char *, unsigned int));
extern bool named_section_first_declaration PARAMS((const char *));
! union tree_node;
! extern unsigned int default_section_type_flags PARAMS ((union tree_node *,
! const char *, int));
! extern unsigned int default_section_type_flags_1 PARAMS ((union tree_node *,
const char *,
int, int));
--- 477,484 ----
extern void named_section_flags PARAMS ((const char *, unsigned int));
extern bool named_section_first_declaration PARAMS((const char *));
! extern unsigned int default_section_type_flags PARAMS ((tree, const char *, int));
! extern unsigned int default_section_type_flags_1 PARAMS ((tree,
const char *,
int, int));
*************** extern void default_coff_asm_named_secti
*** 490,505 ****
unsigned int));
extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int));
! extern void default_stabs_asm_out_destructor PARAMS ((struct rtx_def *, int));
! extern void default_named_section_asm_out_destructor PARAMS ((struct rtx_def *,
! int));
! extern void default_dtor_section_asm_out_destructor PARAMS ((struct rtx_def *,
! int));
! extern void default_stabs_asm_out_constructor PARAMS ((struct rtx_def *, int));
! extern void default_named_section_asm_out_constructor PARAMS ((struct rtx_def *,
! int));
! extern void default_ctor_section_asm_out_constructor PARAMS ((struct rtx_def *,
! int));
extern void default_select_section PARAMS ((tree, int,
unsigned HOST_WIDE_INT));
--- 488,499 ----
unsigned int));
extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int));
! extern void default_stabs_asm_out_destructor PARAMS ((rtx, int));
! extern void default_named_section_asm_out_destructor PARAMS ((rtx, int));
! extern void default_dtor_section_asm_out_destructor PARAMS ((rtx, int));
! extern void default_stabs_asm_out_constructor PARAMS ((rtx, int));
! extern void default_named_section_asm_out_constructor PARAMS ((rtx, int));
! extern void default_ctor_section_asm_out_constructor PARAMS ((rtx, int));
extern void default_select_section PARAMS ((tree, int,
unsigned HOST_WIDE_INT));
*************** extern void file_end_indicate_exec_stack
*** 523,531 ****
extern bool default_valid_pointer_mode PARAMS ((enum machine_mode));
/* Emit data for vtable gc for GNU binutils. */
! extern void assemble_vtable_entry PARAMS ((struct rtx_def *, HOST_WIDE_INT));
! extern void assemble_vtable_inherit PARAMS ((struct rtx_def *,
! struct rtx_def *));
extern int default_address_cost PARAMS ((rtx));
--- 517,524 ----
extern bool default_valid_pointer_mode PARAMS ((enum machine_mode));
/* Emit data for vtable gc for GNU binutils. */
! extern void assemble_vtable_entry PARAMS ((rtx, HOST_WIDE_INT));
! extern void assemble_vtable_inherit PARAMS ((rtx, rtx));
extern int default_address_cost PARAMS ((rtx));
Index: real.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.h,v
retrieving revision 1.66
diff -c -3 -p -r1.66 real.h
*** real.h 23 May 2003 03:46:52 -0000 1.66
--- real.h 17 Jun 2003 19:56:21 -0000
*************** extern REAL_VALUE_TYPE dconsthalf;
*** 344,351 ****
/* Function to return a real value (not a tree node)
from a given integer constant. */
! REAL_VALUE_TYPE real_value_from_int_cst PARAMS ((union tree_node *,
! union tree_node *));
/* Given a CONST_DOUBLE in FROM, store into TO the value it represents. */
#define REAL_VALUE_FROM_CONST_DOUBLE(to, from) \
--- 344,350 ----
/* Function to return a real value (not a tree node)
from a given integer constant. */
! REAL_VALUE_TYPE real_value_from_int_cst PARAMS ((tree, tree));
/* Given a CONST_DOUBLE in FROM, store into TO the value it represents. */
#define REAL_VALUE_FROM_CONST_DOUBLE(to, from) \
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.399
diff -c -3 -p -r1.399 reload1.c
*** reload1.c 16 Jun 2003 21:41:06 -0000 1.399
--- reload1.c 17 Jun 2003 19:56:43 -0000
*************** static char *reload_insn_firstobj;
*** 286,297 ****
examine. */
struct insn_chain *reload_insn_chain;
- #ifdef TREE_CODE
- extern tree current_function_decl;
- #else
- extern union tree_node *current_function_decl;
- #endif
-
/* List of all insns needing reloads. */
static struct insn_chain *insns_need_reload;
--- 286,291 ----
Index: toplev.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.h,v
retrieving revision 1.97
diff -c -3 -p -r1.97 toplev.h
*** toplev.h 17 Jun 2003 05:09:11 -0000 1.97
--- toplev.h 17 Jun 2003 19:56:43 -0000
*************** extern void strip_off_ending (char *, i
*** 33,46 ****
extern const char *trim_filename (const char *);
extern void internal_error (const char *, ...)
ATTRIBUTE_NORETURN;
! extern void _fatal_insn_not_found (struct rtx_def *,
! const char *, int,
! const char *)
ATTRIBUTE_NORETURN;
! extern void _fatal_insn (const char *,
! struct rtx_def *,
! const char *, int,
! const char *)
ATTRIBUTE_NORETURN;
#define fatal_insn(msgid, insn) \
--- 33,42 ----
extern const char *trim_filename (const char *);
extern void internal_error (const char *, ...)
ATTRIBUTE_NORETURN;
! extern void _fatal_insn_not_found (rtx, const char *, int, const char *)
ATTRIBUTE_NORETURN;
! extern void _fatal_insn (const char *, rtx, const char *,
! int, const char *)
ATTRIBUTE_NORETURN;
#define fatal_insn(msgid, insn) \
*************** extern void fatal_error (const char *,
*** 58,82 ****
extern void pedwarn (const char *, ...);
extern void sorry (const char *, ...);
! extern void rest_of_decl_compilation (union tree_node *,
! const char *, int, int);
! extern void rest_of_type_compilation (union tree_node *, int);
! extern void rest_of_compilation (union tree_node *);
!
! extern void pedwarn_with_decl (union tree_node *,
! const char *, ...);
! extern void warning_with_decl (union tree_node *,
! const char *, ...);
! extern void error_with_decl (union tree_node *,
! const char *, ...);
!
! extern void announce_function (union tree_node *);
!
! extern void error_for_asm (struct rtx_def *,
! const char *, ...);
! extern void warning_for_asm (struct rtx_def *,
! const char *, ...);
! extern void warn_deprecated_use (union tree_node *);
extern void output_clean_symbol_name (FILE *, const char *);
#ifdef BUFSIZ
--- 54,72 ----
extern void pedwarn (const char *, ...);
extern void sorry (const char *, ...);
! extern void rest_of_decl_compilation (tree, const char *, int, int);
! extern void rest_of_type_compilation (tree, int);
! extern void rest_of_compilation (tree);
!
! extern void pedwarn_with_decl (tree, const char *, ...);
! extern void warning_with_decl (tree, const char *, ...);
! extern void error_with_decl (tree, const char *, ...);
!
! extern void announce_function (tree);
!
! extern void error_for_asm (rtx, const char *, ...);
! extern void warning_for_asm (rtx, const char *, ...);
! extern void warn_deprecated_use (tree);
extern void output_clean_symbol_name (FILE *, const char *);
#ifdef BUFSIZ
*************** extern void fnotice (FILE *, const cha
*** 91,98 ****
ATTRIBUTE_PRINTF_2;
#endif
! extern int wrapup_global_declarations (union tree_node **, int);
! extern void check_global_declarations (union tree_node **, int);
extern const char *progname;
extern const char *dump_base_name;
--- 81,88 ----
ATTRIBUTE_PRINTF_2;
#endif
! extern int wrapup_global_declarations (tree *, int);
! extern void check_global_declarations (tree *, int);
extern const char *progname;
extern const char *dump_base_name;
Index: varray.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varray.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 varray.c
*** varray.c 16 Jun 2003 21:41:07 -0000 1.18
--- varray.c 17 Jun 2003 19:56:44 -0000
*************** static const struct {
*** 48,56 ****
{ sizeof (unsigned HOST_WIDE_INT), 1 },
{ sizeof (void *), 1 },
{ sizeof (char *), 1 },
! { sizeof (struct rtx_def *), 1 },
! { sizeof (struct rtvec_def *), 1 },
! { sizeof (union tree_node *), 1 },
{ sizeof (struct bitmap_head_def *), 1 },
{ sizeof (struct reg_info_def *), 0 },
{ sizeof (struct const_equiv_data), 0 },
--- 48,56 ----
{ sizeof (unsigned HOST_WIDE_INT), 1 },
{ sizeof (void *), 1 },
{ sizeof (char *), 1 },
! { sizeof (rtx), 1 },
! { sizeof (rtvec), 1 },
! { sizeof (tree), 1 },
{ sizeof (struct bitmap_head_def *), 1 },
{ sizeof (struct reg_info_def *), 0 },
{ sizeof (struct const_equiv_data), 0 },