From: Sebastian Buchwald Date: Wed, 1 Oct 2008 11:23:05 +0000 (+0000) Subject: PBQP now doesn't find a solution, if we modified the costs a little bit. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=35fe54e2f763387aec7545540a5f41a989ae5e67;p=libfirm PBQP now doesn't find a solution, if we modified the costs a little bit. - removed unused global variables - added documentation :-) now the PBQP solver need some new features... [r22390] --- diff --git a/ir/be/test/pbqpHeur2.c b/ir/be/test/pbqpHeur2.c index 50aca8b29..9f01d9aa0 100644 --- a/ir/be/test/pbqpHeur2.c +++ b/ir/be/test/pbqpHeur2.c @@ -1,12 +1,33 @@ +/** + * This test case should provoke incompatible heuristical decision of the + * PBQP solver, which lead to infinity cost, i.e. no solution of the PBQP could + * found. + * + * It is necessary to manipulation some cost vectors to let the PBQP solver + * "crash". More details are shown below. + * + * This also seems more a missing feature of the PBQP solver than a counter + * example against the PBQP approach for instruction selection. + */ + unsigned *block; -unsigned *block1, *block2, *block3, *block4, *block5, *block6, *block7; -unsigned *block8,*block9,*block10,*block11,*block12,*block13,*block14,*block15,*block16,*block17,*block18,*block19; -unsigned *block20,*block21,*block22,*block23; +unsigned *block1, *block2, *block3, *block4, *block5, *block6; +unsigned *block7, *block8,*block9,*block10,*block11; volatile unsigned arr[100]; -unsigned ca,cb,cc,cd,ce; unsigned b = 3008; +unsigned g1,g2,g3; +unsigned g4,g5,g6; +unsigned g7,g8; +unsigned h1,h2,h3; +unsigned h4,h5,h6; +unsigned h7,h8,h9; +unsigned k1,k2,k3; +unsigned k4,k5,k6; +unsigned kb1,kb2,kb3; +unsigned kc1,kc2,kc3; +unsigned kd1,kd2,kd3; +unsigned ke1,ke2,ke3; -// TODO what if we use unsigned* instead of char*? unsigned k3_3(char* base, unsigned i1, unsigned i2, unsigned i3, unsigned k1, unsigned k2, unsigned k3) { char a1, a2, a3; @@ -91,33 +112,28 @@ unsigned k3_3_am(char* base, unsigned i1, unsigned i2, unsigned i3, unsigned k1, return 0; } -unsigned g1,g2,g3; -unsigned g4,g5,g6; -unsigned g7,g8,g9; -unsigned g10,g11,g12; -unsigned h1,h2,h3; -unsigned h4,h5,h6; -unsigned h7,h8,h9; -unsigned k1,k2,k3; -unsigned k4,k5,k6; -unsigned k7,k8,k9; -unsigned k10,k11,k12; -unsigned kb1,kb2,kb3; -unsigned kb4,kb5,kb6; -unsigned kc1,kc2,kc3; -unsigned kc4,kc5,kc6; -unsigned kd1,kd2,kd3; -unsigned kd4,kd5,kd6; -unsigned ke1,ke2,ke3; -unsigned ke4,ke5,ke6; -unsigned s1,s2,s3; -unsigned s4,s5,s6; -unsigned s7,s8,s9; - void full_am(unsigned base, int index, unsigned base2, int index2, unsigned base3, int index3, unsigned base4, int index4, unsigned base5, int index5) { + /* + * This is the core of this example. + * The following line can be done with one instruction + * (add with address mode) on x86. + * We provoke four heuristical decision on nodes of this address mode + * pattern. The mean idea is that the root (the add node) choose this + * pattern, but the decision on the shift const forbid these. + * To achieve this you have to manipulate the cost of the shift const by + * hand! + * The other two heuristical decision ensure, that the two heuristical + * decision above are separated, i.e. there are at least two irreducible + * nodes between them. + */ unsigned ca = arr[index] + base; + /* + * The following function ensure irreducible users of given nodes. + * All of these function have to be inlined. + */ + /* users for shift const */ b = k3_3_am(block, h1, h2, h3, 2, 3, 4); b = k3_3_am(block, h4, h5, h6, 2, 5, 6); @@ -125,24 +141,24 @@ void full_am(unsigned base, int index, unsigned base2, int index2, unsigned base /* users for symconst */ unsigned cb = arr[index2] + base2; - b = k3_3(block12, cb, kb1, kb2, 101, 102, 103); + b = k3_3(block1, cb, kb1, kb2, 101, 102, 103); unsigned cc = arr[index3] + base3; - b = k3_3(block15, cc, kc1, kc2, 111, 112, 113); + b = k3_3(block2, cc, kc1, kc2, 111, 112, 113); unsigned cd = arr[index4] + base4; - b = k3_3(block18, cd, kd1, kd2, 121, 122, 123); + b = k3_3(block3, cd, kd1, kd2, 121, 122, 123); unsigned ce = arr[index5] + base5; - b = k3_3(block21, ce, ke1, ke2, 131, 132, 133); + b = k3_3(block4, ce, ke1, ke2, 131, 132, 133); /* users for offset */ - b = k3_3_2(block1, 4 * index, g2, g3, 31, 32, 33); - b = k3_3_2(block2, 4 * index, g5, g6, 34, 35, 36); - b = k3_3_2(block6, 4 * index, g7, g8, 37, 38, 39); - b = k3_3_2(block7, 4 * index, g9, g10, 40, 41, 42); + b = k3_3_2(block5, 4 * index, g1, g2, 31, 32, 33); + b = k3_3_2(block6, 4 * index, g3, g4, 34, 35, 36); + b = k3_3_2(block7, 4 * index, g5, g6, 37, 38, 39); + b = k3_3_2(block8, 4 * index, g7, g8, 40, 41, 42); /* users for computed value */ - b = k3_3(block3, ca, k8, k9, 13, 14, 15); - b = k3_3(block4, ca, k11, k12, 16, 17, 18); - b = k3_3(block5, ca, k7, k10, 19, 20, 21); + b = k3_3(block9, ca, k1, k2, 13, 14, 15); + b = k3_3(block10, ca, k3, k4, 16, 17, 18); + b = k3_3(block11, ca, k5, k6, 19, 20, 21); } int main(int argc, char **argv) {