summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bearch.c
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-07-27 18:55:58 +0200
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-07-27 22:21:48 +0200
commit6b240a342fb12b37a1639da82728bb816c5793a1 (patch)
treeec32561295e2c287caf67f382b607170d3a210d9 /ir/be/bearch.c
parent8d14210e48e14de3b1d7bca00df590ca92700e0b (diff)
be: Introduce a constraint for memory outputs.
Diffstat (limited to 'ir/be/bearch.c')
-rw-r--r--ir/be/bearch.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/ir/be/bearch.c b/ir/be/bearch.c
index c48cb1b..a6a80f6 100644
--- a/ir/be/bearch.c
+++ b/ir/be/bearch.c
@@ -13,12 +13,27 @@
#include "benode.h"
#include "beinfo.h"
#include "beirg.h"
+#include "bemodule.h"
#include "ircons_t.h"
#include "irnode_t.h"
#include "irop_t.h"
#include "raw_bitset.h"
#include "util.h"
+static arch_register_class_t arch_memory_cls = {
+ .name = "memory",
+ .mode = NULL, /* Filled in at initialization. */
+ .regs = NULL,
+ .class_req = arch_memory_req,
+ .index = (unsigned)-1,
+ .n_regs = 0,
+ .manual_ra = true,
+};
+
+arch_register_req_t const arch_memory_requirement = {
+ .cls = &arch_memory_cls,
+};
+
static arch_register_class_t arch_none_cls = {
.name = "none",
.mode = NULL,
@@ -122,7 +137,7 @@ void be_make_start_mem(be_start_info_t *const info, ir_node *const start, unsign
{
info->pos = pos;
info->irn = NULL;
- arch_set_irn_register_req_out(start, pos, arch_no_register_req);
+ arch_set_irn_register_req_out(start, pos, arch_memory_req);
}
void be_make_start_out(be_start_info_t *const info, ir_node *const start,
@@ -144,7 +159,7 @@ ir_node *be_get_start_proj(ir_graph *const irg, be_start_info_t *const info)
/* 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->mode ? cls->mode : mode_M, info->pos);
+ info->irn = new_r_Proj(start, cls->mode, info->pos);
}
return info->irn;
}
@@ -155,3 +170,9 @@ void arch_copy_irn_out_info(ir_node *const dst, unsigned const dst_pos, ir_node
reg_out_info_t *const dst_info = get_out_info_n(dst, dst_pos);
*dst_info = *src_info;
}
+
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch)
+void be_init_arch(void)
+{
+ arch_memory_cls.mode = mode_M;
+}