summaryrefslogtreecommitdiffhomepage
path: root/ir/be/belive.h
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-01-09 18:51:13 +0100
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-01-09 19:36:28 +0100
commit87d50cbc3b2d23eac16c7204207a92295aaa24cb (patch)
treeb595c9fdfa6e720499d7335a8e35318a4dad7e00 /ir/be/belive.h
parentee066a1bfe80173b715483a95511d4cb7aa07344 (diff)
belive: Replace the union for head and nodes of the liveness sets by a struct with a flexible array member.
Diffstat (limited to 'ir/be/belive.h')
-rw-r--r--ir/be/belive.h30
1 files changed, 13 insertions, 17 deletions
diff --git a/ir/be/belive.h b/ir/be/belive.h
index b980ec8..3f02a85 100644
--- a/ir/be/belive.h
+++ b/ir/be/belive.h
@@ -143,14 +143,10 @@ struct be_lv_info_node_t {
unsigned flags;
};
-struct be_lv_info_head_t {
- unsigned n_members;
- unsigned n_size;
-};
-
-union be_lv_info_t {
- struct be_lv_info_head_t head;
- struct be_lv_info_node_t node;
+struct be_lv_info_t {
+ unsigned n_members;
+ unsigned n_size;
+ be_lv_info_node_t nodes[];
};
be_lv_info_node_t *be_lv_get(const be_lv_t *li, const ir_node *block,
@@ -215,7 +211,7 @@ static inline lv_iterator_t be_lv_iteration_begin(const be_lv_t *lv,
assert(lv->sets_valid);
lv_iterator_t res;
res.info = ir_nodehashmap_get(be_lv_info_t, &lv->map, block);
- res.i = res.info != NULL ? res.info[0].head.n_members : 0;
+ res.i = res.info ? res.info->n_members : 0;
return res;
}
@@ -223,10 +219,10 @@ static inline ir_node *be_lv_iteration_next(lv_iterator_t *iterator,
be_lv_state_t flags)
{
while (iterator->i != 0) {
- const be_lv_info_t *info = iterator->info + iterator->i--;
- assert(get_irn_mode(info->node.node) != mode_T);
- if (info->node.flags & flags)
- return info->node.node;
+ be_lv_info_node_t const *const node = &iterator->info->nodes[--iterator->i];
+ assert(get_irn_mode(node->node) != mode_T);
+ if (node->flags & flags)
+ return node->node;
}
return NULL;
}
@@ -236,12 +232,12 @@ static inline ir_node *be_lv_iteration_cls_next(lv_iterator_t *iterator,
const arch_register_class_t *cls)
{
while (iterator->i != 0) {
- const be_lv_info_t *info = iterator->info + iterator->i--;
- assert(get_irn_mode(info->node.node) != mode_T);
- if (!(info->node.flags & flags))
+ be_lv_info_node_t const *const lnode = &iterator->info->nodes[--iterator->i];
+ assert(get_irn_mode(lnode->node) != mode_T);
+ if (!(lnode->flags & flags))
continue;
- ir_node *node = info->node.node;
+ ir_node *const node = lnode->node;
if (!arch_irn_consider_in_reg_alloc(cls, node))
continue;
return node;