Merge pull request #828 from ncos/ispc_build_fails

Add support for LLVM 3.6 build
This commit is contained in:
Dmitry Babokin
2014-07-30 16:56:02 +04:00
16 changed files with 73 additions and 49 deletions

View File

@@ -113,7 +113,9 @@ ifeq ($(LLVM_VERSION),LLVM_3_4)
ISPC_LIBS += -lcurses ISPC_LIBS += -lcurses
endif endif
ifeq ($(LLVM_VERSION),LLVM_3_5) # There is no logical OR in GNU make.
# This 'ifneq' acts like if($(LLVM_VERSION) == LLVM_3_5 || $(LLVM_VERSION) == LLVM_3_6)
ifneq (,$(filter $(LLVM_VERSION), LLVM_3_5 LLVM_3_6))
ISPC_LIBS += -lcurses -lz ISPC_LIBS += -lcurses -lz
endif endif
@@ -150,7 +152,9 @@ CXXFLAGS=$(OPT) $(LLVM_CXXFLAGS) -I. -Iobjs/ -I$(CLANG_INCLUDE) \
-Wall \ -Wall \
-DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" \ -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" \
-Wno-sign-compare -Wno-unused-function -Werror -Wno-sign-compare -Wno-unused-function -Werror
ifeq ($(LLVM_VERSION),LLVM_3_5)
# if($(LLVM_VERSION) == LLVM_3_5 || $(LLVM_VERSION) == LLVM_3_6)
ifneq (,$(filter $(LLVM_VERSION), LLVM_3_5 LLVM_3_6))
CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register
endif endif
ifneq ($(ARM_ENABLED), 0) ifneq ($(ARM_ENABLED), 0)

View File

@@ -111,6 +111,9 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
FOLDER_NAME=version_LLVM FOLDER_NAME=version_LLVM
if version_LLVM == "trunk": if version_LLVM == "trunk":
SVN_PATH="trunk" SVN_PATH="trunk"
if version_LLVM == "3.5":
SVN_PATH="tags/RELEASE_35/rc1"
version_LLVM = "3_5"
if version_LLVM == "3.4": if version_LLVM == "3.4":
SVN_PATH="tags/RELEASE_34/dot2-final" SVN_PATH="tags/RELEASE_34/dot2-final"
version_LLVM = "3_4" version_LLVM = "3_4"
@@ -351,8 +354,10 @@ def build_ispc(version_LLVM, make):
temp = "3_3" temp = "3_3"
if version_LLVM == "3.4": if version_LLVM == "3.4":
temp = "3_4" temp = "3_4"
if version_LLVM == "trunk": if version_LLVM == "3.5":
temp = "3_5" temp = "3_5"
if version_LLVM == "trunk":
temp = "3_6"
os.environ["LLVM_VERSION"] = "LLVM_" + temp os.environ["LLVM_VERSION"] = "LLVM_" + temp
try_do_LLVM("clean ISPC for building", "msbuild ispc.vcxproj /t:clean", True) try_do_LLVM("clean ISPC for building", "msbuild ispc.vcxproj /t:clean", True)
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", "msbuild ispc.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", True) try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", "msbuild ispc.vcxproj /V:m /p:Platform=Win32 /p:Configuration=Release /t:rebuild", True)
@@ -454,7 +459,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
archs.append("x86-64") archs.append("x86-64")
if "native" in only: if "native" in only:
sde_targets_t = [] sde_targets_t = []
for i in ["3.1", "3.2", "3.3", "3.4", "trunk"]: for i in ["3.1", "3.2", "3.3", "3.4", "3.5", "trunk"]:
if i in only: if i in only:
LLVM.append(i) LLVM.append(i)
if "current" in only: if "current" in only:
@@ -707,7 +712,7 @@ def Main():
if os.environ.get("SMTP_ISPC") == None: if os.environ.get("SMTP_ISPC") == None:
error("you have no SMTP_ISPC in your environment for option notify", 1) error("you have no SMTP_ISPC in your environment for option notify", 1)
if options.only != "": if options.only != "":
test_only_r = " 3.1 3.2 3.3 3.4 trunk current build stability performance x86 x86-64 -O0 -O2 native " test_only_r = " 3.1 3.2 3.3 3.4 3.5 trunk current build stability performance x86 x86-64 -O0 -O2 native "
test_only = options.only.split(" ") test_only = options.only.split(" ")
for iterator in test_only: for iterator in test_only:
if not (" " + iterator + " " in test_only_r): if not (" " + iterator + " " in test_only_r):
@@ -816,7 +821,7 @@ if __name__ == '__main__':
llvm_group = OptionGroup(parser, "Options for building LLVM", llvm_group = OptionGroup(parser, "Options for building LLVM",
"These options must be used with -b option.") "These options must be used with -b option.")
llvm_group.add_option('--version', dest='version', llvm_group.add_option('--version', dest='version',
help='version of llvm to build: 3.1 3.2 3.3 3.4 trunk. Default: trunk', default="trunk") help='version of llvm to build: 3.1 3.2 3.3 3.4 3.5 trunk. Default: trunk', default="trunk")
llvm_group.add_option('--revision', dest='revision', llvm_group.add_option('--revision', dest='revision',
help='revision of llvm to build in format r172870', default="") help='revision of llvm to build in format r172870', default="")
llvm_group.add_option('--debug', dest='debug', llvm_group.add_option('--debug', dest='debug',
@@ -851,7 +856,7 @@ if __name__ == '__main__':
run_group.add_option('--only', dest='only', run_group.add_option('--only', dest='only',
help='set types of tests. Possible values:\n' + help='set types of tests. Possible values:\n' +
'-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' + '-O0, -O2, x86, x86-64, stability (test only stability), performance (test only performance)\n' +
'build (only build with different LLVM), 3.1, 3.2, 3.3, 3.4, trunk, native (do not use SDE), current (do not rebuild ISPC).', 'build (only build with different LLVM), 3.1, 3.2, 3.3, 3.4 3.5, trunk, native (do not use SDE), current (do not rebuild ISPC).',
default="") default="")
run_group.add_option('--perf_LLVM', dest='perf_llvm', run_group.add_option('--perf_LLVM', dest='perf_llvm',
help='compare LLVM 3.3 with "--compare-with", default trunk', default=False, action='store_true') help='compare LLVM 3.3 with "--compare-with", default trunk', default=False, action='store_true')

View File

@@ -66,7 +66,7 @@
#include <llvm/IR/Intrinsics.h> #include <llvm/IR/Intrinsics.h>
#include <llvm/IR/DerivedTypes.h> #include <llvm/IR/DerivedTypes.h>
#endif #endif
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/Linker/Linker.h> #include <llvm/Linker/Linker.h>
#else #else
#include <llvm/Linker.h> #include <llvm/Linker.h>
@@ -705,7 +705,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
llvm::Module *module, SymbolTable *symbolTable) { llvm::Module *module, SymbolTable *symbolTable) {
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length); llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
llvm::MemoryBuffer *bcBuf = llvm::MemoryBuffer::getMemBuffer(sb); llvm::MemoryBuffer *bcBuf = llvm::MemoryBuffer::getMemBuffer(sb);
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
llvm::ErrorOr<llvm::Module *> ModuleOrErr = llvm::parseBitcodeFile(bcBuf, *g->ctx); llvm::ErrorOr<llvm::Module *> ModuleOrErr = llvm::parseBitcodeFile(bcBuf, *g->ctx);
if (std::error_code EC = ModuleOrErr.getError()) if (std::error_code EC = ModuleOrErr.getError())
Error(SourcePos(), "Error parsing stdlib bitcode: %s", EC.message().c_str()); Error(SourcePos(), "Error parsing stdlib bitcode: %s", EC.message().c_str());
@@ -762,7 +762,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
// architecture and investigate what happened. // architecture and investigate what happened.
// Generally we allow library DataLayout to be subset of module // Generally we allow library DataLayout to be subset of module
// DataLayout or library DataLayout to be empty. // DataLayout or library DataLayout to be empty.
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
if (!VerifyDataLayoutCompatibility(module->getDataLayoutStr(), if (!VerifyDataLayoutCompatibility(module->getDataLayoutStr(),
bcModule->getDataLayoutStr())) { bcModule->getDataLayoutStr())) {
Warning(SourcePos(), "Module DataLayout is incompatible with " Warning(SourcePos(), "Module DataLayout is incompatible with "

View File

@@ -1497,13 +1497,17 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
per_lane($1, <$1 x MASK> %mask, ` per_lane($1, <$1 x MASK> %mask, `
%cmp_LANE_ID = extractelement <$1 x $2> %cmp, i32 LANE %cmp_LANE_ID = extractelement <$1 x $2> %cmp, i32 LANE
%val_LANE_ID = extractelement <$1 x $2> %val, i32 LANE %val_LANE_ID = extractelement <$1 x $2> %val, i32 LANE
;; 3.5 and 3.6 code is the same since m4 has no OR and AND operators
ifelse(LLVM_VERSION,LLVM_3_5,` ifelse(LLVM_VERSION,LLVM_3_5,`
%r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst %r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst
%r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0 %r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0
',LLVM_VERSION,LLVM_3_6,`
%r_LANE_ID_t = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst seq_cst
%r_LANE_ID = extractvalue { $2, i1 } %r_LANE_ID_t, 0
',` ',`
%r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst %r_LANE_ID = cmpxchg $2 * %ptr, $2 %cmp_LANE_ID, $2 %val_LANE_ID seq_cst
') ')
%rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE %rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE
store $2 %r_LANE_ID, $2 * %rp_LANE_ID') store $2 %r_LANE_ID, $2 * %rp_LANE_ID')
@@ -1512,10 +1516,14 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
} }
define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp, define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp,
$2 %val) nounwind alwaysinline { $2 %val) nounwind alwaysinline {
;; 3.5 and 3.6 code is the same since m4 has no OR and AND operators
ifelse(LLVM_VERSION,LLVM_3_5,` ifelse(LLVM_VERSION,LLVM_3_5,`
%r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst %r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
%r = extractvalue { $2, i1 } %r_t, 0 %r = extractvalue { $2, i1 } %r_t, 0
',LLVM_VERSION,LLVM_3_6,`
%r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
%r = extractvalue { $2, i1 } %r_t, 0
',` ',`
%r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst %r = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst
') ')

View File

@@ -63,7 +63,7 @@
#include "llvm/Analysis/ConstantsScanner.h" #include "llvm/Analysis/ConstantsScanner.h"
#include "llvm/Analysis/FindUsedTypes.h" #include "llvm/Analysis/FindUsedTypes.h"
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include "llvm/IR/Verifier.h" #include "llvm/IR/Verifier.h"
#include <llvm/IR/IRPrintingPasses.h> #include <llvm/IR/IRPrintingPasses.h>
#include "llvm/IR/CallSite.h" #include "llvm/IR/CallSite.h"
@@ -250,7 +250,7 @@ namespace {
class CBEMCAsmInfo : public llvm::MCAsmInfo { class CBEMCAsmInfo : public llvm::MCAsmInfo {
public: public:
CBEMCAsmInfo() { CBEMCAsmInfo() {
#if !defined(LLVM_3_5) #if !defined(LLVM_3_5) && !defined(LLVM_3_6)
GlobalPrefix = ""; GlobalPrefix = "";
#endif #endif
PrivateGlobalPrefix = ""; PrivateGlobalPrefix = "";
@@ -465,7 +465,7 @@ namespace {
// Must not be used in inline asm, extractelement, or shufflevector. // Must not be used in inline asm, extractelement, or shufflevector.
if (I.hasOneUse()) { if (I.hasOneUse()) {
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.user_back()); const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.user_back());
#else #else
const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.use_back()); const llvm::Instruction &User = llvm::cast<llvm::Instruction>(*I.use_back());
@@ -477,7 +477,7 @@ namespace {
} }
// Only inline instruction it if it's use is in the same BB as the inst. // Only inline instruction it if it's use is in the same BB as the inst.
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
return I.getParent() == llvm::cast<llvm::Instruction>(I.user_back())->getParent(); return I.getParent() == llvm::cast<llvm::Instruction>(I.user_back())->getParent();
#else #else
return I.getParent() == llvm::cast<llvm::Instruction>(I.use_back())->getParent(); return I.getParent() == llvm::cast<llvm::Instruction>(I.use_back())->getParent();
@@ -1770,7 +1770,7 @@ std::string CWriter::GetValueName(const llvm::Value *Operand) {
// Resolve potential alias. // Resolve potential alias.
if (const llvm::GlobalAlias *GA = llvm::dyn_cast<llvm::GlobalAlias>(Operand)) { if (const llvm::GlobalAlias *GA = llvm::dyn_cast<llvm::GlobalAlias>(Operand)) {
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
if (const llvm::Value *V = GA->getAliasee()) if (const llvm::Value *V = GA->getAliasee())
#else #else
if (const llvm::Value *V = GA->resolveAliasedGlobal(false)) if (const llvm::Value *V = GA->resolveAliasedGlobal(false))
@@ -2163,7 +2163,7 @@ static SpecialGlobalClass getGlobalVariableClass(const llvm::GlobalVariable *GV)
// Otherwise, if it is other metadata, don't print it. This catches things // Otherwise, if it is other metadata, don't print it. This catches things
// like debug information. // like debug information.
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
// Here we compare char * // Here we compare char *
if (!strcmp(GV->getSection(), "llvm.metadata")) if (!strcmp(GV->getSection(), "llvm.metadata"))
#else #else
@@ -2225,7 +2225,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
#endif #endif
TAsm = new CBEMCAsmInfo(); TAsm = new CBEMCAsmInfo();
MRI = new llvm::MCRegisterInfo(); MRI = new llvm::MCRegisterInfo();
#if defined(LLVM_3_4) || defined(LLVM_3_5) #if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
TCtx = new llvm::MCContext(TAsm, MRI, NULL); TCtx = new llvm::MCContext(TAsm, MRI, NULL);
#else #else
TCtx = new llvm::MCContext(*TAsm, *MRI, NULL); TCtx = new llvm::MCContext(*TAsm, *MRI, NULL);
@@ -2349,7 +2349,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() || if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
I->hasCommonLinkage()) I->hasCommonLinkage())
Out << "extern "; Out << "extern ";
#if defined (LLVM_3_5) #if defined (LLVM_3_5) || defined(LLVM_3_6)
else if (I->hasDLLImportStorageClass()) else if (I->hasDLLImportStorageClass())
#else #else
else if (I->hasDLLImportLinkage()) else if (I->hasDLLImportLinkage())
@@ -2525,7 +2525,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
if (I->hasLocalLinkage()) if (I->hasLocalLinkage())
Out << "static "; Out << "static ";
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) "; else if (I->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) "; else if (I->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
#else #else
@@ -2810,7 +2810,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
bool isStructReturn = F->hasStructRetAttr(); bool isStructReturn = F->hasStructRetAttr();
if (F->hasLocalLinkage()) Out << "static "; if (F->hasLocalLinkage()) Out << "static ";
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
if (F->hasDLLImportStorageClass()) Out << "__declspec(dllimport) "; if (F->hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
if (F->hasDLLExportStorageClass()) Out << "__declspec(dllexport) "; if (F->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
#else #else
@@ -3145,7 +3145,7 @@ void CWriter::visitSwitchInst(llvm::SwitchInst &SI) {
Out << ":\n"; Out << ":\n";
printPHICopiesForSuccessor (SI.getParent(), Succ, 2); printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
printBranchToBlock(SI.getParent(), Succ, 2); printBranchToBlock(SI.getParent(), Succ, 2);
#if defined (LLVM_3_5) #if defined (LLVM_3_5) || defined(LLVM_3_6)
if (llvm::Function::iterator(Succ) == std::next(llvm::Function::iterator(SI.getParent()))) if (llvm::Function::iterator(Succ) == std::next(llvm::Function::iterator(SI.getParent())))
#else #else
if (llvm::Function::iterator(Succ) == llvm::next(llvm::Function::iterator(SI.getParent()))) if (llvm::Function::iterator(Succ) == llvm::next(llvm::Function::iterator(SI.getParent())))
@@ -3170,7 +3170,7 @@ bool CWriter::isGotoCodeNecessary(llvm::BasicBlock *From, llvm::BasicBlock *To)
/// FIXME: This should be reenabled, but loop reordering safe!! /// FIXME: This should be reenabled, but loop reordering safe!!
return true; return true;
#if defined (LLVM_3_5) #if defined (LLVM_3_5) || defined(LLVM_3_6)
if (std::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To)) if (std::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
#else #else
if (llvm::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To)) if (llvm::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
@@ -3788,7 +3788,7 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
// All other intrinsic calls we must lower. // All other intrinsic calls we must lower.
llvm::Instruction *Before = 0; llvm::Instruction *Before = 0;
if (CI != &BB->front()) if (CI != &BB->front())
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
Before = std::prev(llvm::BasicBlock::iterator(CI)); Before = std::prev(llvm::BasicBlock::iterator(CI));
#else #else
Before = prior(llvm::BasicBlock::iterator(CI)); Before = prior(llvm::BasicBlock::iterator(CI));

View File

@@ -352,7 +352,7 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
AssertPos(currentPos, diSubprogramType.Verify()); AssertPos(currentPos, diSubprogramType.Verify());
} }
#if defined(LLVM_3_4) || defined(LLVM_3_5) #if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
Assert(diSubprogramType.isCompositeType()); Assert(diSubprogramType.isCompositeType());
llvm::DICompositeType diSubprogramType_n = llvm::DICompositeType diSubprogramType_n =
static_cast<llvm::DICompositeType>(diSubprogramType); static_cast<llvm::DICompositeType>(diSubprogramType);
@@ -1546,7 +1546,7 @@ FunctionEmitContext::StartScope() {
llvm::DILexicalBlock lexicalBlock = llvm::DILexicalBlock lexicalBlock =
m->diBuilder->createLexicalBlock(parentScope, diFile, m->diBuilder->createLexicalBlock(parentScope, diFile,
currentPos.first_line, currentPos.first_line,
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
// Revision 202736 in LLVM adds support of DWARF discriminator // Revision 202736 in LLVM adds support of DWARF discriminator
// to the last argument and revision 202737 in clang adds 0 // to the last argument and revision 202737 in clang adds 0
// for the last argument by default. // for the last argument by default.

2
ctx.h
View File

@@ -47,7 +47,7 @@
#include <llvm/IR/InstrTypes.h> #include <llvm/IR/InstrTypes.h>
#include <llvm/IR/Instructions.h> #include <llvm/IR/Instructions.h>
#endif #endif
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/DebugInfo.h> #include <llvm/IR/DebugInfo.h>
#include <llvm/IR/DIBuilder.h> #include <llvm/IR/DIBuilder.h>
#else #else

View File

@@ -74,7 +74,7 @@
#include <llvm/IR/CallingConv.h> #include <llvm/IR/CallingConv.h>
#endif #endif
#include <llvm/ExecutionEngine/GenericValue.h> #include <llvm/ExecutionEngine/GenericValue.h>
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/InstIterator.h> #include <llvm/IR/InstIterator.h>
#else #else
#include <llvm/Support/InstIterator.h> #include <llvm/Support/InstIterator.h>

View File

@@ -69,7 +69,7 @@
#include <llvm/Target/TargetMachine.h> #include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetOptions.h> #include <llvm/Target/TargetOptions.h>
#include <llvm/PassManager.h> #include <llvm/PassManager.h>
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/Verifier.h> #include <llvm/IR/Verifier.h>
#include <llvm/IR/IRPrintingPasses.h> #include <llvm/IR/IRPrintingPasses.h>
#include <llvm/IR/CFG.h> #include <llvm/IR/CFG.h>
@@ -478,7 +478,7 @@ Function::GenerateIR() {
} }
if (m->errorCount == 0) { if (m->errorCount == 0) {
#if defined (LLVM_3_5) #if defined (LLVM_3_5) || defined(LLVM_3_6)
if (llvm::verifyFunction(*function) == true) { if (llvm::verifyFunction(*function) == true) {
#else #else
if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) { if (llvm::verifyFunction(*function, llvm::ReturnStatusAction) == true) {
@@ -528,7 +528,7 @@ Function::GenerateIR() {
emitCode(&ec, appFunction, firstStmtPos); emitCode(&ec, appFunction, firstStmtPos);
if (m->errorCount == 0) { if (m->errorCount == 0) {
sym->exportedFunction = appFunction; sym->exportedFunction = appFunction;
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
if (llvm::verifyFunction(*appFunction) == true) { if (llvm::verifyFunction(*appFunction) == true) {
#else #else
if (llvm::verifyFunction(*appFunction, if (llvm::verifyFunction(*appFunction,

View File

@@ -57,7 +57,7 @@
#include <llvm/IR/Module.h> #include <llvm/IR/Module.h>
#include <llvm/IR/Instructions.h> #include <llvm/IR/Instructions.h>
#endif #endif
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/DebugInfo.h> #include <llvm/IR/DebugInfo.h>
#include <llvm/IR/DIBuilder.h> #include <llvm/IR/DIBuilder.h>
#else #else

4
ispc.h
View File

@@ -40,8 +40,8 @@
#define ISPC_VERSION "1.7.1dev" #define ISPC_VERSION "1.7.1dev"
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) #if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3) && !defined(LLVM_3_4) && !defined(LLVM_3_5) && !defined(LLVM_3_6)
#error "Only LLVM 3.1, 3.2, 3.3, 3.4 and the 3.5 development branch are supported" #error "Only LLVM 3.1, 3.2, 3.3, 3.4, 3.5 and the 3.6 development branch are supported"
#endif #endif
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)

View File

@@ -72,6 +72,8 @@ lPrintVersion() {
"3.4" "3.4"
#elif defined(LLVM_3_5) #elif defined(LLVM_3_5)
"3.5" "3.5"
#elif defined(LLVM_3_6)
"3.6"
#else #else
#error "Unhandled LLVM version" #error "Unhandled LLVM version"
#endif #endif
@@ -166,7 +168,7 @@ devUsage(int ret) {
printf(" disable-uniform-memory-optimizations\tDisable uniform-based coherent memory access\n"); printf(" disable-uniform-memory-optimizations\tDisable uniform-based coherent memory access\n");
printf(" [--yydebug]\t\t\t\tPrint debugging information during parsing\n"); printf(" [--yydebug]\t\t\t\tPrint debugging information during parsing\n");
printf(" [--debug-phase=<value>]\t\tSet optimization phases to dump. --debug-phase=first,210:220,300,305,310:last\n"); printf(" [--debug-phase=<value>]\t\tSet optimization phases to dump. --debug-phase=first,210:220,300,305,310:last\n");
#if defined(LLVM_3_4) || defined(LLVM_3_5) #if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
printf(" [--debug-ir=<value>]\t\tSet optimization phase to generate debugIR after it\n"); printf(" [--debug-ir=<value>]\t\tSet optimization phase to generate debugIR after it\n");
#endif #endif
printf(" [--off-phase=<value>]\t\tSwitch off optimization phases. --off-phase=first,210:220,300,305,310:last\n"); printf(" [--off-phase=<value>]\t\tSwitch off optimization phases. --off-phase=first,210:220,300,305,310:last\n");
@@ -549,7 +551,7 @@ int main(int Argc, char *Argv[]) {
"away or introduce the new ones.\n"); "away or introduce the new ones.\n");
g->debug_stages = ParsingPhases(argv[i] + strlen("--debug-phase=")); g->debug_stages = ParsingPhases(argv[i] + strlen("--debug-phase="));
} }
#if defined(LLVM_3_4) || defined(LLVM_3_5) #if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
else if (strncmp(argv[i], "--debug-ir=", 11) == 0) { else if (strncmp(argv[i], "--debug-ir=", 11) == 0) {
g->debugIR = ParsingPhaseName(argv[i] + strlen("--debug-ir=")); g->debugIR = ParsingPhaseName(argv[i] + strlen("--debug-ir="));
} }

View File

@@ -93,7 +93,7 @@
#include <llvm/IR/DataLayout.h> #include <llvm/IR/DataLayout.h>
#include <llvm/Analysis/TargetTransformInfo.h> #include <llvm/Analysis/TargetTransformInfo.h>
#endif #endif
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/Verifier.h> #include <llvm/IR/Verifier.h>
#include <llvm/IR/IRPrintingPasses.h> #include <llvm/IR/IRPrintingPasses.h>
#include <llvm/IR/CFG.h> #include <llvm/IR/CFG.h>
@@ -948,7 +948,7 @@ Module::writeOutput(OutputType outputType, const char *outFileName,
lStripUnusedDebugInfo(module); lStripUnusedDebugInfo(module);
} }
#if defined (LLVM_3_4) || defined (LLVM_3_5) #if defined (LLVM_3_4) || defined (LLVM_3_5) || defined(LLVM_3_6)
// In LLVM_3_4 after r195494 and r195504 revisions we should pass // In LLVM_3_4 after r195494 and r195504 revisions we should pass
// "Debug Info Version" constant to the module. LLVM will ignore // "Debug Info Version" constant to the module. LLVM will ignore
// our Debug Info metadata without it. // our Debug Info metadata without it.
@@ -1105,7 +1105,7 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
} }
llvm::PassManager pm; llvm::PassManager pm;
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
pm.add(new llvm::DataLayoutPass(*g->target->getDataLayout())); pm.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
#else #else
pm.add(new llvm::DataLayout(*g->target->getDataLayout())); pm.add(new llvm::DataLayout(*g->target->getDataLayout()));
@@ -2114,7 +2114,7 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre
} }
inst.getLangOpts().LineComment = 1; inst.getLangOpts().LineComment = 1;
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
inst.createPreprocessor(clang::TU_Complete); inst.createPreprocessor(clang::TU_Complete);
#else #else
inst.createPreprocessor(); inst.createPreprocessor();

View File

@@ -44,7 +44,7 @@
#if defined(LLVM_3_4) #if defined(LLVM_3_4)
#include <llvm/DebugInfo.h> #include <llvm/DebugInfo.h>
#endif #endif
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/DebugInfo.h> #include <llvm/IR/DebugInfo.h>
#endif #endif

View File

@@ -63,12 +63,12 @@
#include <llvm/IR/BasicBlock.h> #include <llvm/IR/BasicBlock.h>
#include <llvm/IR/Constants.h> #include <llvm/IR/Constants.h>
#endif #endif
#if defined (LLVM_3_4) || defined(LLVM_3_5) #if defined (LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/Transforms/Instrumentation.h> #include <llvm/Transforms/Instrumentation.h>
#endif #endif
#include <llvm/PassManager.h> #include <llvm/PassManager.h>
#include <llvm/PassRegistry.h> #include <llvm/PassRegistry.h>
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/Verifier.h> #include <llvm/IR/Verifier.h>
#include <llvm/IR/IRPrintingPasses.h> #include <llvm/IR/IRPrintingPasses.h>
#include <llvm/IR/PatternMatch.h> #include <llvm/IR/PatternMatch.h>
@@ -444,7 +444,7 @@ DebugPassManager::add(llvm::Pass * P, int stage = -1) {
number, P->getPassName()); number, P->getPassName());
PM.add(CreateDebugPass(buf)); PM.add(CreateDebugPass(buf));
} }
#if defined(LLVM_3_4) || defined(LLVM_3_5) #if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
if (g->debugIR == number) { if (g->debugIR == number) {
// adding generating of LLVM IR debug after optimization // adding generating of LLVM IR debug after optimization
char buf[100]; char buf[100];
@@ -469,7 +469,7 @@ Optimize(llvm::Module *module, int optLevel) {
new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple())); new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple()));
optPM.add(targetLibraryInfo); optPM.add(targetLibraryInfo);
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
optPM.add(new llvm::DataLayoutPass(*g->target->getDataLayout())); optPM.add(new llvm::DataLayoutPass(*g->target->getDataLayout()));
#else #else
optPM.add(new llvm::DataLayout(*g->target->getDataLayout())); optPM.add(new llvm::DataLayout(*g->target->getDataLayout()));

View File

@@ -50,7 +50,7 @@
#include <llvm/IR/Value.h> #include <llvm/IR/Value.h>
#include <llvm/IR/Module.h> #include <llvm/IR/Module.h>
#endif #endif
#if defined(LLVM_3_5) #if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/DebugInfo.h> #include <llvm/IR/DebugInfo.h>
#include <llvm/IR/DIBuilder.h> #include <llvm/IR/DIBuilder.h>
#else #else
@@ -2987,16 +2987,21 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
for (int i = 0; i < GetNumParameters(); ++i) { for (int i = 0; i < GetNumParameters(); ++i) {
const Type *t = GetParameterType(i); const Type *t = GetParameterType(i);
if (t == NULL) if (t == NULL)
#if defined(LLVM_3_4) || defined(LLVM_3_5) #if defined(LLVM_3_4) || defined(LLVM_3_5) || defined(LLVM_3_6)
return llvm::DICompositeType(); return llvm::DICompositeType();
#else #else
return llvm::DIType(); return llvm::DIType();
#endif #endif
retArgTypes.push_back(t->GetDIType(scope)); retArgTypes.push_back(t->GetDIType(scope));
} }
#if defined(LLVM_3_6)
llvm::DITypeArray retArgTypesArray =
m->diBuilder->getOrCreateTypeArray(llvm::ArrayRef<llvm::Value *>(retArgTypes));
#else
llvm::DIArray retArgTypesArray = llvm::DIArray retArgTypesArray =
m->diBuilder->getOrCreateArray(llvm::ArrayRef<llvm::Value *>(retArgTypes)); m->diBuilder->getOrCreateArray(llvm::ArrayRef<llvm::Value *>(retArgTypes));
#endif
llvm::DIType diType = llvm::DIType diType =
// FIXME: DIFile // FIXME: DIFile
m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray); m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray);