[opengtl-commits] [218] split accessPixelDataPtr

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


Revision: 218
Author:   cyrille
Date:     2008-06-22 16:08:43 +0200 (Sun, 22 Jun 2008)

Log Message:
-----------
split accessPixelDataPtr

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-22 09:14:09 UTC (rev 217)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2008-06-22 14:08:43 UTC (rev 218)
@@ -77,13 +77,17 @@
   return func_llvm_memcpy_i32;
 }
 
-llvm::Value* CodeGenerator::accessPixelData( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel)
+llvm::Value* CodeGenerator::accessPixelDataPtr( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _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 );
+  return new llvm::GetElementPtrInst( _pixel, indexes.begin(), indexes.end(), "", _currentBlock );
+}
+
+llvm::Value* CodeGenerator::accessPixelDataAsU8Ptr( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel)
+{
+  llvm::Value* _pointerToPixelVector = accessPixelDataPtr( _gc, _currentBlock, _pixel) ;
   // Cast the vector to a "char*"
   return new llvm::BitCastInst(
       _pointerToPixelVector, llvm::PointerType::get(llvm::IntegerType::get(8), 0), "", _currentBlock);
@@ -109,7 +113,7 @@
 llvm::BasicBlock* CodeGenerator::memToPixel( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _dataPointer, llvm::Value* _pixel, int _size )
 {
   // Access to the data pointer for the _pixel
-  llvm::Value* _pointerToPixelVectorU8 = accessPixelData( _gc, _currentBlock, _pixel );
+  llvm::Value* _pointerToPixelVectorU8 = accessPixelDataAsU8Ptr( _gc, _currentBlock, _pixel );
   // Call llvm.memcpy.i32
   callMemcpy( _gc, _currentBlock, _pointerToPixelVectorU8, _dataPointer, GTLCore::CodeGenerator::integerToConstant( _size ) );
   
@@ -119,7 +123,7 @@
 llvm::BasicBlock* CodeGenerator::pixelToMem( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel, llvm::Value* _dataPointer, int _size )
 {
   // Access to the data pointer for the _pixel
-  llvm::Value* _pointerToPixelVectorU8 = accessPixelData( _gc, _currentBlock, _pixel );
+  llvm::Value* _pointerToPixelVectorU8 = accessPixelDataAsU8Ptr( _gc, _currentBlock, _pixel );
   // Call llvm.memcpy.i32
   callMemcpy( _gc, _currentBlock, _dataPointer, _pointerToPixelVectorU8,  GTLCore::CodeGenerator::integerToConstant( _size ) );
 

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h	2008-06-22 09:14:09 UTC (rev 217)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.h	2008-06-22 14:08:43 UTC (rev 218)
@@ -48,9 +48,10 @@
       static llvm::BasicBlock* memToPixel( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _dataPointer, llvm::Value* _pixel, int _size );
       static llvm::BasicBlock* pixelToMem( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel, llvm::Value* _dataPointer, int _size );
       static llvm::Function* generateEvaluatePixeles( const std::vector<const GTLCore::Type*>& _inputTypes, const GTLCore::Type* _outputType, Kernel* _kernel, GTLCore::ModuleData* _moduleData, const GTLCore::PixelDescription& _pixelDescription );
+      static llvm::Value* accessPixelDataPtr( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel);
     private:
       static llvm::Function* createMemCpyFunction( llvm::Module* _module );
-      static llvm::Value* accessPixelData( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel);
+      static llvm::Value* accessPixelDataAsU8Ptr( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel);
       static llvm::Value* callMemcpy( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _dst, llvm::Value* _src, llvm::Value* _n );
     private:
       static int s_evaluatePixelesId;


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