X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fopt_inline.c;h=661a5ac74169c04c5d7c9b0d411ecb99f053d8c4;hb=762b472fc81c73cf7a1b0041b8cd286b7206d79d;hp=6c5e336c31d88dbcfcc8dcd68c062d22a12b7ba0;hpb=eb7ac83b870791219e7a50cc262f2f1ee9c01b39;p=libfirm diff --git a/ir/opt/opt_inline.c b/ir/opt/opt_inline.c index 6c5e336c3..661a5ac74 100644 --- a/ir/opt/opt_inline.c +++ b/ir/opt/opt_inline.c @@ -155,6 +155,9 @@ static void find_addr(ir_node *node, void *env) /* access to value_type */ *allow_inline = false; } + if (is_parameter_entity(ent)) { + *allow_inline = false; + } } } else if (is_Alloc(node) && get_Alloc_where(node) == stack_alloc) { /* From GCC: @@ -291,6 +294,7 @@ static void copy_frame_entities(ir_graph *from, ir_graph *to) ir_entity *old_ent = get_class_member(from_frame, i); ir_entity *new_ent = copy_entity_own(old_ent, to_frame); set_entity_link(old_ent, new_ent); + assert (!is_parameter_entity(old_ent)); } } @@ -1357,10 +1361,12 @@ static int calc_inline_benefice(call_entry *entry, ir_graph *callee) { ir_node *call = entry->call; ir_entity *ent = get_irg_entity(callee); + ir_type *callee_frame; + size_t i, n_members, n_params; ir_node *frame_ptr; ir_type *mtp; int weight = 0; - int i, n_params, all_const; + int all_const; unsigned cc, v; irg_inline_property prop; @@ -1373,6 +1379,18 @@ static int calc_inline_benefice(call_entry *entry, ir_graph *callee) return entry->benefice = INT_MIN; } + callee_frame = get_irg_frame_type(callee); + n_members = get_class_n_members(callee_frame); + for (i = 0; i < n_members; ++i) { + ir_entity *frame_ent = get_class_member(callee_frame, i); + if (is_parameter_entity(frame_ent)) { + // TODO inliner should handle parameter entities by inserting Store operations + DB((dbg, LEVEL_2, "In %+F Call to %+F: inlining forbidden due to parameter entity\n", call, callee)); + set_irg_inline_property(callee, irg_inline_forbidden); + return entry->benefice = INT_MIN; + } + } + if (get_irg_additional_properties(callee) & mtp_property_noreturn) { DB((dbg, LEVEL_2, "In %+F Call to %+F: not inlining noreturn or weak\n", call, callee)); @@ -1385,7 +1403,7 @@ static int calc_inline_benefice(call_entry *entry, ir_graph *callee) cc = get_method_calling_convention(mtp); if (cc & cc_reg_param) { /* register parameter, smaller costs for register parameters */ - int max_regs = cc & ~cc_bits; + size_t max_regs = cc & ~cc_bits; if (max_regs < n_params) weight += max_regs * 2 + (n_params - max_regs) * 5;