Get rid of determineExpressionType

This commit is contained in:
dcodeIO
2017-12-23 17:49:06 +01:00
parent ca9c79185b
commit d7c069b692
5 changed files with 292 additions and 100 deletions

View File

@ -1,11 +1,49 @@
(module
(type $v (func))
(type $i (func (result i32)))
(type $I (func (result i64)))
(type $f (func (result f32)))
(type $F (func (result f64)))
(global $infer-type/ri (mut i32) (i32.const 0))
(global $infer-type/rI (mut i64) (i64.const 0))
(global $infer-type/rf (mut f32) (f32.const 0))
(global $infer-type/rF (mut f64) (f64.const 0))
(memory $0 1)
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
(block $__inlined_func$infer-type/locals
(nop)
(block
(block $__inlined_func$infer-type/locals
(nop)
)
)
(set_global $infer-type/ri
(block (result i32)
(block $__inlined_func$infer-type/reti (result i32)
(i32.const 0)
)
)
)
(set_global $infer-type/rI
(block (result i64)
(block $__inlined_func$infer-type/retI (result i64)
(i64.const 0)
)
)
)
(set_global $infer-type/rf
(block (result f32)
(block $__inlined_func$infer-type/retf (result f32)
(f32.const 0)
)
)
)
(set_global $infer-type/rF
(block (result f64)
(block $__inlined_func$infer-type/refF (result f64)
(f64.const 0)
)
)
)
)
)

View File

@ -1,12 +1,44 @@
(module
(type $v (func))
(type $i (func (result i32)))
(type $I (func (result i64)))
(type $f (func (result f32)))
(type $F (func (result f64)))
(global $infer-type/ri (mut i32) (i32.const 0))
(global $infer-type/rI (mut i64) (i64.const 0))
(global $infer-type/rf (mut f32) (f32.const 0))
(global $infer-type/rF (mut f64) (f64.const 0))
(memory $0 1)
(export "memory" (memory $0))
(start $start)
(func $infer-type/locals (; 0 ;) (type $v)
(nop)
)
(func $start (; 1 ;) (type $v)
(func $infer-type/reti (; 1 ;) (type $i) (result i32)
(i32.const 0)
)
(func $infer-type/retI (; 2 ;) (type $I) (result i64)
(i64.const 0)
)
(func $infer-type/retf (; 3 ;) (type $f) (result f32)
(f32.const 0)
)
(func $infer-type/refF (; 4 ;) (type $F) (result f64)
(f64.const 0)
)
(func $start (; 5 ;) (type $v)
(call $infer-type/locals)
(set_global $infer-type/ri
(call $infer-type/reti)
)
(set_global $infer-type/rI
(call $infer-type/retI)
)
(set_global $infer-type/rf
(call $infer-type/retf)
)
(set_global $infer-type/rF
(call $infer-type/refF)
)
)
)

View File

@ -16,3 +16,27 @@ function locals(): void {
let aF = F;
}
locals();
function reti(): i32 {
return 0;
}
let ri = reti();
ri;
function retI(): i64 {
return 0;
}
let rI = retI();
rI;
function retf(): f32 {
return 0;
}
let rf = retf();
rf;
function refF(): f64 {
return 0;
}
let rF = refF();
rF;

View File

@ -1,8 +1,16 @@
(module
(type $v (func))
(type $i (func (result i32)))
(type $I (func (result i64)))
(type $f (func (result f32)))
(type $F (func (result f64)))
(global $infer-type/i i32 (i32.const 10))
(global $infer-type/I i64 (i64.const 4294967296))
(global $infer-type/F f64 (f64.const 1.5))
(global $infer-type/ri (mut i32) (i32.const 0))
(global $infer-type/rI (mut i64) (i64.const 0))
(global $infer-type/rf (mut f32) (f32.const 0))
(global $infer-type/rF (mut f64) (f64.const 0))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "memory" (memory $0))
@ -45,7 +53,27 @@
)
)
)
(func $start (; 1 ;) (type $v)
(func $infer-type/reti (; 1 ;) (type $i) (result i32)
(return
(i32.const 0)
)
)
(func $infer-type/retI (; 2 ;) (type $I) (result i64)
(return
(i64.const 0)
)
)
(func $infer-type/retf (; 3 ;) (type $f) (result f32)
(return
(f32.const 0)
)
)
(func $infer-type/refF (; 4 ;) (type $F) (result f64)
(return
(f64.const 0)
)
)
(func $start (; 5 ;) (type $v)
(drop
(i32.const 10)
)
@ -56,6 +84,30 @@
(f64.const 1.5)
)
(call $infer-type/locals)
(set_global $infer-type/ri
(call $infer-type/reti)
)
(drop
(get_global $infer-type/ri)
)
(set_global $infer-type/rI
(call $infer-type/retI)
)
(drop
(get_global $infer-type/rI)
)
(set_global $infer-type/rf
(call $infer-type/retf)
)
(drop
(get_global $infer-type/rf)
)
(set_global $infer-type/rF
(call $infer-type/refF)
)
(drop
(get_global $infer-type/rF)
)
)
)
(;
@ -108,6 +160,14 @@
infer-type/I
infer-type/F
infer-type/locals
infer-type/reti
infer-type/ri
infer-type/retI
infer-type/rI
infer-type/retf
infer-type/rf
infer-type/refF
infer-type/rF
[program.exports]
;)