On Wednesday, 17 August 2016 12:00:46 UTC-4, HWJ wrote:
>
> TL;DR: what's the best way to do SSA back-translation when using 
> x/tools/go/ssa? 
>
> I'm thinking about a Go compiler which accepts a subset of Go and emits 
> assembly for a microcontroller. Instead of going all the way from 
> lexing, parsing etc. I'd like to use x/tools/go/ssa. 
>
> In order to generate assembly code I need to remove the Phi functions 
> and rename the registers accordingly. The register field in SSA is not 
> exported and can be accessed read-only by Name(). This makes SSA 
> back-translation cumbersome. 
>
> What do you suggest to solve this problem? 
>

You could just ignore the register names; they matter only for debugging. 
 The program's semantics are determined by the topology of the SSA value 
graph.


My ideas: 
>
> * visit all SSA nodes and clone them into a new data structure which 
>   supports register renaming. That would probably mean reimplementing a 
>   lot of x/tools/go/ssa. 
>
> * export the register field from x/tools/go/ssa. That would need to be 
>   done by Go devs with write access to the repository. 
>

Alternatively, you could fork go/ssa and modify your copy.  It is very 
stable and well tested, so you wouldn't be missing out on crucial fixes.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to