Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.99
 
1.100
 
MAIN:ragge:20040529141145
 
reader.c
_>703703 }
 704704 
 705705 /*
<>706 - * Count the number of registers needed to evaluate a tree.
 707 - * This is the trivial implementation, for machines with symmetric
 708 - * registers. Machines with difficult register assignment strategies
 709 - * will need to define this function themselves.
 710 - * Return value is the number of registers used so far.
 711 - */
 712 -int
 713 -sucomp(NODE *p)
 714 -{
 715 -        struct optab *q = &table[TBLIDX(p->n_su)];
 716 -        int left, right;
 717 -        int nreg;
 718 -
 719 -        if (p->n_su == -1)
 720 -                return sucomp(p->n_left);
 721 -
 722 -        if (p->n_op == UCALL) {
 723 -                if ((p->n_su & LMASK) && sucomp(p->n_left) < 0)
 724 -                        return -1;
 725 -                return fregs;
 726 -        }
 727 -
 728 -        nreg = (q->needs & NACOUNT) * szty(p->n_type);
 729 -
 730 -        switch (p->n_su & RMASK) {
 731 -        case RREG:
 732 -        case ROREG:
 733 -                if ((right = sucomp(p->n_right)) < 0)
 734 -                        return right;
 735 -                break;
 736 -        case RTEMP:
 737 -                cerror("sucomp RTEMP");
 738 -        default:
 739 -                right = 0;
 740 -        }
 741 -        switch (p->n_su & LMASK) {
 742 -        case LREG:
 743 -        case LOREG:
 744 -                if ((left = sucomp(p->n_left)) < 0)
 745 -                        return left;
 746 -                break;
 747 -        case LTEMP:
 748 -                cerror("sucomp LTEMP");
 749 -        default:
 750 -                left = 0;
 751 -        }
 752 -//printf("sucomp: node %p right %d left %d\n", p, right, left);
 753 -        if ((p->n_su & RMASK) && (p->n_su & LMASK) &&
 754 -            right + szty(p->n_left->n_type) > fregs &&
 755 -            left + szty(p->n_right->n_type) > fregs) {
 756 -                int r = p->n_right->n_op;
 757 -                int l = p->n_left->n_op;
 758 -                /*
 759 -                 * Must store one subtree. Store the tree
 760 -                 * with highest SU, or left.
 761 -                 * Be careful to not try to store an OREG.
 762 -                 */
 763 -                if (r == OREG && l == OREG)
 764 -                        comperr("sucomp: cannot generate code, node %p", p);
 765 -                if ((right > left && r != OREG) || l == OREG)
 766 -                        p->n_right = store(p->n_right);
 767 -                else
 768 -                        p->n_left = store(p->n_left);
 769 -                return -1;
 770 -        }
 771 -        if ((right+left) > fregs) {
 772 -                /* Almost out of regs, traverse the highest SU first */
 773 -                if (right > left)
 774 -                        p->n_su |= DORIGHT;
 775 -        } else if (right && (q->needs & NASL) && (q->rewrite & RLEFT)) {
 776 -                /* Make it easier to share regs */
 777 -                p->n_su |= DORIGHT;
 778 -        } else if (right > left) {
 779 -                p->n_su |= DORIGHT;
 780 -        }
 781 -        /* If both in regs and equal size, return l+r */
 782 -        if (left && left == right)
 783 -                left += right; /* returned below */
 784 -
 785 -        if (right > nreg)
 786 -                nreg = right;
 787 -        if (left > nreg)
 788 -                nreg = left;
 789 -        return nreg;
 790 -}
 791 -
 792 -/*
<_793706  * Rewrite node after instruction emit.
 794707  */
 795708 static void
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-02 14:28 +0200