[Mesa-dev] [PATCH 04/11] clover: Add a function for retrieving a device's preferred ir

Tom Stellard tstellar at gmail.com
Tue May 22 10:25:15 PDT 2012


A device now has two function for getting information about the IR
it needs to return.

ir_target() => returns the preferred IR
llvm_triple() => returns the triple for the target that is understood by
                 clang/llvm.
---
 src/gallium/state_trackers/clover/core/device.cpp |   19 ++++++++++---------
 src/gallium/state_trackers/clover/core/device.hpp |    3 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 69b1b4a..e2df673 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -23,6 +23,7 @@
 #include "core/device.hpp"
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
+#include "util/u_inlines.h"
 
 using namespace clover;
 
@@ -160,16 +161,16 @@ _cl_device_id::vendor_name() const {
    return pipe->get_vendor(pipe);
 }
 
-std::string
+enum pipe_shader_ir
 _cl_device_id::ir_target() const {
-   switch (pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
-                                  PIPE_SHADER_CAP_PREFERRED_IR)) {
-   case PIPE_SHADER_IR_TGSI:
-      return "tgsi";
-   default:
-      assert(0);
-      return "";
-   }
+   return (enum pipe_shader_ir) pipe->get_shader_param(pipe,
+                                                  PIPE_SHADER_COMPUTE,
+                                                  PIPE_SHADER_CAP_PREFERRED_IR);
+}
+
+std::string
+_cl_device_id::llvm_triple() const {
+   return util_get_llvm_triple(pipe, PIPE_SHADER_COMPUTE);
 }
 
 device_registry::device_registry() {
diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
index d106352..9d2f69f 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -60,7 +60,8 @@ public:
    std::vector<size_t> max_block_size() const;
    std::string device_name() const;
    std::string vendor_name() const;
-   std::string ir_target() const;
+   enum pipe_shader_ir ir_target() const;
+   std::string llvm_triple() const;
 
    friend struct _cl_command_queue;
    friend class clover::root_resource;
-- 
1.7.3.4



More information about the mesa-dev mailing list