diff options
author | Michael Forney <mforney@mforney.org> | 2021-07-01 13:25:30 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2021-07-01 13:30:16 -0700 |
commit | 1647af781a279c070a1cd99fc8aeae1be9795084 (patch) | |
tree | fc55f3d89b065347e28117035629df4116aa4327 | |
parent | b4f89ba90b6ca3233cc80aef9d42055266fac8df (diff) |
qbe: Remove unnecessary distinction between loaduw and loadsw
We always store the result to a w temporary, so there is no difference.
In fact, QBE provides loadw as an alias for loadsw precisely for
this reason.
-rw-r--r-- | ops.h | 3 | ||||
-rw-r--r-- | qbe.c | 6 | ||||
-rw-r--r-- | test/bitfield-assignment-sign-extend.qbe | 2 | ||||
-rw-r--r-- | test/bitfield-compound-assign.qbe | 4 | ||||
-rw-r--r-- | test/bitfield-integer-promotion.qbe | 2 | ||||
-rw-r--r-- | test/bitfield-load-signed.qbe | 2 | ||||
-rw-r--r-- | test/bitfield-load-unsigned.qbe | 2 | ||||
-rw-r--r-- | test/builtin-expect.qbe | 2 | ||||
-rw-r--r-- | test/compound-assignment.qbe | 2 | ||||
-rw-r--r-- | test/conditional-compound-literal.qbe | 4 | ||||
-rw-r--r-- | test/do-loop.qbe | 8 | ||||
-rw-r--r-- | test/for-loop.qbe | 6 | ||||
-rw-r--r-- | test/struct-copy.qbe | 6 | ||||
-rw-r--r-- | test/struct-return-2.qbe | 2 | ||||
-rw-r--r-- | test/varargs.qbe | 4 |
15 files changed, 27 insertions, 28 deletions
@@ -23,8 +23,7 @@ OP(ISTOREB, "storeb") OP(ILOADD, "loadd") OP(ILOADS, "loads") OP(ILOADL, "loadl") -OP(ILOADSW, "loadsw") -OP(ILOADUW, "loaduw") +OP(ILOADW, "loadw") OP(ILOADSH, "loadsh") OP(ILOADUH, "loaduh") OP(ILOADSB, "loadsb") @@ -277,7 +277,7 @@ funccopy(struct func *f, struct value *dst, struct value *src, uint64_t size, in switch (align) { case 1: load = ILOADUB, store = ISTOREB; break; case 2: load = ILOADUH, store = ISTOREH; break; - case 4: load = ILOADUW, store = ISTOREW; break; + case 4: load = ILOADW, store = ISTOREW; break; case 8: load = ILOADL, store = ISTOREL; break; default: fatal("internal error; invalid alignment %d", align); @@ -324,7 +324,7 @@ funcstore(struct func *f, struct type *t, enum typequal tq, struct lvalue lval, switch (t->size) { case 1: loadop = ILOADUB; storeop = ISTOREB; break; case 2: loadop = ILOADUH; storeop = ISTOREH; break; - case 4: loadop = ILOADUW; storeop = tp & PROPFLOAT ? ISTORES : ISTOREW; break; + case 4: loadop = ILOADW; storeop = tp & PROPFLOAT ? ISTORES : ISTOREW; break; case 8: loadop = ILOADL; storeop = tp & PROPFLOAT ? ISTORED : ISTOREL; break; default: fatal("internal error; unimplemented store"); @@ -366,7 +366,7 @@ funcload(struct func *f, struct type *t, struct lvalue lval) switch (t->size) { case 1: op = t->basic.issigned ? ILOADSB : ILOADUB; break; case 2: op = t->basic.issigned ? ILOADSH : ILOADUH; break; - case 4: op = t->prop & PROPFLOAT ? ILOADS : t->basic.issigned ? ILOADSW : ILOADUW; break; + case 4: op = t->prop & PROPFLOAT ? ILOADS : ILOADW; break; case 8: op = t->prop & PROPFLOAT ? ILOADD : ILOADL; break; default: fatal("internal error; unimplemented load"); diff --git a/test/bitfield-assignment-sign-extend.qbe b/test/bitfield-assignment-sign-extend.qbe index 05ffbf9..c2af6b8 100644 --- a/test/bitfield-assignment-sign-extend.qbe +++ b/test/bitfield-assignment-sign-extend.qbe @@ -10,7 +10,7 @@ function w $main() { %.6 =w shl %.5, 28 %.7 =w sar %.6, 28 %.8 =w and %.5, 15 - %.9 =w loaduw %.4 + %.9 =w loadw %.4 %.10 =w and %.9, 18446744073709551600 %.11 =w or %.8, %.10 storew %.11, %.4 diff --git a/test/bitfield-compound-assign.qbe b/test/bitfield-compound-assign.qbe index 8e08ff6..6924502 100644 --- a/test/bitfield-compound-assign.qbe +++ b/test/bitfield-compound-assign.qbe @@ -6,7 +6,7 @@ function $f() { %.2 =l mul 0, 1 %.3 =l add %.1, %.2 %.4 =l copy %.3 - %.5 =w loadsw %.4 + %.5 =w loadw %.4 %.6 =w shl %.5, 19 %.7 =w sar %.6, 23 %.8 =w add %.7, 3 @@ -14,7 +14,7 @@ function $f() { %.10 =w shl %.9, 19 %.11 =w sar %.10, 23 %.12 =w and %.9, 8176 - %.13 =w loaduw %.4 + %.13 =w loadw %.4 %.14 =w and %.13, 18446744073709543439 %.15 =w or %.12, %.14 storew %.15, %.4 diff --git a/test/bitfield-integer-promotion.qbe b/test/bitfield-integer-promotion.qbe index dd3bf63..e479e2f 100644 --- a/test/bitfield-integer-promotion.qbe +++ b/test/bitfield-integer-promotion.qbe @@ -7,7 +7,7 @@ function w $main() { %.3 =l mul 0, 1 %.4 =l add %.2, %.3 %.5 =l copy %.4 - %.6 =w loaduw %.5 + %.6 =w loadw %.5 %.7 =w shl %.6, 30 %.8 =w shr %.7, 30 %.9 =w copy %.8 diff --git a/test/bitfield-load-signed.qbe b/test/bitfield-load-signed.qbe index bc3f457..87d1cf5 100644 --- a/test/bitfield-load-signed.qbe +++ b/test/bitfield-load-signed.qbe @@ -6,7 +6,7 @@ function $f() { %.2 =l mul 0, 1 %.3 =l add %.1, %.2 %.4 =l copy %.3 - %.5 =w loadsw %.4 + %.5 =w loadw %.4 %.6 =w shl %.5, 13 %.7 =w sar %.6, 17 ret diff --git a/test/bitfield-load-unsigned.qbe b/test/bitfield-load-unsigned.qbe index c4ea94b..000ca11 100644 --- a/test/bitfield-load-unsigned.qbe +++ b/test/bitfield-load-unsigned.qbe @@ -6,7 +6,7 @@ function $f() { %.2 =l mul 0, 1 %.3 =l add %.1, %.2 %.4 =l copy %.3 - %.5 =w loaduw %.4 + %.5 =w loadw %.4 %.6 =w shl %.5, 13 %.7 =w shr %.6, 17 ret diff --git a/test/builtin-expect.qbe b/test/builtin-expect.qbe index 73e3b42..90011cb 100644 --- a/test/builtin-expect.qbe +++ b/test/builtin-expect.qbe @@ -2,7 +2,7 @@ export function w $main() { @start.1 @body.2 - %.1 =w loadsw $x + %.1 =w loadw $x ret %.1 } export data $x = align 4 { z 4 } diff --git a/test/compound-assignment.qbe b/test/compound-assignment.qbe index dcc7aa7..c91d470 100644 --- a/test/compound-assignment.qbe +++ b/test/compound-assignment.qbe @@ -9,7 +9,7 @@ function $f() { %.3 =l loadl %.2 %.4 =l add %.3, 4 storel %.4, %.2 - %.5 =w loadsw %.3 + %.5 =w loadw %.3 %.6 =w add %.5, 1 storew %.6, %.3 ret diff --git a/test/conditional-compound-literal.qbe b/test/conditional-compound-literal.qbe index 013d179..57358e6 100644 --- a/test/conditional-compound-literal.qbe +++ b/test/conditional-compound-literal.qbe @@ -11,12 +11,12 @@ function w $main() { @cond_true.3 jmp @cond_join.5 @cond_false.4 - %.5 =w loadsw %.1 + %.5 =w loadw %.1 storew %.5, %.4 @cond_join.5 %.6 =l phi @cond_true.3 0, @cond_false.4 %.4 storel %.6, %.2 %.7 =l loadl %.2 - %.8 =w loadsw %.7 + %.8 =w loadw %.7 ret %.8 } diff --git a/test/do-loop.qbe b/test/do-loop.qbe index 0d383e4..c6c5081 100644 --- a/test/do-loop.qbe +++ b/test/do-loop.qbe @@ -7,22 +7,22 @@ function w $main() { storew 2, %.1 storew 0, %.2 @do_body.3 - %.3 =w loadsw %.1 + %.3 =w loadw %.1 %.4 =w ceqw %.3, 1 jnz %.4, @if_true.6, @if_false.7 @if_true.6 jmp @do_cond.4 @if_false.7 - %.5 =w loadsw %.2 + %.5 =w loadw %.2 %.6 =w add %.5, 1 storew %.6, %.2 @do_cond.4 - %.7 =w loadsw %.1 + %.7 =w loadw %.1 %.8 =w sub %.7, 1 storew %.8, %.1 jnz %.7, @do_body.3, @do_join.5 @do_join.5 - %.9 =w loadsw %.2 + %.9 =w loadw %.2 %.10 =w cnew %.9, 2 ret %.10 } diff --git a/test/for-loop.qbe b/test/for-loop.qbe index 56b38b1..6214434 100644 --- a/test/for-loop.qbe +++ b/test/for-loop.qbe @@ -5,14 +5,14 @@ function $f() { @body.2 storew 0, %.1 @for_cond.3 - %.2 =w loadsw %.1 + %.2 =w loadw %.1 %.3 =w csltw %.2, 10 jnz %.3, @for_body.4, @for_join.6 @for_body.4 - %.4 =w loadsw %.1 + %.4 =w loadw %.1 call $g(w %.4) @for_cont.5 - %.5 =w loadsw %.1 + %.5 =w loadw %.1 %.6 =w add %.5, 1 storew %.6, %.1 jmp @for_cond.3 diff --git a/test/struct-copy.qbe b/test/struct-copy.qbe index 684952f..0e0dce3 100644 --- a/test/struct-copy.qbe +++ b/test/struct-copy.qbe @@ -3,15 +3,15 @@ function $f() { @start.1 %.1 =l alloc4 12 @body.2 - %.2 =l loaduw $x + %.2 =l loadw $x storew %.2, %.1 %.3 =l add $x, 4 %.4 =l add %.1, 4 - %.5 =l loaduw %.3 + %.5 =l loadw %.3 storew %.5, %.4 %.6 =l add %.3, 4 %.7 =l add %.4, 4 - %.8 =l loaduw %.6 + %.8 =l loadw %.6 storew %.8, %.7 ret } diff --git a/test/struct-return-2.qbe b/test/struct-return-2.qbe index 3e5a544..1e8ad27 100644 --- a/test/struct-return-2.qbe +++ b/test/struct-return-2.qbe @@ -8,6 +8,6 @@ function w $f() { %.3 =l mul 4, 1 %.4 =l add %.2, %.3 %.5 =l copy %.4 - %.6 =w loadsw %.5 + %.6 =w loadw %.5 ret %.6 } diff --git a/test/varargs.qbe b/test/varargs.qbe index 2a760d6..512a8c7 100644 --- a/test/varargs.qbe +++ b/test/varargs.qbe @@ -7,13 +7,13 @@ function $f(w %.1, ...) { @body.2 vastart %.3 @while_cond.3 - %.4 =w loadsw %.2 + %.4 =w loadw %.2 jnz %.4, @while_body.4, @while_join.5 @while_body.4 %.5 =w vaarg %.3 %.6 =s vaarg %.3 %.7 =l vaarg %.3 - %.8 =w loadsw %.2 + %.8 =w loadw %.2 %.9 =w sub %.8, 1 storew %.9, %.2 jmp @while_cond.3 |