flat assembler
Message board for the users of flat assembler.
Index
> Main > spilling registers on the stack VS new functions |
| Author |
|
|
revolution 10 Jul 2026, 12:10
I don't use register spill as a criterion for creating functions.
If I use some non-trivial code more than once then I will consider making it a function. The final call will be made based upon what I need to optimise for. If I need peak performance then I will benchmark each way to decide. If I want good readability then I usually just make a new function. If I need to move on quickly to meet a deadline then I often just copy/paste with the (often unmet) hope to come back later to "fix" it. |
|||
|
|
sylware 10 Jul 2026, 14:06
Indeed, the "trivial and more than once" usually does pre-empt spilling leading to function creation, that upon initial coding.
The functions I am talking about would have very probably only one call-site (ooof) and would be non-trivial (their state would eat a good part of call-preserved regs since many would perform ABI calls). I guess I should eat the bullet: handle such huge code path with reg spilling all over the place. I should start to figure out a not too disgusting way to handle deeply nested labels (here, I use a basic C pre-processor). |
|||
|
|
bitRAKE 11 Jul 2026, 02:46
My computer science professor called it cohesion and containment. Is the function cohesive - does it do one thing well and not anything else? Is the function contained - not linked to many external things? If those things are true then you have a good function.
As we scale to greater complexity we're asking the questions at a complexity scale. This is systems thinking. * disclaimer: that's advice from the late 80's. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.