diff --git a/builtins.cpp b/builtins.cpp index 57ce2333..69559b51 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -725,7 +725,7 @@ lDefineConstantIntFunc(const char *name, int val, llvm::Module *module, Assert(func != NULL); // it should be declared already... #if defined(LLVM_3_2) func->addFnAttr(llvm::Attributes::AlwaysInline); -#else +#else // LLVM 3.1 and 3.3+ func->addFnAttr(llvm::Attribute::AlwaysInline); #endif llvm::BasicBlock *bblock = llvm::BasicBlock::Create(*g->ctx, "entry", func, 0); diff --git a/cbackend.cpp b/cbackend.cpp index 45cc29f9..d335d4e9 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -88,10 +88,10 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/GetElementPtrTypeIterator.h" -#if defined(LLVM_3_3) - #include "llvm/InstVisitor.h" -#else +#if defined(LLVM_3_1) || defined(LLVM_3_2) #include "llvm/Support/InstVisitor.h" +#else // LLVM 3.3+ + #include "llvm/InstVisitor.h" #endif #include "llvm/Support/MathExtras.h" #include "llvm/Support/TargetRegistry.h" diff --git a/ctx.cpp b/ctx.cpp index 1119f819..9f7c3bfb 100644 --- a/ctx.cpp +++ b/ctx.cpp @@ -3293,7 +3293,7 @@ FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType, // alias analysis. // TODO: what other attributes needs to be copied? // TODO: do the same for varing path. -#if defined (LLVM_3_3) +#if !defined (LLVM_3_1) && !defined (LLVM_3_2) // LLVM 3.3+ llvm::CallInst *cc = llvm::dyn_cast(ci); if (cc && cc->getCalledFunction() && diff --git a/ispc.cpp b/ispc.cpp index daa3f5a8..40bf0020 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -138,9 +138,9 @@ lGetSystemISA() { static const char *supportedCPUs[] = { "atom", "penryn", "core2", "corei7", "corei7-avx" -#if defined(LLVM_3_2) || defined(LLVM_3_3) +#if !defined(LLVM_3_1) , "core-avx-i", "core-avx2" -#endif // LLVM_3_2 or LLVM_3_3 +#endif // LLVM 3.2+ }; Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) : diff --git a/ispc.h b/ispc.h index 8b385bf6..3582e2fc 100644 --- a/ispc.h +++ b/ispc.h @@ -40,8 +40,8 @@ #define ISPC_VERSION "1.3.1dev" -#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3) -#error "Only LLVM 3.1, 3.2 and the 3.3 development branch are supported" +#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) +#error "Only LLVM 3.1, 3.2, 3.3 and the 3.4 development branch are supported" #endif #if defined(_WIN32) || defined(_WIN64) diff --git a/main.cpp b/main.cpp index d58ff71d..cc005fde 100644 --- a/main.cpp +++ b/main.cpp @@ -68,6 +68,8 @@ lPrintVersion() { "3.2" #elif defined(LLVM_3_3) "3.3" +#elif defined(LLVM_3_4) + "3.4" #else #error "Unhandled LLVM version" #endif diff --git a/module.cpp b/module.cpp index 910a3f27..ad672672 100644 --- a/module.cpp +++ b/module.cpp @@ -88,14 +88,12 @@ #include #if defined(LLVM_3_1) #include -#else - #if defined(LLVM_3_2) - #include - #include - #else // LLVM 3.3+ - #include - #include - #endif +#elif defined(LLVM_3_2) + #include + #include +#else // LLVM 3.3+ + #include + #include #endif #include #include @@ -768,14 +766,14 @@ Module::AddFunctionDeclaration(const std::string &name, isInline) #ifdef LLVM_3_2 function->addFnAttr(llvm::Attributes::AlwaysInline); -#else +#else // LLVM 3.1 and 3.3+ function->addFnAttr(llvm::Attribute::AlwaysInline); #endif if (functionType->isTask) // This also applies transitively to members I think? #if defined(LLVM_3_1) function->setDoesNotAlias(1, true); -#else +#else // LLVM 3.2+ function->setDoesNotAlias(1); #endif @@ -1817,7 +1815,7 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre // track the source file position by handling them ourselves. inst.getPreprocessorOutputOpts().ShowComments = 1; -#if defined(LLVM_3_3) +#if !defined(LLVM_3_1) && !defined(LLVM_3_2) // LLVM 3.3+ inst.getPreprocessorOutputOpts().ShowCPP = 1; #endif @@ -1829,7 +1827,7 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre headerOpts.Verbose = 1; for (int i = 0; i < (int)g->includePath.size(); ++i) { headerOpts.AddPath(g->includePath[i], clang::frontend::Angled, -#if !defined(LLVM_3_3) +#if defined(LLVM_3_1) || defined(LLVM_3_2) true /* is user supplied */, #endif false /* not a framework */,