aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/clover
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2013-03-07 10:51:25 -0500
committerTom Stellard <[email protected]>2013-04-05 18:43:34 -0400
commitc5e5b3401c52f83bd885497cb30125e78a21d666 (patch)
tree895fceb4d43d1d6d8e9427907bc081007a86d9fa /src/gallium/state_trackers/clover
parent1a868acbecdd7b7cb71342a75a36ad9a80d8eb17 (diff)
gallium: PIPE_COMPUTE_CAP_IR_TARGET - allow drivers to specify a processor v2
This target string now contains four values instead of three. The old processor field (which was really being interpreted as arch) has been split into two fields: processor and arch. This allows drivers to pass a more a more detailed description of the hardware to compiler frontends. v2: - Adapt to libclc changes Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/clover')
-rw-r--r--src/gallium/state_trackers/clover/llvm/invocation.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 1cad15c1d1d..15b10be2a13 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -110,7 +110,8 @@ namespace {
llvm::Module *
compile(const std::string &source, const std::string &name,
- const std::string &triple, const std::string &opts) {
+ const std::string &triple, const std::string &processor,
+ const std::string &opts) {
clang::CompilerInstance c;
clang::CompilerInvocation invocation;
@@ -175,6 +176,7 @@ namespace {
c.getLangOpts().NoBuiltin = true;
c.getTargetOpts().Triple = triple;
+ c.getTargetOpts().CPU = processor;
#if HAVE_LLVM <= 0x0301
c.getInvocation().setLangDefaults(clang::IK_OpenCL);
#else
@@ -215,12 +217,14 @@ namespace {
void
link(llvm::Module *mod, const std::string &triple,
+ const std::string &processor,
const std::vector<llvm::Function *> &kernels) {
llvm::PassManager PM;
llvm::PassManagerBuilder Builder;
llvm::sys::Path libclc_path =
- llvm::sys::Path(LIBCLC_LIBEXECDIR + triple + ".bc");
+ llvm::sys::Path(LIBCLC_LIBEXECDIR + processor +
+ "-" + triple + ".bc");
// Link the kernel with libclc
#if HAVE_LLVM < 0x0303
@@ -339,18 +343,22 @@ namespace {
module
clover::compile_program_llvm(const compat::string &source,
enum pipe_shader_ir ir,
- const compat::string &triple,
+ const compat::string &target,
const compat::string &opts) {
std::vector<llvm::Function *> kernels;
+ size_t processor_str_len = std::string(target.begin()).find_first_of("-");
+ std::string processor(target.begin(), 0, processor_str_len);
+ std::string triple(target.begin(), processor_str_len + 1,
+ target.size() - processor_str_len - 1);
// The input file name must have the .cl extension in order for the
// CompilerInvocation class to recognize it as an OpenCL source file.
- llvm::Module *mod = compile(source, "input.cl", triple, opts);
+ llvm::Module *mod = compile(source, "input.cl", triple, processor, opts);
find_kernels(mod, kernels);
- link(mod, triple, kernels);
+ link(mod, triple, processor, kernels);
// Build the clover::module
switch (ir) {