comparison modules/il.tp @ 352:f74ce841fd1e

Produce something resembling correct il from low level dialect
author Michael Pavone <pavone@retrodev.com>
date Mon, 13 Apr 2015 22:42:27 -0700
parents a3b06d53bcb9
children a6cdcc1b1c02
comparison
equal deleted inserted replaced
351:04ba2118c5fe 352:f74ce841fd1e
208 #{ 208 #{
209 b <- { byte } 209 b <- { byte }
210 w <- { word } 210 w <- { word }
211 l <- { long } 211 l <- { long }
212 q <- { quad } 212 q <- { quad }
213
214 sizeFromBytes <- :bytes {
215 if: bytes < 4 {
216 if: bytes = 1 { b } else: { w }
217 } else: {
218 if: bytes = 4 { l } else: { q }
219 }
220 }
213 221
214 eq <- { _eq } 222 eq <- { _eq }
215 neq <- { _neq } 223 neq <- { _neq }
216 224
217 //signed conditions 225 //signed conditions
294 sub <- :ina inb out size { 302 sub <- :ina inb out size {
295 op3: _sub a: ina b: inb out: out size: size 303 op3: _sub a: ina b: inb out: out size: size
296 } 304 }
297 305
298 cmp <- :ina inb size { 306 cmp <- :ina inb size {
299 op2: _cmp a: ina out: inb size: size 307 op2: _cmp in: ina out: inb size: size
300 } 308 }
301 309
302 band <- :ina inb out size { 310 band <- :ina inb out size {
303 op3: _and a: ina b: inb out: out size: size 311 op3: _and a: ina b: inb out: out size: size
304 } 312 }
509 bool <- :_cond _out { 517 bool <- :_cond _out {
510 #{ 518 #{
511 opcode <- { _bool } 519 opcode <- { _bool }
512 cond <- { _cond } 520 cond <- { _cond }
513 out <- { _out } 521 out <- { _out }
514 name <- { _names get: _save } 522 name <- { _names get: _bool }
515 numops <- { 0 } 523 numops <- { 0 }
516 524 string <- {
525 name . " " . cond . " " . out
526 }
517 } 527 }
518 } 528 }
519 529
520 allocRegs:withSource <- :instarr :regSrc { 530 allocRegs:withSource <- :instarr :regSrc {
521 _regMap <- dict linear 531 _regMap <- dict linear