Chapter 18 Function representation #215
Replies: 3 comments 3 replies
-
|
"Why are function nodes modeled as regions and arguments as phis. " If we put them in as separate nodes, but also want to optimize a whole compilation unit, we'd basically have to cut-n-paste replicate Regions and Phis. When compiling single functions at a time, you do not get to optimize the common arguments to a function, nor do you need to worry about who calls whom, and you can use a simpler implementation. Simple is compiling whole compilation units; its still all linear time optimizations just at a higher quality level. |
Beta Was this translation helpful? Give feedback.
-
Return Program Counter. Its where you return too after a call. This, plus the stack contents, amounts to a "current continuation" - the "rest of the program" to be executed. Every chip on the planet has a way to make and use these; and generally has substantial hardware support for the RPC so you need to directly deal with it.
There is no alternative to the RPC except never to make any calls. The act of calling implies the act of coming back/returning... and this is exactly what the RPC is. There are many alternative ways to manage the RPC. |
Beta Was this translation helpful? Give feedback.
-
|
@cliffclick for a CCC session, request a deep dive into function calls and how they are implemented in SoN - and how that flows into the code gen. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to understand a couple of things about functions.
Why are function nodes modeled as regions and arguments as phis. Was this design driven by a desire to simplify inlining? Or is this because arguments of a function can be modified later in the function so its useful to make them Phi nodes to start with?
It would be good to discuss the design choices available, what C2 and other SoN implementations do.
My second question was with regards to the RPC - what is this and how is it used? Reading chapter 18 I had thought it was just to support the evaluator but I see that this is also being used on codegen in chapter 21. So it seems the RPC is more of a hard requirement?
What would be the alternative to RPC?
Beta Was this translation helpful? Give feedback.
All reactions