Hello,
My group is currently working on enhancing the fault-tolerance scheme of Clang’s IR code generator. From what I understand, a typical Clang front-end plugin runs alongside the existing front-end routines. In our case, we need to add additional IR instructions on top of the existing code generator’s output.
Ideally, we would like to perform our modifications as a separate pass after the code generation phase. However, our code generator is currently tightly integrated with some portions of the existing code. And it seems to be quite difficult to make it as a separate pass because the location of addition instruction is discovered when code generation happens. Most of our changes are within the methods of the CodeGenFunction
class.
To ensure future maintainability, we want to separate our modifications from the main code generation logic. One possible approach that comes to mind is replacing the original methods of the CodeGenFunction
class with our own methods, or even replacing the entire CodeGenFunction
class with our custom implementation. However, these methods involve modifying the mainline source code directly, which can be considered as source code hacking.
Considering this, we are wondering if there is a way to utilize Clang’s plugin mechanism to achieve our goal. We are looking for a cleaner and more modular solution that aligns with Clang’s architecture and maintains compatibility with future updates.
Thank you for your assistance.
David