summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bearch.c
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2014-10-13 17:38:03 +0200
committerChristoph Mallon <mallon@cs.uni-saarland.de>2014-10-13 18:39:11 +0200
commit9887aa54b418f2a7cdcfdb853a563c923e618eb8 (patch)
tree917de004a3e05a04cbfbb7ec6152e7a32095e434 /ir/be/bearch.c
parent79885a189d2ea807e87eec202fff4248d758ab77 (diff)
be: Factorise code to get the register Projs of the backend start nodes.
Diffstat (limited to 'ir/be/bearch.c')
-rw-r--r--ir/be/bearch.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/ir/be/bearch.c b/ir/be/bearch.c
index b7fc356..8937b98 100644
--- a/ir/be/bearch.c
+++ b/ir/be/bearch.c
@@ -258,3 +258,32 @@ void arch_dump_reqs_and_registers(FILE *F, const ir_node *node)
}
fprintf(F, " (0x%x)\n", (unsigned)flags);
}
+
+void be_make_start_mem(be_start_info_t *const info, ir_node *const start, unsigned const pos)
+{
+ info->pos = pos;
+ info->irn = NULL;
+ arch_set_irn_register_req_out(start, pos, arch_no_register_req);
+}
+
+void be_make_start_out(be_start_info_t *const info, struct obstack *const obst, ir_node *const start, unsigned const pos, arch_register_t const *const reg, arch_register_req_type_t const flags)
+{
+ info->pos = pos;
+ info->irn = NULL;
+ arch_register_req_t const *const req =
+ flags == arch_register_req_type_none ? reg->single_req :
+ be_create_reg_req(obst, reg, flags);
+ arch_set_irn_register_req_out(start, pos, req);
+ arch_set_irn_register_out(start, pos, reg);
+}
+
+ir_node *be_get_start_proj(ir_graph *const irg, be_start_info_t *const info)
+{
+ if (!info->irn) {
+ /* This is already the transformed start node. */
+ ir_node *const start = get_irg_start(irg);
+ arch_register_class_t const *const cls = arch_get_irn_register_req_out(start, info->pos)->cls;
+ info->irn = new_r_Proj(start, cls ? cls->mode : mode_M, info->pos);
+ }
+ return info->irn;
+}