2 static char rcsid[] = "$Id: equiv.c,v 0.6 1994/06/24 13:27:11 ceriel Exp $";
16 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
17 * See the copyright notice in the ACK home directory, in the file "Copyright".
19 * Author: Hans van Staveren
22 extern string myalloc();
31 tuples(regls,nregneeded) rl_p *regls; {
34 register struct reginfo *rp;
37 * First compute equivalence classes of registers.
40 for (i=NREGS, rp = &machregs[NREGS-1];--i>=0;rp--) {
41 regclass[i] = class++;
42 if (getrefcount(i, FALSE) == 0) {
43 for (j=NREGS;--j>i;) {
44 if (eqregclass(i,j) &&
45 eqtoken(&rp->r_contents,
46 &machregs[j].r_contents)) {
47 regclass[i] = regclass[j];
55 * Now create tuples through a recursive function
58 maxindex = nregneeded;
66 register struct perm *pp;
70 if (index == maxindex) {
71 for (pp=perms; pp != 0; pp=pp->p_next) {
72 for (i=0; i<maxindex; i++)
73 if (regclass[rar[i]] != regclass[pp->p_rar[i]])
75 for (i=0; i<maxindex; i++) {
76 int rari = rar[i], p_rari = pp->p_rar[i];
78 if (clash(rari,rar[j]) !=
79 clash(p_rari,pp->p_rar[j]))
85 pp = (struct perm *) myalloc(sizeof ( *pp ));
87 for (i=0; i<maxindex; i++)
88 pp->p_rar[i] = rar[i];
92 for (i=rlp->rl_n; i>0; i--) {
93 rar[index] = rlp->rl_list[rlp->rl_n-i];