Started to play with __local and __constant declarations
authorBenjamin Segovia <devnull@localhost>
Mon, 25 Jun 2012 01:29:35 +0000 (01:29 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 10 Aug 2012 23:18:55 +0000 (16:18 -0700)
backend/doc/TODO.md
backend/src/ir/value.hpp
backend/src/llvm/llvm_gen_backend.cpp
backend/src/llvm/llvm_passes.cpp
backend/src/sys/assert.cpp

index 431aab5..9f5a934 100644 (file)
@@ -96,7 +96,7 @@ The code is defined in `src/backend`. Main things to do are:
 - Implementing the instruction scheduling pass
 
 General plumbing
-------------------
+----------------
 
 I tried to keep the code clean, well, as far as C++ can be really clean. There
 are some header cleaning steps required though, in particular in the backend
index 763b36f..47b9048 100644 (file)
@@ -190,7 +190,11 @@ namespace ir {
   /*! All possible definitions for a use */
   typedef set<ValueDef*> DefSet;
 
-  /*! Get the chains (in both directions) for the complete program */
+  /*! Get the chains (in both directions) for the complete program. This data
+   *  structure is unfortunately way too brutal. Using std::sets all over the
+   *  place just burns a huge amount of memory. There is work to do to decrease
+   *  the memory footprint
+   */
   class FunctionDAG : public NonCopyable
   {
   public:
index 4567671..51f7ae2 100644 (file)
@@ -431,7 +431,7 @@ namespace gbe
     TheModule = &M;
 
     TAsm = new CBEMCAsmInfo();
-    TD = new TargetData(&M);
+    TD   = new TargetData(&M);
     MRI  = new MCRegisterInfo();
     TCtx = new MCContext(*TAsm, *MRI, NULL);
     Mang = new Mangler(*TCtx, *TD);
index c6c3306..5a79ead 100644 (file)
@@ -222,21 +222,21 @@ namespace gbe
 
     if(isa<GlobalVariable>(parentPointer)) //HACK: !!!!
     {
-#if FORMER_VERSION
+#if 1//FORMER_VERSION
       Function *constWrapper = 
         Function::Create(FunctionType::get(parentPointer->getType(),true),
             GlobalValue::ExternalLinkage,
-            Twine(CONSTWRAPPERNAME));
+            Twine("__gen_ocl_const_wrapper"));
 
-      std::vector<Value*> params;
-      params.push_back(parentPointer);
+      llvm::ArrayRef<Value*> params(parentPointer);
+      // params.push_back(parentPointer);
 
       //create and insert wrapper call
       CallInst * wrapperCall = 
-        CallInst::Create(constWrapper,params.begin(), params.end(),"",GEPInst);
+        CallInst::Create(constWrapper,params,"",GEPInst);
       parentPointer = wrapperCall;
 #else
-      NOT_IMPLEMENTED;
+      // NOT_IMPLEMENTED;
 #endif
     }
 
index 3aa691b..52178a1 100644 (file)
  */
 #if GBE_COMPILE_UTESTS
 
-#include "assert.hpp"
-#include "exception.hpp"
+#include "sys/assert.hpp"
+#include "sys/exception.hpp"
+#include "sys/cvar.hpp"
 #include <cassert>
 #include <cstdlib>
 
 namespace gbe
 {
+  BVAR(OCL_BREAK_POINT_IN_ASSERTION, false);
+  BVAR(OCL_ABORT_IN_ASSERTION, false);
+
   void onFailedAssertion(const char *msg, const char *file, const char *fn, int line)
   {
     char lineString[256];
@@ -40,7 +44,12 @@ namespace gbe
                           + std::string(file)
                           + ", function " + std::string(fn)
                           + ", line " + std::string(lineString);
-    // assert(0);
+    if (OCL_BREAK_POINT_IN_ASSERTION)
+      DEBUGBREAK();
+    if (OCL_ABORT_IN_ASSERTION) {
+      assert(false);
+      exit(-1);
+    }
     throw Exception(str);
   }
 } /* namespace gbe */