diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-08-19 00:26:56 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-08-19 00:26:56 +0000 |
commit | ef0fe503088eaf82df1665f7e32b090c5f3b5374 (patch) | |
tree | b36c1adf97283d550b96e06e464780e67b445c90 /gcc | |
parent | a140b66ba7419e17673cc2bbd5facb8c846f0b0c (diff) | |
download | gcc-ef0fe503088eaf82df1665f7e32b090c5f3b5374.zip gcc-ef0fe503088eaf82df1665f7e32b090c5f3b5374.tar.gz gcc-ef0fe503088eaf82df1665f7e32b090c5f3b5374.tar.bz2 |
Replace BB_HEAD et al macros with functions
gcc/
2014-08-19 David Malcolm <dmalcolm@redhat.com>
* basic-block.h (BB_HEAD): Convert to a function. Strengthen the
return type from rtx to rtx_insn *.
(BB_END): Likewise.
(BB_HEADER): Likewise.
(BB_FOOTER): Likewise.
(SET_BB_HEAD): Convert to a function.
(SET_BB_END): Likewise.
(SET_BB_HEADER): Likewise.
(SET_BB_FOOTER): Likewise.
* cfgrtl.c (BB_HEAD): New function, from macro of same name.
Strengthen the return type from rtx to rtx_insn *. For now, this
is done by adding a checked cast, but this will eventually
become a field lookup.
(BB_END): Likewise.
(BB_HEADER): Likewise.
(BB_FOOTER): Likewise.
(SET_BB_HEAD): New function, from macro of same name. This is
intended for use as an lvalue, and so returns an rtx& to allow
in-place modification.
(SET_BB_END): Likewise.
(SET_BB_HEADER): Likewise.
(SET_BB_FOOTER): Likewise.
From-SVN: r214126
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/basic-block.h | 26 | ||||
-rw-r--r-- | gcc/cfgrtl.c | 60 |
3 files changed, 101 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6f2c4b..8ccdde2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2014-08-19 David Malcolm <dmalcolm@redhat.com> + + * basic-block.h (BB_HEAD): Convert to a function. Strengthen the + return type from rtx to rtx_insn *. + (BB_END): Likewise. + (BB_HEADER): Likewise. + (BB_FOOTER): Likewise. + (SET_BB_HEAD): Convert to a function. + (SET_BB_END): Likewise. + (SET_BB_HEADER): Likewise. + (SET_BB_FOOTER): Likewise. + + * cfgrtl.c (BB_HEAD): New function, from macro of same name. + Strengthen the return type from rtx to rtx_insn *. For now, this + is done by adding a checked cast, but this will eventually + become a field lookup. + (BB_END): Likewise. + (BB_HEADER): Likewise. + (BB_FOOTER): Likewise. + (SET_BB_HEAD): New function, from macro of same name. This is + intended for use as an lvalue, and so returns an rtx& to allow + in-place modification. + (SET_BB_END): Likewise. + (SET_BB_HEADER): Likewise. + (SET_BB_FOOTER): Likewise. + 2014-08-18 David Malcolm <dmalcolm@redhat.com> * basic-block.h (BB_HEAD): Split macro in two: the existing one, diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 98cb00c..d6aebb4 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -368,17 +368,21 @@ struct GTY(()) control_flow_graph { /* Stuff for recording basic block info. */ -/* These macros are currently split into two: - one suitable for reading, and for writing. - These will become functions in a follow-up patch. */ -#define BB_HEAD(B) (((const_basic_block)B)->il.x.head_) -#define SET_BB_HEAD(B) (B)->il.x.head_ -#define BB_END(B) (((const rtl_bb_info *)(B)->il.x.rtl)->end_) -#define SET_BB_END(B) (B)->il.x.rtl->end_ -#define BB_HEADER(B) (((const rtl_bb_info *)(B)->il.x.rtl)->header_) -#define SET_BB_HEADER(B) (B)->il.x.rtl->header_ -#define BB_FOOTER(B) (((const rtl_bb_info *)(B)->il.x.rtl)->footer_) -#define SET_BB_FOOTER(B) (B)->il.x.rtl->footer_ +/* For now, these will be functions (so that they can include checked casts + to rtx_insn. Once the underlying fields are converted from rtx + to rtx_insn, these can be converted back to macros. */ + +extern rtx_insn *BB_HEAD (const_basic_block bb); +extern rtx& SET_BB_HEAD (basic_block bb); + +extern rtx_insn *BB_END (const_basic_block bb); +extern rtx& SET_BB_END (basic_block bb); + +extern rtx_insn *BB_HEADER (const_basic_block bb); +extern rtx& SET_BB_HEADER (basic_block bb); + +extern rtx_insn *BB_FOOTER (const_basic_block bb); +extern rtx& SET_BB_FOOTER (basic_block bb); /* Special block numbers [markers] for entry and exit. Neither of them is supposed to hold actual statements. */ diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 6543762..671d5f3 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -5091,4 +5091,64 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { rtl_account_profile_record, }; +/* BB_HEAD as an rvalue. */ + +rtx_insn *BB_HEAD (const_basic_block bb) +{ + rtx insn = bb->il.x.head_; + return safe_as_a <rtx_insn *> (insn); +} + +/* BB_HEAD for use as an lvalue. */ + +rtx& SET_BB_HEAD (basic_block bb) +{ + return bb->il.x.head_; +} + +/* BB_END as an rvalue. */ + +rtx_insn *BB_END (const_basic_block bb) +{ + rtx insn = bb->il.x.rtl->end_; + return safe_as_a <rtx_insn *> (insn); +} + +/* BB_END as an lvalue. */ + +rtx& SET_BB_END (basic_block bb) +{ + return bb->il.x.rtl->end_; +} + +/* BB_HEADER as an rvalue. */ + +rtx_insn *BB_HEADER (const_basic_block bb) +{ + rtx insn = bb->il.x.rtl->header_; + return safe_as_a <rtx_insn *> (insn); +} + +/* BB_HEADER as an lvalue. */ + +rtx& SET_BB_HEADER (basic_block bb) +{ + return bb->il.x.rtl->header_; +} + +/* BB_FOOTER as an rvalue. */ + +rtx_insn *BB_FOOTER (const_basic_block bb) +{ + rtx insn = bb->il.x.rtl->footer_; + return safe_as_a <rtx_insn *> (insn); +} + +/* BB_FOOTER as an lvalue. */ + +rtx& SET_BB_FOOTER (basic_block bb) +{ + return bb->il.x.rtl->footer_; +} + #include "gt-cfgrtl.h" |