summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bearch.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-01-14 10:06:40 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2016-01-14 10:37:04 +0100
commit493826e29bda93cfd10d66c0e7175405054e9169 (patch)
tree544a6b51bc560502ee6a7430b3ba1136e8f277ff /ir/be/bearch.c
parent543a4b6875f7c599628bcb36cb11cbfd56ea84d3 (diff)
be: Assert that the register can be assigned to the given node in arch_set_irn_register{,_out}().
Diffstat (limited to 'ir/be/bearch.c')
-rw-r--r--ir/be/bearch.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ir/be/bearch.c b/ir/be/bearch.c
index 9643ccf..10d1ef4 100644
--- a/ir/be/bearch.c
+++ b/ir/be/bearch.c
@@ -81,17 +81,23 @@ const arch_register_t *arch_get_irn_register_in(const ir_node *node, int pos)
return arch_get_irn_register(op);
}
+static inline void set_out_info_reg(reg_out_info_t *const out, arch_register_t const *const reg)
+{
+ assert(arch_reg_is_allocatable(out->req, reg));
+ out->reg = reg;
+}
+
void arch_set_irn_register_out(ir_node *node, unsigned pos,
const arch_register_t *reg)
{
reg_out_info_t *out = get_out_info_n(node, pos);
- out->reg = reg;
+ set_out_info_reg(out, reg);
}
void arch_set_irn_register(ir_node *node, const arch_register_t *reg)
{
reg_out_info_t *out = get_out_info(node);
- out->reg = reg;
+ set_out_info_reg(out, reg);
}
bool arch_reg_is_allocatable(const arch_register_req_t *req,