diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-05-14 10:58:54 +0200 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-05-14 14:46:21 +0200 |
commit | ac7e59f92eabb7c200e84e5a6947ac139810d8c0 (patch) | |
tree | c969510a71099b2df434c8cf8173bd36f76d9308 | |
parent | 50002c5ed291c8cc5b2c59692f94a8c7a19b8575 (diff) |
add collecting types for GIMPLE_RETURN
-rw-r--r-- | gcc/gimple.h | 28 | ||||
-rw-r--r-- | gcc/ipa-escape-analysis.c | 13 |
2 files changed, 34 insertions, 7 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index ca7fec6247e..e5b594a5b01 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -6494,6 +6494,23 @@ gimple_transaction_set_subcode (gtransaction *transaction_stmt, transaction_stmt->subcode = subcode; } + +/* Return the return value for GIMPLE_RETURN GS. */ + +static inline tree +gimple_return_retval (const greturn *gs) +{ + return gs->op[0]; +} + +static inline tree +gimple_return_retval(const gimple *gs) +{ + GIMPLE_CHECK(gs, GIMPLE_RETURN); + const greturn *gr = dyn_cast<const greturn *> (gs); + return gimple_return_retval (gr); +} + /* Return a pointer to the return value for GIMPLE_RETURN GS. */ static inline tree * @@ -6502,15 +6519,14 @@ gimple_return_retval_ptr (greturn *gs) return &gs->op[0]; } -/* Return the return value for GIMPLE_RETURN GS. */ - -static inline tree -gimple_return_retval (const greturn *gs) +static inline tree * +gimple_return_retval_ptr (gimple *gs) { - return gs->op[0]; + GIMPLE_CHECK(gs, GIMPLE_RETURN); + greturn *gr = dyn_cast<greturn *> (gs); + return gimple_return_retval_ptr (gr); } - /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ static inline void diff --git a/gcc/ipa-escape-analysis.c b/gcc/ipa-escape-analysis.c index a3d6a2cb191..5b0e878fb2c 100644 --- a/gcc/ipa-escape-analysis.c +++ b/gcc/ipa-escape-analysis.c @@ -470,6 +470,15 @@ collect_types_from_stmt_cond(gimple *stmt, typeset &types) } static void +collect_types_from_stmt_return(gimple *stmt, typeset &types) +{ + is_gimple_code(stmt, GIMPLE_RETURN); + const_tree retval = gimple_return_retval(stmt); + gcc_assert(retval); + collect_types_from_expr(retval); +} + +static void collect_types_from_stmt(gimple *stmt, typeset &types) { gcc_assert(stmt); @@ -484,8 +493,10 @@ collect_types_from_stmt(gimple *stmt, typeset &types) case GIMPLE_COND: collect_types_from_stmt_cond(stmt, types); break; - case GIMPLE_LABEL: case GIMPLE_RETURN: + collect_types_from_stmt_return(stmt, types); + break; + case GIMPLE_LABEL: case GIMPLE_PREDICT: break; default: |