Mercurial > repos > tabletprog
comparison modules/x86.tp @ 194:30bed95cbb18
Apply register assignments in il module
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 26 Aug 2013 20:42:20 -0700 |
parents | 4293c725394c |
children | 7856f0916549 |
comparison
equal
deleted
inserted
replaced
193:4293c725394c | 194:30bed95cbb18 |
---|---|
208 _r15 | 208 _r15 |
209 ] | 209 ] |
210 _tempregs <- #[ | 210 _tempregs <- #[ |
211 _r10 | 211 _r10 |
212 _r11 | 212 _r11 |
213 _rax | 213 //TODO: Add rax back in once there's logic in il to properly |
214 //allocate it for the instances in which it's live | |
215 //_rax | |
214 ] | 216 ] |
215 | 217 |
216 | 218 |
217 inst <- :ilist { | 219 inst <- :ilist { |
218 #{ | 220 #{ |
551 _argregs | 553 _argregs |
552 _calleesave | 554 _calleesave |
553 ] | 555 ] |
554 } | 556 } |
555 //allocated the return register | 557 //allocated the return register |
556 allocRet <- :size { | 558 allocRet <- { |
557 bit <- (lshift: 1 by: (_rax num)) | 559 bit <- (lshift: 1 by: (_rax num)) |
558 _used <- _used or bit | 560 _used <- _used or bit |
559 _usedAllTime <- _usedAllTime or bit | 561 _usedAllTime <- _usedAllTime or bit |
560 _rax | 562 _rax |
561 } | 563 } |
563 if: argnum < (_argregs length) { | 565 if: argnum < (_argregs length) { |
564 reg <- _argregs get: argnum | 566 reg <- _argregs get: argnum |
565 bit <- (lshift: 1 by: (reg num)) | 567 bit <- (lshift: 1 by: (reg num)) |
566 _used <- _used or bit | 568 _used <- _used or bit |
567 _usedAllTime <- _usedAllTime or bit | 569 _usedAllTime <- _usedAllTime or bit |
570 reg | |
568 } else: { | 571 } else: { |
569 il base: _rsp offset: _nextStackOff + 8 * (argnum - (_argregs length)) | 572 il base: _rsp offset: _nextStackOff + 8 * (argnum - (_argregs length)) |
570 } | 573 } |
571 } | 574 } |
572 allocSpecific <- :reg { | 575 allocSpecific <- :reg { |