3 ms·
What do you mean automatic register allocation? Your example doesn't really make sense to me. mov 5, eax mov eax, ebx It seems pretty prerequisite to know wh
by arthurcolle 11y ago
What do you mean automatic register allocation? Your example doesn't really make sense to me.
mov 5, eax
mov eax, ebx
It seems pretty prerequisite to know what you're doing with the registers themselves. I have only taken a basic systems class that taught y86 so knowledge of building anything production worthy in assembly is nil. Just caught my eye and thought I'd ask!
- indutny 11y agoSomething 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.
- gfody 11y agobasm (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.
- to3m 11y agoI 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.
- deleted 11y ago[deleted]