summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorVadim Girlin <[email protected]>2013-04-23 10:34:42 +0400
committerVadim Girlin <[email protected]>2013-04-30 21:50:47 +0400
commit6d6c8c88a38ccdd453d2ad184e58b3eb35230a5a (patch)
treedd6b88fba0b3ee9bd7b83cdf338d127658ba9668 /src/gallium
parent188c893e65facb8826c58a6f0226b7508f2870fa (diff)
r600g/sb: improve error checking in ra_coalesce pass
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp35
-rw-r--r--src/gallium/drivers/r600/sb/sb_shader.h6
2 files changed, 27 insertions, 14 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp b/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp
index 52e76687b95..cec4bbc74de 100644
--- a/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp
+++ b/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp
@@ -40,10 +40,7 @@ namespace r600_sb {
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) {
@@ -417,7 +414,9 @@ coalescer::~coalescer() {
}
}
-void coalescer::run() {
+int coalescer::run() {
+ int r;
+
RA_DUMP( dump_edges(); );
build_chunks();
@@ -426,10 +425,13 @@ void coalescer::run() {
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) {
@@ -457,7 +459,7 @@ ra_chunk* coalescer::detach_value(value *v) {
}
-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;
@@ -558,6 +560,11 @@ void coalescer::color_reg_constraint(ra_constraint *c) {
} 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;
@@ -585,9 +592,13 @@ void coalescer::color_reg_constraint(ra_constraint *c) {
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) {
@@ -598,11 +609,13 @@ void coalescer::color_constraints() {
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
diff --git a/src/gallium/drivers/r600/sb/sb_shader.h b/src/gallium/drivers/r600/sb/sb_shader.h
index 5531fdaa092..039d1fa5c84 100644
--- a/src/gallium/drivers/r600/sb/sb_shader.h
+++ b/src/gallium/drivers/r600/sb/sb_shader.h
@@ -192,13 +192,13 @@ public:
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);
@@ -223,7 +223,7 @@ private:
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);