[LLVMdev] Importing existing function declarations into LLVM C++ API

Jin Gu Kang jaykang10 at imrc.kist.re.kr
Thu Apr 5 16:03:46 PDT 2012


Hi Dan,

The name of C++ declarations is changed by name mangling. If you want to import
C++ declarations into LLVM IR directly, Clang's APIs related to mangling will help you.
You can find basic mangling APIs of Clang in following files.
"include/clang/AST/Mangle.h"
"lib/AST/Mangle.cpp"
etc.. (name mangling is affected by compiler vendors such as Microsoft.)

Good luck,
Jin-Gu Kang
________________________________________
From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] On Behalf Of Dan Bailey [dan at dneg.com]
Sent: Tuesday, April 03, 2012 9:10 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Importing existing function declarations into LLVM C++ API

Hi,

This is a tricky problem to search for on the llvmdev list as all the
ways I can think of describing this seem to use pretty common keywords,
so this may have been asked before.

I'm looking for a way of importing or including existing function
declarations or global variables into LLVM IR that I'm building manually
using the API. These declarations are written in C++, so I guess there
are two possible ways of doing this, either parsing and importing them
using the Clang API (though I'm not particularly familiar with this) or
compiling them to IR externally without running any optimisation passes
and importing them from .ll files? Or maybe produce two separate modules
and merge them?

Is there anything in the codebase or the documentation that someone
could point me to? Or any suggestions on how better to tackle this would
be appreciated?

Thanks,
Dan
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list