Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This still needs some tests and some work around register allocation.
To get a "register", you can define it inside
rlet
, which is like a normallet
but:object
if there's no initial value.It will behave like a normal variable and use normal GOAL coloring tricks, but can only live in that given register and can't be spilled to the stack ever. If it goes dead inside the
rlet
, the GOAL coloring system can use it as a temporary in any high level GOAL code. If you don't want this to happen, don't write higher level GOAL code in yourrlet
. This is usually not an issue because asm ops should interact correctly with the coloring system by default.For even more control, use an
asm-func
a GOAL function where you have to do everything yourself. There's no prologue or epilogue. You can still write GOAL code, but the compiler shouldn't use the stack or any callee saved registers, and as a result some stuff can fail if you run out of temporary registers.We should consider a "nuclear option" to completely bypass the coloring system and access registers. In either case, this is a dangerous thing to do and can mess with any higher level GOAL expression. Currently this is by setting
:color #f
inside of the asm operation, but it isn't clear that it works in a useful way yet.It's not clear what should happen if you manually use a callee-saved register. I think it should by default work with the coloring system. It's too annoying to have a special mode for these where they can be used, but not default allocated, and not backed up only in asm-funcs. So it'll get backed up in a normal function, and error in an asm-function (unless you use the
:color #f
option).Test ideas: