added LLVM_3_6 var

This commit is contained in:
Anton Mitrokhin
2014-07-30 11:50:15 +04:00
parent e044db016d
commit 725be222ac
15 changed files with 54 additions and 40 deletions

View File

@@ -117,6 +117,10 @@ ifeq ($(LLVM_VERSION),LLVM_3_5)
ISPC_LIBS += -lcurses -lz
endif
ifeq ($(LLVM_VERSION),LLVM_3_6)
ISPC_LIBS += -lcurses -lz
endif
ifeq ($(ARCH_OS),Linux)
ISPC_LIBS += -ldl
endif
@@ -153,6 +157,9 @@ CXXFLAGS=$(OPT) $(LLVM_CXXFLAGS) -I. -Iobjs/ -I$(CLANG_INCLUDE) \
ifeq ($(LLVM_VERSION),LLVM_3_5)
CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register
endif
ifeq ($(LLVM_VERSION),LLVM_3_6)
CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register
endif
ifneq ($(ARM_ENABLED), 0)
CXXFLAGS+=-DISPC_ARM_ENABLED
endif

View File

@@ -66,7 +66,7 @@
#include <llvm/IR/Intrinsics.h>
#include <llvm/IR/DerivedTypes.h>
#endif
#if defined(LLVM_3_5)
#if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/Linker/Linker.h>
#else
#include <llvm/Linker.h>
@@ -705,7 +705,7 @@ AddBitcodeToModule(const unsigned char *bitcode, int length,
llvm::Module *module, SymbolTable *symbolTable) {
llvm::StringRef sb = llvm::StringRef((char *)bitcode, length);
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);
if (std::error_code EC = ModuleOrErr.getError())
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.
// Generally we allow library DataLayout to be subset of module
// 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(),
bcModule->getDataLayoutStr())) {
Warning(SourcePos(), "Module DataLayout is incompatible with "

View File

@@ -1500,10 +1500,12 @@ define <$1 x $2> @__atomic_compare_exchange_$3_global($2* %ptr, <$1 x $2> %cmp,
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 = 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
')
%rp_LANE_ID = getelementptr $2 * %rptr32, i32 LANE
store $2 %r_LANE_ID, $2 * %rp_LANE_ID')
@@ -1516,6 +1518,9 @@ define $2 @__atomic_compare_exchange_uniform_$3_global($2* %ptr, $2 %cmp,
ifelse(LLVM_VERSION,LLVM_3_5,`
%r_t = cmpxchg $2 * %ptr, $2 %cmp, $2 %val seq_cst seq_cst
%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
')

View File

@@ -63,7 +63,7 @@
#include "llvm/Analysis/ConstantsScanner.h"
#include "llvm/Analysis/FindUsedTypes.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/IRPrintingPasses.h>
#include "llvm/IR/CallSite.h"
@@ -250,7 +250,7 @@ namespace {
class CBEMCAsmInfo : public llvm::MCAsmInfo {
public:
CBEMCAsmInfo() {
#if !defined(LLVM_3_5)
#if !defined(LLVM_3_5) && !defined(LLVM_3_6)
GlobalPrefix = "";
#endif
PrivateGlobalPrefix = "";
@@ -465,7 +465,7 @@ namespace {
// Must not be used in inline asm, extractelement, or shufflevector.
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());
#else
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.
#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();
#else
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.
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())
#else
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
// like debug information.
#if defined(LLVM_3_5)
#if defined(LLVM_3_5) || defined(LLVM_3_6)
// Here we compare char *
if (!strcmp(GV->getSection(), "llvm.metadata"))
#else
@@ -2225,7 +2225,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
#endif
TAsm = new CBEMCAsmInfo();
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);
#else
TCtx = new llvm::MCContext(*TAsm, *MRI, NULL);
@@ -2349,7 +2349,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
I->hasCommonLinkage())
Out << "extern ";
#if defined (LLVM_3_5)
#if defined (LLVM_3_5) || defined(LLVM_3_6)
else if (I->hasDLLImportStorageClass())
#else
else if (I->hasDLLImportLinkage())
@@ -2525,7 +2525,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
if (I->hasLocalLinkage())
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->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
#else
@@ -2810,7 +2810,7 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
bool isStructReturn = F->hasStructRetAttr();
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->hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
#else
@@ -3145,7 +3145,7 @@ void CWriter::visitSwitchInst(llvm::SwitchInst &SI) {
Out << ":\n";
printPHICopiesForSuccessor (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())))
#else
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!!
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))
#else
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.
llvm::Instruction *Before = 0;
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));
#else
Before = prior(llvm::BasicBlock::iterator(CI));

View File

@@ -352,7 +352,7 @@ FunctionEmitContext::FunctionEmitContext(Function *func, Symbol *funSym,
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());
llvm::DICompositeType diSubprogramType_n =
static_cast<llvm::DICompositeType>(diSubprogramType);
@@ -1546,7 +1546,7 @@ FunctionEmitContext::StartScope() {
llvm::DILexicalBlock lexicalBlock =
m->diBuilder->createLexicalBlock(parentScope, diFile,
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
// to the last argument and revision 202737 in clang adds 0
// for the last argument by default.

2
ctx.h
View File

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

View File

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

View File

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

View File

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

4
ispc.h
View File

@@ -40,8 +40,8 @@
#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)
#error "Only LLVM 3.1, 3.2, 3.3, 3.4 and the 3.5 development branch are supported"
#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, 3.5 and the 3.6 development branch are supported"
#endif
#if defined(_WIN32) || defined(_WIN64)

View File

@@ -72,6 +72,8 @@ lPrintVersion() {
"3.4"
#elif defined(LLVM_3_5)
"3.5"
#elif defined(LLVM_3_6)
"3.6"
#else
#error "Unhandled LLVM version"
#endif
@@ -166,7 +168,7 @@ devUsage(int ret) {
printf(" disable-uniform-memory-optimizations\tDisable uniform-based coherent memory access\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");
#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");
#endif
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");
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) {
g->debugIR = ParsingPhaseName(argv[i] + strlen("--debug-ir="));
}

View File

@@ -93,7 +93,7 @@
#include <llvm/IR/DataLayout.h>
#include <llvm/Analysis/TargetTransformInfo.h>
#endif
#if defined(LLVM_3_5)
#if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/Verifier.h>
#include <llvm/IR/IRPrintingPasses.h>
#include <llvm/IR/CFG.h>
@@ -948,7 +948,7 @@ Module::writeOutput(OutputType outputType, const char *outFileName,
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
// "Debug Info Version" constant to the module. LLVM will ignore
// our Debug Info metadata without it.
@@ -1105,7 +1105,7 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
}
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()));
#else
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;
#if defined(LLVM_3_5)
#if defined(LLVM_3_5) || defined(LLVM_3_6)
inst.createPreprocessor(clang::TU_Complete);
#else
inst.createPreprocessor();

View File

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

View File

@@ -63,12 +63,12 @@
#include <llvm/IR/BasicBlock.h>
#include <llvm/IR/Constants.h>
#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>
#endif
#include <llvm/PassManager.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/IRPrintingPasses.h>
#include <llvm/IR/PatternMatch.h>
@@ -444,7 +444,7 @@ DebugPassManager::add(llvm::Pass * P, int stage = -1) {
number, P->getPassName());
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) {
// adding generating of LLVM IR debug after optimization
char buf[100];
@@ -469,7 +469,7 @@ Optimize(llvm::Module *module, int optLevel) {
new llvm::TargetLibraryInfo(llvm::Triple(module->getTargetTriple()));
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()));
#else
optPM.add(new llvm::DataLayout(*g->target->getDataLayout()));

View File

@@ -50,7 +50,7 @@
#include <llvm/IR/Value.h>
#include <llvm/IR/Module.h>
#endif
#if defined(LLVM_3_5)
#if defined(LLVM_3_5) || defined(LLVM_3_6)
#include <llvm/IR/DebugInfo.h>
#include <llvm/IR/DIBuilder.h>
#else
@@ -2987,7 +2987,7 @@ FunctionType::GetDIType(llvm::DIDescriptor scope) const {
for (int i = 0; i < GetNumParameters(); ++i) {
const Type *t = GetParameterType(i);
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();
#else
return llvm::DIType();