Generating C code using Clang


I am trying to use Clang to generate C (partly, Intel AVX) code to test some abstractions. Apparently, most of the documentation is related to generating LLVM-IR. Are there any tools to do this? (I have generated AST from these abstractions. I want to generate C code from it).

My goal is AST->C. That’s it. I already have AST and I am not translating to LLVM-IR.

Thank you! :slight_smile:

As per the discussion in the LLVM thread, can you explain what kind of AST it is - I’m guessing it is NOT Clang’s AST, but something else…

I did not build a full AST. It’s enough to support the abstractions. The format is not Clang AST. There is no problem in changing to it