[cfe-dev] Implementing a user-directed optimization

Probir Roy via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 10 09:57:40 PDT 2020


Hi cfe-dev,

I am considering to implement a user-guided optimization (xTool).
Programmers will provide pragma directives to guide the backend. Since
I am new to LLVM and clang, I am having a hard time figuring out how
to implement it. Here are the steps I am considering for the frontend:

User will provide directives as:

#pragma xTool someClause
{
     Compound statements
}

I want to implement directives handling as a "clang plug-in". I am
thinking to create AST node classes for xTool directive inheriting
Stmt class from the plug-in. Is it possible with current clang? If it
is possible I can access the compound statements enclosed in {} with
"CapturedStmt". Or should I consider to "annotate" the stmt node
instead of creating a new class?

Any feedback on how to implement this on the clang frontend would be
really helpful. So far I have looked into few codes of the OpenMP
directive implementation.

-Probir


More information about the cfe-dev mailing list