Instrumenting IL generation in Mono's C# compiler

Someone asked me the other day how I'd go about instrumenting the IL generated by the Mono C# compiler: something to do with custom profiling I think. I still haven't come up with a totally satisfactory answer but here's a patch of some work I did showing how I hacked away at various bits of the sources to emit custom method prologues and epilogues. Download the patch and apply it to your Mono Git repo.

Here is a Stack Overflow question I asked about the preferred method of extending the C# compiler. This relates to my plan to do very spiffy things to mcs's ASTs and type checker!

0001-Emit-custom-prologue-and-epilogue-code-and-top-and-b.patch_.txt5.07 KB