Some abis, like the riscv one, treat arguments differently depending on whether they are variadic or not. To prepare for the upcomming riscv target, we change the variadic call syntax and give meaning to the location of the '...' marker. # new syntax %ret =w call $f(w %regular, ..., w %variadic) By nature of their abis, the change is backwards compatible for existing targets.
Unified · Split
| @@ -171,12 +171,11 @@ enum { · 170 unmodified lines | ||
| 171 | 171 | }; |
| 172 | 172 | |
| 173 | 173 | #define INRANGE(x, l, u) ((unsigned)(x) - l <= u - l) /* linear in x */ |
| 174 | −#define iscall(o) INRANGE(o, Ocall, Ovacall) | |
| 175 | 174 | #define isstore(o) INRANGE(o, Ostoreb, Ostored) |
| 176 | 175 | #define isload(o) INRANGE(o, Oloadsb, Oload) |
| 177 | 176 | #define isext(o) INRANGE(o, Oextsb, Oextuw) |
| 178 | 177 | #define ispar(o) INRANGE(o, Opar, Opare) |
| 179 | −#define isarg(o) INRANGE(o, Oarg, Oarge) | |
| 178 | +#define isarg(o) INRANGE(o, Oarg, Oargv) | |
| 180 | 179 | #define isret(j) INRANGE(j, Jret0, Jretc) |
| 181 | 180 | |
| 182 | 181 | enum Class { |
| @@ -153,7 +153,7 @@ selret(Blk *b, Fn *fn) · 152 unmodified lines | ||
| 153 | 153 | static int |
| 154 | 154 | argsclass(Ins *i0, Ins *i1, AClass *ac, int op, AClass *aret, Ref *env) |
| 155 | 155 | { |
| 156 | − int nint, ni, nsse, ns, n, *pn; | |
| 156 | + int varc, envc, nint, ni, nsse, ns, n, *pn; | |
| 157 | 157 | AClass *a; |
| 158 | 158 | Ins *i; |
| 159 | 159 | |
| @@ -162,6 +162,8 @@ argsclass(Ins *i0, Ins *i1, AClass *ac, int op, AClass *aret, Ref *env) · 2 unmodified lines | ||
| 162 | 162 | else |
| 163 | 163 | nint = 6; |
| 164 | 164 | nsse = 8; |
| 165 | + varc = 0; | |
| 166 | + envc = 0; | |
| 165 | 167 | for (i=i0, a=ac; i<i1; i++, a++) |
| 166 | 168 | switch (i->op - op + Oarg) { |
| 167 | 169 | case Oarg: |
| @@ -196,14 +198,23 @@ argsclass(Ins *i0, Ins *i1, AClass *ac, int op, AClass *aret, Ref *env) · 28 unmodified lines | ||
| 196 | 198 | a->inmem = 1; |
| 197 | 199 | break; |
| 198 | 200 | case Oarge: |
| 201 | + envc = 1; | |
| 199 | 202 | if (op == Opar) |
| 200 | 203 | *env = i->to; |
| 201 | 204 | else |
| 202 | 205 | *env = i->arg[0]; |
| 203 | 206 | break; |
| 207 | + case Oargv: | |
| 208 | + varc = 1; | |
| 209 | + break; | |
| 210 | + default: | |
| 211 | + die("unreachable"); | |
| 204 | 212 | } |
| 205 | 213 | |
| 206 | − return (!req(R, *env) << 12) | ((6-nint) << 4) | ((8-nsse) << 8); | |
| 214 | + if (varc && envc) | |
| 215 | + err("sysv abi does not support variadic env calls"); | |
| 216 | + | |
| 217 | + return ((varc|envc) << 12) | ((6-nint) << 4) | ((8-nsse) << 8); | |
| 207 | 218 | } |
| 208 | 219 | |
| 209 | 220 | int amd64_sysv_rsave[] = { |
| @@ -290,7 +301,7 @@ selcall(Fn *fn, Ins *i0, Ins *i1, RAlloc **rap) · 80 unmodified lines | ||
| 290 | 301 | { |
| 291 | 302 | Ins *i; |
| 292 | 303 | AClass *ac, *a, aret; |
| 293 | − int ca, ni, ns, al, varc, envc; | |
| 304 | + int ca, ni, ns, al; | |
| 294 | 305 | uint stk, off; |
| 295 | 306 | Ref r, r1, r2, reg[2], env; |
| 296 | 307 | RAlloc *ra; |
| @@ -358,22 +369,20 @@ selcall(Fn *fn, Ins *i0, Ins *i1, RAlloc **rap) · 61 unmodified lines | ||
| 358 | 369 | ca += 1 << 2; |
| 359 | 370 | } |
| 360 | 371 | } |
| 361 | − envc = !req(R, env); | |
| 362 | − varc = i1->op == Ovacall; | |
| 363 | − if (varc && envc) | |
| 364 | − err("sysv abi does not support variadic env calls"); | |
| 365 | − ca |= varc << 12; /* envc set in argsclass() */ | |
| 372 | + | |
| 366 | 373 | emit(Ocall, i1->cls, R, i1->arg[0], CALL(ca)); |
| 367 | − if (envc) | |
| 374 | + | |
| 375 | + if (!req(R, env)) | |
| 368 | 376 | emit(Ocopy, Kl, TMP(RAX), env, R); |
| 369 | − if (varc) | |
| 377 | + else if ((ca >> 12) & 1) /* vararg call */ | |
| 370 | 378 | emit(Ocopy, Kw, TMP(RAX), getcon((ca >> 8) & 15, fn), R); |
| 371 | 379 | |
| 372 | 380 | ni = ns = 0; |
| 373 | 381 | if (ra && aret.inmem) |
| 374 | 382 | emit(Ocopy, Kl, rarg(Kl, &ni, &ns), ra->i.to, R); /* pass hidden argument */ |
| 383 | + | |
| 375 | 384 | for (i=i0, a=ac; i<i1; i++, a++) { |
| 376 | − if (a->inmem || i->op == Oarge) | |
| 385 | + if (i->op >= Oarge || a->inmem) | |
| 377 | 386 | continue; |
| 378 | 387 | r1 = rarg(a->cls[0], &ni, &ns); |
| 379 | 388 | if (i->op == Oargc) { |
| @@ -393,7 +402,7 @@ selcall(Fn *fn, Ins *i0, Ins *i1, RAlloc **rap) · 13 unmodified lines | ||
| 393 | 402 | |
| 394 | 403 | r = newtmp("abi", Kl, fn); |
| 395 | 404 | for (i=i0, a=ac, off=0; i<i1; i++, a++) { |
| 396 | − if (!a->inmem) | |
| 405 | + if (i->op >= Oarge || !a->inmem) | |
| 397 | 406 | continue; |
| 398 | 407 | if (i->op == Oargc) { |
| 399 | 408 | if (a->align == 4) |
| @@ -676,7 +685,6 @@ amd64_sysv_abi(Fn *fn) · 276 unmodified lines | ||
| 676 | 685 | emiti(*i); |
| 677 | 686 | break; |
| 678 | 687 | case Ocall: |
| 679 | − case Ovacall: | |
| 680 | 688 | for (i0=i; i0>b->ins; i0--) |
| 681 | 689 | if (!isarg((i0-1)->op)) |
| 682 | 690 | break; |
| @@ -255,6 +255,10 @@ argsclass(Ins *i0, Ins *i1, Class *carg, Ref *env) · 254 unmodified lines | ||
| 255 | 255 | case Oarge: |
| 256 | 256 | *env = i->arg[0]; |
| 257 | 257 | break; |
| 258 | + case Oargv: | |
| 259 | + break; | |
| 260 | + default: | |
| 261 | + die("unreachable"); | |
| 258 | 262 | } |
| 259 | 263 | |
| 260 | 264 | return ((gp-gpreg) << 5) | ((fp-fpreg) << 9); |
| @@ -371,10 +375,11 @@ selcall(Fn *fn, Ins *i0, Ins *i1, Insl **ilp) · 110 unmodified lines | ||
| 371 | 375 | } |
| 372 | 376 | } |
| 373 | 377 | |
| 378 | + emit(Ocall, 0, R, i1->arg[0], CALL(cty)); | |
| 379 | + | |
| 374 | 380 | envc = !req(R, env); |
| 375 | 381 | if (envc) |
| 376 | 382 | die("todo (arm abi): env calls"); |
| 377 | − emit(Ocall, 0, R, i1->arg[0], CALL(cty)); | |
| 378 | 383 | |
| 379 | 384 | if (cty & (1 << 13)) |
| 380 | 385 | /* struct return argument */ |
| @@ -383,9 +388,9 @@ selcall(Fn *fn, Ins *i0, Ins *i1, Insl **ilp) · 2 unmodified lines | ||
| 383 | 388 | for (i=i0, c=ca; i<i1; i++, c++) { |
| 384 | 389 | if ((c->class & Cstk) != 0) |
| 385 | 390 | continue; |
| 386 | − if (i->op != Oargc) | |
| 391 | + if (i->op == Oarg) | |
| 387 | 392 | emit(Ocopy, *c->cls, TMP(*c->reg), i->arg[0], R); |
| 388 | − else | |
| 393 | + if (i->op == Oargc) | |
| 389 | 394 | ldregs(c->reg, c->cls, c->nreg, i->arg[1], fn); |
| 390 | 395 | } |
| 391 | 396 | |
| @@ -393,11 +398,12 @@ selcall(Fn *fn, Ins *i0, Ins *i1, Insl **ilp) · 1 unmodified line | ||
| 393 | 398 | for (i=i0, c=ca; i<i1; i++, c++) { |
| 394 | 399 | if ((c->class & Cstk) == 0) |
| 395 | 400 | continue; |
| 396 | − if (i->op != Oargc) { | |
| 401 | + if (i->op == Oarg) { | |
| 397 | 402 | r = newtmp("abi", Kl, fn); |
| 398 | 403 | emit(Ostorel, 0, R, i->arg[0], r); |
| 399 | 404 | emit(Oadd, Kl, r, TMP(SP), getcon(off, fn)); |
| 400 | − } else | |
| 405 | + } | |
| 406 | + if (i->op == Oargc) | |
| 401 | 407 | blit(TMP(SP), off, i->arg[1], c->size, fn); |
| 402 | 408 | off += c->size; |
| 403 | 409 | } |
| @@ -675,7 +681,6 @@ arm64_abi(Fn *fn) · 271 unmodified lines | ||
| 675 | 681 | emiti(*i); |
| 676 | 682 | break; |
| 677 | 683 | case Ocall: |
| 678 | − case Ovacall: | |
| 679 | 684 | for (i0=i; i0>b->ins; i0--) |
| 680 | 685 | if (!isarg((i0-1)->op)) |
| 681 | 686 | break; |
| @@ -751,7 +751,7 @@ single-precision floating point number `%f` into `%rs`. · 750 unmodified lines | ||
| 751 | 751 | ARG := |
| 752 | 752 | ABITY VAL # Regular argument |
| 753 | 753 | | 'env' VAL # Environment argument (first) |
| 754 | − | '...' # Variadic marker (last) | |
| 754 | + | '...' # Variadic marker | |
| 755 | 755 | |
| 756 | 756 | ABITY := BASETY | :IDENT |
| 757 | 757 | |
| @@ -778,8 +778,8 @@ integer. If the called function does not expect an environment · 20 unmodified lines | ||
| 778 | 778 | parameter, it will be safely discarded. See the <@ Functions > |
| 779 | 779 | section for more information about environment parameters. |
| 780 | 780 | |
| 781 | −When the called function is variadic, the last argument | |
| 782 | −must be `...`. | |
| 781 | +When the called function is variadic, there must be a `...` | |
| 782 | +marker separating the named and variadic arguments. | |
| 783 | 783 | |
| 784 | 784 | ~ Variadic |
| 785 | 785 | ~~~~~~~~~~ |
| @@ -82,7 +82,7 @@ Again: · 81 unmodified lines | ||
| 82 | 82 | for (k=0; k<2; k++) |
| 83 | 83 | b->nlive[k] = nlv[k]; |
| 84 | 84 | for (i=&b->ins[b->nins]; i!=b->ins;) { |
| 85 | − if (iscall((--i)->op) && rtype(i->arg[1]) == RCall) { | |
| 85 | + if ((--i)->op == Ocall && rtype(i->arg[1]) == RCall) { | |
| 86 | 86 | b->in->t[0] &= ~T.retregs(i->arg[1], m); |
| 87 | 87 | for (k=0; k<2; k++) { |
| 88 | 88 | nlv[k] -= m[k]; |
| @@ -234,7 +234,7 @@ def(Slice sl, bits msk, Blk *b, Ins *i, Loc *il) · 233 unmodified lines | ||
| 234 | 234 | while (i > b->ins) { |
| 235 | 235 | --i; |
| 236 | 236 | if (killsl(i->to, sl) |
| 237 | − || (iscall(i->op) && escapes(sl.ref, curf))) | |
| 237 | + || (i->op == Ocall && escapes(sl.ref, curf))) | |
| 238 | 238 | goto Load; |
| 239 | 239 | ld = isload(i->op); |
| 240 | 240 | if (ld) { |
| @@ -137,8 +137,8 @@ O(pare, T(e,x,e,e, e,x,e,e), 0) X(0, 0, 0) · 136 unmodified lines | ||
| 137 | 137 | O(arg, T(w,l,s,d, x,x,x,x), 0) X(0, 0, 0) |
| 138 | 138 | O(argc, T(e,x,e,e, e,l,e,e), 0) X(0, 0, 0) |
| 139 | 139 | O(arge, T(e,l,e,e, e,x,e,e), 0) X(0, 0, 0) |
| 140 | +O(argv, T(x,x,x,x, x,x,x,x), 0) X(0, 0, 0) | |
| 140 | 141 | O(call, T(m,m,m,m, x,x,x,x), 0) X(0, 0, 0) |
| 141 | −O(vacall, T(m,m,m,m, x,x,x,x), 0) X(0, 0, 0) | |
| 142 | 142 | |
| 143 | 143 | /* Flags Setting */ |
| 144 | 144 | O(flagieq, T(x,x,e,e, x,x,e,e), 0) X(0, 0, 1) |
| @@ -450,25 +450,44 @@ parsecls(int *tyn) · 449 unmodified lines | ||
| 450 | 450 | static int |
| 451 | 451 | parserefl(int arg) |
| 452 | 452 | { |
| 453 | − int k, ty, env, hasenv; | |
| 453 | + int k, ty, env, hasenv, vararg; | |
| 454 | 454 | Ref r; |
| 455 | 455 | |
| 456 | 456 | hasenv = 0; |
| 457 | + vararg = 0; | |
| 457 | 458 | expect(Tlparen); |
| 458 | − while (peek() != Trparen && peek() != Tdots) { | |
| 459 | + while (peek() != Trparen) { | |
| 459 | 460 | if (curi - insb >= NIns) |
| 460 | 461 | err("too many instructions (1)"); |
| 461 | − env = peek() == Tenv; | |
| 462 | − if (env) { | |
| 462 | + if (!arg && vararg) | |
| 463 | + err("no parameters allowed after '...'"); | |
| 464 | + switch (peek()) { | |
| 465 | + case Tdots: | |
| 466 | + if (vararg) | |
| 467 | + err("only one '...' allowed"); | |
| 468 | + vararg = 1; | |
| 469 | + if (arg) { | |
| 470 | + *curi = (Ins){.op = Oargv}; | |
| 471 | + curi++; | |
| 472 | + } | |
| 473 | + next(); | |
| 474 | + goto Next; | |
| 475 | + case Tenv: | |
| 476 | + if (hasenv) | |
| 477 | + err("only one environment allowed"); | |
| 478 | + hasenv = 1; | |
| 479 | + env = 1; | |
| 463 | 480 | next(); |
| 464 | 481 | k = Kl; |
| 465 | − } else | |
| 482 | + break; | |
| 483 | + default: | |
| 484 | + env = 0; | |
| 466 | 485 | k = parsecls(&ty); |
| 486 | + break; | |
| 487 | + } | |
| 467 | 488 | r = parseref(); |
| 468 | 489 | if (req(r, R)) |
| 469 | 490 | err("invalid argument"); |
| 470 | − if (hasenv && env) | |
| 471 | − err("only one environment allowed"); | |
| 472 | 491 | if (!arg && rtype(r) != RTmp) |
| 473 | 492 | err("invalid function parameter"); |
| 474 | 493 | if (k == 4) |
| @@ -487,16 +506,13 @@ parserefl(int arg) · 12 unmodified lines | ||
| 487 | 506 | else |
| 488 | 507 | *curi = (Ins){Opar, k, r, {R}}; |
| 489 | 508 | curi++; |
| 490 | − hasenv |= env; | |
| 509 | + Next: | |
| 491 | 510 | if (peek() == Trparen) |
| 492 | 511 | break; |
| 493 | 512 | expect(Tcomma); |
| 494 | 513 | } |
| 495 | − if (next() == Tdots) { | |
| 496 | − expect(Trparen); | |
| 497 | − return 1; | |
| 498 | − } | |
| 499 | − return 0; | |
| 514 | + expect(Trparen); | |
| 515 | + return vararg; | |
| 500 | 516 | } |
| 501 | 517 | |
| 502 | 518 | static Blk * |
| @@ -621,10 +637,8 @@ DoOp: · 118 unmodified lines | ||
| 621 | 637 | } |
| 622 | 638 | if (op == Tcall) { |
| 623 | 639 | arg[0] = parseref(); |
| 624 | − if (parserefl(1)) | |
| 625 | − op = Ovacall; | |
| 626 | − else | |
| 627 | − op = Ocall; | |
| 640 | + parserefl(1); | |
| 641 | + op = Ocall; | |
| 628 | 642 | expect(Tnl); |
| 629 | 643 | if (k == 4) { |
| 630 | 644 | k = Kl; |
| @@ -3408,7 +3408,7 @@ function $transparent_crc(l %.1, l %.3, w %.5) { · 3407 unmodified lines | ||
| 3408 | 3408 | %.9 =l copy $.Lstring.93 |
| 3409 | 3409 | %.10 =l loadl %.4 |
| 3410 | 3410 | %.11 =l loadl %.2 |
| 3411 | − %.12 =w call $printf(l %.9, l %.10, l %.11, ...) | |
| 3411 | + %.12 =w call $printf(l %.9, ..., l %.10, l %.11) | |
| 3412 | 3412 | @if_false.679 |
| 3413 | 3413 | %.13 =l loadl $crc32_context |
| 3414 | 3414 | %.14 =l loadl %.2 |
| @@ -3461,7 +3461,7 @@ function $transparent_crc_bytes(l %.1, w %.3, l %.5, w %.7) { · 46 unmodified lines | ||
| 3461 | 3461 | %.28 =l loadl $crc32_context |
| 3462 | 3462 | %.29 =l copy 4294967295 |
| 3463 | 3463 | %.30 =l xor %.28, %.29 |
| 3464 | − %.31 =w call $printf(l %.26, l %.27, l %.30, ...) | |
| 3464 | + %.31 =w call $printf(l %.26, ..., l %.27, l %.30) | |
| 3465 | 3465 | @if_false.687 |
| 3466 | 3466 | ret |
| 3467 | 3467 | } |
| @@ -3480,7 +3480,7 @@ function $platform_main_end(l %.1, w %.3) { · 12 unmodified lines | ||
| 3480 | 3480 | @if_true.690 |
| 3481 | 3481 | %.8 =l copy $.Lstring.97 |
| 3482 | 3482 | %.9 =l loadl %.2 |
| 3483 | − %.10 =w call $printf(l %.8, l %.9, ...) | |
| 3483 | + %.10 =w call $printf(l %.8, ..., l %.9) | |
| 3484 | 3484 | @if_false.691 |
| 3485 | 3485 | ret |
| 3486 | 3486 | } |
| @@ -35219,7 +35219,7 @@ function w $main(w %.1, l %.3) { · 31732 unmodified lines | ||
| 35219 | 35219 | %.53 =w loadsw %.5 |
| 35220 | 35220 | %.54 =w loadsw %.6 |
| 35221 | 35221 | %.55 =w loadsw %.7 |
| 35222 | − %.56 =w call $printf(l %.52, w %.53, w %.54, w %.55, ...) | |
| 35222 | + %.56 =w call $printf(l %.52, ..., w %.53, w %.54, w %.55) | |
| 35223 | 35223 | @if_false.1519 |
| 35224 | 35224 | @for_cont.1516 |
| 35225 | 35225 | %.57 =w loadsw %.7 |
| @@ -35338,7 +35338,7 @@ function w $main(w %.1, l %.3) { · 112 unmodified lines | ||
| 35338 | 35338 | @if_true.1524 |
| 35339 | 35339 | %.138 =l copy $.Lstring.129 |
| 35340 | 35340 | %.139 =w loadsw %.5 |
| 35341 | − %.140 =w call $printf(l %.138, w %.139, ...) | |
| 35341 | + %.140 =w call $printf(l %.138, ..., w %.139) | |
| 35342 | 35342 | @if_false.1525 |
| 35343 | 35343 | @for_cont.1522 |
| 35344 | 35344 | %.141 =w loadsw %.5 |
| @@ -25,41 +25,41 @@ export · 24 unmodified lines | ||
| 25 | 25 | function $test() { |
| 26 | 26 | @start |
| 27 | 27 | %r1 =:st1 call $t1() |
| 28 | − %i1 =w call $printf(l $fmt1, l %r1, ...) | |
| 28 | + %i1 =w call $printf(l $fmt1, ..., l %r1) | |
| 29 | 29 | |
| 30 | 30 | %r2 =:st2 call $t2() |
| 31 | 31 | %w2 =w loadw %r2 |
| 32 | − %i2 =w call $printf(l $fmt2, w %w2, ...) | |
| 32 | + %i2 =w call $printf(l $fmt2, ..., w %w2) | |
| 33 | 33 | |
| 34 | 34 | %r3 =:st3 call $t3() |
| 35 | 35 | %s3 =s loads %r3 |
| 36 | 36 | %r34 =l add %r3, 4 |
| 37 | 37 | %w3 =w loadw %r34 |
| 38 | 38 | %p3 =d exts %s3 |
| 39 | − %i3 =w call $printf(l $fmt3, d %p3, w %w3, ...) | |
| 39 | + %i3 =w call $printf(l $fmt3, ..., d %p3, w %w3) | |
| 40 | 40 | |
| 41 | 41 | %r4 =:st4 call $t4() |
| 42 | 42 | %w4 =w loadw %r4 |
| 43 | 43 | %r48 =l add 8, %r4 |
| 44 | 44 | %d4 =d loadd %r48 |
| 45 | − %i4 =w call $printf(l $fmt4, w %w4, d %d4, ...) | |
| 45 | + %i4 =w call $printf(l $fmt4, ..., w %w4, d %d4) | |
| 46 | 46 | |
| 47 | 47 | %r5 =:st5 call $t5() |
| 48 | 48 | %s5 =s loads %r5 |
| 49 | 49 | %d5 =d exts %s5 |
| 50 | 50 | %r58 =l add %r5, 8 |
| 51 | 51 | %l5 =l loadl %r58 |
| 52 | − %i5 =w call $printf(l $fmt5, d %d5, l %l5, ...) | |
| 52 | + %i5 =w call $printf(l $fmt5, ..., d %d5, l %l5) | |
| 53 | 53 | |
| 54 | 54 | %r6 =:st6 call $t6() |
| 55 | − %i6 =w call $printf(l $fmt6, l %r6, ...) | |
| 55 | + %i6 =w call $printf(l $fmt6, ..., l %r6) | |
| 56 | 56 | |
| 57 | 57 | %r7 =:st7 call $t7() |
| 58 | 58 | %s7 =s loads %r7 |
| 59 | 59 | %d71 =d exts %s7 |
| 60 | 60 | %r78 =l add %r7, 8 |
| 61 | 61 | %d72 =d loadd %r78 |
| 62 | − %i7 =w call $printf(l $fmt7, d %d71, d %d72, ...) | |
| 62 | + %i7 =w call $printf(l $fmt7, ..., d %d71, d %d72) | |
| 63 | 63 | |
| 64 | 64 | %r8 =:st8 call $t8() |
| 65 | 65 | %r84 =l add 4, %r8 |
| @@ -69,14 +69,14 @@ function $test() { · 3 unmodified lines | ||
| 69 | 69 | %w82 =w loadw %r84 |
| 70 | 70 | %w83 =w loadw %r88 |
| 71 | 71 | %w84 =w loadw %r812 |
| 72 | − %i8 =w call $printf(l $fmt8, w %w81, w %w82, w %w83, w %w84, ...) | |
| 72 | + %i8 =w call $printf(l $fmt8, ..., w %w81, w %w82, w %w83, w %w84) | |
| 73 | 73 | |
| 74 | 74 | %r9 =:st9 call $t9() |
| 75 | 75 | %r94 =l add 4, %r9 |
| 76 | 76 | %w9 =w loadw %r9 |
| 77 | 77 | %s9 =s loads %r94 |
| 78 | 78 | %d9 =d exts %s9 |
| 79 | − %i9 =w call $printf(l $fmt9, w %w9, d %d9, ...) | |
| 79 | + %i9 =w call $printf(l $fmt9, ..., w %w9, d %d9) | |
| 80 | 80 | |
| 81 | 81 | ret |
| 82 | 82 | } |
| @@ -13,8 +13,8 @@ function $f(:hfa3 %h1, :hfa3 %h2, d %d1, :hfa3 %h3, d %d2) { · 12 unmodified lines | ||
| 13 | 13 | call $phfa3(:hfa3 %h1) |
| 14 | 14 | call $phfa3(:hfa3 %h2) |
| 15 | 15 | call $phfa3(:hfa3 %h3) |
| 16 | − call $printf(l $dfmt, d %d1, ...) | |
| 17 | − call $printf(l $dfmt, d %d2, ...) | |
| 16 | + call $printf(l $dfmt, ..., d %d1) | |
| 17 | + call $printf(l $dfmt, ..., d %d2) | |
| 18 | 18 | ret |
| 19 | 19 | } |
| 20 | 20 | |
| @@ -20,7 +20,7 @@ function w $main(w %argc, l %argv) { · 19 unmodified lines | ||
| 20 | 20 | @loop2 |
| 21 | 21 | %sep =w phi @last 10, @nolast 32 |
| 22 | 22 | %arg =l loadl %av |
| 23 | − %r =w call $printf(l %fmt, l %arg, w %sep, ...) | |
| 23 | + %r =w call $printf(l %fmt, ..., l %arg, w %sep) | |
| 24 | 24 | %av1 =l add %av, 8 |
| 25 | 25 | %ac1 =w sub %ac, 1 |
| 26 | 26 | jmp @loop |
| @@ -19,11 +19,11 @@ export function $qbeprint0(l %fmt, ...) { · 18 unmodified lines | ||
| 19 | 19 | jnz %isg, @casef, @cased |
| 20 | 20 | @casef |
| 21 | 21 | %dbl =d vaarg %vp |
| 22 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 22 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 23 | 23 | jmp @loop |
| 24 | 24 | @cased |
| 25 | 25 | %int =w vaarg %vp |
| 26 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 26 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 27 | 27 | jmp @loop |
| 28 | 28 | @end |
| 29 | 29 | %r =w call $puts(l %emptys) |
| @@ -59,11 +59,11 @@ export function $qbeprint1(w %argw0, l %fmt, ...) { · 29 unmodified lines | ||
| 59 | 59 | jnz %isg, @casef, @cased |
| 60 | 60 | @casef |
| 61 | 61 | %dbl =d vaarg %vp |
| 62 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 62 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 63 | 63 | jmp @loop |
| 64 | 64 | @cased |
| 65 | 65 | %int =w vaarg %vp |
| 66 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 66 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 67 | 67 | jmp @loop |
| 68 | 68 | @end |
| 69 | 69 | %r =w call $puts(l %emptys) |
| @@ -99,11 +99,11 @@ export function $qbeprint2(d %argd0, l %fmt, ...) { · 29 unmodified lines | ||
| 99 | 99 | jnz %isg, @casef, @cased |
| 100 | 100 | @casef |
| 101 | 101 | %dbl =d vaarg %vp |
| 102 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 102 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 103 | 103 | jmp @loop |
| 104 | 104 | @cased |
| 105 | 105 | %int =w vaarg %vp |
| 106 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 106 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 107 | 107 | jmp @loop |
| 108 | 108 | @end |
| 109 | 109 | %r =w call $puts(l %emptys) |
| @@ -139,11 +139,11 @@ export function $qbeprint3(w %argw0, w %argw1, w %argw2, w %argw3, l %fmt, ...) · 29 unmodified lines | ||
| 139 | 139 | jnz %isg, @casef, @cased |
| 140 | 140 | @casef |
| 141 | 141 | %dbl =d vaarg %vp |
| 142 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 142 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 143 | 143 | jmp @loop |
| 144 | 144 | @cased |
| 145 | 145 | %int =w vaarg %vp |
| 146 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 146 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 147 | 147 | jmp @loop |
| 148 | 148 | @end |
| 149 | 149 | %r =w call $puts(l %emptys) |
| @@ -179,11 +179,11 @@ export function $qbeprint4(d %argd0, d %argd1, d %argd2, d %argd3, d %argd4, d % · 29 unmodified lines | ||
| 179 | 179 | jnz %isg, @casef, @cased |
| 180 | 180 | @casef |
| 181 | 181 | %dbl =d vaarg %vp |
| 182 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 182 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 183 | 183 | jmp @loop |
| 184 | 184 | @cased |
| 185 | 185 | %int =w vaarg %vp |
| 186 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 186 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 187 | 187 | jmp @loop |
| 188 | 188 | @end |
| 189 | 189 | %r =w call $puts(l %emptys) |
| @@ -219,11 +219,11 @@ export function $qbeprint5(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, d % · 29 unmodified lines | ||
| 219 | 219 | jnz %isg, @casef, @cased |
| 220 | 220 | @casef |
| 221 | 221 | %dbl =d vaarg %vp |
| 222 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 222 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 223 | 223 | jmp @loop |
| 224 | 224 | @cased |
| 225 | 225 | %int =w vaarg %vp |
| 226 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 226 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 227 | 227 | jmp @loop |
| 228 | 228 | @end |
| 229 | 229 | %r =w call $puts(l %emptys) |
| @@ -259,11 +259,11 @@ export function $qbeprint6(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w % · 29 unmodified lines | ||
| 259 | 259 | jnz %isg, @casef, @cased |
| 260 | 260 | @casef |
| 261 | 261 | %dbl =d vaarg %vp |
| 262 | − %r =w call $printf(l %fmtdbl, d %dbl, ...) | |
| 262 | + %r =w call $printf(l %fmtdbl, ..., d %dbl) | |
| 263 | 263 | jmp @loop |
| 264 | 264 | @cased |
| 265 | 265 | %int =w vaarg %vp |
| 266 | − %r =w call $printf(l %fmtint, w %int, ...) | |
| 266 | + %r =w call $printf(l %fmtint, ..., w %int) | |
| 267 | 267 | jmp @loop |
| 268 | 268 | @end |
| 269 | 269 | %r =w call $puts(l %emptys) |