diff options
Diffstat (limited to 'gcc/ipa-hello-world.c')
-rw-r--r-- | gcc/ipa-hello-world.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/gcc/ipa-hello-world.c b/gcc/ipa-hello-world.c index e35fdf01145..1c8eaf285d8 100644 --- a/gcc/ipa-hello-world.c +++ b/gcc/ipa-hello-world.c @@ -335,6 +335,78 @@ mark_escaping_function(ptrset_t &types, typemap &calc, cgraph_node *cnode) } static void +calculate_escaping_types_from_cast(ptrset_t &types, typemap &calc, gimple *stmt) +{ + is_gimple_code(stmt, GIMPLE_ASSIGN); + const_tree lhs = gimple_assign_lhs(stmt); + gcc_assert(lhs); + const_tree rhs = gimple_assign_rhs1(stmt); + gcc_assert(rhs); + +} + +static void +calculate_escaping_types_from_assign(ptrset_t &types, typemap &calc, gimple *stmt) +{ + is_gimple_code(stmt, GIMPLE_ASSIGN); + // If it is a cast, we must look at the lhs and the rhs... + const enum gimple_rhs_class gclass = gimple_assign_rhs_class(stmt); + switch(gclass) + { + case GIMPLE_TERNARY_RHS: + /* fall-through */ + case GIMPLE_BINARY_RHS: + /* fall-through */ + case GIMPLE_UNARY_RHS: + case GIMPLE_SINGLE_RHS: + calculate_escaping_types_from_cast(types, calc, stmt); + break; + default: + gcc_unreachable(); + break; + } +} + +static void +calculate_escaping_types_from_stmt(ptrset_t &types, typemap &calc, undefset &undef, gimple *stmt) +{ + // Should be the same as ipa-type-collector.c + // Otherwise, we might be skipping exploring some paths... + gcc_assert(stmt); + const enum gimple_code code = gimple_code (stmt); + switch (code) + { + case GIMPLE_ASSIGN: + calculate_escaping_types_from_assign(types, calc, stmt); + break; + case GIMPLE_CALL: + calculate_escaping_types_from_call(types, calc, undef, stmt); + break; + case GIMPLE_COND: + calculate_escaping_types_from_cond(types, calc, stmt); + break; + case GIMPLE_RETURN: + calculate_escaping_types_from_return(types, calc, stmt); + break; + case GIMPLE_LABEL: + case GIMPLE_PREDICT: + case GIMPLE_DEBUG: + case GIMPLE_SWITCH: +#ifdef FUZZ_MODE + gcc_unreachable(); +#endif + break; + default: + { + const char* name = gimple_code_name[code]; + log("gimple code name %s\n", name); + gcc_unreachable(); + } + break; + } +} + +static void calculate_escaping_types_from_bb(ptrset_t &types, typemap &calc, undefset &undef, basic_block bb) { gcc_assert(bb); |