Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Something like

mov 5, a

mov a, b

Where `a` gets `eax`, and `b` gets `ebx` during register allocation, and the lifetime analysis of each variable makes sure that all alive vars have register.



basm (borland's assembler, built into delphi and bcb) does this. You just freely reference variables defined outside your 'asm' block and the compiler determines how to map them to registers, stack offsets, etc.


I used CodeWarrior for PowerPC a few years ago and this did something similar. You did have to declare register variables with `register', though. (Being RISC, all instructions took register operands exclusively, so the distinction between memory and register was fairly important.)

This worked really well - the compiler would sort out spills and reloads at the start and end of asm blocks, so you could generally just write one or two instructions per asm block, then have an assert, then on to the next asm block. Made debugging amazingly easy, and I never had to care about the ABI.

For day-to-day programming it was certainly streets ahead of the nonsense gcc foists on you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: