Debug DMD's secret '--b' switch will helpfully print out the elem tree for every function that reaches the backend, if you want to avoid manually tracing through e2ir.
On Mon, Dec 28, 2015 at 11:29 PM, Jacob Carlborg via dmd-internals <[email protected]> wrote: > On 27 dec 2015, at 22:33, Martin Nowak via dmd-internals > <[email protected]> wrote: > > What do you want to achieve? > > > My overall goal is to implement native TLS on OS X in DMD. For this > particular question I was trying to figure out how to get DMD to generate > same assembly as the corresponding D code, when a TLS variable is accessed, > using the el_* functions. > > auto foo = *bar.thunk(&bar); > > In general specific instructions such as > for TLS access should be implemented by the corresponding cd* function, > not in the intermediate representation. > The IR might be the right place for a low-level lowering though. > > > It looks like the lowering for a TLS variable access to a call to > ___tls_get_addr occurs in el_picvar for OS X. > > The simply construct an IR tree, no magic here. > > > You make it sound so easy :). I guess my main problem is that I’m reading > the assembly that Clang outputs then I have no idea how to get DMD to > generate the same assembly. > > Anyway, I think I managed to figure it out, this seems to work [1]. I > basically traced all the el_* functions to see which were called and with > what arguments when I compiled D code looking something like "auto foo = > *bar.thunk(&bar);”. > > [1] > https://github.com/jacob-carlborg/dmd/commit/49ecd3ff7861e2eb5838e2b2cd14b18f7fe2e07b > > -- > /Jacob Carlborg > > _______________________________________________ > dmd-internals mailing list > [email protected] > http://lists.puremagic.com/mailman/listinfo/dmd-internals _______________________________________________ dmd-internals mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-internals
