Implementing a user-directed optimization

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.