Rework compileUnaryPostfixExpression

Previously this tried to reuse too much code, making it hard to implement operator overloading
This commit is contained in:
dcodeIO
2018-10-29 20:06:21 +01:00
parent 0bb5cb829e
commit 6f8a0fe03a
20 changed files with 2532 additions and 3313 deletions

View File

@ -6882,19 +6882,29 @@ export class Compiler extends DiagnosticEmitter {
ConversionKind.NONE, ConversionKind.NONE,
WrapMode.NONE WrapMode.NONE
); );
// shortcut if compiling the getter already failed // shortcut if compiling the getter already failed
if (getExpressionId(getValue) == ExpressionId.Unreachable) return getValue; if (getExpressionId(getValue) == ExpressionId.Unreachable) return getValue;
var currentType = this.currentType; var currentType = this.currentType;
var op: BinaryOp; // if the value isn't dropped, a temp. local is required to remember the original value
var nativeType: NativeType; var tempLocal: Local | null = null;
var nativeOne: ExpressionRef; if (contextualType != Type.void) {
tempLocal = currentFunction.getTempLocal(currentType, false);
getValue = module.createTeeLocal(
tempLocal.index,
getValue
);
}
var calcValue: ExpressionRef;
switch (expression.operator) { switch (expression.operator) {
case Token.PLUS_PLUS: { case Token.PLUS_PLUS: {
// TODO: check operator overload // TODO: check operator overload
if (this.currentType.is(TypeFlags.REFERENCE)) { if (currentType.is(TypeFlags.REFERENCE)) {
this.error( this.error(
DiagnosticCode.Operation_not_supported, DiagnosticCode.Operation_not_supported,
expression.range expression.range
@ -6910,38 +6920,48 @@ export class Compiler extends DiagnosticEmitter {
case TypeKind.U16: case TypeKind.U16:
case TypeKind.U32: case TypeKind.U32:
case TypeKind.BOOL: { case TypeKind.BOOL: {
op = BinaryOp.AddI32; calcValue = module.createBinary(
nativeType = NativeType.I32; BinaryOp.AddI32,
nativeOne = module.createI32(1); getValue,
module.createI32(1)
);
break; break;
} }
case TypeKind.USIZE: // TODO: check operator overload case TypeKind.USIZE:
case TypeKind.ISIZE: { case TypeKind.ISIZE: {
let options = this.options; let options = this.options;
op = options.isWasm64 calcValue = module.createBinary(
? BinaryOp.AddI64 options.isWasm64
: BinaryOp.AddI32; ? BinaryOp.AddI64
nativeType = options.nativeSizeType; : BinaryOp.AddI32,
nativeOne = currentType.toNativeOne(module); getValue,
currentType.toNativeOne(module)
);
break; break;
} }
case TypeKind.I64: case TypeKind.I64:
case TypeKind.U64: { case TypeKind.U64: {
op = BinaryOp.AddI64; calcValue = module.createBinary(
nativeType = NativeType.I64; BinaryOp.AddI64,
nativeOne = module.createI64(1); getValue,
module.createI64(1)
);
break; break;
} }
case TypeKind.F32: { case TypeKind.F32: {
op = BinaryOp.AddF32; calcValue = module.createBinary(
nativeType = NativeType.F32; BinaryOp.AddF32,
nativeOne = module.createF32(1); getValue,
module.createF32(1)
);
break; break;
} }
case TypeKind.F64: { case TypeKind.F64: {
op = BinaryOp.AddF64; calcValue = module.createBinary(
nativeType = NativeType.F64; BinaryOp.AddF64,
nativeOne = module.createF64(1); getValue,
module.createF64(1)
);
break; break;
} }
default: { default: {
@ -6970,38 +6990,48 @@ export class Compiler extends DiagnosticEmitter {
case TypeKind.U16: case TypeKind.U16:
case TypeKind.U32: case TypeKind.U32:
case TypeKind.BOOL: { case TypeKind.BOOL: {
op = BinaryOp.SubI32; calcValue = module.createBinary(
nativeType = NativeType.I32; BinaryOp.SubI32,
nativeOne = module.createI32(1); getValue,
module.createI32(1)
);
break; break;
} }
case TypeKind.USIZE: // TODO: check operator overload case TypeKind.USIZE:
case TypeKind.ISIZE: { case TypeKind.ISIZE: {
let options = this.options; let options = this.options;
op = options.isWasm64 calcValue = module.createBinary(
? BinaryOp.SubI64 options.isWasm64
: BinaryOp.SubI32; ? BinaryOp.SubI64
nativeType = options.nativeSizeType; : BinaryOp.SubI32,
nativeOne = currentType.toNativeOne(module); getValue,
currentType.toNativeOne(module)
);
break; break;
} }
case TypeKind.I64: case TypeKind.I64:
case TypeKind.U64: { case TypeKind.U64: {
op = BinaryOp.SubI64; calcValue = module.createBinary(
nativeType = NativeType.I64; BinaryOp.SubI64,
nativeOne = module.createI64(1); getValue,
module.createI64(1)
);
break; break;
} }
case TypeKind.F32: { case TypeKind.F32: {
op = BinaryOp.SubF32; calcValue = module.createBinary(
nativeType = NativeType.F32; BinaryOp.SubF32,
nativeOne = module.createF32(1); getValue,
module.createF32(1)
);
break; break;
} }
case TypeKind.F64: { case TypeKind.F64: {
op = BinaryOp.SubF64; calcValue = module.createBinary(
nativeType = NativeType.F64; BinaryOp.SubF64,
nativeOne = module.createF64(1); getValue,
module.createF64(1)
);
break; break;
} }
default: { default: {
@ -7018,33 +7048,25 @@ export class Compiler extends DiagnosticEmitter {
} }
// simplify if dropped anyway // simplify if dropped anyway
if (contextualType == Type.void) { if (!tempLocal) {
this.currentType = Type.void;
return this.compileAssignmentWithValue(expression.operand, return this.compileAssignmentWithValue(expression.operand,
module.createBinary(op, calcValue,
getValue,
nativeOne
),
false false
); );
} }
// otherwise use a temp local for the intermediate value (always possibly overflows) // otherwise use the temp. local for the intermediate value (always possibly overflows)
var tempLocal = currentFunction.getTempLocal(currentType, false);
var setValue = this.compileAssignmentWithValue(expression.operand, var setValue = this.compileAssignmentWithValue(expression.operand,
module.createBinary(op, calcValue, // also tees getValue to tempLocal
this.module.createGetLocal(tempLocal.index, nativeType),
nativeOne
),
false false
); );
this.currentType = assert(tempLocal).type; this.currentType = tempLocal.type;
currentFunction.freeTempLocal(<Local>tempLocal); currentFunction.freeTempLocal(tempLocal);
var nativeType = tempLocal.type.toNativeType();
var localIndex = (<Local>tempLocal).index;
return module.createBlock(null, [ return module.createBlock(null, [
module.createSetLocal(localIndex, getValue),
setValue, setValue,
module.createGetLocal(localIndex, nativeType) module.createGetLocal(tempLocal.index, nativeType)
], nativeType); // result of 'x++' / 'x--' might overflow ], nativeType); // result of 'x++' / 'x--' might overflow
} }

View File

@ -18,12 +18,11 @@
(block (block
(set_global $comma/b (set_global $comma/b
(block (result i32) (block (result i32)
(set_local $0
(get_global $comma/a)
)
(set_global $comma/a (set_global $comma/a
(i32.add (i32.add
(get_local $0) (tee_local $0
(get_global $comma/a)
)
(i32.const 1) (i32.const 1)
) )
) )

View File

@ -78,12 +78,11 @@
(nop) (nop)
(br_if $continue|1 (br_if $continue|1
(block (result i32) (block (result i32)
(set_local $0
(get_global $do/n)
)
(set_global $do/n (set_global $do/n
(i32.sub (i32.sub
(get_local $0) (tee_local $0
(get_global $do/n)
)
(i32.const 1) (i32.const 1)
) )
) )

File diff suppressed because it is too large Load Diff

View File

@ -71,12 +71,11 @@
) )
(i32.store8 (i32.store8
(block (result i32) (block (result i32)
(set_local $4
(get_local $0)
)
(set_local $0 (set_local $0
(i32.add (i32.add
(get_local $4) (tee_local $4
(get_local $0)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -84,12 +83,11 @@
) )
(i32.load8_u (i32.load8_u
(block (result i32) (block (result i32)
(set_local $4
(get_local $1)
)
(set_local $1 (set_local $1
(i32.add (i32.add
(get_local $4) (tee_local $4
(get_local $1)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -152,12 +150,11 @@
(block (block
(i32.store8 (i32.store8
(block (result i32) (block (result i32)
(set_local $4
(get_local $0)
)
(set_local $0 (set_local $0
(i32.add (i32.add
(get_local $4) (tee_local $4
(get_local $0)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -165,12 +162,11 @@
) )
(i32.load8_u (i32.load8_u
(block (result i32) (block (result i32)
(set_local $4
(get_local $1)
)
(set_local $1 (set_local $1
(i32.add (i32.add
(get_local $4) (tee_local $4
(get_local $1)
)
(i32.const 1) (i32.const 1)
) )
) )

View File

@ -78,12 +78,11 @@
) )
(set_local $1 (set_local $1
(block (result i32) (block (result i32)
(set_local $2
(get_local $0)
)
(set_local $0 (set_local $0
(i32.add (i32.add
(get_local $2) (tee_local $2
(get_local $0)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -115,12 +114,11 @@
) )
(set_local $1 (set_local $1
(block (result i32) (block (result i32)
(set_local $2
(get_local $0)
)
(set_local $0 (set_local $0
(i32.sub (i32.sub
(get_local $2) (tee_local $2
(get_local $0)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -361,12 +359,11 @@
) )
(set_local $0 (set_local $0
(block (result i32) (block (result i32)
(set_local $2
(get_local $1)
)
(set_local $1 (set_local $1
(i32.add (i32.add
(get_local $2) (tee_local $2
(get_local $1)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -398,12 +395,11 @@
) )
(set_local $0 (set_local $0
(block (result i32) (block (result i32)
(set_local $2
(get_local $1)
)
(set_local $1 (set_local $1
(i32.sub (i32.sub
(get_local $2) (tee_local $2
(get_local $1)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -638,12 +634,11 @@
) )
(set_local $1 (set_local $1
(block (result i32) (block (result i32)
(set_local $2
(get_local $0)
)
(set_local $0 (set_local $0
(i32.sub (i32.sub
(get_local $2) (tee_local $2
(get_local $0)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -672,12 +667,11 @@
) )
(set_local $1 (set_local $1
(block (result i32) (block (result i32)
(set_local $2
(get_local $0)
)
(set_local $0 (set_local $0
(i32.add (i32.add
(get_local $2) (tee_local $2
(get_local $0)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -894,12 +888,11 @@
) )
(set_local $0 (set_local $0
(block (result i32) (block (result i32)
(set_local $2
(get_local $1)
)
(set_local $1 (set_local $1
(i32.sub (i32.sub
(get_local $2) (tee_local $2
(get_local $1)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -928,12 +921,11 @@
) )
(set_local $0 (set_local $0
(block (result i32) (block (result i32)
(set_local $2
(get_local $1)
)
(set_local $1 (set_local $1
(i32.add (i32.add
(get_local $2) (tee_local $2
(get_local $1)
)
(i32.const 1) (i32.const 1)
) )
) )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1096,15 +1096,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -2294,15 +2293,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -3505,15 +3503,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -4703,15 +4700,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -5926,15 +5922,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -7061,15 +7056,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -8327,15 +8321,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -9477,15 +9470,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -10633,15 +10625,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -11793,15 +11784,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )

File diff suppressed because it is too large Load Diff

View File

@ -1083,15 +1083,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -2090,15 +2089,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -3131,15 +3129,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -4138,15 +4135,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -5197,15 +5193,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -6192,15 +6187,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -7318,15 +7312,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -8314,15 +8307,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -9314,15 +9306,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -10316,15 +10307,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $5) (tee_local $5
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -54,12 +54,11 @@
(local $2 i32) (local $2 i32)
(set_local $2 (set_local $2
(block (result i32) (block (result i32)
(set_local $1
(get_global $~lib/symbol/nextId)
)
(set_global $~lib/symbol/nextId (set_global $~lib/symbol/nextId
(i32.add (i32.add
(get_local $1) (tee_local $1
(get_global $~lib/symbol/nextId)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -1389,15 +1388,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -1866,15 +1864,14 @@
) )
(i32.mul (i32.mul
(block (result i32) (block (result i32)
(set_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.store offset=16 (i32.store offset=16
(get_local $0) (get_local $0)
(i32.add (i32.add
(get_local $6) (tee_local $6
(i32.load offset=16
(get_local $0)
)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -1966,12 +1963,11 @@
) )
(set_local $2 (set_local $2
(block (result i32) (block (result i32)
(set_local $1
(get_global $~lib/symbol/nextId)
)
(set_global $~lib/symbol/nextId (set_global $~lib/symbol/nextId
(i32.add (i32.add
(get_local $1) (tee_local $1
(get_global $~lib/symbol/nextId)
)
(i32.const 1) (i32.const 1)
) )
) )

View File

@ -2866,12 +2866,11 @@
(set_local $8 (set_local $8
(i32.add (i32.add
(block (result i32) (block (result i32)
(set_local $8
(get_local $6)
)
(set_local $6 (set_local $6
(i32.sub (i32.sub
(get_local $8) (tee_local $8
(get_local $6)
)
(i32.const 1) (i32.const 1)
) )
) )

View File

@ -150,12 +150,11 @@
) )
(set_global $unary/i (set_global $unary/i
(block (result i32) (block (result i32)
(set_local $0
(get_global $unary/i)
)
(set_global $unary/i (set_global $unary/i
(i32.add (i32.add
(get_local $0) (tee_local $0
(get_global $unary/i)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -164,12 +163,11 @@
) )
(set_global $unary/i (set_global $unary/i
(block (result i32) (block (result i32)
(set_local $0
(get_global $unary/i)
)
(set_global $unary/i (set_global $unary/i
(i32.sub (i32.sub
(get_local $0) (tee_local $0
(get_global $unary/i)
)
(i32.const 1) (i32.const 1)
) )
) )
@ -285,12 +283,11 @@
) )
(set_global $unary/I (set_global $unary/I
(block (result i64) (block (result i64)
(set_local $1
(get_global $unary/I)
)
(set_global $unary/I (set_global $unary/I
(i64.add (i64.add
(get_local $1) (tee_local $1
(get_global $unary/I)
)
(i64.const 1) (i64.const 1)
) )
) )
@ -299,12 +296,11 @@
) )
(set_global $unary/I (set_global $unary/I
(block (result i64) (block (result i64)
(set_local $1
(get_global $unary/I)
)
(set_global $unary/I (set_global $unary/I
(i64.sub (i64.sub
(get_local $1) (tee_local $1
(get_global $unary/I)
)
(i64.const 1) (i64.const 1)
) )
) )
@ -399,12 +395,11 @@
) )
(set_global $unary/f (set_global $unary/f
(block (result f32) (block (result f32)
(set_local $2
(get_global $unary/f)
)
(set_global $unary/f (set_global $unary/f
(f32.add (f32.add
(get_local $2) (tee_local $2
(get_global $unary/f)
)
(f32.const 1) (f32.const 1)
) )
) )
@ -413,12 +408,11 @@
) )
(set_global $unary/f (set_global $unary/f
(block (result f32) (block (result f32)
(set_local $2
(get_global $unary/f)
)
(set_global $unary/f (set_global $unary/f
(f32.sub (f32.sub
(get_local $2) (tee_local $2
(get_global $unary/f)
)
(f32.const 1) (f32.const 1)
) )
) )
@ -517,12 +511,11 @@
) )
(set_global $unary/F (set_global $unary/F
(block (result f64) (block (result f64)
(set_local $3
(get_global $unary/F)
)
(set_global $unary/F (set_global $unary/F
(f64.add (f64.add
(get_local $3) (tee_local $3
(get_global $unary/F)
)
(f64.const 1) (f64.const 1)
) )
) )
@ -531,12 +524,11 @@
) )
(set_global $unary/F (set_global $unary/F
(block (result f64) (block (result f64)
(set_local $3
(get_global $unary/F)
)
(set_global $unary/F (set_global $unary/F
(f64.sub (f64.sub
(get_local $3) (tee_local $3
(get_global $unary/F)
)
(f64.const 1) (f64.const 1)
) )
) )

View File

@ -224,12 +224,11 @@
(if (result i32) (if (result i32)
(tee_local $0 (tee_local $0
(block (result i32) (block (result i32)
(set_local $0
(get_global $while/n)
)
(set_global $while/n (set_global $while/n
(i32.sub (i32.sub
(get_local $0) (tee_local $0
(get_global $while/n)
)
(i32.const 1) (i32.const 1)
) )
) )