using std::cerr;
int ra_coalesce::run() {
-
- sh.coal.run();
-
- return 0;
+ return sh.coal.run();
}
void coalescer::add_edge(value* a, value* b, unsigned cost) {
}
}
-void coalescer::run() {
+int coalescer::run() {
+ int r;
+
RA_DUMP( dump_edges(); );
build_chunks();
build_constraint_queue();
RA_DUMP( dump_constraint_queue(); );
- color_constraints();
+ if ((r = color_constraints()))
+ return r;
build_chunk_queue();
color_chunks();
+
+ return 0;
}
void coalescer::color_phi_constraint(ra_constraint* c) {
}
-void coalescer::color_reg_constraint(ra_constraint *c) {
+int coalescer::color_reg_constraint(ra_constraint *c) {
unsigned k, cnt = c->values.size();
vvec & cv = c->values;
} while (std::next_permutation(swz, swz + 4));
+ if (!done && pass) {
+ cerr << "sb: ra_coalesce - out of registers\n";
+ return -1;
+ }
+
if (pass == 0 && done)
break;
color_chunk(cc, color);
cc->fix();
}
+
+ return 0;
}
-void coalescer::color_constraints() {
+int coalescer::color_constraints() {
+ int r;
+
for (constraint_queue::iterator I = constraints.begin(),
E = constraints.end(); I != E; ++I) {
dump_constraint(c);
);
- if (c->kind == CK_SAME_REG)
- color_reg_constraint(c);
- else if (c->kind == CK_PHI)
+ if (c->kind == CK_SAME_REG) {
+ if ((r = color_reg_constraint(c)))
+ return r;
+ } else if (c->kind == CK_PHI)
color_phi_constraint(c);
}
+ return 0;
}
} // namespace r600_sb
coalescer(shader &sh) : sh(sh), edges(), chunks(), constraints() {}
~coalescer();
- void run();
+ int run();
void add_edge(value *a, value *b, unsigned cost);
void build_chunks();
void build_constraint_queue();
void build_chunk_queue();
- void color_constraints();
+ int color_constraints();
void color_chunks();
ra_constraint* create_constraint(constraint_kind kind);
void unify_chunks(ra_edge *e);
bool chunks_interference(ra_chunk *c1, ra_chunk *c2);
- void color_reg_constraint(ra_constraint *c);
+ int color_reg_constraint(ra_constraint *c);
void color_phi_constraint(ra_constraint *c);