2 static char rcsid[] = "$Id: equiv.c,v 2.4 1994/06/24 13:23:29 ceriel Exp $";
10 #include <cg_pattern.h>
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; {
36 * First compute equivalence classes of registers.
39 for (i=0;i<NREGS;i++) {
40 regclass[i] = class++;
41 if (getrefcount(i, FALSE) == 0) {
43 if (eqregclass(i,j) &&
44 eqtoken(&machregs[i].r_contents,
45 &machregs[j].r_contents)) {
46 regclass[i] = regclass[j];
54 * Now create tuples through a recursive function
57 maxindex = nregneeded;
65 register struct perm *pp;
69 if (index == maxindex) {
70 for (pp=perms; pp != 0; pp=pp->p_next) {
71 for (i=0; i<maxindex; i++)
72 if (regclass[rar[i]] != regclass[pp->p_rar[i]])
74 for (i=0; i<maxindex; i++)
76 if (clash(rar[i],rar[j]) !=
77 clash(pp->p_rar[i],pp->p_rar[j]))
82 pp = (struct perm *) myalloc(sizeof ( *pp ));
84 for (i=0; i<maxindex; i++)
85 pp->p_rar[i] = rar[i];
89 for (i=rlp->rl_n-1; i>=0; i--) {
90 rar[index] = rlp->rl_list[i];