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. Thanks for your help. Regard, Kangkook
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
Hi Óscar,> To the developers: maybe it is a good idea to define something like > LLVM_MAJOR_VERSION and LLVM_MINOR_VERSION ? Preferably in llvm-config.hprobably it's best to just go ahead and implement this (with PACKAGE_VERSION being auto-computed from these) and see if anyone objects :) Ciao, Duncan.
Reasonably Related Threads
- [LLVMdev] How to identify LLVM version?
- Moving instructions from source Basic Block to dest Basic Block
- [LLVMdev] Confusion with a Use of a getelementptr instruction being a Use of a select instruction instead
- simplify CFG Pass in llvm
- [LLVMdev] Optimisation pass to move an alloca'd array to a global constant array