diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 70d1aa109c8..5ecfc7afb2a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2006-11-03 Steven Bosscher + + * tree-dump.c (dump_enable_all): Rename local variable + ir_type to avoid name conflicts. + * cfgloopmanip.c (lv_adjust_loop_entry_edge): Check for IR_GIMPLE + instead of using ir_type(). + * profile.c (tree_register_profile_hooks): Likewise. + * value-prof.c (tree_register_value_prof_hooks): Likewise. + * basic-block.h (struct edge_def): Likewise. + * config/arm/arm.c (legitimize_pic_address): Likewise. + * coretypes.h (ir_type): New enum of all intermediate languages + used in GCC. + * cfghooks.c (ir_type): Rename to... + (current_ir_type): ...this. Distinguish between cfgrtl and + cfglayout mode when the current IR is RTL. Return enum ir_type. + * cfghooks.h (ir_type): Replace with current_ir_type prototype. + 2006-11-03 Paul Brook gcc/ diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 67c09226ad1..371b124baca 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -123,9 +123,9 @@ struct edge_def GTY(()) /* Instructions queued on the edge. */ union edge_def_insns { - rtx GTY ((tag ("0"))) r; - tree GTY ((tag ("1"))) t; - } GTY ((desc ("ir_type ()"))) insns; + tree GTY ((tag ("true"))) t; + rtx GTY ((tag ("false"))) r; + } GTY ((desc ("current_ir_type () == IR_GIMPLE"))) insns; /* Auxiliary info specific to a pass. */ PTR GTY ((skip (""))) aux; diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index a4cc31c8b61..4d89aea8f5c 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -55,12 +55,19 @@ tree_register_cfg_hooks (void) cfg_hooks = &tree_cfg_hooks; } -/* Returns current ir type (rtl = 0, trees = 1). */ +/* Returns current ir type. */ -int -ir_type (void) +enum ir_type +current_ir_type (void) { - return cfg_hooks == &tree_cfg_hooks ? 1 : 0; + if (cfg_hooks == &tree_cfg_hooks) + return IR_GIMPLE; + else if (cfg_hooks == &rtl_cfg_hooks) + return IR_RTL_CFGRTL; + else if (cfg_hooks == &cfg_layout_rtl_cfg_hooks) + return IR_RTL_CFGLAYOUT; + else + gcc_unreachable (); } /* Verify the CFG consistency. diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index fcdc23f4048..bdab8676f53 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -184,7 +184,7 @@ extern struct cfg_hooks rtl_cfg_hooks; extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; /* Declarations. */ -extern int ir_type (void); +extern enum ir_type current_ir_type (void); extern void rtl_register_cfg_hooks (void); extern void cfg_layout_rtl_register_cfg_hooks (void); extern void tree_register_cfg_hooks (void); diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 638b2996584..1ef65143d44 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1268,7 +1268,8 @@ lv_adjust_loop_entry_edge (basic_block first_head, cond_expr); /* Don't set EDGE_TRUE_VALUE in RTL mode, as it's invalid there. */ - e1 = make_edge (new_head, first_head, ir_type () ? EDGE_TRUE_VALUE : 0); + e1 = make_edge (new_head, first_head, + current_ir_type () == IR_GIMPLE ? EDGE_TRUE_VALUE : 0); set_immediate_dominator (CDI_DOMINATORS, first_head, new_head); set_immediate_dominator (CDI_DOMINATORS, second_head, new_head); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 70e3d787a0c..6527f5556da 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3230,7 +3230,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) /* Play games to avoid marking the function as needing pic if we are being called as part of the cost-estimation process. */ - if (!ir_type()) + if (current_ir_type () != IR_GIMPLE) current_function_uses_pic_offset_table = 1; } else @@ -3242,7 +3242,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) /* Play games to avoid marking the function as needing pic if we are being called as part of the cost-estimation process. */ - if (!ir_type()) + if (current_ir_type () != IR_GIMPLE) { current_function_uses_pic_offset_table = 1; start_sequence (); diff --git a/gcc/coretypes.h b/gcc/coretypes.h index 6173bd8e8fe..3f0c58a7e06 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -48,6 +48,13 @@ typedef union tree_node *tree; union section; typedef union section section; +/* The major intermediate representations of GCC. */ +enum ir_type { + IR_GIMPLE, + IR_RTL_CFGRTL, + IR_RTL_CFGLAYOUT +}; + /* Provide forward struct declaration so that we don't have to include all of cpplib.h whenever a random prototype includes a pointer. Note that the cpp_reader typedef remains part of cpplib.h. */ diff --git a/gcc/profile.c b/gcc/profile.c index 9b493095684..689af18a8e4 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -1228,7 +1228,7 @@ end_branch_prob (void) void tree_register_profile_hooks (void) { - gcc_assert (ir_type ()); + gcc_assert (current_ir_type () == IR_GIMPLE); profile_hooks = &tree_profile_hooks; } diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index db315c8229f..8c008ab705c 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -956,12 +956,12 @@ dump_end (enum tree_dump_index phase ATTRIBUTE_UNUSED, FILE *stream) static int dump_enable_all (int flags, int letter) { - int ir_type = (flags & (TDF_TREE | TDF_RTL | TDF_IPA)); + int ir_dump_type = (flags & (TDF_TREE | TDF_RTL | TDF_IPA)); int n = 0; size_t i; for (i = TDI_none + 1; i < (size_t) TDI_end; i++) - if ((dump_files[i].flags & ir_type) + if ((dump_files[i].flags & ir_dump_type) && (letter == 0 || letter == dump_files[i].letter)) { dump_files[i].state = -1; @@ -970,7 +970,7 @@ dump_enable_all (int flags, int letter) } for (i = 0; i < extra_dump_files_in_use; i++) - if ((extra_dump_files[i].flags & ir_type) + if ((extra_dump_files[i].flags & ir_dump_type) && (letter == 0 || letter == extra_dump_files[i].letter)) { extra_dump_files[i].state = -1; diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 6c64e3cbe27..993bd514ad4 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -854,8 +854,8 @@ static struct value_prof_hooks tree_value_prof_hooks = { void tree_register_value_prof_hooks (void) { + gcc_assert (current_ir_type () == IR_GIMPLE); value_prof_hooks = &tree_value_prof_hooks; - gcc_assert (ir_type ()); } /* IR-independent entry points. */