regarding user defined pragmas

Hi,

I want to be able to include a #pragma directive in my C code, run it
through clang and let the directive be available on the LLVM side (as
part of the LLVM IR code) so that I can parse it using a LLVM pass.

Is there any way to do it? Currently, the pragma directive just
disappears.

Thanks

Arvind

Arvind Sudarsanam

Software Engineer

CPU Technology Inc.

1500 Kansas Ave, Suite 3E, Longmont, CO - 80503

asudarsanam@cputech.com

Ph: 435-512-7769

Arvind,

My understanding is that you’ll need to add a pragma handler specifically for it (building on the PragmaHandler class). Depending on what the pragma does (assuming it needs to be represented in LLVM IR) you’ll need to create the appropriate representation too.

I’m at the beginning stages of doing the same thing. I hope someone else will chime in if the blind are leading the blind down the wrong path.

Kirk

see also:

http://clang.llvm.org/doxygen/classclang_1_1PragmaHandler.html

http://llvm.org/releases/1.5/docs/ExtendingLLVM.html#intrinsic