[opengtl-commits] [300] Visitor:: get return an expression result which give the correct associated type

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


Revision: 300
Author:   cyrille
Date:     2008-07-04 15:29:31 +0200 (Fri, 04 Jul 2008)

Log Message:
-----------
Visitor::get return an expression result which give the correct associated type

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/ExpressionResult_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.h
    trunk/OpenGTL/OpenShiva/tests/convolution/blur.shiva


Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp	2008-07-04 13:29:31 UTC (rev 300)
@@ -39,7 +39,8 @@
   llvm::Value* ptr_ = pointer( _gc, _bb );
   GTL_ASSERT(ptr_);
   const Visitor* visitor = Visitor::getVisitorFor( type() );
-  return GTLCore::ExpressionResult( visitor->get( _gc, _bb, ptr_ ), type() );
+  GTL_DEBUG("Type = " << *type() << " ptr = " << *ptr_);
+  return visitor->get( _gc, _bb, ptr_, type() );
 }
 
 llvm::BasicBlock* AccessorExpression::affect( GenerationContext& _gc, llvm::BasicBlock* _bb, const ExpressionResult& _value )

Modified: trunk/OpenGTL/OpenGTL/GTLCore/ExpressionResult_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/ExpressionResult_p.cpp	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenGTL/GTLCore/ExpressionResult_p.cpp	2008-07-04 13:29:31 UTC (rev 300)
@@ -52,6 +52,7 @@
 {
   GTL_ASSERT( _value );
   GTL_ASSERT( _type );
+  GTL_DEBUG( *_value->getType() << " " << *_type->d->type() << " " << *_type->d->asArgumentType() );
   GTL_ASSERT( _value->getType() == _type->d->type() or _value->getType() == _type->d->asArgumentType() );
   d->valueOrConstant.value = _value;
   d->isConstant = false;

Modified: trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp	2008-07-04 13:29:31 UTC (rev 300)
@@ -105,7 +105,7 @@
 
 llvm::Value* VariableNG::get(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock)
 {
-  llvm::Value* v = d->visitor->get( _generationContext, _currentBlock, d->pointer );
+  llvm::Value* v = d->visitor->get( _generationContext, _currentBlock, d->pointer, d->type ).value();
   return v;
 }
 

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp	2008-07-04 13:29:31 UTC (rev 300)
@@ -104,9 +104,9 @@
   GTL_ABORT("Primitive type doesn't allow access using indexes"); //TODO except vectors
 }
 
-llvm::Value* PrimitiveVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer) const
+ExpressionResult PrimitiveVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType) const
 {
-  return new llvm::LoadInst( _pointer, "", _currentBlock);
+  return ExpressionResult( new llvm::LoadInst( _pointer, "", _currentBlock), _pointerType);
 }
 
 llvm::BasicBlock* PrimitiveVisitor::set( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _value, const Type* _valueType, bool _allocatedInMemory ) const
@@ -150,10 +150,9 @@
   return _generationContext.codeGenerator()->accessArrayValue( _currentBlock, _pointer, _index);
 }
 
-llvm::Value* ArrayVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock,
-                                llvm::Value* _pointer ) const
+ExpressionResult ArrayVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType ) const
 {
-  return _pointer;
+  return ExpressionResult(_pointer, _pointerType);
 }
 
 llvm::BasicBlock* ArrayVisitor::set( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _value, const Type* _valueType, bool _allocatedInMemory) const
@@ -188,7 +187,7 @@
           _pointerType->embeddedType(),
           visitor->get( _generationContext, bodyBlock, 
                   _generationContext.codeGenerator()->accessArrayValue(
-                                    bodyBlock, _value, index->get( _generationContext, bodyBlock  ) ) ),
+                                    bodyBlock, _value, index->get( _generationContext, bodyBlock ) ), _pointerType->embeddedType() ).value(),
           _valueType->embeddedType(), _allocatedInMemory );
     
     // Create the for statement
@@ -310,9 +309,9 @@
               _index, "", _currentBlock);
 }
 
-llvm::Value* VectorVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer) const
+ExpressionResult VectorVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType) const
 {
-  return new llvm::LoadInst( _pointer, "", _currentBlock);
+  return ExpressionResult(new llvm::LoadInst( _pointer, "", _currentBlock), _pointerType );
 }
 
 llvm::BasicBlock* VectorVisitor::set(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _value, const Type* _valueType, bool _allocatedInMemory) const
@@ -368,9 +367,9 @@
   GTL_ABORT("Structure doesn't allow access using indexes");
 }
 
-llvm::Value* StructureVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer ) const
+ExpressionResult StructureVisitor::get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType ) const
 {
-  return _pointer;
+  return ExpressionResult(_pointer, _pointerType);
 }
 
 llvm::BasicBlock* StructureVisitor::set( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _value, const Type* _valueType, bool _allocatedInMemory ) const
@@ -382,7 +381,7 @@
     llvm::Value* nptrToOwnMember = pointerToValue(_generationContext, _currentBlock, _pointer, i);
     llvm::Value* nptrToValueMember = pointerToValue( _generationContext, _currentBlock, _value, i);
     const Visitor* visitor = Visitor::getVisitorFor( type );
-    llvm::Value* memberValue = visitor->get( _generationContext, _currentBlock, nptrToValueMember );
+    llvm::Value* memberValue = visitor->get( _generationContext, _currentBlock, nptrToValueMember, type ).value();
     visitor->set( _generationContext, _currentBlock, nptrToOwnMember, type, memberValue, type, _allocatedInMemory );
   }
   return _currentBlock;

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.h	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.h	2008-07-04 13:29:31 UTC (rev 300)
@@ -34,6 +34,7 @@
 }
 
 namespace GTLCore {
+  class ExpressionResult;
   class GenerationContext;
   class Type;
   /**
@@ -54,12 +55,12 @@
       /**
        * @return the type that will be returned by a call to \ref pointerToIndex
        */
-      virtual const GTLCore::Type* pointerToIndexType( const GTLCore::Type* _type ) const = 0;
+      virtual const Type* pointerToIndexType( const Type* _type ) const = 0;
       /**
        * Allow to access to the element of an object through an index, used for vectors,
        * arrays and some stucture (like pixels).
        */
-      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const = 0;
+      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _type, llvm::Value* _index) const = 0;
       /**
        * Allow to get the value
        * @param _errMsg a pointer to a pointer (usually initialised to 0), the pointer will be
@@ -70,7 +71,7 @@
        * @param _ma
        * @return the value
        */
-      virtual llvm::Value* get(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer) const = 0;
+      virtual ExpressionResult get(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const Type* _pointerType) const = 0;
       /**
        * Allow to set the value
        * @param _errMsg a pointer to a pointer (usually initialised to 0), the pointer will be
@@ -81,7 +82,7 @@
        * @param _value the new value
        * @param _ma
        */
-      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _value, const GTLCore::Type* _valueType, bool _allocatedInMemory) const = 0;
+      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _value, const Type* _valueType, bool _allocatedInMemory) const = 0;
       /**
        * initialise a the data which is pointed by this Visitor.
        * @param _errMsg a pointer to a pointer (usually initialised to 0), the pointer will be
@@ -91,13 +92,13 @@
        * @param _pointer a pointer toward the data
        * @param _size the size of the array, if applicable
        */
-      virtual llvm::BasicBlock* initialise(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const = 0;
-      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const = 0;
+      virtual llvm::BasicBlock* initialise(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const = 0;
+      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const = 0;
     public:
       /**
        * This function create the Visitor for the type given in argument
        */
-      static const Visitor* getVisitorFor(const GTLCore::Type* _type);
+      static const Visitor* getVisitorFor(const Type* _type);
   };
   /**
    * @internal
@@ -109,13 +110,13 @@
       PrimitiveVisitor();
       virtual ~PrimitiveVisitor();
     public:
-      virtual const GTLCore::Type* pointerToIndexType( const GTLCore::Type* _type ) const;
-      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const;
-      virtual llvm::Value* get( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock,
-                                llvm::Value* pointer) const;
-      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const GTLCore::Type* _pointerType, llvm::Value*, const GTLCore::Type* _valueType, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* initialise(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
+      virtual const Type* pointerToIndexType( const Type* _type ) const;
+      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _type, llvm::Value* _index) const;
+      virtual ExpressionResult get( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock,
+                                llvm::Value* pointer, const Type* _pointerType) const;
+      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const Type* _pointerType, llvm::Value*, const Type* _valueType, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* initialise(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
   };
   /**
    * @internal
@@ -127,12 +128,12 @@
       ArrayVisitor();
       virtual ~ArrayVisitor();
     public:
-      virtual const GTLCore::Type* pointerToIndexType( const GTLCore::Type* _type ) const;
-      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const;
-      virtual llvm::Value* get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer) const;
-      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value*, const GTLCore::Type* _valueType, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* initialise( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
+      virtual const Type* pointerToIndexType( const Type* _type ) const;
+      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _type, llvm::Value* _index) const;
+      virtual ExpressionResult get( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType) const;
+      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value*, const Type* _valueType, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* initialise( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
     private:
       /**
        * Allow to access the size of an array.
@@ -153,7 +154,7 @@
        * @param _pointer a pointer toward the data
        * @param _size the new size of the array
        */
-      void setSize(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _size, bool _allocatedInMemory, bool _allreadyInitialised ) const;
+      void setSize(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _size, bool _allocatedInMemory, bool _allreadyInitialised ) const;
   };
 
   class VectorVisitor : public Visitor {
@@ -161,12 +162,12 @@
       VectorVisitor( );
       virtual ~VectorVisitor();
     public:
-      virtual const GTLCore::Type* pointerToIndexType( const GTLCore::Type* _type ) const;
-      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const;
-      virtual llvm::Value* get( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer) const;
-      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const GTLCore::Type* _pointerType, llvm::Value*, const GTLCore::Type* _valueType, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* initialise( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
+      virtual const Type* pointerToIndexType( const Type* _type ) const;
+      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _type, llvm::Value* _index) const;
+      virtual ExpressionResult get( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const Type* _pointerType) const;
+      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const Type* _pointerType, llvm::Value*, const Type* _valueType, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* initialise( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
   };
 
   /**
@@ -178,12 +179,12 @@
       StructureVisitor( );
       virtual ~StructureVisitor();
     public:
-      virtual const GTLCore::Type* pointerToIndexType( const GTLCore::Type* _type ) const;
-      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const;
-      virtual llvm::Value* get( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer) const;
-      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const GTLCore::Type* _pointerType, llvm::Value*, const GTLCore::Type* _valueType, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* initialise( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
-      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
+      virtual const Type* pointerToIndexType( const Type* _type ) const;
+      virtual llvm::Value* pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _type, llvm::Value* _index) const;
+      virtual ExpressionResult get( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const Type* _pointerType) const;
+      virtual llvm::BasicBlock* set(GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const Type* _pointerType, llvm::Value*, const Type* _valueType, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* initialise( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
+      virtual llvm::BasicBlock* cleanUp( GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;
     private:
       llvm::Value* pointerToValue(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, int index ) const;
   };

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp	2008-07-04 13:29:31 UTC (rev 300)
@@ -22,6 +22,7 @@
 // LLVM
 #include <llvm/Instructions.h>
 
+#include "GTLCore/ExpressionResult_p.h"
 #include "GTLCore/Macros_p.h"
 #include "GTLCore/Type.h"
 
@@ -63,14 +64,14 @@
   return llvm::GetElementPtrInst::Create( ptr, _index, "", _currentBlock);
 }
 
-llvm::Value* PixelVisitor::get( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer) const
+GTLCore::ExpressionResult PixelVisitor::get( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType) const
 {
   llvm::Value* result = new llvm::LoadInst(
       CodeGenerator::accessPixelDataPtr( _generationContext, _currentBlock, _pointer ),
       "",
       _currentBlock );
   SHIVA_DEBUG( *_pointer << " " << *result );
-  return result;
+  return GTLCore::ExpressionResult( result, (*_pointerType->structDataMembers())[0].type());
 }
 
 llvm::BasicBlock* PixelVisitor::set( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _value, const GTLCore::Type* _valueType, bool _allocatedInMemory) const

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.h	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.h	2008-07-04 13:29:31 UTC (rev 300)
@@ -40,7 +40,7 @@
       virtual ~PixelVisitor();
       virtual const GTLCore::Type* pointerToIndexType( const GTLCore::Type* _type ) const;
       virtual llvm::Value* pointerToIndex( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const;
-      virtual llvm::Value* get(GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer) const;
+      virtual GTLCore::ExpressionResult get(GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* pointer, const GTLCore::Type* _pointerType) const;
       virtual llvm::BasicBlock* set(GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _value, const GTLCore::Type* _valueType, bool _allocatedInMemory) const;
       virtual llvm::BasicBlock* initialise(GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, const std::list< llvm::Value*>& _sizes, bool _allocatedInMemory) const;
       virtual llvm::BasicBlock* cleanUp( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _pointerType, llvm::Value* _donttouch, bool _allocatedInMemory ) const;

Modified: trunk/OpenGTL/OpenShiva/tests/convolution/blur.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/convolution/blur.shiva	2008-07-03 11:09:06 UTC (rev 299)
+++ trunk/OpenGTL/OpenShiva/tests/convolution/blur.shiva	2008-07-04 13:29:31 UTC (rev 300)
@@ -14,9 +14,11 @@
     pixel v1 = img.sampleNearest( point1 );
     pixel v2 = img.sampleNearest( point2 );
     pixel v3 = img.sampleNearest( point3 );
+    pixel v4 = v1 + v2 + v3;
     for(int i = 0; i < 3; ++i)
     {
-      result[i] = (v1[i] + v2[i] + v3[i]) / 3;
+      result[i] = v4 / 3;
+//       result[i] = (v1[i] + v2[i] + v3[i]) / 3;
     }
   }
 }


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