[Beignet] [PATCH 1/2] Backend: Use KernelArgument::ArgInfo to replace llvm's arg info.

junyan.he at inbox.com junyan.he at inbox.com
Mon Jan 18 00:49:24 PST 2016


From: Junyan He <junyan.he at linux.intel.com>

We define ourself's ArgInfo structure to ease the serialization
of the arguement.

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 backend/src/backend/context.cpp |  6 +++++-
 backend/src/backend/program.cpp |  2 +-
 backend/src/backend/program.hpp | 13 +++++++++++--
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/backend/src/backend/context.cpp b/backend/src/backend/context.cpp
index b8dfa8c..b230aa8 100644
--- a/backend/src/backend/context.cpp
+++ b/backend/src/backend/context.cpp
@@ -452,7 +452,11 @@ namespace gbe
       const auto &arg = fn.getArg(argID);
 
       kernel->args[argID].align = arg.align;
-      kernel->args[argID].info = arg.info;
+      kernel->args[argID].info.addrSpace = arg.info.addrSpace;
+      kernel->args[argID].info.typeName = arg.info.typeName;
+      kernel->args[argID].info.accessQual = arg.info.accessQual;
+      kernel->args[argID].info.typeQual = arg.info.typeQual;
+      kernel->args[argID].info.argName = arg.info.argName;
       switch (arg.type) {
         case ir::FunctionArgument::VALUE:
         case ir::FunctionArgument::STRUCTURE:
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 0ee76fc..fd9e179 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -1023,7 +1023,7 @@ namespace gbe {
   static void *kernelGetArgInfo(gbe_kernel genKernel, uint32_t argID, uint32_t value) {
     if (genKernel == NULL) return NULL;
     const gbe::Kernel *kernel = (const gbe::Kernel*) genKernel;
-    ir::FunctionArgument::InfoFromLLVM* info = kernel->getArgInfo(argID);
+    KernelArgument::ArgInfo* info = kernel->getArgInfo(argID);
 
     switch (value) {
       case GBE_GET_ARG_INFO_ADDRSPACE:
diff --git a/backend/src/backend/program.hpp b/backend/src/backend/program.hpp
index cff2463..4836c51 100644
--- a/backend/src/backend/program.hpp
+++ b/backend/src/backend/program.hpp
@@ -49,7 +49,16 @@ namespace gbe {
     uint32_t size;     //!< Size of the argument
     uint32_t align;    //!< addr alignment of the argument
     uint8_t bti;      //!< binding table index for __global buffer
-    ir::FunctionArgument::InfoFromLLVM info;
+
+    // Strings for arg info.
+    struct ArgInfo {
+      uint32_t addrSpace;
+      std::string typeName;
+      std::string accessQual;
+      std::string typeQual;
+      std::string argName;
+    };
+    ArgInfo info;
   };
 
   /*! Stores the offset where to patch where to patch */
@@ -161,7 +170,7 @@ namespace gbe {
                                 global_wk_sz1, global_wk_sz2, output_sz);
     }
 
-    ir::FunctionArgument::InfoFromLLVM* getArgInfo(uint32_t id) const { return &args[id].info; }
+    KernelArgument::ArgInfo* getArgInfo(uint32_t id) const { return &args[id].info; }
 
     /*! Set compile work group size */
     void setCompileWorkGroupSize(const size_t wg_sz[3]) {
-- 
1.9.1





More information about the Beignet mailing list