Re: [PATCH 017/236] Add subclasses for the various kinds of instruction
On Tue, 2014-08-12 at 21:07 -0600, Jeff Law wrote: On 08/06/14 11:19, David Malcolm wrote: gcc/ * coretypes.h (class rtx_real_insn): Add forward declaration. (class rtx_debug_insn): Likewise. (class rtx_nonjump_insn): Likewise. (class rtx_jump_insn): Likewise. (class rtx_call_insn): Likewise. (class rtx_jump_table_data): Likewise. (class rtx_barrier): Likewise. (class rtx_code_label): Likewise. (class rtx_note): Likewise. * rtl.h (class rtx_real_insn): New, a subclass of rtx_insn, adding the invariant INSN_P (X). (class rtx_debug_insn): New, a subclass of rtx_real_insn, adding the invariant DEBUG_INSN_P (X). (class rtx_nonjump_insn): New, a subclass of rtx_real_insn, adding the invariant NONJUMP_INSN_P (X). (class rtx_jump_insn): New, a subclass of rtx_real_insn, adding the invariant JUMP_P (X). (class rtx_call_insn): New, a subclass of rtx_real_insn, adding the invariant CALL_P (X). (class rtx_jump_table): New, a subclass of rtx_insn, adding the invariant JUMP_TABLE_DATA_P (X). (class rtx_barrier): New, a subclass of rtx_insn, adding the invariant BARRIER_P (X). (class rtx_code_label): New, a subclass of rtx_real_insn, adding the invariant LABEL_P (X). (class rtx_note): New, a subclass of rtx_real_insn, adding the invariant NOTE_P(X). (is_a_helper rtx_real_insn *::test): New. (is_a_helper rtx_debug_insn *::test): New. (is_a_helper rtx_nonjump_insn *::test): New. (is_a_helper rtx_jump_insn *::test): New. (is_a_helper rtx_call_insn *::test): New. (is_a_helper rtx_jump_table_data *::test): New functions, overloaded for both rtx and rtx_insn *. (is_a_helper rtx_barrier *::test): New. (is_a_helper rtx_code_label *::test): New functions, overloaded for both rtx and rtx_insn *. (is_a_helper rtx_note *::test): New. Sounds like the direction we're going right now is to drop rtx_real_insn and squish one level of inheritance out. OK with the obvious changes around that. I probably won't call out any rtx_real_insn stuff for future patches as I'll assume you will take care of that as you do your bootstrap builds prior to installation. Thanks. Removed class rtx_real_insn, and committed to trunk as r214172, having verified bootstrapregrtest on x86_64-unknown-linux-gnu (Fedora 20) albeit in combination with patches 9-29 [1], and verified that it builds standalone with 9 targets. Am attaching what I committed. Dave [1] as per https://gcc.gnu.org/ml/gcc-patches/2014-08/msg01420.html Index: gcc/ChangeLog === --- gcc/ChangeLog (revision 214171) +++ gcc/ChangeLog (revision 214172) @@ -1,3 +1,41 @@ +2014-08-19 David Malcolm dmalc...@redhat.com + + * coretypes.h (class rtx_debug_insn): Add forward declaration. + (class rtx_nonjump_insn): Likewise. + (class rtx_jump_insn): Likewise. + (class rtx_call_insn): Likewise. + (class rtx_jump_table_data): Likewise. + (class rtx_barrier): Likewise. + (class rtx_code_label): Likewise. + (class rtx_note): Likewise. + + * rtl.h (class rtx_debug_insn): New, a subclass of rtx_insn, + adding the invariant DEBUG_INSN_P (X). + (class rtx_nonjump_insn): New, a subclass of rtx_insn, adding + the invariant NONJUMP_INSN_P (X). + (class rtx_jump_insn): New, a subclass of rtx_insn, adding + the invariant JUMP_P (X). + (class rtx_call_insn): New, a subclass of rtx_insn, adding + the invariant CALL_P (X). + (class rtx_jump_table): New, a subclass of rtx_insn, adding the + invariant JUMP_TABLE_DATA_P (X). + (class rtx_barrier): New, a subclass of rtx_insn, adding the + invariant BARRIER_P (X). + (class rtx_code_label): New, a subclass of rtx_insn, adding + the invariant LABEL_P (X). + (class rtx_note): New, a subclass of rtx_insn, adding + the invariant NOTE_P(X). + (is_a_helper rtx_debug_insn *::test): New. + (is_a_helper rtx_nonjump_insn *::test): New. + (is_a_helper rtx_jump_insn *::test): New. + (is_a_helper rtx_call_insn *::test): New. + (is_a_helper rtx_jump_table_data *::test): New functions, + overloaded for both rtx and rtx_insn *. + (is_a_helper rtx_barrier *::test): New. + (is_a_helper rtx_code_label *::test): New functions, overloaded + for both rtx and rtx_insn *. + (is_a_helper rtx_note *::test): New. + 2014-08-19 Marek Polacek pola...@redhat.com * config/alpha/alpha.h (CLZ_DEFINED_VALUE_AT_ZERO, Index: gcc/coretypes.h === --- gcc/coretypes.h (revision 214171) +++ gcc/coretypes.h (revision 214172) @@ -57,10 +57,18 @@ typedef const struct rtx_def *const_rtx; /* Subclasses of rtx_def, using indentation to show the class - hierarchy. + hierarchy, along with the relevant invariant. Where possible, keep this list in the same order as in rtl.def. */ class rtx_def; class rtx_insn; +class
Re: [PATCH 017/236] Add subclasses for the various kinds of instruction
On 08/06/14 11:19, David Malcolm wrote: gcc/ * coretypes.h (class rtx_real_insn): Add forward declaration. (class rtx_debug_insn): Likewise. (class rtx_nonjump_insn): Likewise. (class rtx_jump_insn): Likewise. (class rtx_call_insn): Likewise. (class rtx_jump_table_data): Likewise. (class rtx_barrier): Likewise. (class rtx_code_label): Likewise. (class rtx_note): Likewise. * rtl.h (class rtx_real_insn): New, a subclass of rtx_insn, adding the invariant INSN_P (X). (class rtx_debug_insn): New, a subclass of rtx_real_insn, adding the invariant DEBUG_INSN_P (X). (class rtx_nonjump_insn): New, a subclass of rtx_real_insn, adding the invariant NONJUMP_INSN_P (X). (class rtx_jump_insn): New, a subclass of rtx_real_insn, adding the invariant JUMP_P (X). (class rtx_call_insn): New, a subclass of rtx_real_insn, adding the invariant CALL_P (X). (class rtx_jump_table): New, a subclass of rtx_insn, adding the invariant JUMP_TABLE_DATA_P (X). (class rtx_barrier): New, a subclass of rtx_insn, adding the invariant BARRIER_P (X). (class rtx_code_label): New, a subclass of rtx_real_insn, adding the invariant LABEL_P (X). (class rtx_note): New, a subclass of rtx_real_insn, adding the invariant NOTE_P(X). (is_a_helper rtx_real_insn *::test): New. (is_a_helper rtx_debug_insn *::test): New. (is_a_helper rtx_nonjump_insn *::test): New. (is_a_helper rtx_jump_insn *::test): New. (is_a_helper rtx_call_insn *::test): New. (is_a_helper rtx_jump_table_data *::test): New functions, overloaded for both rtx and rtx_insn *. (is_a_helper rtx_barrier *::test): New. (is_a_helper rtx_code_label *::test): New functions, overloaded for both rtx and rtx_insn *. (is_a_helper rtx_note *::test): New. Sounds like the direction we're going right now is to drop rtx_real_insn and squish one level of inheritance out. OK with the obvious changes around that. I probably won't call out any rtx_real_insn stuff for future patches as I'll assume you will take care of that as you do your bootstrap builds prior to installation. Jeff
[PATCH 017/236] Add subclasses for the various kinds of instruction
gcc/ * coretypes.h (class rtx_real_insn): Add forward declaration. (class rtx_debug_insn): Likewise. (class rtx_nonjump_insn): Likewise. (class rtx_jump_insn): Likewise. (class rtx_call_insn): Likewise. (class rtx_jump_table_data): Likewise. (class rtx_barrier): Likewise. (class rtx_code_label): Likewise. (class rtx_note): Likewise. * rtl.h (class rtx_real_insn): New, a subclass of rtx_insn, adding the invariant INSN_P (X). (class rtx_debug_insn): New, a subclass of rtx_real_insn, adding the invariant DEBUG_INSN_P (X). (class rtx_nonjump_insn): New, a subclass of rtx_real_insn, adding the invariant NONJUMP_INSN_P (X). (class rtx_jump_insn): New, a subclass of rtx_real_insn, adding the invariant JUMP_P (X). (class rtx_call_insn): New, a subclass of rtx_real_insn, adding the invariant CALL_P (X). (class rtx_jump_table): New, a subclass of rtx_insn, adding the invariant JUMP_TABLE_DATA_P (X). (class rtx_barrier): New, a subclass of rtx_insn, adding the invariant BARRIER_P (X). (class rtx_code_label): New, a subclass of rtx_real_insn, adding the invariant LABEL_P (X). (class rtx_note): New, a subclass of rtx_real_insn, adding the invariant NOTE_P(X). (is_a_helper rtx_real_insn *::test): New. (is_a_helper rtx_debug_insn *::test): New. (is_a_helper rtx_nonjump_insn *::test): New. (is_a_helper rtx_jump_insn *::test): New. (is_a_helper rtx_call_insn *::test): New. (is_a_helper rtx_jump_table_data *::test): New functions, overloaded for both rtx and rtx_insn *. (is_a_helper rtx_barrier *::test): New. (is_a_helper rtx_code_label *::test): New functions, overloaded for both rtx and rtx_insn *. (is_a_helper rtx_note *::test): New. --- gcc/coretypes.h | 11 +++- gcc/rtl.h | 200 2 files changed, 210 insertions(+), 1 deletion(-) diff --git a/gcc/coretypes.h b/gcc/coretypes.h index f22b980..17dc0e6 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -57,10 +57,19 @@ typedef struct rtx_def *rtx; typedef const struct rtx_def *const_rtx; /* Subclasses of rtx_def, using indentation to show the class - hierarchy. + hierarchy, along with the relevant invariant. Where possible, keep this list in the same order as in rtl.def. */ class rtx_def; class rtx_insn; +class rtx_real_insn; /* INSN_P (X) */ + class rtx_debug_insn; /* DEBUG_INSN_P (X) */ + class rtx_nonjump_insn;/* NONJUMP_INSN_P (X) */ + class rtx_jump_insn; /* JUMP_P (X) */ + class rtx_call_insn; /* CALL_P (X) */ +class rtx_jump_table_data; /* JUMP_TABLE_DATA_P (X) */ +class rtx_barrier; /* BARRIER_P (X) */ +class rtx_code_label;/* LABEL_P (X) */ +class rtx_note; /* NOTE_P (X) */ struct rtvec_def; typedef struct rtvec_def *rtvec; diff --git a/gcc/rtl.h b/gcc/rtl.h index 5936829..31df60f 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -421,6 +421,110 @@ class GTY(()) rtx_insn : public rtx_def */ }; +class GTY(()) rtx_real_insn : public rtx_insn +{ + /* No extra fields, but adds the invariant: + INSN_P (X) + i.e. that we have a real insn, one of: + (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X)) + */ +}; + +/* Subclasses of rtx_real_insn. */ + +class GTY(()) rtx_debug_insn : public rtx_real_insn +{ + /* No extra fields, but adds the invariant: + DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN) + i.e. an annotation for tracking variable assignments. + + This is an instance of: + DEF_RTL_EXPR(DEBUG_INSN, debug_insn, uuBeiie, RTX_INSN) + from rtl.def. */ +}; + +class GTY(()) rtx_nonjump_insn : public rtx_real_insn +{ + /* No extra fields, but adds the invariant: + NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN) + i.e an instruction that cannot jump. + + This is an instance of: + DEF_RTL_EXPR(INSN, insn, uuBeiie, RTX_INSN) + from rtl.def. */ +}; + +class GTY(()) rtx_jump_insn : public rtx_real_insn +{ + /* No extra fields, but adds the invariant: + JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN) + i.e. an instruction that can possibly jump. + + This is an instance of: + DEF_RTL_EXPR(JUMP_INSN, jump_insn, uuBeiie0, RTX_INSN) + from rtl.def. */ +}; + +class GTY(()) rtx_call_insn : public rtx_real_insn +{ + /* No extra fields, but adds the invariant: + CALL_P (X) aka (GET_CODE (X) == CALL_INSN) + i.e. an instruction that can possibly call a subroutine + but which will not change which instruction comes next + in the current function. + + This is an instance of: + DEF_RTL_EXPR(CALL_INSN, call_insn, uuBeiiee, RTX_INSN) + from rtl.def. */ +}; + +/*