Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.3
 
1.4
 
MAIN:ragge:20090522081802
 
local2.c
_>4141 
 4242 static int regoff[7];
 4343 static TWORD ftype;
<> 44+char *rbyte[], *rshort[], *rlong[];
4445 
 4546 /*
 4647  * Print out the prolog assembler.
     
 !
4950 static void
 5051 prtprolog(struct interpass_prolog *ipp, int addto)
 5152 {
<>52 -        static int lwnr;
  53+//      static int lwnr;
5354         int i;
 5455 
 5556         printf("\tpushq %%rbp\n");
 5657         printf("\tmovq %%rsp,%%rbp\n");
 5758         if (addto)
 5859                 printf("\tsubq $%d,%%rsp\n", addto);
 5960         for (i = 0; i < MAXREGS; i++)
<>60 -                if (TESTBIT(ipp->ipp_regs, i))
  61+                if (TESTBIT(ipp->ipp_regs, i)) {
6162                         fprintf(stdout, "\tmov %s,-%d(%s)\n",
 6263                             rnames[i], regoff[i], rnames[FPREG]);
<> 64+}
  65+#if 0
6366         if (kflag == 0)
 6467                 return;
 6568 
     
 !
8992         printf(".LW%d:\n", lwnr);
 9093         printf("        popl %%ebx\n");
 9194         printf("        addl $_GLOBAL_OFFSET_TABLE_+[.-.LW%d], %%ebx\n", lwnr);
<> 95+#endif
9296 }
 9397 
 9498 /*
     
 !
300304         return 1;
 301305 }
 302306 
<> 307+#if 0
303308 static void
 304309 bfext(NODE *p)
 305310 {
     
 !
422427         printf("        faddp %%st,%%st(1)\n");
 423428         printf(LABFMT ":\n", jmplab);
 424429 }
<> 430+#endif
425431 
 426432 static int
 427433 argsiz(NODE *p)
     
 !
444450 void
 445451 zzzcode(NODE *p, int c)
 446452 {
<>447 -        NODE *l;
 448 -        int pr, lr, s;
  453+//      NODE *l;
  454+//      int pr, lr, s;
449455 
 450456         switch (c) {
<> 457+#if 0
451458         case 'A': /* swap st0 and st1 if right is evaluated second */
 452459                 if ((p->n_su & DORIGHT) == 0) {
 453460                         if (logop(p->n_op))
     
 !
552559                         break;
 553560                 }
 554561                 break;
<>555 -
  562+#endif
556563         default:
 557564                 comperr("zzzcode %c", c);
 558565         }
     
 !
799806         }
 800807 }
 801808 
<>802 -/*
 803 - * Must store floats in memory if there are two function calls involved.
 804 - */
 805 -static int
 806 -storefloat(struct interpass *ip, NODE *p)
 807 -{
 808 -        int l, r;
 809 -
 810 -        switch (optype(p->n_op)) {
 811 -        case BITYPE:
 812 -                l = storefloat(ip, p->n_left);
 813 -                r = storefloat(ip, p->n_right);
 814 -                if (p->n_op == CM)
 815 -                        return 0; /* arguments, don't care */
 816 -                if (callop(p->n_op))
 817 -                        return 1; /* found one */
 818 -#define ISF(p) ((p)->n_type == FLOAT || (p)->n_type == DOUBLE || \
 819 -        (p)->n_type == LDOUBLE)
 820 -                if (ISF(p->n_left) && ISF(p->n_right) && l && r) {
 821 -                        /* must store one. store left */
 822 -                        struct interpass *nip;
 823 -                        TWORD t = p->n_left->n_type;
 824 -                        NODE *ll;
 825 -                        int off;
 826 -
 827 -                        off = BITOOR(freetemp(szty(t)));
 828 -                        ll = mklnode(OREG, off, FPREG, t);
 829 -                        nip = ipnode(mkbinode(ASSIGN, ll, p->n_left, t));
 830 -                        p->n_left = mklnode(OREG, off, FPREG, t);
 831 -                        DLIST_INSERT_BEFORE(ip, nip, qelem);
 832 -                }
 833 -                return l|r;
 834 -
 835 -        case UTYPE:
 836 -                l = storefloat(ip, p->n_left);
 837 -                if (callop(p->n_op))
 838 -                        l = 1;
 839 -                return l;
 840 -        default:
 841 -                return 0;
 842 -        }
 843 -}
 844 -
845809 void
 846810 myreader(struct interpass *ipole)
 847811 {
     
 !
852816                 if (ip->type != IP_NODE)
 853817                         continue;
 854818                 walkf(ip->ip_node, fixcalls, 0);
<>855 -                storefloat(ip, ip->ip_node);
856819         }
 857820         if (stkpos > p2autooff)
 858821                 p2autooff = stkpos;
     
 !
912875                 break;
 913876         case CHAR:
 914877         case UCHAR:
<>915 -                printf("        movb %s,%s\n", rnames[s], rnames[d]);
  878+                printf("        movb %s,%s\n", rbyte[s], rbyte[d]);
916879                 break;
<> 880+        case SHORT:
  881+        case USHORT:
  882+                printf("        movw %s,%s\n", rshort[s], rshort[d]);
  883+                break;
917884         case FLOAT:
 918885         case DOUBLE:
 919886         case LDOUBLE:
     
 !
923890 #endif
 924891                 break;
 925892         default:
<>926 -                printf("        movl %s,%s\n", rnames[s], rnames[d]);
  893+                printf("        movl %s,%s\n", rlong[s], rlong[d]);
927894         }
 928895 }
 929896 
     
 !
934901 int
 935902 COLORMAP(int c, int *r)
 936903 {
<>937 -        int num;
938904 
 939905         switch (c) {
 940906         case CLASSA:
<>941 -                num = r[CLASSB] > 4 ? 4 : r[CLASSB];
 942 -                num += 2*r[CLASSC];
 943 -                num += r[CLASSA];
 944 -                return num < 6;
  907+                return r[CLASSA] < 14;
945908         case CLASSB:
<>946 -                num = r[CLASSA];
 947 -                num += 2*r[CLASSC];
 948 -                num += r[CLASSB];
 949 -                return num < 4;
 950 -        case CLASSC:
 951 -                num = r[CLASSA];
 952 -                num += r[CLASSB] > 4 ? 4 : r[CLASSB];
 953 -                num += 2*r[CLASSC];
 954 -                return num < 5;
 955 -        case CLASSD:
 956 -                return r[CLASSD] < DREGCNT;
  909+                return r[CLASSB] < 16;
957910         }
 958911         return 0; /* XXX gcc */
 959912 }
 960913 
 961914 char *rnames[] = {
<>962 -        "%eax", "%edx", "%ecx", "%ebx", "%esi", "%edi", "%ebp", "%esp",
 963 -        "%al", "%ah", "%dl", "%dh", "%cl", "%ch", "%bl", "%bh",
964915         "%rax", "%rdx", "%rcx", "%rbx", "%rsi", "%rdi", "%rbp", "%rsp",
<>965 -        "%r08", "%r09", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
 966 -        "%eaxedx",
 967 -        "%st0", "%st1", "%st2", "%st3", "%st4", "%st5", "%st6", "%st7",
  916+        "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
  917+        "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7",
  918+        "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14",
  919+        "%xmm15",
968920 };
 969921 
<> 922+/* register names for shorter sizes */
  923+char *rbyte[] = {
  924+        "%al", "%dl", "%cl", "%bl", "%sil", "%dil", "%bpl", "%spl",
  925+        "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b",
  926+};
  927+char *rshort[] = {
  928+        "%ax", "%dx", "%cx", "%bx", "%si", "%di", "%bp", "%sp",
  929+        "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w",
  930+};
  931+char *rlong[] = {
  932+        "%eax", "%edx", "%ecx", "%ebx", "%esi", "%edi", "%ebp", "%esp",
  933+        "%r8l", "%r9l", "%r10l", "%r11l", "%r12l", "%r13l", "%r14l", "%r15l",
  934+};
  935+
  936+
970937 /*
 971938  * Return a class suitable for a specific type.
 972939  */
 973940 int
 974941 gclass(TWORD t)
 975942 {
<>976 -        if (t == CHAR || t == UCHAR)
 977 -                return CLASSB;
 978 -        if (t == LONG || t == ULONG || t == LONGLONG || t == ULONGLONG)
 979 -                return CLASSC;
980943         if (t == FLOAT || t == DOUBLE || t == LDOUBLE)
<>981 -                return CLASSD;
  944+                return CLASSB;
982945         return CLASSA;
 983946 }
 984947 
     
 !
10501013 int
 10511014 myxasm(struct interpass *ip, NODE *p)
 10521015 {
<> 1016+cerror("myxasm");
  1017+#if 0
10531018         struct interpass *ip2;
 10541019         NODE *in = 0, *ut = 0;
 10551020         TWORD t;
     
 !
11111076                 ip2 = ipnode(mkbinode(ASSIGN, tcopy(p->n_left), in, t));
 11121077                 DLIST_INSERT_BEFORE(ip, ip2, qelem);
 11131078         }
<> 1079+#endif
11141080         return 1;
 11151081 }
 11161082 
 11171083 void
 11181084 targarg(char *w, void *arg)
 11191085 {
<> 1086+cerror("targarg");
  1087+#if 0
11201088         NODE **ary = arg;
 11211089         NODE *p, *q;
 11221090 
     
 !
11391107         }
 11401108         adrput(stdout, q);
 11411109         tfree(q);
<> 1110+#endif
<_11421111 }
 11431112 
 11441113 /*
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-09-21 10:08 +0200