Mercurial > repos > tabletprog
diff modules/llcompile.tp @ 354:a6cdcc1b1c02
Fix il and llcompile modules enough that it actually attempts to run the compiled program
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 15 Apr 2015 20:08:38 -0700 |
parents | 95bc24c729e6 |
children | 3b023e5a0b42 |
line wrap: on
line diff
--- a/modules/llcompile.tp Tue Apr 14 19:54:03 2015 -0700 +++ b/modules/llcompile.tp Wed Apr 15 20:08:38 2015 -0700 @@ -126,7 +126,12 @@ } _signed <- (l signed?) || (r signed?) _opMap ifget: (expr op) :ingen { - ilf add: (ingen: lv rv (dest val) _size) + if: (lv isInteger?) { + tmp <- lv + lv <- ilf getReg + ilf add: (il mov: tmp lv ls) + } + ilf add: (ingen: rv lv (dest val) _size) #{ val <- dest val size <- _size @@ -134,12 +139,12 @@ } } else: { _compOps ifget: (expr op) :condFun { - if: (rv isInteger?) { - tmp <- rv - rv <- ilf getReg - ilf add: (il mov: tmp rv rs) + if: (lv isInteger?) { + tmp <- lv + lv <- ilf getReg + ilf add: (il mov: tmp lv ls) } - ilf add: (il cmp: lv rv _size) + ilf add: (il cmp: rv lv _size) cond <- condFun: _signed ilf add: (il bool: cond (dest val)) #{ @@ -511,7 +516,8 @@ _notError: mcode { ba <- bytearray executableFromBytes: mcode arg <- if: (length: args) > 2 { int32: (args get: 2) } else: {0} - ba runWithArg: (arg i64) + res <- ba runWithArg: (arg int64) + print: (string: res) . "\n" } else: :err { (file stderr) write: (err msg) . "\n" }