diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-12-19 20:19:55 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-12-19 20:19:55 +0000 |
commit | d92e8c9e3561b18fb587c415fb3faf95e92f51ea (patch) | |
tree | 908c43b89917dcf56b9d05f492c70da946fd5bbf /usr.bin | |
parent | f05d90f8ad9ee5a85c9a8a33a3161cc2f7c8ab5f (diff) |
sync to main repo; requested by mickey
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pcc/hppa/code.c | 73 | ||||
-rw-r--r-- | usr.bin/pcc/hppa/local.c | 102 | ||||
-rw-r--r-- | usr.bin/pcc/hppa/local2.c | 248 | ||||
-rw-r--r-- | usr.bin/pcc/hppa/macdefs.h | 389 | ||||
-rw-r--r-- | usr.bin/pcc/hppa/order.c | 22 | ||||
-rw-r--r-- | usr.bin/pcc/hppa/table.c | 152 |
6 files changed, 612 insertions, 374 deletions
diff --git a/usr.bin/pcc/hppa/code.c b/usr.bin/pcc/hppa/code.c index a3fa3381345..f00c7639bf5 100644 --- a/usr.bin/pcc/hppa/code.c +++ b/usr.bin/pcc/hppa/code.c @@ -1,4 +1,4 @@ -/* $OpenBSD: code.c,v 1.2 2007/11/22 15:06:43 stefan Exp $ */ +/* $OpenBSD: code.c,v 1.3 2007/12/19 20:19:54 otto Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -31,6 +31,8 @@ # include "pass1.h" +NODE *funarg(NODE *, int *); + /* * cause the alignment to become a multiple of n * never called for text segment. @@ -151,7 +153,7 @@ bycode(int t, int i) puts("\""); } else { if (i == 0) - printf("\t.ascii \""); + printf("\t.ascii\t\""); if (t == '\\' || t == '"') { lastoctal = 0; putchar('\\'); @@ -161,7 +163,7 @@ bycode(int t, int i) printf("\\%o",t); } else if (lastoctal && '0' <= t && t <= '9') { lastoctal = 0; - printf("\"\n\t.ascii \"%c", t); + printf("\"\n\t.ascii\t\"%c", t); } else { lastoctal = 0; putchar(t); @@ -170,16 +172,6 @@ bycode(int t, int i) } /* - * n integer words of zeros - */ -void -zecode(int n) -{ - printf("\t.block %d\n", n * (SZINT/SZCHAR)); -/* inoff += n * SZINT; */ -} - -/* * return the alignment of field of type t */ int @@ -203,6 +195,58 @@ mygenswitch(int num, TWORD type, struct swents **p, int n) { return 0; } + +NODE * +funarg(NODE *p, int *n) +{ + NODE *r; + int sz; + + if (p->n_op == CM) { + p->n_left = funarg(p->n_left, n); + p->n_right = funarg(p->n_right, n); + return p; + } + + sz = szty(p->n_type); + if (*n % sz) + (*n)++; /* XXX */ + + if (*n >= 4) { + *n += sz; + r = block(OREG, NIL, NIL, p->n_type|PTR, 0, + MKSUE(p->n_type|PTR)); + r->n_rval = SP; + r->n_lval = -(32 + *n * 4); + } else { + r = block(REG, NIL, NIL, p->n_type, 0, 0); + r->n_lval = 0; + switch (p->n_type) { + case FLOAT: + r->n_rval = FR7L - 2 * (*n)++; + break; + case DOUBLE: + case LDOUBLE: + *n = (*n + 1) & ~1; + r->n_rval = FR6 - *n; + *n += 2; + break; + case LONGLONG: + case ULONGLONG: + *n = (*n + 1) & ~1; + r->n_rval = AD1 - *n / 2; + *n += 2; + break; + default: + r->n_rval = ARG0 - (*n)++; + } + } + p = block(ASSIGN, r, p, p->n_type, 0, 0); + clocal(p); + + return p; +} + /* * Called with a function call with arguments as argument. * This is done early in buildtree() and only done once. @@ -210,5 +254,8 @@ mygenswitch(int num, TWORD type, struct swents **p, int n) NODE * funcode(NODE *p) { + int n = 0; + + p->n_right = funarg(p->n_right, &n); return p; } diff --git a/usr.bin/pcc/hppa/local.c b/usr.bin/pcc/hppa/local.c index 2e2c1d43519..2c9fd3fa4a1 100644 --- a/usr.bin/pcc/hppa/local.c +++ b/usr.bin/pcc/hppa/local.c @@ -1,4 +1,4 @@ -/* $OpenBSD: local.c,v 1.2 2007/11/18 17:39:55 ragge Exp $ */ +/* $OpenBSD: local.c,v 1.3 2007/12/19 20:19:54 otto Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -48,10 +48,10 @@ NODE * clocal(NODE *p) { - register struct symtab *q; register NODE *r, *l, *s; register int o, m, rn; + char *ch, name[16]; TWORD t; #ifdef PCC_DEBUG @@ -60,7 +60,7 @@ clocal(NODE *p) fwalk(p, eprint, 0); } #endif - switch( o = p->n_op ){ + switch (o = p->n_op) { case NAME: if ((q = p->n_sp) == NULL) @@ -76,11 +76,11 @@ clocal(NODE *p) r->n_lval = 0; switch (p->n_type) { case FLOAT: - /* TODO */ + r->n_rval = FR7L - rn; break; case DOUBLE: case LDOUBLE: - /* TODO */ + r->n_rval = FR6 - rn; break; case LONGLONG: case ULONGLONG: @@ -122,7 +122,7 @@ clocal(NODE *p) r->n_lval = 0; p = block(UMUL, block(PLUS, l, r, INT, 0, 0), - NIL, p->n_type, p->n_df, MKSUE(p->n_type)); + NIL, p->n_type, p->n_df, p->n_sue); break; } break; @@ -131,38 +131,18 @@ clocal(NODE *p) if (!ISFTN(p->n_left->n_type)) break; - t = p->n_type; - l = p->n_left; - nfree(p); - p = l; l = block(REG, NIL, NIL, INT, 0, 0); l->n_lval = 0; l->n_rval = R1; - l = block(ASSIGN, l, p, INT, 0, 0); + l = block(ASSIGN, l, p->n_left, INT, 0, 0); r = block(ICON, NIL, NIL, INT, 0, 0); - r->n_sp = p->n_sp; + r->n_sp = p->n_left->n_sp; r->n_lval = 0; - p = block(PLUS, l, r, t, 0, 0); + l = block(PLUS, l, r, p->n_type, p->n_df, p->n_sue); + nfree(p); + p = l; break; - case STCALL: - case CALL: - /* Fix function call arguments. On x86, just add funarg */ - for (r = p->n_right; r->n_op == CM; r = r->n_left) { - if (r->n_right->n_op != STARG && - r->n_right->n_op != FUNARG) - /* TODO put first four into regs */ - r->n_right = block(FUNARG, r->n_right, NIL, - r->n_right->n_type, r->n_right->n_df, - r->n_right->n_sue); - } - if (r->n_op != STARG && r->n_op != FUNARG) { - l = talloc(); - *l = *r; - r->n_op = FUNARG; r->n_left = l; r->n_type = l->n_type; - } - break; - case CBRANCH: l = p->n_left; @@ -375,9 +355,25 @@ clocal(NODE *p) break; case ASSIGN: + r = p->n_right; + l = p->n_left; + + /* rewrite ICON#0 into %r0 */ + if (r->n_op == ICON && r->n_lval == 0 && + (l->n_op == REG || l->n_op == OREG)) { + r->n_op = REG; + r->n_rval = R0; + } + + /* rewrite FCON#0 into %fr0 */ + if (r->n_op == FCON && r->n_lval == 0 && l->n_op == REG) { + r->n_op = REG; + r->n_rval = r->n_type == FLOAT? FR0L : FR0; + } + if (p->n_left->n_op != FLD) break; - l = p->n_left; + r = tempnode(0, l->n_type, l->n_df, l->n_sue); p = block(COMOP, block(ASSIGN, r, l->n_left, l->n_type, l->n_df, l->n_sue), @@ -389,6 +385,40 @@ clocal(NODE *p) l->n_left = tcopy(r); break; } + + /* second pass - rewrite long ops */ + switch (o) { + case DIV: + case MOD: + case MUL: + case RS: + case LS: + if (!(p->n_type == LONGLONG || p->n_type == ULONGLONG) || + !((o == DIV || o == MOD || o == MUL) && + p->n_type < FLOAT)) + break; + if (o == DIV && p->n_type == ULONGLONG) ch = "udiv"; + else if (o == DIV) ch = "div"; + else if (o == MUL) ch = "mul"; + else if (o == MOD && p->n_type == ULONGLONG) ch = "umod"; + else if (o == MOD) ch = "mod"; + else if (o == RS && p->n_type == ULONGLONG) ch = "lshr"; + else if (o == RS) ch = "ashr"; + else if (o == LS) ch = "ashl"; + else break; + snprintf(name, sizeof(name), "__%sdi3", ch); + p->n_right = block(CM, p->n_left, p->n_right, 0, 0, 0); + p->n_left = block(ADDROF, + block(NAME, NIL, NIL, FTN, 0, MKSUE(INT)), NIL, + PTR|FTN, 0, MKSUE(INT)); + p->n_left->n_left->n_sp = lookup(addname(name), 0); + defid(p->n_left->n_left, EXTERN); + p->n_left = clocal(p->n_left); + p->n_op = CALL; + funcode(p); + break; + } + #ifdef PCC_DEBUG if (xdebug) { printf("clocal end: %p\n", p); @@ -416,11 +446,12 @@ andable(NODE *p) void cendarg() { + /* TODO can use to generate sp/rp tree ops? */ autooff = AUTOINIT; } /* - * Return 1 if a variable of type type is OK to put in register. + * Return 1 if a variable of type "t" is OK to put in register. */ int cisreg(TWORD t) @@ -514,14 +545,14 @@ instring(char *str) char *s; /* be kind to assemblers and avoid long strings */ - printf("\t.ascii \""); + printf("\t.ascii\t\""); for (s = str; *s != 0; ) { if (*s++ == '\\') { (void)esccon(&s); } if (s - str > 64) { fwrite(str, 1, s - str, stdout); - printf("\"\n\t.ascii \""); + printf("\"\n\t.ascii\t\""); str = s; } } @@ -643,6 +674,7 @@ ninval(CONSZ off, int fsz, NODE *p) /* FALLTHROUGH */ case CHAR: case UCHAR: + /* TODO make the upper layer give an .asciz */ printf("\t.byte %d\n", (int)p->n_lval & 0xff); break; case LDOUBLE: diff --git a/usr.bin/pcc/hppa/local2.c b/usr.bin/pcc/hppa/local2.c index c3800e493f6..a76693ce6de 100644 --- a/usr.bin/pcc/hppa/local2.c +++ b/usr.bin/pcc/hppa/local2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: local2.c,v 1.1 2007/11/16 08:36:23 otto Exp $ */ +/* $OpenBSD: local2.c,v 1.2 2007/12/19 20:19:54 otto Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -34,14 +34,21 @@ # include <string.h> void acon(NODE *p); -int argsize(NODE *p); +void prtprolog(struct interpass_prolog *, int); +int countargs(NODE *p, int *); +void fixcalls(NODE *p); static int stkpos; +int p2calls; static const int rl[] = - { R1, R5, R7, R9, R11, R13, R15, R17, T4, T2, ARG3, ARG1, RET1 }; + { R0, R1, R1, R1, R1, R1, R31, R31, R31, R31, + R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, + T1, T4, T3, T2, ARG3, ARG1, RET1 }; static const int rh[] = - { R31, R4, R6, R8, R10, R12, R14, R16, T3, T1, ARG2, ARG0, RET0 }; + { R0, R31, T4, T3, T2, T1, T4, T3, T2, T1, + R18, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, + T4, T3, T2, T1, ARG2, ARG0, RET0 }; void deflab(int label) @@ -56,27 +63,42 @@ static TWORD ftype; * Print out the prolog assembler. * addto and regoff are already calculated. */ -static void +void prtprolog(struct interpass_prolog *ipp, int addto) { int i; - printf("\tcopy\t%%r3,%%r1\n" - "\tcopy\t%%sp,%%r3\n" - "\tstw,ma\t%%r1,%d(%%sp)\n", addto); + /* if this functions calls nothing -- no frame is needed */ + if (p2calls || p2maxautooff > 4) { + printf("\tcopy\t%%r3,%%r1\n\tcopy\t%%sp,%%r3\n"); + if (addto < 0x2000) + printf("\tstw,ma\t%%r1,%d(%%sp)\n", addto); + else if (addto < 0x802000) + printf("\tstw,ma\t%%r1,8192(%%sp)\n" + "\taddil\t%d-8192,%%sp\n" + "\tcopy\t%%r1,%%sp\n", addto); + else + comperr("too much local allocation"); + if (p2calls) + printf("\tstw\t%%rp,-20(%%r3)\n"); + } + for (i = 0; i < MAXREGS; i++) if (TESTBIT(ipp->ipp_regs, i)) { if (i <= R31) - printf("\tstw\t%s,%d(%s)\n", - rnames[i], regoff[i], rnames[FPREG]); - else if (i < RETD0) - printf("\tstw\t%s,%d(%s)\n\tstw\t%s,%d(%s)\n", - rnames[rl[i - RD0]], regoff[i] + 0, rnames[FPREG], - rnames[rh[i - RD0]], regoff[i] + 4, rnames[FPREG]); + printf("\tstw\t%s,%d(%%sp)\n", + rnames[i], regoff[i]); + else if (i <= RETD0) + printf("\tstw\t%s,%d(%%sp)\n" + "\tstw\t%s,%d(%%sp)\n", + rnames[rl[i - RD0]], regoff[i] + 0, + rnames[rh[i - RD0]], regoff[i] + 4); else if (i <= FR31) - ; + printf("\tfstws\t%s,%d(%%sp)\n", + rnames[i], regoff[i]); else - ; + printf("\tfstds\t%s,%d(%%sp)\n", + rnames[i], regoff[i]); } } @@ -89,12 +111,20 @@ offcalc(struct interpass_prolog *ipp) int i, addto; addto = 32; + if (p2calls) { + i = p2calls - 1; + /* round up to 4 args */ + if (i < 4) + i = 4; + addto += i * 4; + } + for (i = 0; i < MAXREGS; i++) if (TESTBIT(ipp->ipp_regs, i)) { regoff[i] = addto; addto += SZINT/SZCHAR; } - addto += p2maxautooff; + addto += 4 + p2maxautooff; return (addto + 63) & ~63; } @@ -128,13 +158,34 @@ eoftn(struct interpass_prolog *ipp) /* return from function code */ for (i = 0; i < MAXREGS; i++) - if (TESTBIT(ipp->ipp_regs, i)) - printf("\tldw\t%d(%s),%s\n", - regoff[i], rnames[FPREG], rnames[i]); + if (TESTBIT(ipp->ipp_regs, i)) { + if (i <= R31) + printf("\tldw\t%d(%%sp),%s\n", + regoff[i], rnames[i]); + else if (i <= RETD0) + printf("\tldw\t%d(%%sp),%s\n" + "\tldw\t%d(%%sp),%s\n", + regoff[i] + 0, rnames[rl[i - RD0]], + regoff[i] + 4, rnames[rh[i - RD0]]); + else if (i <= FR31) + printf("\tfldws\t%d(%%sp),%s\n", + regoff[i], rnames[i]); + else + printf("\tfldds\t%d(%%sp),%s\n", + regoff[i], rnames[i]); + } - /* TODO restore sp,rp */ - printf("\tbv\t%%r0(%%rp)\n\tnop\n" - "\t.exit\n\t.procend\n\t.size\t%s, .-%s\n", + if (p2calls || p2maxautooff > 4) { + if (p2calls) + printf("\tldw\t-20(%%r3),%%rp\n"); + printf("\tcopy\t%%r3,%%r1\n" + "\tldw\t(%%r3),%%r3\n" + "\tbv\t%%r0(%%rp)\n" + "\tcopy\t%%r1,%%sp\n"); + } else + printf("\tbv\t%%r0(%%rp)\n\tnop\n"); + + printf("\t.exit\n\t.procend\n\t.size\t%s, .-%s\n", ipp->ipp_name, ipp->ipp_name); } @@ -176,18 +227,18 @@ hopcode(int f, int o) case LT: str = "<="; break; - case GE: - str = ">"; - break; - case GT: - str = ">="; - break; case ULE: str = "<<"; break; case ULT: str = "<<="; break; + case GE: + str = ">="; + break; + case GT: + str = ">"; + break; case UGE: str = ">>"; break; @@ -256,6 +307,52 @@ argsiz(NODE *p) return 0; } +/* + * Emit code to compare two longlong numbers. + */ +static void +twollcomp(NODE *p) +{ + int o = p->n_op; + int s = getlab(); + int e = p->n_label; + int cb1, cb2; + + if (o >= ULE) + o -= (ULE-LE); + switch (o) { + case NE: + cb1 = 0; + cb2 = NE; + break; + case EQ: + cb1 = NE; + cb2 = 0; + break; + case LE: + case LT: + cb1 = GT; + cb2 = LT; + break; + case GE: + case GT: + cb1 = LT; + cb2 = GT; + break; + + default: + cb1 = cb2 = 0; /* XXX gcc */ + } + if (p->n_op >= ULE) + cb1 += 4, cb2 += 4; + expand(p, 0, " cmpl UR,UL\n"); + if (cb1) cbgen(cb1, s); + if (cb2) cbgen(cb2, e); + expand(p, 0, " cmpl AR,AL\n"); + cbgen(p->n_op, e); + deflab(s); +} + void zzzcode(NODE *p, int c) { @@ -264,18 +361,18 @@ zzzcode(NODE *p, int c) switch (c) { case 'C': /* after-call fixup */ - n = p->n_qual; - if (n) - printf("\tldo\t-%d(%%sp),%%sp\n", n); + n = p->n_qual; /* args */ break; case 'P': /* returning struct-call setup */ - n = p->n_qual; - if (n) - printf("\tldo\t%d(%%sp),%%sp\n", n); + n = p->n_qual; /* args */ break; - case 'F': /* output extr/dep offset/len parts for bitfields */ + case 'D': /* Long long comparision */ + twollcomp(p); + break; + + case 'F': /* struct as an arg */ default: comperr("zzzcode %c", c); @@ -472,15 +569,42 @@ cbgen(int o, int lab) { } -static void +int +countargs(NODE *p, int *n) +{ + int sz; + + if (p->n_op == CM) { + countargs(p->n_left, n); + countargs(p->n_right, n); + return *n; + } + + sz = argsiz(p) / 4; + if (*n % (sz > 4? 4 : sz)) + (*n)++; /* XXX */ + + return *n += sz; +} + +void fixcalls(NODE *p) { + int n, o; + /* Prepare for struct return by allocating bounce space on stack */ - switch (p->n_op) { + switch (o = p->n_op) { case STCALL: case USTCALL: - if (p->n_stsize+p2autooff > stkpos) - stkpos = p->n_stsize+p2autooff; + if (p->n_stsize + p2autooff > stkpos) + stkpos = p->n_stsize + p2autooff; + /* FALLTHROGH */ + case CALL: + case UCALL: + n = 0; + n = 1 + countargs(p->n_right, &n); + if (n > p2calls) + p2calls = n; break; } } @@ -492,9 +616,15 @@ myreader(struct interpass *ipole) stkpos = p2autooff; DLIST_FOREACH(ip, ipole, qelem) { - if (ip->type != IP_NODE) - continue; - walkf(ip->ip_node, fixcalls); + switch (ip->type) { + case IP_PROLOG: + p2calls = 0; + break; + + case IP_NODE: + walkf(ip->ip_node, fixcalls); + break; + } } if (stkpos > p2autooff) p2autooff = stkpos; @@ -537,7 +667,7 @@ mycanon(NODE *p) } void -myoptim(struct interpass *ip) +myoptim(struct interpass *ipole) { } @@ -554,13 +684,6 @@ rmove(int s, int d, TWORD t) dl = rl[d-RD0]; dh = rh[d-RD0]; - /* sanity checks, remove when satisfied */ - if (memcmp(rnames[s], rnames[sl]+1, 3) != 0 || - memcmp(rnames[s]+3, rnames[sh]+1, 3) != 0) - comperr("rmove source error"); - if (memcmp(rnames[d], rnames[dl]+1, 3) != 0 || - memcmp(rnames[d]+3, rnames[dh]+1, 3) != 0) - comperr("rmove dest error"); #define SW(x,y) { int i = x; x = y; y = i; } if (sl == dh || sh == dl) { /* Swap if moving to itself */ @@ -615,12 +738,14 @@ COLORMAP(int c, int *r) } const char * const rnames[MAXREGS] = { - "%r1", "%rp", "%r3", "%r4", "%r5", "%r6", "%r7", "%r8", "%r9", + "%r0", "%r1", "%rp", "%r3", "%r4", "%r5", "%r6", "%r7", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "%r16", "%r17", "%r18", "%t4", "%t3", "%t2", "%t1", "%arg3", "%arg2", "%arg1", "%arg0", "%dp", "%ret0", "%ret1", "%sp", "%r31", "%rd0", "%rd1", "%rd2", "%rd3", "%rd4", "%rd5", "%rd6", "%rd7", - "%td2", "%td1", "%ad1", "%ad0", "%retd0", + "%rd8", "%rd9", "%rd10", "%rd11", "%rd12", "%rd13", "%rd14", "%rd15", + "%rd16", "%rd17", "%rd18", "%rd19", "%rd20", "%rd21", "%rd22", "%rd23", + "%rd24", "%td4", "%td3", "%td2", "%td1", "%ad1", "%ad0", "%retd0", "%fr0", "%fr4", "%fr5", "%fr6", "%fr7", "%fr8", "%fr9", "%fr10", "%fr11", "%fr12", "%fr13", "%fr14", "%fr15", "%fr16", "%fr17", "%fr18", "%fr19", "%fr20", "%fr21", "%fr22", "%fr23", "%fr24", "%fr25", "%fr26", @@ -629,9 +754,9 @@ const char * const rnames[MAXREGS] = { "%fr7l", "%fr7r", "%fr8l", "%fr8r", "%fr9l", "%fr9r", "%fr10l", "%fr10r", "%fr11l", "%fr11r", "%fr12l", "%fr12r", "%fr13l", "%fr13r", "%fr14l", "%fr14r", "%fr15l", "%fr15r", - "%fr16l", "%fr16r", "%fr17l", "%fr17r", + "%fr16l", "%fr16r", "%fr17l", "%fr17r", "%fr18l", "%fr18r", #ifdef __hppa64__ - "%fr18l", "%fr18r", "%fr19l", "%fr19r", + "%fr19l", "%fr19r", "%fr20l", "%fr20r", "%fr21l", "%fr21r", "%fr22l", "%fr22r", "%fr23l", "%fr23r", "%fr24l", "%fr24r", "%fr25l", "%fr25r", "%fr26l", "%fr26r", "%fr27l", "%fr27r", "%fr28l", "%fr28r", @@ -690,6 +815,11 @@ special(NODE *p, int shape) if (o == STCALL || o == USTCALL) return SRREG; break; + case SPIMM: + if (o != ICON || p->n_name[0] || + p->n_lval < -31 || p->n_lval >= 32) + break; + return SRDIR; case SPICON: if (o != ICON || p->n_name[0] || p->n_lval < -1024 || p->n_lval >= 1024) @@ -707,3 +837,11 @@ special(NODE *p, int shape) } return SRNOPE; } + +/* + * Target-dependent command-line options. + */ +void +mflags(char *str) +{ +} diff --git a/usr.bin/pcc/hppa/macdefs.h b/usr.bin/pcc/hppa/macdefs.h index b2addf2fef2..65eedbd59ee 100644 --- a/usr.bin/pcc/hppa/macdefs.h +++ b/usr.bin/pcc/hppa/macdefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: macdefs.h,v 1.1 2007/11/16 08:36:23 otto Exp $ */ +/* $OpenBSD: macdefs.h,v 1.2 2007/12/19 20:19:54 otto Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -101,8 +101,6 @@ typedef long long OFFSZ; #undef BACKAUTO /* stack grows upwards */ #undef BACKTEMP /* stack grows upwards */ -#define MYP2TREE(p) myp2tree(p) - #define FIELDOPS /* have bit field ops */ #define LTORBYTES /* big endian */ @@ -114,154 +112,174 @@ typedef long long OFFSZ; #define STOFARG(p) #define STOSTARG(p) -#define szty(t) (((t) == DOUBLE || (t) == FLOAT || \ - (t) == LONGLONG || (t) == ULONGLONG) ? 2 : (t) == LDOUBLE ? 2 : 1) +#define szty(t) (((t) == DOUBLE || (t) == LONGLONG || (t) == ULONGLONG) ? 2 : \ + (t) == LDOUBLE ? 2 : 1) -#define R1 0 -#define RP 1 -#define FP 2 -#define R4 3 -#define R5 4 -#define R6 5 -#define R7 6 -#define R8 7 -#define R9 8 -#define R10 9 -#define R11 10 -#define R12 11 -#define R13 12 -#define R14 13 -#define R15 14 -#define R16 15 -#define R17 16 -#define R18 17 -#define T4 18 -#define T3 19 -#define T2 20 -#define T1 21 -#define ARG3 22 -#define ARG2 23 -#define ARG1 24 -#define ARG0 25 -#define DP 26 -#define RET0 27 -#define RET1 28 -#define SP 29 -#define R31 30 +#define R0 0 +#define R1 1 +#define RP 2 +#define FP 3 +#define R4 4 +#define R5 5 +#define R6 6 +#define R7 7 +#define R8 8 +#define R9 9 +#define R10 10 +#define R11 11 +#define R12 12 +#define R13 13 +#define R14 14 +#define R15 15 +#define R16 16 +#define R17 17 +#define R18 18 +#define T4 19 +#define T3 20 +#define T2 21 +#define T1 22 +#define ARG3 23 +#define ARG2 24 +#define ARG1 25 +#define ARG0 26 +#define DP 27 +#define RET0 28 +#define RET1 29 +#define SP 30 +#define R31 31 /* double regs overlay */ -#define RD0 31 /* r1:r31 */ -#define RD1 32 /* r5:r4 */ -#define RD2 33 /* r7:r6 */ -#define RD3 34 /* r9:r8 */ -#define RD4 35 /* r11:r10 */ -#define RD5 36 /* r13:r12 */ -#define RD6 37 /* r15:r14 */ -#define RD7 38 /* r17:r16 */ -#define TD2 39 /* t4:t3 */ -#define TD1 40 /* t2:t1 */ -#define AD2 41 /* arg3:arg2 */ -#define AD1 42 /* arg1:arg0 */ -#define RETD0 43 /* ret1:ret0 */ +#define RD0 32 /* r0:r0 */ +#define RD1 33 /* r1:r31 */ +#define RD2 34 /* r1:t4 */ +#define RD3 35 /* r1:t3 */ +#define RD4 36 /* r1:t2 */ +#define RD5 37 /* r1:t1 */ +#define RD6 38 /* r31:t4 */ +#define RD7 39 /* r31:t3 */ +#define RD8 40 /* r31:t2 */ +#define RD9 41 /* r31:t1 */ +#define RD10 42 /* r4:r18 */ +#define RD11 43 /* r5:r4 */ +#define RD12 44 /* r6:r5 */ +#define RD13 45 /* r7:r6 */ +#define RD14 46 /* r8:r7 */ +#define RD15 47 /* r9:r8 */ +#define RD16 48 /* r10:r9 */ +#define RD17 49 /* r11:r10 */ +#define RD18 50 /* r12:r11 */ +#define RD19 51 /* r13:r12 */ +#define RD20 52 /* r14:r13 */ +#define RD21 53 /* r15:r14 */ +#define RD22 54 /* r16:r15 */ +#define RD23 55 /* r17:r16 */ +#define RD24 56 /* r18:r17 */ +#define TD4 57 /* t1:t4 */ +#define TD3 58 /* t4:t3 */ +#define TD2 59 /* t3:t2 */ +#define TD1 60 /* t2:t1 */ +#define AD2 61 /* arg3:arg2 */ +#define AD1 62 /* arg1:arg0 */ +#define RETD0 63 /* ret1:ret0 */ /* FPU regs */ -#define FR0 44 -#define FR4 45 -#define FR5 46 -#define FR6 47 -#define FR7 48 -#define FR8 49 -#define FR9 50 -#define FR10 51 -#define FR11 52 -#define FR12 53 -#define FR13 54 -#define FR14 55 -#define FR15 56 -#define FR16 57 -#define FR17 58 -#define FR18 59 -#define FR19 60 -#define FR20 61 -#define FR21 62 -#define FR22 63 -#define FR23 64 -#define FR24 65 -#define FR25 66 -#define FR26 67 -#define FR27 68 -#define FR28 69 -#define FR29 70 -#define FR30 71 -#define FR31 72 +#define FR0 64 +#define FR4 65 +#define FR5 66 +#define FR6 67 +#define FR7 68 +#define FR8 69 +#define FR9 70 +#define FR10 71 +#define FR11 72 +#define FR12 73 +#define FR13 74 +#define FR14 75 +#define FR15 76 +#define FR16 77 +#define FR17 78 +#define FR18 79 +#define FR19 80 +#define FR20 81 +#define FR21 82 +#define FR22 83 +#define FR23 84 +#define FR24 85 +#define FR25 86 +#define FR26 87 +#define FR27 88 +#define FR28 89 +#define FR29 90 +#define FR30 91 +#define FR31 92 -#define FR0L 73 -#define FR0R 74 -#define FR4L 75 -#define FR4R 76 -#define FR5L 77 -#define FR5R 78 -#define FR6L 79 -#define FR6R 80 -#define FR7L 81 -#define FR7R 82 -#define FR8L 83 -#define FR8R 84 -#define FR9L 85 -#define FR9R 86 -#define FR10L 87 -#define FR10R 88 -#define FR11L 89 -#define FR11R 90 -#define FR12L 91 -#define FR12R 92 -#define FR13L 93 -#define FR13R 94 -#define FR14L 95 -#define FR14R 96 -#define FR15L 97 -#define FR15R 98 -#define FR16L 99 -#define FR16R 100 -#define FR17L 101 -#define FR17R 102 +#define FR0L 93 +#define FR0R 94 +#define FR4L 95 +#define FR4R 96 +#define FR5L 97 +#define FR5R 98 +#define FR6L 99 +#define FR6R 100 +#define FR7L 101 +#define FR7R 102 +#define FR8L 103 +#define FR8R 104 +#define FR9L 105 +#define FR9R 106 +#define FR10L 107 +#define FR10R 108 +#define FR11L 109 +#define FR11R 110 +#define FR12L 111 +#define FR12R 112 +#define FR13L 113 +#define FR13R 114 +#define FR14L 115 +#define FR14R 116 +#define FR15L 117 +#define FR15R 118 +#define FR16L 119 +#define FR16R 120 +#define FR17L 121 +#define FR17R 122 +#define FR18L 123 +#define FR18R 124 #ifdef __hppa64__ -#define FR18L 103 -#define FR18R 104 -#define FR19L 105 -#define FR19R 106 -#define FR20L 107 -#define FR20R 108 -#define FR21L 109 -#define FR21R 110 -#define FR22L 111 -#define FR22R 112 -#define FR23L 113 -#define FR23R 114 -#define FR24L 115 -#define FR24R 116 -#define FR25L 117 -#define FR25R 118 -#define FR26L 119 -#define FR26R 120 -#define FR27L 121 -#define FR27R 122 -#define FR28L 123 -#define FR28R 124 -#define FR29L 125 -#define FR29R 126 -#define FR30L 127 -#define FR30R 128 -#define FR31L 129 -#define FR31R 130 +#define FR19L 125 +#define FR19R 126 +#define FR20L 127 +#define FR20R 128 +#define FR21L 129 +#define FR21R 130 +#define FR22L 131 +#define FR22R 132 +#define FR23L 133 +#define FR23R 134 +#define FR24L 135 +#define FR24R 136 +#define FR25L 137 +#define FR25R 138 +#define FR26L 139 +#define FR26R 140 +#define FR27L 141 +#define FR27R 142 +#define FR28L 143 +#define FR28R 144 +#define FR29L 145 +#define FR29R 146 +#define FR30L 147 +#define FR30R 148 +#define FR31L 149 +#define FR31R 150 -#define MAXREGS 131 +#define MAXREGS 151 #else -#define MAXREGS 103 +#define MAXREGS 125 #endif #define RSTATUS \ - SAREG|TEMPREG, 0, 0, SAREG|PERMREG, SAREG|PERMREG, \ + 0, SAREG|TEMPREG, 0, 0, SAREG|PERMREG, SAREG|PERMREG, \ SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \ SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \ SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, SAREG|PERMREG, \ @@ -270,8 +288,11 @@ typedef long long OFFSZ; SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, SAREG|TEMPREG, \ 0, SAREG|TEMPREG, SAREG|TEMPREG, 0, SAREG|TEMPREG, \ /* double overlays */ \ + 0, \ + SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \ + SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \ + SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \ SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \ - SBREG, SBREG, SBREG, SBREG, SBREG, SBREG, \ /* double-precision floats */ \ 0, \ SDREG|TEMPREG, SDREG|TEMPREG, SDREG|TEMPREG, SDREG|TEMPREG, \ @@ -283,43 +304,75 @@ typedef long long OFFSZ; SDREG|TEMPREG, SDREG|TEMPREG, SDREG|TEMPREG, SDREG|TEMPREG, \ SDREG|TEMPREG, SDREG|TEMPREG, \ /* single-precision floats */ \ - 0, 0, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \ + 0, 0, \ SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \ SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \ - SCREG, SCREG, SCREG, SCREG, SCREG, + SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \ + SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, #ifdef __hppa64__ - SCREG, SCREG, SCREG, \ + SCREG, SCREG, \ SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \ SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, \ - SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, + SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, SCREG, #endif #define ROVERLAP \ - { RD0, -1 }, { -1 }, { -1 }, \ - { RD1, -1 }, { RD1, -1 }, \ - { RD2, -1 }, { RD2, -1 }, \ - { RD3, -1 }, { RD3, -1 }, \ - { RD4, -1 }, { RD4, -1 }, \ - { RD5, -1 }, { RD5, -1 }, \ - { RD6, -1 }, { RD6, -1 }, \ - { RD7, -1 }, { RD7, -1 }, \ { -1 }, \ - { TD2, -1 }, { TD2, -1 }, \ - { TD1, -1 }, { TD1, -1 }, \ + { RD1, RD2, RD3, RD4, RD5, -1 },\ + { -1 }, { -1 }, \ + { RD10, RD11, -1 }, \ + { RD11, RD12, -1 }, \ + { RD12, RD13, -1 }, \ + { RD13, RD14, -1 }, \ + { RD14, RD15, -1 }, \ + { RD15, RD16, -1 }, \ + { RD16, RD17, -1 }, \ + { RD17, RD18, -1 }, \ + { RD18, RD19, -1 }, \ + { RD19, RD20, -1 }, \ + { RD20, RD21, -1 }, \ + { RD21, RD22, -1 }, \ + { RD22, RD23, -1 }, \ + { RD23, RD24, -1 }, \ + { RD24, RD10, -1 }, \ + { TD1, TD4, -1 }, \ + { TD3, TD2, -1 }, \ + { TD1, TD2, -1 }, \ + { TD1, TD4, -1 }, \ { AD2, -1 }, { AD2, -1 }, \ { AD1, -1 }, { AD1, -1 }, \ { -1 }, \ { RETD0, -1 }, { RETD0, -1 }, \ - { -1 }, { RD0, -1 }, \ + { -1 }, \ + { RD1, RD5, RD6, RD7, RD8, -1 },\ + { -1 }, \ { R1, R31, -1 }, \ - { R4, R5, -1 }, \ - { R6, R7, -1 }, \ - { R8, R9, -1 }, \ - { R10, R11, -1 }, \ - { R12, R13, -1 }, \ + { R1, T4, -1 }, \ + { R1, T3, -1 }, \ + { R1, T2, -1 }, \ + { R1, T1, -1 }, \ + { R31, T4, -1 }, \ + { R31, T3, -1 }, \ + { R31, T2, -1 }, \ + { R31, T1, -1 }, \ + { R4, R18, -1 }, \ + { R5, R4, -1 }, \ + { R6, R5, -1 }, \ + { R7, R6, -1 }, \ + { R8, R7, -1 }, \ + { R9, R8, -1 }, \ + { R10, R9, -1 }, \ + { R11, R10, -1 }, \ + { R12, R11, -1 }, \ + { R13, R12, -1 }, \ { R14, R15, -1 }, \ - { R16, R17, -1 }, \ + { R15, R14, -1 }, \ + { R16, R15, -1 }, \ + { R17, R16, -1 }, \ + { R18, R17, -1 }, \ + { T1, T4, -1 }, \ { T4, T3, -1 }, \ + { T3, T2, -1 }, \ { T2, T1, -1 }, \ { ARG3, ARG2, -1 }, \ { ARG1, ARG0, -1 }, \ @@ -339,7 +392,7 @@ typedef long long OFFSZ; { FR15L, FR15R, -1 }, \ { FR16L, FR16R, -1 }, \ { FR17L, FR17R, -1 }, \ - { -1 }, \ + { FR18L, FR18R, -1 }, \ { -1 }, \ { -1 }, \ { -1 }, \ @@ -367,9 +420,9 @@ typedef long long OFFSZ; { FR14, -1 }, { FR14, -1 }, \ { FR15, -1 }, { FR15, -1 }, \ { FR16, -1 }, { FR16, -1 }, \ - { FR17, -1 }, { FR17, -1 }, + { FR17, -1 }, { FR17, -1 }, \ + { FR18, -1 }, { FR18, -1 }, #ifdef __hppa64__ - { FR18, -1 }, { FR18, -1 }, \ { FR19, -1 }, { FR19, -1 }, \ { FR20, -1 }, { FR20, -1 }, \ { FR21, -1 }, { FR21, -1 }, \ @@ -393,9 +446,8 @@ typedef long long OFFSZ; #define NUMCLASS 4 /* highest number of reg classes used */ int COLORMAP(int c, int *r); -TOWRD gtype(int); -#define PERMTYPE(x) ((x) < 31? INT : ((x) < 44? LONGLONG : ((x) < 73? LDOUBLE : FLOAT))) -#define GCLASS(x) ((x) < 31? CLASSA : ((x) < 44? CLASSB : ((x) < 73? CLASSD : CLASSC))) +#define PERMTYPE(x) ((x) < 32? INT : ((x) < 64? LONGLONG : ((x) < 93? LDOUBLE : FLOAT))) +#define GCLASS(x) ((x) < 32? CLASSA : ((x) < 64? CLASSB : ((x) < 93? CLASSD : CLASSC))) #define DECRA(x,y) (((x) >> (y*8)) & 255) /* decode encoded regs */ #define ENCRD(x) (x) /* Encode dest reg in n_reg */ #define ENCRA1(x) ((x) << 8) /* A1 */ @@ -415,4 +467,5 @@ TOWRD gtype(int); #define SFUNCALL (MAXSPECIAL+1) /* struct assign after function call */ #define SPCON (MAXSPECIAL+2) /* smaller constant */ #define SPICON (MAXSPECIAL+3) /* even smaller constant */ -#define SPNAME (MAXSPECIAL+4) /* ext symbol reference load/store */ +#define SPIMM (MAXSPECIAL+4) /* immidiate const for depi/comib */ +#define SPNAME (MAXSPECIAL+5) /* ext symbol reference load/store */ diff --git a/usr.bin/pcc/hppa/order.c b/usr.bin/pcc/hppa/order.c index c1ba92c913d..68513151ba1 100644 --- a/usr.bin/pcc/hppa/order.c +++ b/usr.bin/pcc/hppa/order.c @@ -1,4 +1,4 @@ -/* $OpenBSD: order.c,v 1.1 2007/11/16 08:36:23 otto Exp $ */ +/* $OpenBSD: order.c,v 1.2 2007/12/19 20:19:54 otto Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -108,18 +108,6 @@ shumul(NODE *p) } /* - * Rewrite increment/decrement operation. - */ -int -setincr(NODE *p) -{ - if (x2debug) - printf("setincr(%p)\n", p); - - return(0); -} - -/* * Rewrite operations on binary operators (like +, -, etc...). * Called as a result of table lookup. */ @@ -201,3 +189,11 @@ livecall(NODE *p) return &r[0]; } +/* + * Signal whether the instruction is acceptable for this target. + */ +int +acceptable(struct optab *op) +{ + return 1; +} diff --git a/usr.bin/pcc/hppa/table.c b/usr.bin/pcc/hppa/table.c index 965d8e56219..71149fc9fae 100644 --- a/usr.bin/pcc/hppa/table.c +++ b/usr.bin/pcc/hppa/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.1 2007/11/16 08:36:23 otto Exp $ */ +/* $OpenBSD: table.c,v 1.2 2007/12/19 20:19:54 otto Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -88,7 +88,7 @@ struct optab table[] = { /* convert pointers to int. */ { SCONV, ININT, - SHINT, TPOINT|TWORD, + SHINT, TWORD|TPOINT, SANY, TWORD, 0, RLEFT, "", }, @@ -200,75 +200,75 @@ struct optab table[] = { /* convert char to (unsigned) short/int. */ { SCONV, ININT, SAREG, TCHAR, - SAREG, THWORD|TWORD, + SAREG, THWORD|TWORD, NASL|NAREG, RESC1, "\textrs\tAL,31,8,A1\n", }, /* convert unsigned char to (unsigned) short/int. */ { SCONV, ININT, SAREG, TUCHAR, - SAREG, THWORD|TWORD, + SAREG, THWORD|TWORD, NASL|NAREG, RESC1, "\textru\tAL,31,8,A1\n", }, /* convert char to (unsigned) long long. */ { SCONV, INLL, SAREG, TCHAR, - SBREG, TLL, + SBREG, TLL, NBSL|NBREG, RESC1, "\textrs\tAL,31,8,A1\n\textrs\tA1,0,1,U1", }, /* convert unsigned char to (unsigned) long long. */ { SCONV, INLL, SAREG, TUCHAR, - SBREG, TLL, + SBREG, TLL, NBSL|NBREG, RESC1, "\textru\tAL,31,8,A1\n\tcopy\t%r0,U1", }, /* convert short to (unsigned) int. */ { SCONV, ININT, SAREG, TSHORT, - SAREG, TWORD, + SAREG, TWORD, NASL|NAREG, RESC1, "\textrs\tAL,31,16,A1\n", }, /* convert unsigned short to (unsigned) int. */ { SCONV, ININT, SAREG, TUSHORT, - SAREG, THWORD, + SAREG, THWORD, NASL|NAREG, RESC1, "\textru\tAL,31,16,A1\n", }, /* convert short to (unsigned) long long. */ { SCONV, INLL, SAREG, TSHORT, - SBREG, TLL, + SBREG, TLL, NBSL|NBREG, RESC1, "\textrs\tAL,31,16,A1\n\textrs\tA1,0,1,U1", }, /* convert unsigned short to (unsigned) long long. */ { SCONV, INLL, SAREG, TUSHORT, - SBREG, TLL, + SBREG, TLL, NBSL|NBREG, RESC1, "\textru\tAL,31,16,A1\n\tcopy\t%r0,U1", }, /* convert int,short,char (in memory) to int,short,char */ { SCONV, ININT, SOREG, TBYTE, - SHINT, TBYTE|TPOINT, + SHINT, TBYTE|TPOINT, NAREG|NASL, RESC1, "\tldb\tAL,A1\n", }, { SCONV, ININT, SOREG, THWORD, - SHINT, THWORD|TPOINT, + SHINT, THWORD|TPOINT, NAREG|NASL, RESC1, "\tldh\tAL,A1\n", }, { SCONV, ININT, SOREG, TWORD, - SHINT, TWORD|TPOINT, + SHINT, TWORD|TPOINT, NAREG|NASL, RESC1, "\tldw\tAL,A1\n", }, @@ -282,7 +282,7 @@ struct optab table[] = { /* convert (u)long (in memory) to int,short,char */ { SCONV, ININT, SOREG, TLL, - SHINT, ANYFIXED, + SHINT, ANYFIXED, NAREG|NASL, RESC1, "\tldw\tAL,A1\n", }, @@ -330,7 +330,7 @@ struct optab table[] = { * Subroutine calls. */ -{ CALL, ININT, +{ CALL, FOREFF, SAREG, TANY, SANY, TANY, 0, 0, @@ -338,25 +338,42 @@ struct optab table[] = { "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, -{ UCALL, ININT, - SOREG, TANY, +{ UCALL, FOREFF, + SAREG, TANY, SANY, TANY, 0, 0, - "ZP\tble\tAL\n" - "\tcopy\t%r1,rp\nZC", }, + "ZP\tblr\t%r0, %rp\n" + "\tbv,n\t%r0(AL)\n" + "\tnop\nZC", }, + +{ CALL, ININT, + SAREG, TANY, + SHINT, ANYFIXED|TPOINT, + NAREG|NASL, RESC1, + "ZP\tblr\t%r0, %rp\n" + "\tbv,n\t%r0(AL)\n" + "\tnop\nZC", }, + +{ UCALL, ININT, + SAREG, TANY, + SHINT, ANYFIXED|TPOINT, + NAREG|NASL, RESC1, + "ZP\tblr\t%r0, %rp\n" + "\tbv,n\t%r0(AL)\n" + "\tnop\nZC", }, { CALL, INLL, SAREG, TANY, - SANY, TANY, - 0, 0, + SHLL, TLL, + NBREG|NBSL, RESC1, "ZP\tblr\t%r0, %rp\n" "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, { UCALL, INLL, SAREG, TANY, - SANY, TANY, - 0, 0, + SHLL, TLL, + NBREG|NBSL, RESC1, "ZP\tblr\t%r0, %rp\n" "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, @@ -364,7 +381,7 @@ struct optab table[] = { { CALL, INFL, SAREG, TANY, SHFL, TFLOAT, - 0, 0, + NCREG|NCSL, RESC1, "ZP\tblr\t%r0, %rp\n" "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, @@ -372,7 +389,7 @@ struct optab table[] = { { UCALL, INFL, SAREG, TANY, SHFL, TFLOAT, - 0, 0, + NCREG|NCSL, RESC1, "ZP\tblr\t%r0, %rp\n" "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, @@ -380,15 +397,15 @@ struct optab table[] = { { CALL, INDBL, SAREG, TANY, SHDBL, TDOUBLE|TLDOUBLE, - 0, 0, + NDREG|NDSL, RESC1, "ZP\tblr\t%r0, %rp\n" "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, -{ UCALL, INFL, +{ UCALL, INDBL, SAREG, TANY, SHDBL, TDOUBLE|TLDOUBLE, - 0, 0, + NDREG|NDSL, RESC1, "ZP\tblr\t%r0, %rp\n" "\tbv,n\t%r0(AL)\n" "\tnop\nZC", }, @@ -497,13 +514,6 @@ struct optab table[] = { /* * The next rules handle all shift operators. */ -/* (u)longlong left shift is emulated */ -{ LS, INLL, - SHLL|SCON, TLL, - SHINT|SCON, TINT, - NSPECIAL|NBREG|NBSL|NBSR, RESC1, - "ZO", }, - { LS, ININT, SHINT, ANYFIXED, SCON, ANYFIXED, @@ -532,13 +542,6 @@ struct optab table[] = { "\tshd\tUL,AL,AR,A1\n" "\textru\tUL,31-AR,32,U1\n", }, -/* (u)longlong right shift is emulated */ -{ RS, INLL, - SHLL|SCON, TLL, - SHINT|SCON, TINT, - NSPECIAL|NBREG|NBSL|NBSR, RESC1, - "ZO", }, - { RS, ININT, SHINT, ANYSIGNED, SCON, ANYFIXED, @@ -592,7 +595,7 @@ struct optab table[] = { { ASSIGN, FOREFF|INAREG, SOREG, TWORD|TPOINT, - SHINT, TWORD|TPOINT, + SHINT, TWORD|TPOINT, 0, RDEST, "\tstw\tAR,AL\n", }, @@ -642,7 +645,7 @@ struct optab table[] = { { ASSIGN, FOREFF|ININT, SFLD, TANY, - SPICON, TANY, + SPIMM, TANY, 0, RDEST, "\tdepi\tAR,31-H,S,AL\n", }, @@ -698,19 +701,6 @@ struct optab table[] = { /* * DIV/MOD/MUL */ - -{ DIV, ININT, - SHINT, TWORD, - SHINT, TWORD, - NAREG, RESC1, - "ZO", }, - -{ DIV, INLL, - SHLL, TLL, - SHLL, TLL, - NBREG, RESC1, - "ZO", }, - { DIV, INFL, SHFL, TFLOAT, SHFL, TFLOAT, @@ -723,30 +713,6 @@ struct optab table[] = { NDREG|NDSL|NDSR, RESC1, "\tfdiv,dbl\tAL,AR,A1\n", }, -{ MOD, ININT, - SHINT, TWORD, - SHINT, TWORD, - NAREG, RESC1, - "ZO", }, - -{ MOD, INLL, - SHLL, TLL, - SHLL, TLL, - NBREG, RESC1, - "ZO", }, - -{ MUL, ININT, - SHINT, TWORD, - SHINT, TWORD, - NAREG, RESC1, - "ZO", }, - -{ MUL, INLL, - SHLL, TLL, - SHLL, TLL, - NBREG, RESC1, - "ZO", }, - { MUL, INFL, SHFL, TFLOAT, SHFL, TFLOAT, @@ -809,16 +775,16 @@ struct optab table[] = { "ZD", }, { OPLOG, FORCC, - SHINT, TWORD|TPOINT, - SPICON, TWORD|TPOINT, + SHINT, ANYFIXED|TPOINT, + SPIMM, ANYFIXED|TPOINT, 0, 0, - "\tcomib,O\tAR,AL,LC\n", }, + "\tcomib,O\tAR,AL,LC\n\tnop\n", }, { OPLOG, FORCC, - SHINT, TWORD|TPOINT, - SHINT, TWORD|TPOINT, + SHINT, ANYFIXED|TPOINT, + SHINT, ANYFIXED|TPOINT, 0, 0, - "\tcomb,O\tAR,AL,LC\n", }, + "\tcomb,O\tAR,AL,LC\n\tnop\n", }, { OPLOG, FORCC, SHFL, TFLOAT, @@ -905,6 +871,15 @@ struct optab table[] = { "\tldil\tUR,A1\n" "\tldo\tAR(A1),A1\n", }, +{ OPLTYPE, INLL, + SHLL, TLL, + SCON, TLL, + NBREG, RESC1, + "\tldil\tUR,A1\n" + "\tldo\tAR(A1),A1\n" + "\tldil\tUR>>32,U1\n" + "\tldo\tAR>>32(A1),U1\n", }, + { OPLTYPE, INCREG, SANY, TFLOAT, SHFL, TFLOAT, @@ -961,9 +936,6 @@ struct optab table[] = { /* * Arguments to functions. */ -/* TODO */ - - { STARG, FOREFF, SAREG|SOREG|SNAME|SCON, TANY, |