summaryrefslogtreecommitdiffhomepage
path: root/ir/be/betranshlp.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-12-22 06:22:40 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2016-12-22 09:52:38 +0100
commita367d208bcbaa7ca4a909f1ad4ed97c673e8fcb5 (patch)
tree932f5abbac571849af180a7af42e764a5e78d578 /ir/be/betranshlp.c
parentb165fe1a748ef81ec6f9aaf6fb5e3e730183dba5 (diff)
be: Factor out code to collect all parameter entities.
Diffstat (limited to 'ir/be/betranshlp.c')
-rw-r--r--ir/be/betranshlp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ir/be/betranshlp.c b/ir/be/betranshlp.c
index 53f9ea5..1d78376 100644
--- a/ir/be/betranshlp.c
+++ b/ir/be/betranshlp.c
@@ -715,6 +715,26 @@ void be_stack_finish(be_stack_env_t *const env)
DEL_ARR_F(changes);
}
+ir_entity **be_collect_parameter_entities(ir_graph *const irg)
+{
+ ir_entity *const fun_ent = get_irg_entity(irg);
+ ir_type *const fun_type = get_entity_type(fun_ent);
+ size_t const n_params = get_method_n_params(fun_type);
+ ir_entity **const params = XMALLOCNZ(ir_entity*, n_params);
+ ir_type *const frame_type = get_irg_frame_type(irg);
+ for (size_t f = get_compound_n_members(frame_type); f-- > 0;) {
+ ir_entity *const member = get_compound_member(frame_type, f);
+ if (is_parameter_entity(member)) {
+ size_t const num = get_entity_parameter_number(member);
+ assert(num < n_params);
+ if (params[num])
+ panic("multiple entities for parameter %u in %+F found", f, irg);
+ params[num] = member;
+ }
+ }
+ return params;
+}
+
void be_add_parameter_entity_stores_list(ir_graph *irg, unsigned n_entities,
ir_entity **entities)
{