int printo(u32 x) { if (x==0) putc('\0'); else rpo(x); }
int rpo(u16 x){ char c; if(x){ c = table[x % BASE_8]; rpo(x / BASE_8); putc(c); } }
int printo(u32 x) { if (x==0) putchar('0'); else rpo(x); putchar(' '); }
int rpo(u32 x) { char c; if (x){ c = table[x % BASE_OCT]; rpo(x / BASE_OCT); putc(c); } }
NatSetDense* DominanceInfo::do_dominators(bool direction) const { CfgNodeListRpo rpo(_graph, direction); bool changed = false; int cfg_size = nodes_size(_graph); // allocate and initialize the new bit vectors NatSetDense *d = new NatSetDense[cfg_size]; for (int i = 0; i < cfg_size; i++) d[i].insert_all(); // set up the first node CfgNode *start = (direction == FORWARD ? get_entry_node(_graph) : get_exit_node(_graph)); d[get_number(start)].remove_all(); d[get_number(start)].insert(get_number(start)); NatSetDense t; // iterate until no changes do { changed = false; for (CfgNodeHandle nh = rpo.start(); nh != rpo.end(); ++nh) { CfgNode *n = *nh; if (n == start) continue; // get intersection of predecessors of n t.insert_all(); CfgNodeHandle h; int count; if (direction == FORWARD) { h = preds_start(n); count = preds_size(n); } else { h = succs_start(n); count = succs_size(n); } for (int i = 0; i < count; ++i, ++h) t *= d[get_number(*h)]; // include itself in dominator set t.insert(get_number(n)); // check if there were any changes if (d[get_number(n)] != t) { d[get_number(n)] = t; changed = true; } } } while (changed); return d; }
int printo(u16 o){ if(o==0) putc('0'); else rpo(o); }