[opengtl-commits] [206] move the pixel structure to data pointer as an independent function

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 206
Author:   cyrille
Date:     2008-06-21 00:39:26 +0200 (Sat, 21 Jun 2008)

Log Message:
-----------
move the pixel structure to data pointer as an independent function

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2008-06-20 20:45:35 UTC (rev 205)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2008-06-20 22:39:26 UTC (rev 206)
@@ -77,20 +77,24 @@
   return func_llvm_memcpy_i32;
 }
 
-llvm::BasicBlock* CodeGenerator::memToPixel( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _dataPointer, llvm::Value* _pixel, int _size )
+llvm::Value* CodeGenerator::accessPixelData( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel)
 {
-  // Initialise llvm_memcpy_i32
-  llvm::Function* func_llvm_memcpy_i32 = createMemCpyFunction( _gc.llvmModule() );
-  // Access to the data pointer for the _pixel
   std::vector<llvm::Value*> indexes;
   indexes.push_back( _gc.codeGenerator()->integerToConstant(0));
   indexes.push_back( _gc.codeGenerator()->integerToConstant(PixelWrap::INDEX_DATA));
   llvm::Value* _pointerToPixelVector =
       new llvm::GetElementPtrInst( _pixel, indexes.begin(), indexes.end(), "", _currentBlock );
   // Cast the vector to a "char*"
-  llvm::Value* _pointerToPixelVectorU8 = new llvm::BitCastInst(
+  return new llvm::BitCastInst(
       _pointerToPixelVector, llvm::PointerType::get(llvm::IntegerType::get(8), 0), "", _currentBlock);
-  
+}
+
+llvm::BasicBlock* CodeGenerator::memToPixel( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _dataPointer, llvm::Value* _pixel, int _size )
+{
+  // Initialise llvm_memcpy_i32
+  llvm::Function* func_llvm_memcpy_i32 = createMemCpyFunction( _gc.llvmModule() );
+  // Access to the data pointer for the _pixel
+  llvm::Value* _pointerToPixelVectorU8 = accessPixelData( _gc, _currentBlock, _pixel );
   // Call llvm.memcpy.i32
   std::vector<llvm::Value*> memcpy_params;
   memcpy_params.push_back( _pointerToPixelVectorU8 );

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h	2008-06-20 20:45:35 UTC (rev 205)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h	2008-06-20 22:39:26 UTC (rev 206)
@@ -50,6 +50,7 @@
       static llvm::Function* generateEvaluatePixeles( const std::vector<const GTLCore::Type*>& _inputTypes, const GTLCore::Type* _outputType, Kernel* _kernel, GTLCore::ModuleData* _moduleData, const GTLCore::PixelDescription& _pixelDescription );
     private:
       static llvm::Function* createMemCpyFunction( llvm::Module* _module );
+      static llvm::Value* accessPixelData( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel);
     private:
       static int s_evaluatePixelesId;
   };


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/