diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 752942fc9fcce20390f9f6ace09e1ce68ceed3d0..0d64ef41cc1c70d8b8bcf333199962af89d0b580 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -660,6 +660,10 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(uwtable); KEYWORD(writeonly); KEYWORD(zeroext); + // VISC parameter attributes + KEYWORD(in); + KEYWORD(out); + KEYWORD(inout); KEYWORD(type); KEYWORD(opaque); diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 4cd986e143b6c1617ab3c2b554140c7ece280888..d7189c56ce1290f21f5a16e7f1b15ec8be479af3 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -1138,6 +1138,11 @@ bool LLParser::ParseFnAttributeValuePairs(AttrBuilder &B, case lltok::kw_sret: case lltok::kw_swifterror: case lltok::kw_swiftself: + // VISC Parameter only attributes + case lltok::kw_in: + case lltok::kw_out: + case lltok::kw_inout: + HaveError |= Error(Lex.getLoc(), "invalid use of parameter-only attribute on a function"); @@ -1413,6 +1418,10 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) { case lltok::kw_swiftself: B.addAttribute(Attribute::SwiftSelf); break; case lltok::kw_writeonly: B.addAttribute(Attribute::WriteOnly); break; case lltok::kw_zeroext: B.addAttribute(Attribute::ZExt); break; + // VISC parameter attributes + case lltok::kw_in: B.addAttribute(Attribute::In); break; + case lltok::kw_out: B.addAttribute(Attribute::Out); break; + case lltok::kw_inout: B.addAttribute(Attribute::InOut); break; case lltok::kw_alignstack: case lltok::kw_alwaysinline: @@ -1501,6 +1510,10 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) { case lltok::kw_sret: case lltok::kw_swifterror: case lltok::kw_swiftself: + // VISC Parameter only attributes + case lltok::kw_in: + case lltok::kw_out: + case lltok::kw_inout: HaveError |= Error(Lex.getLoc(), "invalid use of parameter-only attribute"); break; diff --git a/llvm/lib/AsmParser/LLToken.h b/llvm/lib/AsmParser/LLToken.h index 048aeee90b359b141737b776e31a26088b30529b..0c05d5154498da5fb9d255750bc7f4084d7544c0 100644 --- a/llvm/lib/AsmParser/LLToken.h +++ b/llvm/lib/AsmParser/LLToken.h @@ -209,6 +209,10 @@ enum Kind { kw_uwtable, kw_writeonly, kw_zeroext, + // VISC parameter attributes + kw_in, + kw_out, + kw_inout, kw_type, kw_opaque, diff --git a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp index 2fe229216485d52003644b01fea6c383ca7e268e..7aeebaef5f00d6d0bd929697b017682c63d67dc7 100644 --- a/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp +++ b/llvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp @@ -157,7 +157,7 @@ class CGT_NVPTX : public CodeGenTraversal { private: //Member variables Module &KernelM; - DFNode* KernelLaunchNode; + DFNode* KernelLaunchNode = NULL; Kernel* kernel; // VISC Runtime API @@ -255,7 +255,7 @@ void CGT_NVPTX::initRuntimeAPI() { assert(LLVM_SRC_ROOT != NULL && "Define LLVM_SRC_ROOT environment variable!"); Twine llvmSrcRoot = LLVM_SRC_ROOT; - Twine runtimeAPI = llvmSrcRoot+"/projects/visc-rt/visc-rt.ll"; + Twine runtimeAPI = llvmSrcRoot+"/../build/projects/visc-rt/visc-rt.ll"; runtimeModule = parseIRFile(runtimeAPI.str(), Err, M.getContext()); if(runtimeModule == nullptr) @@ -284,7 +284,7 @@ void CGT_NVPTX::initRuntimeAPI() { Function* VI = M.getFunction("llvm.visc.init"); assert(VI->getNumUses() == 1 && "__visc__init should only be used once"); - InitCall = cast<Instruction>(*VI->use_begin()); + InitCall = cast<Instruction>(*VI->user_begin()); initializeTimerSet(InitCall); switchToTimer(visc_TimerID_INIT_CTX, InitCall); CallInst::Create(llvm_visc_ocl_initContext, @@ -298,7 +298,7 @@ void CGT_NVPTX::initRuntimeAPI() { DEBUG(errs() << *VC << "\n"); assert(VC->getNumUses() == 1 && "__visc__clear should only be used once"); - CleanupCall = cast<Instruction>(*VC->use_begin()); + CleanupCall = cast<Instruction>(*VC->user_begin()); printTimerSet(CleanupCall); @@ -1504,7 +1504,7 @@ void CGT_NVPTX::fixValueAddrspace(Value* V, unsigned addrspace) { PointerType* OldTy = cast<PointerType>(V->getType()); PointerType* NewTy = PointerType::get(OldTy->getElementType(), addrspace); V->mutateType(NewTy); - for(Value::use_iterator ui = V->use_begin(), ue = V->use_end(); ui != ue; ui++) { + for(Value::user_iterator ui = V->user_begin(), ue = V->user_end(); ui != ue; ui++) { // Change all uses producing pointer type in same address space to new // addressspace. if(PointerType* PTy = dyn_cast<PointerType>((*ui)->getType())) { @@ -1706,7 +1706,7 @@ static bool findLoadStoreUses(Value* V, std::vector<Value*>*UseList, std::vector return false; } VisitedList->push_back(V); - for(Value::use_iterator ui = V->use_begin(), ue = V->use_end(); + for(Value::user_iterator ui = V->user_begin(), ue = V->user_end(); ui != ue; ++ui) { Instruction* I = dyn_cast<Instruction>(*ui); if(!I) { diff --git a/llvm/lib/Transforms/GenVISC/GenVISC.cpp b/llvm/lib/Transforms/GenVISC/GenVISC.cpp index fa803c97383e34b935fe01a9f5d714a72b8d1eb8..7a5d8646e5d00a4170fa47b1358c42bb07c79e2b 100644 --- a/llvm/lib/Transforms/GenVISC/GenVISC.cpp +++ b/llvm/lib/Transforms/GenVISC/GenVISC.cpp @@ -1337,8 +1337,6 @@ bool GenVISC::runOnModule(Module &M) { } } - - return false; //TODO: What does returning "false" mean? } diff --git a/llvm/lib/Transforms/LocalMem/LocalMem.cpp b/llvm/lib/Transforms/LocalMem/LocalMem.cpp index 085a915c37feb58cc90e1bd9a26a66fc2e4412ba..896c3f382a2977e49d91711fed0f387e9601b6d2 100644 --- a/llvm/lib/Transforms/LocalMem/LocalMem.cpp +++ b/llvm/lib/Transforms/LocalMem/LocalMem.cpp @@ -140,7 +140,7 @@ void AT_OCL::codeGen(DFLeafNode* N) { // 2. (TODO:) Whether the allocated pointer escapes the parent node AllocationNodeProperty* isAllocationNode(DFLeafNode* N) { // Allocation node must be free from side-effects - if(!N->hasSideEffects()) + if(N->hasSideEffects()) return NULL; // Allocation node must have some outgoing edges