[oclgrind] 03/04: Add patch for LLVM 3.8 support
James Price
jprice-guest at moszumanska.debian.org
Sat Oct 1 12:11:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
jprice-guest pushed a commit to branch master
in repository oclgrind.
commit 2337e67b32e6e7347f7606ad9d5727d7084bde54
Author: James Price <j.price at bristol.ac.uk>
Date: Sat Oct 1 13:03:44 2016 +0100
Add patch for LLVM 3.8 support
---
debian/patches/llvm-3.8.patch | 252 ++++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 253 insertions(+)
diff --git a/debian/patches/llvm-3.8.patch b/debian/patches/llvm-3.8.patch
new file mode 100644
index 0000000..f448429
--- /dev/null
+++ b/debian/patches/llvm-3.8.patch
@@ -0,0 +1,252 @@
+Description: Add support for LLVM 3.8
+Author: James Price <j.price at bristol.ac.uk>
+Last-Update: 2016-10-01
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -197,7 +197,7 @@
+ POST_BUILD
+ COMMAND
+ ${CLANG}
+- -cc1 -x cl -cl-std=CL1.2 -O0 -g -fno-builtin
++ -cc1 -x cl -cl-std=CL1.2 -O0 -fno-builtin
+ -emit-pch -triple spir-unknown-unknown
+ -relocatable-pch -isysroot ${CMAKE_BINARY_DIR}/include/oclgrind/
+ ${CMAKE_BINARY_DIR}/include/oclgrind/clc.h
+@@ -209,7 +209,7 @@
+ POST_BUILD
+ COMMAND
+ ${CLANG}
+- -cc1 -x cl -cl-std=CL1.2 -O0 -g -fno-builtin
++ -cc1 -x cl -cl-std=CL1.2 -O0 -fno-builtin
+ -emit-pch -triple spir64-unknown-unknown
+ -relocatable-pch -isysroot ${CMAKE_BINARY_DIR}/include/oclgrind/
+ ${CMAKE_BINARY_DIR}/include/oclgrind/clc.h
+--- a/src/core/Kernel.cpp
++++ b/src/core/Kernel.cpp
+@@ -54,12 +54,12 @@
+ new unsigned char[sizeof(size_t)]
+ };
+ value.setPointer(address);
+- m_arguments[itr] = value;
++ m_arguments[&*itr] = value;
+
+ break;
+ }
+ case AddrSpaceConstant:
+- m_constants.push_back(itr);
++ m_constants.push_back(&*itr);
+ break;
+ case AddrSpaceLocal:
+ {
+@@ -71,7 +71,7 @@
+ new unsigned char[sizeof(size_t)]
+ };
+ v.setPointer(m_localMemory->allocateBuffer(size));
+- m_arguments[itr] = v;
++ m_arguments[&*itr] = v;
+
+ break;
+ }
+@@ -141,7 +141,7 @@
+ llvm::Function::const_arg_iterator itr;
+ for (itr = m_function->arg_begin(); itr != m_function->arg_end(); itr++)
+ {
+- if (!m_arguments.count(itr))
++ if (!m_arguments.count(&*itr))
+ {
+ return false;
+ }
+@@ -196,7 +196,7 @@
+ {
+ argItr++;
+ }
+- return argItr;
++ return &*argItr;
+ }
+
+ unsigned int Kernel::getArgumentAccessQualifier(unsigned int index) const
+--- a/src/core/WorkItem.cpp
++++ b/src/core/WorkItem.cpp
+@@ -30,9 +30,9 @@
+
+ struct WorkItem::Position
+ {
+- llvm::Function::const_iterator prevBlock;
+- llvm::Function::const_iterator currBlock;
+- llvm::Function::const_iterator nextBlock;
++ const llvm::BasicBlock * prevBlock;
++ const llvm::BasicBlock * currBlock;
++ const llvm::BasicBlock * nextBlock;
+ llvm::BasicBlock::const_iterator currInst;
+ std::stack<const llvm::Instruction*> callStack;
+ std::stack< std::list<size_t> > allocations;
+@@ -81,7 +81,7 @@
+ m_position = new Position;
+ m_position->prevBlock = NULL;
+ m_position->nextBlock = NULL;
+- m_position->currBlock = kernel->getFunction()->begin();
++ m_position->currBlock = &*kernel->getFunction()->begin();
+ m_position->currInst = m_position->currBlock->begin();
+ }
+
+@@ -310,7 +310,7 @@
+
+ const llvm::Instruction* WorkItem::getCurrentInstruction() const
+ {
+- return m_position->currInst;
++ return &*m_position->currInst;
+ }
+
+ Size3 WorkItem::getGlobalID() const
+@@ -509,7 +509,7 @@
+ assert(m_state == READY);
+
+ // Execute the next instruction
+- execute(m_position->currInst);
++ execute(&*m_position->currInst);
+
+ // Check if we've reached the end of the block
+ if (++m_position->currInst == m_position->currBlock->end() ||
+@@ -663,9 +663,9 @@
+ // Check if function has definition
+ if (!function->isDeclaration())
+ {
+- m_position->callStack.push(m_position->currInst);
++ m_position->callStack.push(&*m_position->currInst);
+ m_position->allocations.push(list<size_t>());
+- m_position->nextBlock = function->begin();
++ m_position->nextBlock = &*function->begin();
+
+ // Set function arguments
+ llvm::Function::const_arg_iterator argItr;
+@@ -673,7 +673,7 @@
+ argItr != function->arg_end(); argItr++)
+ {
+ const llvm::Value *arg = callInst->getArgOperand(argItr->getArgNo());
+- setValue(argItr, m_pool.clone(getOperand(arg)));
++ setValue(&*argItr, m_pool.clone(getOperand(arg)));
+ }
+
+ return;
+@@ -1116,7 +1116,11 @@
+
+ if (!m_position->callStack.empty())
+ {
++#if LLVM_VERSION < 38
+ m_position->currInst = m_position->callStack.top();
++#else
++ m_position->currInst.reset(m_position->callStack.top());
++#endif
+ m_position->currBlock = m_position->currInst->getParent();
+ m_position->callStack.pop();
+
+@@ -1124,7 +1128,7 @@
+ const llvm::Value *returnVal = retInst->getReturnValue();
+ if (returnVal)
+ {
+- setValue(m_position->currInst, m_pool.clone(getOperand(returnVal)));
++ setValue(&*m_position->currInst, m_pool.clone(getOperand(returnVal)));
+ }
+
+ // Clear stack allocations
+@@ -1365,7 +1369,7 @@
+ llvm::Module::const_global_iterator G;
+ for (G = module->global_begin(); G != module->global_end(); G++)
+ {
+- addValueID(G);
++ addValueID(&*G);
+ }
+
+
+@@ -1385,7 +1389,7 @@
+ llvm::Function::arg_iterator A;
+ for (A = function->arg_begin(); A != function->arg_end(); A++)
+ {
+- addValueID(A);
++ addValueID(&*A);
+ }
+
+ // Iterate through instructions in function
+--- a/src/core/common.cpp
++++ b/src/core/common.cpp
+@@ -404,9 +404,10 @@
+ }
+ case llvm::Instruction::ICmp:
+ case llvm::Instruction::FCmp:
+- return llvm::CmpInst::Create((llvm::Instruction::OtherOps)opcode,
+- expr->getPredicate(),
+- operands[0], operands[1]);
++ return llvm::CmpInst::Create(
++ (llvm::Instruction::OtherOps)opcode,
++ (llvm::CmpInst::Predicate)expr->getPredicate(),
++ operands[0], operands[1]);
+ default:
+ assert(expr->getNumOperands() == 2 && "Must be binary operator?");
+
+--- a/src/core/Program.cpp
++++ b/src/core/Program.cpp
+@@ -129,7 +129,11 @@
+ args.push_back("-cl-std=CL1.2");
+ args.push_back("-cl-kernel-arg-info");
+ args.push_back("-fno-builtin");
++#if LLVM_VERSION >= 38
++ args.push_back("-debug-info-kind=standalone");
++#else
+ args.push_back("-g");
++#endif
+ args.push_back("-triple");
+ if (sizeof(size_t) == 4)
+ args.push_back("spir-unknown-unknown");
+@@ -502,19 +506,29 @@
+ {
+ llvm::Module *module = new llvm::Module("oclgrind_linked",
+ llvm::getGlobalContext());
++
++#if LLVM_VERSION < 38
+ llvm::Linker linker(module);
++#else
++ llvm::Linker linker(*module);
++#endif
+
+ // Link modules
+ list<const Program*>::iterator itr;
+ for (itr = programs.begin(); itr != programs.end(); itr++)
+ {
+- if (linker.linkInModule(CloneModule((*itr)->m_module.get())))
++#if LLVM_VERSION < 38
++ llvm::Module *m = llvm::CloneModule((*itr)->m_module.get());
++#else
++ unique_ptr<llvm::Module> m = llvm::CloneModule((*itr)->m_module.get());
++#endif
++ if (linker.linkInModule(std::move(m)))
+ {
+ return NULL;
+ }
+ }
+
+- return new Program(context, linker.getModule());
++ return new Program(context, module);
+ }
+
+ Kernel* Program::createKernel(const string name)
+@@ -719,7 +733,8 @@
+ set<llvm::Instruction*> intrinsics;
+ for (llvm::Module::iterator F = m_module->begin(); F != m_module->end(); F++)
+ {
+- for (llvm::inst_iterator I = inst_begin(F), E = inst_end(F); I != E; I++)
++ llvm::Function *f = &*F;
++ for (llvm::inst_iterator I = inst_begin(f), E = inst_end(f); I != E; I++)
+ {
+ if (I->getOpcode() == llvm::Instruction::Call)
+ {
+--- a/src/plugins/InteractiveDebugger.cpp
++++ b/src/plugins/InteractiveDebugger.cpp
+@@ -308,7 +308,7 @@
+ cout << ", ";
+ }
+ cout << argItr->getName().str() << "=";
+- m_kernelInvocation->getCurrentWorkItem()->printValue(argItr);
++ m_kernelInvocation->getCurrentWorkItem()->printValue(&*argItr);
+ }
+
+ cout << ") at line " << dec << getLineNumber(instruction) << endl;
diff --git a/debian/patches/series b/debian/patches/series
index 1e6fa64..590de3e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ use-opencl-headers.patch
altivec-fix.patch
use-std.patch
big-endian.patch
+llvm-3.8.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/oclgrind.git
More information about the Pkg-opencl-commits
mailing list