Beyond the Compiler: External SSA Analysis Workflows

Hi all,

I’m trying to run some analysis on Go SSA and benchmark the results. While exploring, I found the ssa/interp package, which can execute SSA directly, so my initial idea was to perform the analysis (possibly modifying the SSA) and then run it through the interpreter.

However, ssa/interp docs mentions: “* The “testing” package is no longer supported because it depends on low-level details that change too often.“, which makes me think this approach might not be suitable for benchmarking.

I also considered converting SSA back to AST and regenerating source using go/printer, but I’m not sure how feasible or complex that would be in practice (or if it’s even possible).

Would appreciate any suggestions on how to proceed.

Thanks in advance

What’s the definition of “results”? If you mean count of instructions, then there are many runtime function calls and assembly whose instructions may not be easy to be counted.

I’m not sure how feasible or complex that would be in practice

You can just list the relationship between AST nodes and SSA. I think only when you know how AST is converted to SSA can you convert SSA back to AST. There are many kinds of AST nodes and SSA instructions.

What’s your motivation? AST can also be analyzed. Do you need to analyze memory status [mem]-like in SSA?