Reading up on SSA stuff again because it's been a few years since I last poked at this...

"A Gentle Introduction to LLVM IR"
https://mcyoung.xyz/2023/08/01/llvm-ir/
Reminded me that LLVM initially leaves locals in stack allocated slots and then "promotes" them in the mem2reg pass.

"A catalog of ways to generate SSA"
https://bernsteinbear.com/blog/ssa/
New since I last looked, links to a selection of papers.

"SSA-based Register Allocation"
https://compilers.cs.uni-saarland.de/projects/ssara/

#Projects #Compiler

A Gentle Introduction to LLVM IR · mcyoung

Leaning toward at least starting with write "Single-Pass Generation of Static Single-Assignment Form for Structured Languages", Brandis and Mössenböck, 1994, which is where I started last time around.
https://bernsteinbear.com/assets/img/brandis-single-pass.pdf

"Simple and Efficient Construction of Static Single Assignment Form", Braun et al, 2013, seems interesting too from a more flexible but maybe not all that much more complicated standpoint.
https://bernsteinbear.com/assets/img/braun13cc.pdf

#Projects #Compiler

Revisiting that 1994 paper is handy for understanding my code from last time around, which was definitely based on the algorithm as described.

@swetland Hardest part is converting it out of SSA if I recall correctly. Esp with debug info. I spent a long time coming up with the way dex originally worked. Every paper I read just waved their hands at this part, and no one dirtied their hands with challenges like debug symbols. I got it working...two days later I found a better way but decided just to leave it.

Ha...that was 20 years ago.

I know this part of dex got rewritten like 10 yrs ago. Still a good run though.

@swetland Mattias often attends the LLVM Bay Area monthly meetup.
@swetland my compiler has a couple development documents that go into SSA, IR generation, and more, if you want to see an idiot's approach vs a scholar's

@swetland i read a really good blog about the cranelift register allocator a year or so ago, and i *think* it was one of these two, but not sure which one (or maybe both?) -- but they're both long:

- https://cfallin.org/blog/2022/06/09/cranelift-regalloc2/

- https://d-sonuga.netlify.app/gsoc/regalloc-ii/

Cranelift, Part 4: A New Register Allocator