At some point I'm gonna try and rustle up some web hosting and make a website/wiki/thingy for all of the dev info for Athena...
But anyway here's something new my friend worked out today. You use inline Athena ASM when you write functions and procedures in Apollo. Well, today that got a pretty significant improvement. Previously it just dumped your raw ASM into the generated final assembly, but now it actually has its own ASM parser and will parse your custom instructions. There's a lot of benefits to this:
1.) You can now directly refer to variable and function argument names and it will automatically translate those into the correct stack locations or warn you if it couldn't resolve that name:
function MyASMProcedure( myArg : ushort )
asm
load r0 myArg ; "myArg" gets automatically translated into the stack location where myArg resides as an offset from the SBP register
add r0 $0x10
store r0 MyASMProcedure ; and just like in Pascal you assign to a "variable" named the same as the function to set the return value
end;
Still working out how this will work with arrays and structs but it already supports this for other variable types.
2.) You can use virtual registers. This means the registers you refer to of the form "r[number]" are actually "virtual" and only get mapped to hardware registers in the compilation phase. You can therefore use as many registers as you want, and the compiler will handle mapping those to hardware registers as efficiently as possible and spilling out to stack locations where necessary. It can also optimize your register usage via liveness tracking, where it keeps track of where you use registers and knows when it can reuse a register for other calculations if you don't refer to it anymore.
3.) Instruction-level optimization passes apply to your inline assembly now. I already mentioned it can optimize your register usage, but additionally it can do things like optimize redundant load/stores, perform instruction-level constant folding (if you load a constant immediate into a register and then, say, add another constant immediate value to that, the compiler will automatically fold those into a single load for you), etc.