On Wed, Jul 3, 2019 at 9:04 PM Ian Lance Taylor <i...@golang.org> wrote:

> [ +khr ]
>
> On Wed, Jul 3, 2019 at 4:46 PM Mohit Verma <vmohit...@gmail.com> wrote:
> >
> > Hi All,
> >
> > I am trying to change the ssa phase of Go compiler to do extra work
> during memory stores.
> > For example whenever there is a memory store, I want to make a function
> call to one of my Go packages instead of the store.
> > So, far I have some working changes and I can see the new SSA nodes when
> I dump SSA using GOSSAFUNC.
> >
> > I have a couple of questions:
> >
> > 1. Is there a tool which can covert the SSA nodes back to some version
> of Go code?
>

Nope. Such a thing might be nice, actually. Handing phis, memory values,
flags, etc. might be hard.


> > 2. How does Go team/others develop/make changes to Go compiler? So, far
> I have been adding prints in the Go compiler (cmd/compile/internal/syntax,
> gc, & ssa packages) to understand the code flow. But, this is very time
> consuming. I am sure a better way exists.
>

That sounds about what I do when working on the compiler. Understanding
what the compiler is doing is often 90% of the battle, and there's no easy
solution. You can run the compiler under a debugger, if you want.
If you can be more specific about what you are trying to do and what you
are running up against, I might be able to give you more specific
recommendations.
If the compiler is generating bad code, you might be able to condition your
new code on cmd/compile/internal/ssa/func.go:DebugTest which will let you
binary search for a particular function whose code is bad.



> >
> > I'll appreciate any help!
> >
> > Thanks!
> > Mohit
> >
> > --
> > 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.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CAJ%2B6RRU%3D%3D33ct1%3D%2B0U10nDLnFjvBXff%2BrrmbYRvwY-TTRReLfw%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAB%3Df9xRLxCDaDeeDQhmchbrgJV6_9xWpaqEWAK7WvGtjpSTO9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to