summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/clover/llvm
diff options
context:
space:
mode:
authorSerge Martin <[email protected]>2016-10-30 17:21:15 -0700
committerSerge Martin <[email protected]>2016-11-06 15:56:54 +0100
commitcc495055cdfe7e39002180d095d09fe4b6905eb9 (patch)
tree0ac1320ce58a9a14f5dcefae3e62c1dfa1b37196 /src/gallium/state_trackers/clover/llvm
parent05fcc73f087fa2b8c447ec8c79c7bdab57d49faf (diff)
clover: Add CL_PROGRAM_BINARY_TYPE support (CL1.2).
v3 [Francisco Jerez]: Loosely based on Serge's v1 of this patch in order to avoid CL-specific enums in the clover module binary format. In addition to other changes made in v2: Represent the CL program binary type as the section type instead of adding a CL API-specific enum, check that the binary types of the input objects are valid during clLinkProgram(), pass section type as argument to build_module_library() instead of using separate function. Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/clover/llvm')
-rw-r--r--src/gallium/state_trackers/clover/llvm/codegen.hpp3
-rw-r--r--src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp5
-rw-r--r--src/gallium/state_trackers/clover/llvm/codegen/common.cpp3
-rw-r--r--src/gallium/state_trackers/clover/llvm/invocation.cpp4
4 files changed, 9 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/codegen.hpp b/src/gallium/state_trackers/clover/llvm/codegen.hpp
index e0e990190d2..44971adb7dd 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen.hpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen.hpp
@@ -46,7 +46,8 @@ namespace clover {
print_module_bitcode(const ::llvm::Module &mod);
module
- build_module_library(const ::llvm::Module &mod);
+ build_module_library(const ::llvm::Module &mod,
+ enum module::section::type section_type);
std::unique_ptr<::llvm::Module>
parse_module_library(const module &m, ::llvm::LLVMContext &ctx,
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
index 658cce923c9..108f8d54e9e 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
@@ -80,10 +80,11 @@ clover::llvm::print_module_bitcode(const ::llvm::Module &mod) {
}
module
-clover::llvm::build_module_library(const ::llvm::Module &mod) {
+clover::llvm::build_module_library(const ::llvm::Module &mod,
+ enum module::section::type section_type) {
module m;
const auto code = emit_code(mod);
- m.secs.emplace_back(0, module::section::text, code.size(), code);
+ m.secs.emplace_back(0, section_type, code.size(), code);
return m;
}
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
index 834b06a134c..13ccd591c11 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
@@ -179,7 +179,8 @@ namespace {
module::section
make_text_section(const std::vector<char> &code) {
const pipe_llvm_program_header header { uint32_t(code.size()) };
- module::section text { 0, module::section::text, header.num_bytes, {} };
+ module::section text { 0, module::section::text_executable,
+ header.num_bytes, {} };
text.data.insert(text.data.end(), reinterpret_cast<const char *>(&header),
reinterpret_cast<const char *>(&header) + sizeof(header));
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index b5e8b523fab..675cf1944d7 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -211,7 +211,7 @@ clover::llvm::compile_program(const std::string &source,
if (has_flag(debug::llvm))
debug::log(".ll", print_module_bitcode(*mod));
- return build_module_library(*mod);
+ return build_module_library(*mod, module::section::text_intermediate);
}
namespace {
@@ -280,7 +280,7 @@ clover::llvm::link_program(const std::vector<module> &modules,
debug::log(".ll", print_module_bitcode(*mod));
if (create_library) {
- return build_module_library(*mod);
+ return build_module_library(*mod, module::section::text_library);
} else if (ir == PIPE_SHADER_IR_LLVM) {
return build_module_bitcode(*mod, *c);