5 ms·
In the previous version of the spec, I had a large number of bits that were unused, but once I thought about it I realized that any bits that go unused tautolog
by robertelder 11y ago
In the previous version of the spec, I had a large number of bits that were unused, but once I thought about it I realized that any bits that go unused tautologically guarantee less than optimal performance. I played with the instructions a bit, and it worked out well to allow addressing of registers with 9 bits. Right now, the compiler mainly works as a stack machine and doesn't use more than 10 registers at a time (usually just one or two). In the future, I think it would make sense to make the number of registers big enough that it would fit inside the lowest level CPU cache, since this CPU is mainly designed to be emulated. Storing temporary data in registers instead of the stack has the advantage of not needing to push and pop all the time.
- tptacek 11y agoI like the idea of visualizing the parse tree, and another fun place to go would be to do a real IR, bring things into SSA form, show phi function placement, and then do register allocation and optimization.
- rayiner 11y agoI have in the past used xdot files to good effect for visualizing phi function placement and interference graphs. What would be great is a way to make the result interactive (e.g. drill down from basic blocks to instructions, selectively get more or less detail on voluminous data like live ranges). Graphviz unfortunately isn't suitable for that.
- mcguire 11y agoYou have a register dedicated to zero?
- robertelder 11y agoYes, I also have a register dedicated to the word size (4). Since these values are used so commonly, I felt that it didn't make sense to constantly have to load them manually. You'll also notice that there is no move instruction. With the existence of the zero register, move becomes unnecessary because you can just do add r1 ZR r2; Moves the contents of register r2 into r1. There are a number of other similar situations where it makes sense to have zero handy all the time.
- shoover 11y ago"Changing the value in the zero register is not recommended." Hee hee.
- robertelder 11y ago:p
- tptacek 11y agoNot uncommon in real architectures, either by convention (ARM r0) or design (the MSP430 CG, which, like this architecture, also generates other useful constants).