[LLVMdev] How to identify LLVM version?
Óscar Fuentes
ofv at wanadoo.es
Tue May 31 12:26:15 PDT 2011
Kangkook Jee <aixer77 at gmail.com> writes:
> Hi, all
>
> I'd like to write a code that can build different codes based on LLVM version.
> Like code snippets in the below.
>
> #ifdef __LLVM_29__
> PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), 2, "iftmp");
> #elif __LLVM_28__
> PHINode *PN = Builder.CreatePHI (Type::getDoubleTy(getGlobalContext()), "iftmp");
> #else
> assert ("wrong version");
> #endif
>
> I've been trying to find something like these (__LLVM_29__,
> __LLVM_28__), but I couldn't find them yet.
llvm/Config/config.h defines PACKAGE_VERSION to a string like "3.0", but
I'm afraid that it is not very convenient for your purposes.
To the developers: maybe it is a good idea to define something like
LLVM_MAJOR_VERSION and LLVM_MINOR_VERSION ? Preferably in llvm-config.h
More information about the llvm-dev
mailing list