Skip to content

Linearization does not apply to chained LIR evaluation

OVM -lin works if chained with -show-ast. However, it does not work with a chained -lir, which runs LIR evaluation.

For instance, ovm -lin -lir treetests/15.hir results in an error caused by non-linearized IR. Linearization is not taken intop account during the evaluation.

AST Output
$ ovm -lin -show-ast treetests/15.hir

label main
cjump ne const 0 const 0 name l3 name l4
label l3
cjump ne const 1 const 0 name l0 name l1
label l4
cjump ne const 0 const 0 name l0 name l1
label l0
move
  temp t0
  const 2
jump name l2 
label l1
move
  temp t0
  const 3
label l2
move
  temp t1
  temp t0
sxp
  call
     name print_int
     temp t1
  call end
sxp
  const 0
label end

3%
LIR Output
$ ovm -lin -lir treetests/15.hir

OVM error: Ill-formed program, "eseq not allowed in LIR" in file treetests/15.hir, Line 10, Column 6 to Line 43, Column 13
5 : # Body
6 : seq
7 :   sxp
8 :     call
9 :       name print_int
10 :       eseq 
11 :         seq
12 :           seq
13 :             cjump ne
14 :               const 0
15 :               const 0
16 :               name l3
17 :               name l4
18 :             label l3
19 :             cjump ne
20 :               const 1
21 :               const 0
22 :               name l0
23 :               name l1
24 :             label l4
25 :             cjump ne
26 :               const 0
27 :               const 0
28 :               name l0
29 :               name l1
30 :