comparison modules/il.tp @ 361:06dceff348ea

llcompile now has Hacky support for calling C functions using dl to lookup symbols and almost has support string constants
author Michael Pavone <pavone@retrodev.com>
date Thu, 23 Apr 2015 19:24:20 -0700
parents 3b023e5a0b42
children d949fe826e04
comparison
equal deleted inserted replaced
360:0b83f15e819d 361:06dceff348ea
22 _ret <- 18 22 _ret <- 18
23 _skipif <- 19 23 _skipif <- 19
24 _skipifelse <- 20 24 _skipifelse <- 20
25 _save <- 21 25 _save <- 21
26 _bool <- 22 26 _bool <- 22
27 _label <- 23
28 _data <- 24
27 29
28 _names <- #[ 30 _names <- #[
29 "add" 31 "add"
30 "and" 32 "and"
31 "or" 33 "or"
47 "ret" 49 "ret"
48 "skipIf" 50 "skipIf"
49 "skipIf:else" 51 "skipIf:else"
50 "save" 52 "save"
51 "bool" 53 "bool"
54 "label"
55 "data"
52 ] 56 ]
53 57
54 op3:a:b:out:size <- :_opcode :_ina :_inb :_out :_size { 58 op3:a:b:out:size <- :_opcode :_ina :_inb :_out :_size {
55 #{ 59 #{
56 opcode <- { _opcode } 60 opcode <- { _opcode }
202 _ls <- condition: 5 206 _ls <- condition: 5
203 _uge <- condition: 6 207 _uge <- condition: 6
204 _ule <- condition: 7 208 _ule <- condition: 7
205 _ugr <- condition: 8 209 _ugr <- condition: 8
206 _uls <- condition: 9 210 _uls <- condition: 9
211
212 _curLabel <- 0
207 213
208 #{ 214 #{
209 b <- { byte } 215 b <- { byte }
210 w <- { word } 216 w <- { word }
211 l <- { long } 217 l <- { long }
550 assignRegs:at:withSource:andUsage <- :assignments :address :regSrc :usage { 556 assignRegs:at:withSource:andUsage <- :assignments :address :regSrc :usage {
551 newout <- if: (_out register?) { 557 newout <- if: (_out register?) {
552 _out assign: assignments withSource: regSrc 558 _out assign: assignments withSource: regSrc
553 } else: { _out } 559 } else: { _out }
554 bool: _cond newout 560 bool: _cond newout
561 }
562 }
563 }
564
565 label <- {
566 _labelNum <- _curLabel
567 _curLabel <- _curLabel + 1
568 #{
569 opcode <- { _label }
570 numops <- { 0 }
571 name <- { _names get: opcode }
572 string <- { name . " " . _labelNum }
573 reference <- {
574 #{
575 isInteger? <- { false }
576 register? <- { false }
577 argument? <- { false }
578 return? <- { false }
579 label? <- { true }
580 num <- { _labelNum }
581 string <- { "label " . _labelNum}
582
583 recordUsage:at:withSize <- :tracker :address :size {
584 }
585 assign:withSource <- :assignments :regSrc {
586 self
587 }
588 }
589 }
590 recordUsage:at <- :tracker :address {
591
592 }
593 assignRegs:at:withSource:andUsage <- :assignments :at :regSrc :usage {
594 self
595 }
596 }
597 }
598 data <- :_bytes {
599 #{
600 opcode <- { _data }
601 numops <- { 0 }
602 name <- { _names get: opcode }
603 string <- { name . " " . _bytes }
604 bytes <- { _bytes }
605 recordUsage:at <- :tracker :address {
606
607 }
608 assignRegs:at:withSource:andUsage <- :assignments :at :regSrc :usage {
609 self
555 } 610 }
556 } 611 }
557 } 612 }
558 613
559 allocRegs:withSource <- :instarr :regSrc { 614 allocRegs:withSource <- :instarr :regSrc {