make variadic args explicit
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.
This commit is contained in:
parent
9858a12730
commit
fcdef10dae
13 changed files with 101 additions and 75 deletions
|
@ -3408,7 +3408,7 @@ function $transparent_crc(l %.1, l %.3, w %.5) {
|
|||
%.9 =l copy $.Lstring.93
|
||||
%.10 =l loadl %.4
|
||||
%.11 =l loadl %.2
|
||||
%.12 =w call $printf(l %.9, l %.10, l %.11, ...)
|
||||
%.12 =w call $printf(l %.9, ..., l %.10, l %.11)
|
||||
@if_false.679
|
||||
%.13 =l loadl $crc32_context
|
||||
%.14 =l loadl %.2
|
||||
|
@ -3461,7 +3461,7 @@ function $transparent_crc_bytes(l %.1, w %.3, l %.5, w %.7) {
|
|||
%.28 =l loadl $crc32_context
|
||||
%.29 =l copy 4294967295
|
||||
%.30 =l xor %.28, %.29
|
||||
%.31 =w call $printf(l %.26, l %.27, l %.30, ...)
|
||||
%.31 =w call $printf(l %.26, ..., l %.27, l %.30)
|
||||
@if_false.687
|
||||
ret
|
||||
}
|
||||
|
@ -3480,7 +3480,7 @@ function $platform_main_end(l %.1, w %.3) {
|
|||
@if_true.690
|
||||
%.8 =l copy $.Lstring.97
|
||||
%.9 =l loadl %.2
|
||||
%.10 =w call $printf(l %.8, l %.9, ...)
|
||||
%.10 =w call $printf(l %.8, ..., l %.9)
|
||||
@if_false.691
|
||||
ret
|
||||
}
|
||||
|
@ -35219,7 +35219,7 @@ function w $main(w %.1, l %.3) {
|
|||
%.53 =w loadsw %.5
|
||||
%.54 =w loadsw %.6
|
||||
%.55 =w loadsw %.7
|
||||
%.56 =w call $printf(l %.52, w %.53, w %.54, w %.55, ...)
|
||||
%.56 =w call $printf(l %.52, ..., w %.53, w %.54, w %.55)
|
||||
@if_false.1519
|
||||
@for_cont.1516
|
||||
%.57 =w loadsw %.7
|
||||
|
@ -35338,7 +35338,7 @@ function w $main(w %.1, l %.3) {
|
|||
@if_true.1524
|
||||
%.138 =l copy $.Lstring.129
|
||||
%.139 =w loadsw %.5
|
||||
%.140 =w call $printf(l %.138, w %.139, ...)
|
||||
%.140 =w call $printf(l %.138, ..., w %.139)
|
||||
@if_false.1525
|
||||
@for_cont.1522
|
||||
%.141 =w loadsw %.5
|
||||
|
|
|
@ -25,41 +25,41 @@ export
|
|||
function $test() {
|
||||
@start
|
||||
%r1 =:st1 call $t1()
|
||||
%i1 =w call $printf(l $fmt1, l %r1, ...)
|
||||
%i1 =w call $printf(l $fmt1, ..., l %r1)
|
||||
|
||||
%r2 =:st2 call $t2()
|
||||
%w2 =w loadw %r2
|
||||
%i2 =w call $printf(l $fmt2, w %w2, ...)
|
||||
%i2 =w call $printf(l $fmt2, ..., w %w2)
|
||||
|
||||
%r3 =:st3 call $t3()
|
||||
%s3 =s loads %r3
|
||||
%r34 =l add %r3, 4
|
||||
%w3 =w loadw %r34
|
||||
%p3 =d exts %s3
|
||||
%i3 =w call $printf(l $fmt3, d %p3, w %w3, ...)
|
||||
%i3 =w call $printf(l $fmt3, ..., d %p3, w %w3)
|
||||
|
||||
%r4 =:st4 call $t4()
|
||||
%w4 =w loadw %r4
|
||||
%r48 =l add 8, %r4
|
||||
%d4 =d loadd %r48
|
||||
%i4 =w call $printf(l $fmt4, w %w4, d %d4, ...)
|
||||
%i4 =w call $printf(l $fmt4, ..., w %w4, d %d4)
|
||||
|
||||
%r5 =:st5 call $t5()
|
||||
%s5 =s loads %r5
|
||||
%d5 =d exts %s5
|
||||
%r58 =l add %r5, 8
|
||||
%l5 =l loadl %r58
|
||||
%i5 =w call $printf(l $fmt5, d %d5, l %l5, ...)
|
||||
%i5 =w call $printf(l $fmt5, ..., d %d5, l %l5)
|
||||
|
||||
%r6 =:st6 call $t6()
|
||||
%i6 =w call $printf(l $fmt6, l %r6, ...)
|
||||
%i6 =w call $printf(l $fmt6, ..., l %r6)
|
||||
|
||||
%r7 =:st7 call $t7()
|
||||
%s7 =s loads %r7
|
||||
%d71 =d exts %s7
|
||||
%r78 =l add %r7, 8
|
||||
%d72 =d loadd %r78
|
||||
%i7 =w call $printf(l $fmt7, d %d71, d %d72, ...)
|
||||
%i7 =w call $printf(l $fmt7, ..., d %d71, d %d72)
|
||||
|
||||
%r8 =:st8 call $t8()
|
||||
%r84 =l add 4, %r8
|
||||
|
@ -69,14 +69,14 @@ function $test() {
|
|||
%w82 =w loadw %r84
|
||||
%w83 =w loadw %r88
|
||||
%w84 =w loadw %r812
|
||||
%i8 =w call $printf(l $fmt8, w %w81, w %w82, w %w83, w %w84, ...)
|
||||
%i8 =w call $printf(l $fmt8, ..., w %w81, w %w82, w %w83, w %w84)
|
||||
|
||||
%r9 =:st9 call $t9()
|
||||
%r94 =l add 4, %r9
|
||||
%w9 =w loadw %r9
|
||||
%s9 =s loads %r94
|
||||
%d9 =d exts %s9
|
||||
%i9 =w call $printf(l $fmt9, w %w9, d %d9, ...)
|
||||
%i9 =w call $printf(l $fmt9, ..., w %w9, d %d9)
|
||||
|
||||
ret
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ function $f(:hfa3 %h1, :hfa3 %h2, d %d1, :hfa3 %h3, d %d2) {
|
|||
call $phfa3(:hfa3 %h1)
|
||||
call $phfa3(:hfa3 %h2)
|
||||
call $phfa3(:hfa3 %h3)
|
||||
call $printf(l $dfmt, d %d1, ...)
|
||||
call $printf(l $dfmt, d %d2, ...)
|
||||
call $printf(l $dfmt, ..., d %d1)
|
||||
call $printf(l $dfmt, ..., d %d2)
|
||||
ret
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ function w $main(w %argc, l %argv) {
|
|||
@loop2
|
||||
%sep =w phi @last 10, @nolast 32
|
||||
%arg =l loadl %av
|
||||
%r =w call $printf(l %fmt, l %arg, w %sep, ...)
|
||||
%r =w call $printf(l %fmt, ..., l %arg, w %sep)
|
||||
%av1 =l add %av, 8
|
||||
%ac1 =w sub %ac, 1
|
||||
jmp @loop
|
||||
|
|
|
@ -19,11 +19,11 @@ export function $qbeprint0(l %fmt, ...) {
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
@ -59,11 +59,11 @@ export function $qbeprint1(w %argw0, l %fmt, ...) {
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
@ -99,11 +99,11 @@ export function $qbeprint2(d %argd0, l %fmt, ...) {
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
@ -139,11 +139,11 @@ export function $qbeprint3(w %argw0, w %argw1, w %argw2, w %argw3, l %fmt, ...)
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
@ -179,11 +179,11 @@ export function $qbeprint4(d %argd0, d %argd1, d %argd2, d %argd3, d %argd4, d %
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
@ -219,11 +219,11 @@ export function $qbeprint5(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, d %
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
@ -259,11 +259,11 @@ export function $qbeprint6(w %argw0, w %argw1, w %argw2, w %argw3, w %argw4, w %
|
|||
jnz %isg, @casef, @cased
|
||||
@casef
|
||||
%dbl =d vaarg %vp
|
||||
%r =w call $printf(l %fmtdbl, d %dbl, ...)
|
||||
%r =w call $printf(l %fmtdbl, ..., d %dbl)
|
||||
jmp @loop
|
||||
@cased
|
||||
%int =w vaarg %vp
|
||||
%r =w call $printf(l %fmtint, w %int, ...)
|
||||
%r =w call $printf(l %fmtint, ..., w %int)
|
||||
jmp @loop
|
||||
@end
|
||||
%r =w call $puts(l %emptys)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue