From: Borja F. <bor...@gm...> - 2012-05-26 16:28:19
|
About point 2: As the calling convention states, arguments that don't fit in registers r25 down to r8 are passed through the stack, that's why the last argument is being passed this way. If registers Y or Z are used depends on a number of conditions that are bit hard to explain, it depends if there are spilled registers, allocas, and incoming arguments in the stack. In this particular case, Y is ALWAYS used when reading incoming arguments from the stack, Z COULD be used only when passing arguments into a function call. So the difference is that Y is always used to READ incoming arguments from the stack, and Z or Y can be used to WRITE arguments on the stack as the preparation of the function call. About the code you attached I find it's correct. It's a void function so why care on computing an add instruction where its result is unused, also the return value of the called function is unused as well since the add instruction is useless. That's why you see r25:r24 being overwritten by the stack pointer so it can be restored to its original state when the function ends. This is all a bit tricky so if you dont understand feel free to ask, it's important to get it right so you can write good tests. 2012/5/25 Nicklas Bo Jensen <nbj...@gm...> > 1) The i8 @return8_reg test is fully commented out, can it be removed? I >> don't understand what you want to test here. >> > Can be removed, was not supposed to be there :) > > >> 2) In return64_arg2 the backend will always use Y to read arguments from >> the stack, so there's no need to check for Z. >> > Ah ok, is there any rule for putting them on the stack? Here it can be > both Y and Z right? > > >> About your calling tests, I can't see them xD > > Attached :) > |