Walter's talk on D backend

claptrap clap at trap.com
Mon Sep 23 19:47:52 UTC 2024


On Monday, 23 September 2024 at 18:05:34 UTC, user1234 wrote:
> On Monday, 23 September 2024 at 15:46:25 UTC, claptrap wrote:
>> On Monday, 23 September 2024 at 14:39:12 UTC, user1234 wrote:
>>> [...]
>>
>> first 3 web hits...
>>
>> "In compiler design, static single assignment form (often 
>> abbreviated as SSA form or simply SSA) is a type of 
>> intermediate representation (IR) where each variable is 
>> assigned exactly once"
>> https://en.wikipedia.org/wiki/Static_single-assignment_form
>>
>> [...]
>
> In the results, the use of the word "variable" is just wrong. 
> That's exactly what's misleading. An SSA node is not a variable 
> node and it does not represent a variable either.

You have source code, with variables, each time you assign to a 
variable it gets a new name, x ==> x0,x1,x2...

Those assignments become "nodes" in the SSA IR, for LLVM 
x0,x1,x2.. become %3,%7,%8 or whatever, so yes those nodes 
represent the variable 'x' at that point in the program.

Yes you have other nodes that don't directly represent variables 
in the source code, but they do represent temporaries in the 
evaluation of expressions. So if you rejig the original source so 
it has one operation per statement, a more complex expression 
would require you to give names to the temporaries, those also 
become nodes. So they are temporary variables!

But then Im also not sure if its just the use of "variable" for 
something that never changes that bothers you, in the same way 
"immutable variable" makes no sense?



More information about the Digitalmars-d mailing list