diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-27 20:30:51 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-27 20:30:51 +0000 |
commit | ede4900a3370698d85011d12fc89b3ff2e41e7bf (patch) | |
tree | 11494656a8b241d4f92fd8d40071e2c4c83d9ade /gcc | |
parent | 3655b6bf72aa8349aa31943dc36e7fffb15f5147 (diff) | |
download | gcc-ede4900a3370698d85011d12fc89b3ff2e41e7bf.tar.gz |
Introduce rtx_expr_list subclass of rtx_def
gcc/
2014-08-27 David Malcolm <dmalcolm@redhat.com>
* coretypes.h (class rtx_expr_list): Add forward declaration.
* emit-rtl.c (gen_rtx_EXPR_LIST): New.
* gengenrtl.c (special_rtx): Add EXPR_LIST.
* rtl.h (class rtx_expr_list): New subclass of rtx_def, adding
invariant: GET_CODE (X) == EXPR_LIST.
(is_a_helper <rtx_expr_list *>::test): New.
(rtx_expr_list::next): New.
(rtx_expr_list::element): New.
(gen_rtx_EXPR_LIST): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214601 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/coretypes.h | 1 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 7 | ||||
-rw-r--r-- | gcc/gengenrtl.c | 3 | ||||
-rw-r--r-- | gcc/rtl.h | 36 |
5 files changed, 58 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0aae07faee2..dbdae273604 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 2014-08-27 David Malcolm <dmalcolm@redhat.com> + * coretypes.h (class rtx_expr_list): Add forward declaration. + * emit-rtl.c (gen_rtx_EXPR_LIST): New. + * gengenrtl.c (special_rtx): Add EXPR_LIST. + * rtl.h (class rtx_expr_list): New subclass of rtx_def, adding + invariant: GET_CODE (X) == EXPR_LIST. + (is_a_helper <rtx_expr_list *>::test): New. + (rtx_expr_list::next): New. + (rtx_expr_list::element): New. + (gen_rtx_EXPR_LIST): New. + +2014-08-27 David Malcolm <dmalcolm@redhat.com> + * varasm.c (mark_constants): Convert a GET_CODE check into a dyn_cast, strengthening local "seq" from rtx to rtx_sequence *. Use methods of rtx_sequence to clarify the code. diff --git a/gcc/coretypes.h b/gcc/coretypes.h index d5d4885a0ec..9951f101654 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -60,6 +60,7 @@ typedef const struct rtx_def *const_rtx; hierarchy, along with the relevant invariant. Where possible, keep this list in the same order as in rtl.def. */ class rtx_def; + class rtx_expr_list; /* GET_CODE (X) == EXPR_LIST */ class rtx_insn_list; /* GET_CODE (X) == INSN_LIST */ class rtx_sequence; /* GET_CODE (X) == SEQUENCE */ class rtx_insn; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index cffb8db40f4..f5ec8b4493b 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -409,6 +409,13 @@ gen_raw_REG (enum machine_mode mode, int regno) functions do the raw handling. If you add to this list, modify special_rtx in gengenrtl.c as well. */ +rtx_expr_list * +gen_rtx_EXPR_LIST (enum machine_mode mode, rtx expr, rtx expr_list) +{ + return as_a <rtx_expr_list *> (gen_rtx_fmt_ee (EXPR_LIST, mode, expr, + expr_list)); +} + rtx_insn_list * gen_rtx_INSN_LIST (enum machine_mode mode, rtx insn, rtx insn_list) { diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index cd2934126af..885dd200c27 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -123,7 +123,8 @@ special_format (const char *fmt) static int special_rtx (int idx) { - return (strcmp (defs[idx].enumname, "INSN_LIST") == 0 + return (strcmp (defs[idx].enumname, "EXPR_LIST") == 0 + || strcmp (defs[idx].enumname, "INSN_LIST") == 0 || strcmp (defs[idx].enumname, "CONST_INT") == 0 || strcmp (defs[idx].enumname, "REG") == 0 || strcmp (defs[idx].enumname, "SUBREG") == 0 diff --git a/gcc/rtl.h b/gcc/rtl.h index fe8201dca72..4f8533de71f 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -402,6 +402,28 @@ struct GTY((desc("0"), tag("0"), } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u; }; +/* A node for constructing singly-linked lists of rtx. */ + +class GTY(()) rtx_expr_list : public rtx_def +{ + /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */ + +public: + /* Get next in list. */ + rtx_expr_list *next () const; + + /* Get at the underlying rtx. */ + rtx element () const; +}; + +template <> +template <> +inline bool +is_a_helper <rtx_expr_list *>::test (rtx rt) +{ + return rt->code == EXPR_LIST; +} + class GTY(()) rtx_insn_list : public rtx_def { /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST). @@ -1233,6 +1255,19 @@ extern void rtl_check_failed_flag (const char *, const_rtx, const char *, #define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx) +/* Methods of rtx_expr_list. */ + +inline rtx_expr_list *rtx_expr_list::next () const +{ + rtx tmp = XEXP (this, 1); + return safe_as_a <rtx_expr_list *> (tmp); +} + +inline rtx rtx_expr_list::element () const +{ + return XEXP (this, 0); +} + /* Methods of rtx_insn_list. */ inline rtx_insn_list *rtx_insn_list::next () const @@ -3048,6 +3083,7 @@ get_mem_attrs (const_rtx x) generation functions included above do the raw handling. If you add to this list, modify special_rtx in gengenrtl.c as well. */ +extern rtx_expr_list *gen_rtx_EXPR_LIST (enum machine_mode, rtx, rtx); extern rtx_insn_list *gen_rtx_INSN_LIST (enum machine_mode, rtx, rtx); extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT); extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec); |