#include "irnodeset.h"
#include "absgraph.h"
-#include "statev.h"
+#include "statev_t.h"
#include "beutil.h"
#include "belive_t.h"
be_lv_info_node_t *res = NULL;
stat_ev_tim_push();
- irn_live = (be_lv_info_t*)ir_nodehashmap_get(&li->map, bl);
+ irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
if (irn_live != NULL) {
unsigned idx = get_irn_idx(irn);
static be_lv_info_node_t *be_lv_get_or_set(be_lv_t *li, ir_node *bl,
ir_node *irn)
{
- be_lv_info_t *irn_live = (be_lv_info_t*)ir_nodehashmap_get(&li->map, bl);
+ be_lv_info_t *irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
if (irn_live == NULL) {
irn_live = OALLOCNZ(&li->obst, be_lv_info_t, LV_STD_SIZE);
irn_live[0].head.n_size = LV_STD_SIZE-1;
static int be_lv_remove(be_lv_t *li, const ir_node *bl,
const ir_node *irn)
{
- be_lv_info_t *irn_live = (be_lv_info_t*)ir_nodehashmap_get(&li->map, bl);
+ be_lv_info_t *irn_live = ir_nodehashmap_get(be_lv_info_t, &li->map, bl);
if (irn_live != NULL) {
unsigned n = irn_live[0].head.n_members;
*/
static void liveness_for_node(ir_node *irn)
{
- const ir_edge_t *edge;
ir_node *def_block;
bitset_clear_all(re.visited);
void be_liveness_transfer(const arch_register_class_t *cls,
ir_node *node, ir_nodeset_t *nodeset)
{
- int i, arity;
-
/* You should better break out of your loop when hitting the first phi
* function. */
assert(!is_Phi(node) && "liveness_transfer produces invalid results for phi nodes");
- if (get_irn_mode(node) == mode_T) {
- const ir_edge_t *edge;
-
- foreach_out_edge(node, edge) {
- ir_node *proj = get_edge_src_irn(edge);
+ ir_node *value;
+ be_foreach_definition(node, cls, value,
+ ir_nodeset_remove(nodeset, value);
+ );
- if (arch_irn_consider_in_reg_alloc(cls, proj)) {
- ir_nodeset_remove(nodeset, proj);
- }
- }
- } else if (arch_irn_consider_in_reg_alloc(cls, node)) {
- ir_nodeset_remove(nodeset, node);
- }
-
- arity = get_irn_arity(node);
- for (i = 0; i < arity; ++i) {
+ int arity = get_irn_arity(node);
+ for (int i = 0; i < arity; ++i) {
ir_node *op = get_irn_n(node, i);
-
- if (arch_irn_consider_in_reg_alloc(cls, op))
- ir_nodeset_insert(nodeset, op);
+ if (!arch_irn_consider_in_reg_alloc(cls, op))
+ continue;
+ ir_nodeset_insert(nodeset, op);
}
}
const arch_register_class_t *cls,
const ir_node *block, ir_nodeset_t *live)
{
- int i;
-
assert(lv->sets_valid && "live sets must be computed");
- be_lv_foreach(lv, block, be_lv_state_end, i) {
- ir_node *node = be_lv_get_irn(lv, block, i);
+ be_lv_foreach(lv, block, be_lv_state_end, node) {
if (!arch_irn_consider_in_reg_alloc(cls, node))
continue;
const ir_node *pos, ir_nodeset_t *live)
{
const ir_node *bl = is_Block(pos) ? pos : get_nodes_block(pos);
- ir_node *irn;
be_liveness_end_of_block(lv, cls, bl, live);
sched_foreach_reverse(bl, irn) {