[opengtl-commits] [255] add a function to access value of a vector

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


Revision: 255
Author:   cyrille
Date:     2008-06-28 00:14:16 +0200 (Sat, 28 Jun 2008)

Log Message:
-----------
add a function to access value of a vector

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


Modified: trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp	2008-06-27 20:37:48 UTC (rev 254)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp	2008-06-27 22:14:16 UTC (rev 255)
@@ -197,6 +197,11 @@
   
 }
 
+llvm::Value* CodeGenerator::vectorValueAt( llvm::BasicBlock* _currentBlock, llvm::Value* _vector, llvm::Value* _index)
+{
+  return new llvm::ExtractElementInst( _vector, _index, "", _currentBlock );
+}
+
 void CodeGenerator::createIfStatement( llvm::BasicBlock* before, llvm::Value* test, const Type* testType, llvm::BasicBlock* firstAction, llvm::BasicBlock* lastAction, llvm::BasicBlock* after)
 {
   if( not lastAction->getTerminator() )

Modified: trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.h	2008-06-27 20:37:48 UTC (rev 254)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.h	2008-06-27 22:14:16 UTC (rev 255)
@@ -87,14 +87,13 @@
        * @return a pointer to the llvm function
        */
       llvm::Function* createFunction( llvm::FunctionType* type, const GTLCore::String& name);
-//       llvm::Value* convertValueTo(llvm::BasicBlock* currentBlock, llvm::Value* value, const llvm::Type* type);
-//       llvm::Constant* convertConstantTo(llvm::Constant* constant, const llvm::Type* type);
       static llvm::Value* convertPointerToCharP(llvm::BasicBlock* currentBlock, llvm::Value* value);
       static llvm::Value* convertPointerTo(llvm::BasicBlock* currentBlock, llvm::Value* value, const llvm::Type* type);
       static llvm::Value* convertValueTo(llvm::BasicBlock* currentBlock, llvm::Value* value, const Type* valueType, const Type* type);
       static llvm::Constant* convertConstantTo(llvm::Constant* constant, const Type* constantType, const Type* type);
       static llvm::Value* convertToHalf( GenerationContext& generationContext, llvm::BasicBlock* currentBlock, llvm::Value* value, const Type* _valueType);
       static llvm::Value* convertFromHalf( GenerationContext& generationContext, llvm::BasicBlock* currentBlock, llvm::Value* value);
+      static llvm::Value* vectorValueAt( llvm::BasicBlock* _currentBlock, llvm::Value* _vector, llvm::Value* _index);
     public: // Boolean Expression
       llvm::Value* createOrExpression(llvm::BasicBlock* currentBlock, llvm::Value* lhs, const Type* lhsType, llvm::Value* rhs, const Type* rhsType);
       ExpressionResult createOrExpression( llvm::BasicBlock* currentBlock, ExpressionResult lhs, const Type* lhsType, ExpressionResult rhs, const Type* rhsType);


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