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-09-08 08:58:00 +0200 |
commit | 9651d2f47106fc1ae9773c06cd9974cea5180155 (patch) | |
tree | e6d6e867a818389e56f52a47fcff49bbc8d8cda1 | |
parent | 68a848abb8dbfcfe34c485bca84d793fb6a956cc (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 6cc7e66059d..ea5e6100741 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -6397,6 +6397,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 * @@ -6405,15 +6422,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: |