From b7d72a173819f34abd0399bd6f6aa96c66e21696 Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Fri, 30 Mar 2018 13:25:56 +0300 Subject: [PATCH 1/3] Switch to 6.0 release branch --- alloy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alloy.py b/alloy.py index 1eb743ee06..310d95f340 100755 --- a/alloy.py +++ b/alloy.py @@ -138,7 +138,7 @@ def checkout_LLVM(component, use_git, version_LLVM, revision, target_dir, from_v SVN_PATH="trunk" GIT_BRANCH="master" elif version_LLVM == "6_0": - SVN_PATH="branches/release_60" + SVN_PATH="tags/RELEASE_600/final" GIT_BRANCH="release_60" elif version_LLVM == "5_0": SVN_PATH="tags/RELEASE_501/final" From e6be2d02d5b7aa6b812e2e60ebe8917ba8b3c4ae Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Fri, 30 Mar 2018 13:26:30 +0300 Subject: [PATCH 2/3] Fix assertion in 6.0 --- module.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module.cpp b/module.cpp index 8dc03a0794..16f064e90a 100644 --- a/module.cpp +++ b/module.cpp @@ -2492,7 +2492,6 @@ void Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostream) const { clang::CompilerInstance inst; - inst.createFileManager(); llvm::raw_fd_ostream stderrRaw(2, false); @@ -2506,6 +2505,8 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre inst.setDiagnostics(diagEngine); + inst.createFileManager(); + #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_4 // 3.2, 3.3, 3.4 clang::TargetOptions &options = inst.getTargetOpts(); #else // LLVM 3.5+ From 9d8426948b20a75634211f3dba22abce65406bd4 Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Fri, 30 Mar 2018 13:27:29 +0300 Subject: [PATCH 3/3] Remove trailing spaces --- module.cpp | 80 +++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/module.cpp b/module.cpp index 16f064e90a..d4947071ff 100644 --- a/module.cpp +++ b/module.cpp @@ -349,7 +349,7 @@ lStripUnusedDebugInfo(llvm::Module *module) { // And now we can go and stuff it into the unit with some // confidence... - llvm::MDNode *replNode = llvm::MDNode::get(module->getContext(), + llvm::MDNode *replNode = llvm::MDNode::get(module->getContext(), llvm::ArrayRef(usedSubprograms)); cu.replaceSubprograms(llvm::DIArray(replNode)); #else // LLVM 3.7+ @@ -601,7 +601,7 @@ Module::AddGlobalVariable(const std::string &name, const Type *type, Expr *initE } #ifdef ISPC_NVPTX_ENABLED - if (g->target->getISA() == Target::NVPTX && + if (g->target->getISA() == Target::NVPTX && #if 0 !type->IsConstType() && #endif @@ -621,7 +621,7 @@ Module::AddGlobalVariable(const std::string &name, const Type *type, Expr *initE * or 128 threads. * ***note-to-me***:please define these value (128threads/4warps) * in nvptx-target definition - * instead of compile-time constants + * instead of compile-time constants */ nel *= at->GetElementCount(); assert (!type->IsSOAType()); @@ -842,7 +842,7 @@ lRecursiveCheckValidParamType(const Type *t, bool vectorOk) { if (pt != NULL) { // Only allow exported uniform pointers // Uniform pointers to varying data, however, are ok. - if (pt->IsVaryingType()) + if (pt->IsVaryingType()) return false; else return lRecursiveCheckValidParamType(pt->GetBaseType(), true); @@ -850,7 +850,7 @@ lRecursiveCheckValidParamType(const Type *t, bool vectorOk) { if (t->IsVaryingType() && !vectorOk) return false; - else + else return true; } @@ -883,7 +883,7 @@ lCheckExportedParameterTypes(const Type *type, const std::string &name, static void lCheckTaskParameterTypes(const Type *type, const std::string &name, SourcePos pos) { - if (g->target->getISA() != Target::NVPTX) + if (g->target->getISA() != Target::NVPTX) return; if (lRecursiveCheckValidParamType(type, false) == false) { if (CastType(type)) @@ -1038,7 +1038,7 @@ Module::AddFunctionDeclaration(const std::string &name, functionName += functionType->Mangle(); // If we treat generic as smth, we should have appropriate mangling if (g->mangleFunctionsWithTarget) { - if (g->target->getISA() == Target::GENERIC && + if (g->target->getISA() == Target::GENERIC && !g->target->getTreatGenericAsSmth().empty()) functionName += g->target->getTreatGenericAsSmth(); else @@ -1346,7 +1346,7 @@ Module::writeOutput(OutputType outputType, const char *outFileName, #ifdef ISPC_NVPTX_ENABLED typedef std::vector vecString_t; -static vecString_t +static vecString_t lSplitString(const std::string &s) { std::stringstream ss(s); @@ -1355,7 +1355,7 @@ lSplitString(const std::string &s) return vecString_t(begin,end); } -static void +static void lFixAttributes(const vecString_t &src, vecString_t &dst) { dst.clear(); @@ -1454,7 +1454,7 @@ Module::writeBitcode(llvm::Module *module, const char *outFileName) { #ifdef ISPC_NVPTX_ENABLED if (g->target->getISA() == Target::NVPTX) { - /* when using "nvptx" target, emit patched/hacked assembly + /* when using "nvptx" target, emit patched/hacked assembly * NVPTX only accepts 3.2-style LLVM assembly, where attributes * must be inlined, rather then referenced by #attribute_d * As soon as NVVM support 3.3,3.4 style assembly this fix won't be needed @@ -1526,7 +1526,7 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_5 std::string error; -#else // LLVM 3.6+ +#else // LLVM 3.6+ std::error_code error; #endif @@ -1540,7 +1540,7 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine, #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_5 if (error.size()) { -#else // LLVM 3.6+ +#else // LLVM 3.6+ if (error) { #endif @@ -1625,7 +1625,7 @@ static void lEmitStructDecl(const StructType *st, std::vector *emittedStructs, FILE *file, bool emitUnifs=true) { - // if we're emitting this for a generic dispatch header file and it's + // if we're emitting this for a generic dispatch header file and it's // struct that only contains uniforms, don't bother if we're emitting uniforms if (!emitUnifs && !lContainsPtrToVarying(st)) { return; @@ -1648,7 +1648,7 @@ lEmitStructDecl(const StructType *st, std::vector *emittedSt // And now it's safe to declare this one emittedStructs->push_back(st); - + fprintf(file, "#ifndef __ISPC_STRUCT_%s__\n",st->GetCStructName().c_str()); fprintf(file, "#define __ISPC_STRUCT_%s__\n",st->GetCStructName().c_str()); @@ -1870,7 +1870,7 @@ lGetExportedTypes(const Type *type, lGetExportedTypes(ftype->GetParameterType(j), exportedStructTypes, exportedEnumTypes, exportedVectorTypes); } - else + else Assert(CastType(type) != NULL); } @@ -2371,7 +2371,7 @@ struct DispatchHeaderInfo { bool Module::writeDispatchHeader(DispatchHeaderInfo *DHI) { FILE *f = DHI->file; - + if (DHI->EmitFrontMatter) { fprintf(f, "//\n// %s\n// (Header automatically generated by the ispc compiler.)\n", DHI->fn); fprintf(f, "// DO NOT EDIT THIS FILE.\n//\n\n"); @@ -2414,10 +2414,10 @@ Module::writeDispatchHeader(DispatchHeaderInfo *DHI) { std::vector exportedFuncs, externCFuncs; m->symbolTable->GetMatchingFunctions(lIsExported, &exportedFuncs); m->symbolTable->GetMatchingFunctions(lIsExternC, &externCFuncs); - + int programCount = g->target->getVectorWidth(); - - if ((DHI->Emit4 && (programCount == 4)) || + + if ((DHI->Emit4 && (programCount == 4)) || (DHI->Emit8 && (programCount == 8)) || (DHI->Emit16 && (programCount == 16))) { // Get all of the struct, vector, and enumerant types used as function @@ -2429,7 +2429,7 @@ Module::writeDispatchHeader(DispatchHeaderInfo *DHI) { &exportedEnumTypes, &exportedVectorTypes); lGetExportedParamTypes(externCFuncs, &exportedStructTypes, &exportedEnumTypes, &exportedVectorTypes); - + // Go through the explicitly exported types for (int i = 0; i < (int)exportedTypes.size(); ++i) { if (const StructType *st = CastType(exportedTypes[i].first)) @@ -2442,19 +2442,19 @@ Module::writeDispatchHeader(DispatchHeaderInfo *DHI) { FATAL("Unexpected type in export list"); } - + // And print them if (DHI->EmitUnifs) { lEmitVectorTypedefs(exportedVectorTypes, f); lEmitEnumDecls(exportedEnumTypes, f); } lEmitStructDecls(exportedStructTypes, f, DHI->EmitUnifs); - + // Update flags DHI->EmitUnifs = false; if (programCount == 4) { DHI->Emit4 = false; - } + } else if (programCount == 8) { DHI->Emit8 = false; } @@ -2479,12 +2479,12 @@ Module::writeDispatchHeader(DispatchHeaderInfo *DHI) { // end namespace fprintf(f, "\n"); fprintf(f, "\n#ifdef __cplusplus\n} /* namespace */\n#endif // __cplusplus\n"); - + // end guard fprintf(f, "\n#endif // %s\n", guard.c_str()); DHI->EmitBackMatter = false; } - + return true; } @@ -2498,11 +2498,11 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre clang::DiagnosticOptions *diagOptions = new clang::DiagnosticOptions(); clang::TextDiagnosticPrinter *diagPrinter = new clang::TextDiagnosticPrinter(stderrRaw, diagOptions); - + llvm::IntrusiveRefCntPtr diagIDs(new clang::DiagnosticIDs); clang::DiagnosticsEngine *diagEngine = new clang::DiagnosticsEngine(diagIDs, diagOptions, diagPrinter); - + inst.setDiagnostics(diagEngine); inst.createFileManager(); @@ -2510,7 +2510,7 @@ Module::execPreprocessor(const char *infilename, llvm::raw_string_ostream *ostre #if ISPC_LLVM_VERSION <= ISPC_LLVM_3_4 // 3.2, 3.3, 3.4 clang::TargetOptions &options = inst.getTargetOpts(); #else // LLVM 3.5+ - const std::shared_ptr< clang::TargetOptions > &options = + const std::shared_ptr< clang::TargetOptions > &options = std::make_shared< clang::TargetOptions >(inst.getTargetOpts()); #endif @@ -2681,7 +2681,7 @@ lGetTargetFileName(const char *outFileName, const char *isaString, bool forceCXX strcpy(targetOutFileName, outFileName); strcat(targetOutFileName, "_"); strcat(targetOutFileName, isaString); - + // Append ".cpp" suffix to the original file if it is *-generic target if (forceCXX) strcat(targetOutFileName, ".cpp"); @@ -2787,11 +2787,11 @@ lGetVaryingDispatchType(FunctionTargetVariants &funcs) { } } } - + // We should've found at least one variant here // or else something fishy is going on. Assert(resultFuncTy); - + return resultFuncTy; } @@ -2874,7 +2874,7 @@ lCreateDispatchFunction(llvm::Module *module, llvm::Function *setISAFunc, // dispatchNum is needed to separate generic from *-generic target int dispatchNum = i; - if ((Target::ISA)(i == Target::GENERIC) && + if ((Target::ISA)(i == Target::GENERIC) && !g->target->getTreatGenericAsSmth().empty()) { if (g->target->getTreatGenericAsSmth() == "knl_generic") dispatchNum = Target::KNL_AVX512; @@ -2906,7 +2906,7 @@ lCreateDispatchFunction(llvm::Module *module, llvm::Function *setISAFunc, args.push_back(&*argIter); } else { - llvm::CastInst *argCast = + llvm::CastInst *argCast = llvm::CastInst::CreatePointerCast(&*argIter, targsIter->getType(), "dpatch_arg_bitcast", callBBlock); args.push_back(argCast); @@ -3080,7 +3080,7 @@ lExtractOrCheckGlobals(llvm::Module *msrc, llvm::Module *mdst, bool check) { } #ifdef ISPC_NVPTX_ENABLED -static std::string lCBEMangle(const std::string &S) +static std::string lCBEMangle(const std::string &S) { std::string Result; @@ -3129,7 +3129,7 @@ Module::CompileAndOutput(const char *srcFile, if (m->CompileFile() == 0) { #ifdef ISPC_NVPTX_ENABLED /* NVPTX: - * for PTX target replace '.' with '_' in all global variables + * for PTX target replace '.' with '_' in all global variables * a PTX identifier name must match [a-zA-Z$_][a-zA-Z$_0-9]* */ if (g->target->getISA() == Target::NVPTX) @@ -3162,7 +3162,7 @@ Module::CompileAndOutput(const char *srcFile, } } else if (outputType == Asm || outputType == Object) { - if (target != NULL && + if (target != NULL && (strncmp(target, "generic-", 8) == 0 || strstr(target, "-generic-") != NULL)) { Error(SourcePos(), "When using a \"generic-*\" compilation target, " "%s output can not be used.", @@ -3239,7 +3239,7 @@ Module::CompileAndOutput(const char *srcFile, std::map exportedFunctions; int errorCount = 0; - + // Handle creating a "generic" header file for multiple targets // that use exported varyings DispatchHeaderInfo DHI; @@ -3261,7 +3261,7 @@ Module::CompileAndOutput(const char *srcFile, } // Variable is needed later for approptiate dispatch function. - // It indicates if we have *-generic target. + // It indicates if we have *-generic target. std::string treatGenericAsSmth = ""; for (unsigned int i = 0; i < targets.size(); ++i) { @@ -3299,9 +3299,9 @@ Module::CompileAndOutput(const char *srcFile, if (outFileName != NULL) { std::string targetOutFileName; // We always generate cpp file for *-generic target during multitarget compilation - if (g->target->getISA() == Target::GENERIC && + if (g->target->getISA() == Target::GENERIC && !g->target->getTreatGenericAsSmth().empty()) { - targetOutFileName = lGetTargetFileName(outFileName, + targetOutFileName = lGetTargetFileName(outFileName, g->target->getTreatGenericAsSmth().c_str(), true); if (!m->writeOutput(CXX, targetOutFileName.c_str(), includeFileName)) return 1;