Phoenix Plug-Ins

Plugin is one topic that I will cover in my TechEd SEA presentation. A "plug-in" means a user-written module that will be executed by backend compiler (C2), or a Phoenix-based analysis tool. Suppose we build a plug-in, called OurPlugIn.dll for C2.exe. Then, with the appropriate command-line switches, C2 will load and execute the code within OurPlugIn.dll as part of its compilations. Plugin has full access to the internal data structures of its 'host', C2. Thus, OurPlugIn can alter the behavior of C2, adding new phases, bypassing existing phases, or substituting alternative phases. For example, OurPlugIn could be designed for:

- RegAlloc. Register-allocation phase, that replaces the one built into C2
- Code Injection. Inject extra code (eg: runtime profiling instrumentation)
- IR View. Dump a view of the IR for a function as it is compiled
- Operation Info. Dump information about the C2 operation, such as cpu and/or memory use

Take a look at this picture documentation (hope it help you to figure it out):


The distinguishing feature of a plug-in is that it can be built entirely separate from its 'host'. For example, a user can build and use MyPlugIn, without access to C2 source code. Everything required to build a Phoenix plug-in is provided by MSIL code in the Phx.dll assembly, and Phoenix documentation. You need to read it. Currently, plug-ins are supported only for the managed version of the Phoenix framework (eg: for the managed version of C2.exe). Whether unmanaged plug-ins are supported in future remains To Be Decided.

Ciao

Share this post: | | | |
Published Thursday, September 07, 2006 1:25 AM by Risman Adnan Mattotorang

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: