[opengtl-commits] [276] update to use llvm2.3

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


Revision: 276
Author:   cyrille
Date:     2008-06-30 22:54:23 +0200 (Mon, 30 Jun 2008)

Log Message:
-----------
update to use llvm2.3
0.9.3 -> 0.9.4

Modified Paths:
--------------
    trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp
    trunk/OpenGTL/OpenCTL/OpenCTL/Version.h
    trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
    trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Version.h
    trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp
    trunk/OpenGTL/OpenGTL/GTLTest/Version.h
    trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Version.h


Modified: trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/Program.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -175,7 +175,7 @@
       // Initialise a generation context
       GTLCore::GenerationContext gc( &cg, func, 0, d->moduleData );
       // {
-      llvm::BasicBlock* initialBlock = new llvm::BasicBlock;
+      llvm::BasicBlock* initialBlock = llvm::BasicBlock::Create();
       func->getBasicBlockList().push_back( initialBlock );
       // Initialise the buffer, as needed
       GTLCore::VariableNG** buffer = new GTLCore::VariableNG*[dstCountChannels];
@@ -213,16 +213,16 @@
       GTLCore::VariableNG* posDst = new GTLCore::VariableNG( GTLCore::Type::Integer32, false);
       posDst->initialise( gc, initialBlock, GTLCore::ExpressionResult(cg.integerToConstant(0), GTLCore::Type::Integer32), std::list<llvm::Value*>());
       // i < size
-      llvm::BasicBlock* forTestBlock = new llvm::BasicBlock("forTestBlock");
+      llvm::BasicBlock* forTestBlock = llvm::BasicBlock::Create("forTestBlock");
       func->getBasicBlockList().push_back( forTestBlock);
       llvm::Value* forTest = cg.createStrictInferiorExpression(forTestBlock, posSrc->get( gc, forTestBlock ), posSrc->type(), size, GTLCore::Type::Integer32 );
       // i += pixelSize
-      llvm::BasicBlock* updateBlock = new llvm::BasicBlock("updateBlock");
+      llvm::BasicBlock* updateBlock = llvm::BasicBlock::Create("updateBlock");
       func->getBasicBlockList().push_back( updateBlock);
       posSrc->set( gc, updateBlock, cg.createAdditionExpression( updateBlock, posSrc->get( gc, updateBlock), posSrc->type(), srcPixelSizeValue, GTLCore::Type::Integer32 ), GTLCore::Type::Integer32 );
       posDst->set( gc, updateBlock, cg.createAdditionExpression( updateBlock, posDst->get( gc, updateBlock), posSrc->type(), dstPixelSizeValue, GTLCore::Type::Integer32 ), GTLCore::Type::Integer32 );
       // Construct the body of the for loop
-      llvm::BasicBlock* bodyBlock = new llvm::BasicBlock("bodyBlock");
+      llvm::BasicBlock* bodyBlock = llvm::BasicBlock::Create("bodyBlock");
       
       // function(in[i], in[i+indexes[1]] ..., out + i, out + i +indexes[1], ...);
       func->getBasicBlockList().push_back( bodyBlock);
@@ -235,7 +235,7 @@
         // Load the value from the input buffer
         llvm::Value* convertedIn = new llvm::LoadInst(
                         cg.convertPointerTo( bodyBlock,
-                                           new llvm::GetElementPtrInst( in, cg.createAdditionExpression( bodyBlock, srcIndex, posSrc->type(), srcIndexes[i], GTLCore::Type::Integer32), "", bodyBlock),
+                                           llvm::GetElementPtrInst::Create( in, cg.createAdditionExpression( bodyBlock, srcIndex, posSrc->type(), srcIndexes[i], GTLCore::Type::Integer32), "", bodyBlock),
                                            srcChannelsTypes[i]->d->type()),
                         "", bodyBlock);
         if( srcNeedBuffer[i])
@@ -254,7 +254,7 @@
       llvm::Value* dstIndex = posDst->get( gc, bodyBlock);
       for(int i = 0; i < dstCountChannels; ++i)
       {
-        llvm::Value* pointer = cg.convertPointerTo( bodyBlock, new llvm::GetElementPtrInst( out, cg.createAdditionExpression( bodyBlock, dstIndex, GTLCore::Type::Integer32, dstIndexes[i], GTLCore::Type::Integer32), "", bodyBlock), dstPixelDescription.channelTypes()[i]->d->type());
+        llvm::Value* pointer = cg.convertPointerTo( bodyBlock, llvm::GetElementPtrInst::Create( out, cg.createAdditionExpression( bodyBlock, dstIndex, GTLCore::Type::Integer32, dstIndexes[i], GTLCore::Type::Integer32), "", bodyBlock), dstPixelDescription.channelTypes()[i]->d->type());
         if( dstNeedBuffer[i])
         {
           OCTL_ASSERT(buffer[i]);
@@ -291,7 +291,7 @@
       }
       OCTL_DEBUG( *function->getFunctionType());
 #endif
-      llvm::CallInst *CallFunc = new llvm::CallInst(function, arguments.begin(), arguments.end(), "", bodyBlock);
+      llvm::CallInst *CallFunc = llvm::CallInst::Create(function, arguments.begin(), arguments.end(), "", bodyBlock);
       CallFunc->setTailCall();
       // If there was buffering, save to output
       for(int i = 0; i < dstCountChannels; ++i)
@@ -299,7 +299,7 @@
         if( dstNeedBuffer[i])
         {
           const llvm::Type* channelType = dstChannelsTypes[i]->d->type();
-          llvm::Value* pointer = cg.convertPointerTo( bodyBlock, new llvm::GetElementPtrInst( out, cg.createAdditionExpression( bodyBlock, dstIndex, GTLCore::Type::Integer32, dstIndexes[i], GTLCore::Type::Integer32), "", bodyBlock), channelType);
+          llvm::Value* pointer = cg.convertPointerTo( bodyBlock, llvm::GetElementPtrInst::Create( out, cg.createAdditionExpression( bodyBlock, dstIndex, GTLCore::Type::Integer32, dstIndexes[i], GTLCore::Type::Integer32), "", bodyBlock), channelType);
           llvm::Value* result = 0;
           if( dstChannelsTypes[i] == GTLCore::Type::Half )
           {
@@ -313,11 +313,11 @@
       }
     // Put the for loop together
       // for(int i = 0; i < size; ++i)
-      llvm::BasicBlock* finBlock = new llvm::BasicBlock("finBlock");
+      llvm::BasicBlock* finBlock = llvm::BasicBlock::Create("finBlock");
       func->getBasicBlockList().push_back( finBlock);
       cg.createForStatement(initialBlock, forTestBlock, forTest, GTLCore::Type::Boolean, updateBlock, bodyBlock, bodyBlock, finBlock);
       // return;
-      new llvm::ReturnInst(finBlock);
+      llvm::ReturnInst::Create(finBlock);
       OCTL_DEBUG(*d->module);
       //
       llvm::PassManager Passes;

Modified: trunk/OpenGTL/OpenCTL/OpenCTL/Version.h
===================================================================
--- trunk/OpenGTL/OpenCTL/OpenCTL/Version.h	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenCTL/OpenCTL/Version.h	2008-06-30 20:54:23 UTC (rev 276)
@@ -25,10 +25,10 @@
   const char* LibraryName = "Open Color Transformation Language";
   const char* LibraryCopyright = "Copyright (c) 2007-2008 Cyrille Berger (cberger@xxxxxxxxxxx)";
   const char* LibraryLicence = "GNU Lesser General Public License Version 2";
-  const char* LibraryVersionString = "0.9.3";
+  const char* LibraryVersionString = "0.9.4";
   int LibraryVersionMajor = 0;
   int LibraryVersionMinor = 9;
-  int LibraryVersionRevision = 3;
+  int LibraryVersionRevision = 4;
   /**
    * Give the latest version of the CTL language supported by this library.
    */

Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -72,7 +72,7 @@
   std::vector<llvm::Value*> indexes;
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); // Access the structure of the array
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); // Access the size of the array
-  return new llvm::GetElementPtrInst( m_parent->pointer( _gc, _bb),
+  return llvm::GetElementPtrInst::Create( m_parent->pointer( _gc, _bb),
                                       indexes.begin(), indexes.end(), "", _bb);
 }
 
@@ -92,7 +92,7 @@
   std::vector<llvm::Value*> indexes;
   indexes.push_back( _gc.codeGenerator()->integerToConstant(0));
   indexes.push_back( _gc.codeGenerator()->integerToConstant(m_index));
-  return new llvm::GetElementPtrInst( m_parent->pointer( _gc, _bb) , indexes.begin(), indexes.end(), "", _bb);
+  return llvm::GetElementPtrInst::Create( m_parent->pointer( _gc, _bb) , indexes.begin(), indexes.end(), "", _bb);
 }
 
 bool StructAccessorExpression::isConstant() const

Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -126,7 +126,7 @@
         GTLCore::Function::Data::symbolName(m_function->name() , gtlParams ) );
     GenerationContext generationContext( _codeGenerator, function, m_function, _module);
     // Create a block for the call to the function with one more parameter
-    llvm::BasicBlock* BB = new llvm::BasicBlock("CallForwarder");
+    llvm::BasicBlock* BB = llvm::BasicBlock::Create("CallForwarder");
     function->getBasicBlockList().push_back( BB );
     llvm::Value* defaultValue = m_parameters[i - 1]->initialiser()->generateValue( generationContext , BB).value();
     if( m_parameters[i - 1]->parameter().type()->dataType() != Type::STRUCTURE
@@ -143,9 +143,9 @@
     }
     arguments.push_back( defaultValue);
     // Make the call
-    llvm::CallInst *callPrevious = new llvm::CallInst(previousFunction, arguments.begin(), arguments.end(), "", BB);
+    llvm::CallInst *callPrevious = llvm::CallInst::Create(previousFunction, arguments.begin(), arguments.end(), "", BB);
     callPrevious->setTailCall(true);
-    new llvm::ReturnInst( callPrevious , BB);
+    llvm::ReturnInst::Create( callPrevious , BB);
     previousFunction = function;
     functions[ params.size() ] = function;
   }
@@ -153,7 +153,7 @@
   // Set the list of functions
   m_functionData->setFunctions( functions );
   // Generate the code of the function
-  llvm::BasicBlock* firstBlock = new llvm::BasicBlock;
+  llvm::BasicBlock* firstBlock = llvm::BasicBlock::Create();
   fullFunction->getBasicBlockList().push_back( firstBlock );
   // Initialise the context
   GenerationContext generationContext( _codeGenerator, fullFunction, m_function, _module);
@@ -184,10 +184,10 @@
     GTL_DEBUG("No return instruction for function : " << m_function->name() << " creating one");
     if( m_function->returnType() == GTLCore::Type::Void )
     {
-      new llvm::ReturnInst(lastBlock);
+      llvm::ReturnInst::Create(lastBlock);
     } else
     {
-      new llvm::ReturnInst( _codeGenerator->convertConstantTo( _codeGenerator->integerToConstant( 0), GTLCore::Type::Integer32, m_function->returnType() ), lastBlock  );
+      llvm::ReturnInst::Create( _codeGenerator->convertConstantTo( _codeGenerator->integerToConstant( 0), GTLCore::Type::Integer32, m_function->returnType() ), lastBlock  );
     }
   }
 }

Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -46,7 +46,7 @@
 llvm::BasicBlock* Statement::createBlock( GenerationContext& context) const
 {
   GTL_ASSERT( context.llvmFunction() );
-  llvm::BasicBlock* bb = new llvm::BasicBlock;
+  llvm::BasicBlock* bb = llvm::BasicBlock::Create();
   context.llvmFunction()->getBasicBlockList().push_back( bb );
   return bb;
 }
@@ -230,14 +230,14 @@
     {
       result = _context.codeGenerator()->convertValueTo(_bb, result, m_returnExpr->type(), _context.function()->returnType() );
     }
-    new llvm::ReturnInst( result, _bb);
+    llvm::ReturnInst::Create( result, _bb);
   } else {
     for( std::list<VariableNG*>::const_iterator it = m_variablesToClean.begin();
          it != m_variablesToClean.end(); ++it)
     {
       _bb = (*it)->cleanUp(_context, _bb, 0);
     }
-    new llvm::ReturnInst( _bb );
+    llvm::ReturnInst::Create( _bb );
   }
   return _bb;
 }
@@ -284,6 +284,6 @@
       GTL_DEBUG("Unknown type for print " << *type);
     }
   }
-  new llvm::CallInst(func, values.begin(), values.end(), "", _bb);
+  llvm::CallInst::Create(func, values.begin(), values.end(), "", _bb);
   return _bb;
 }

Modified: trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt	2008-06-30 20:54:23 UTC (rev 276)
@@ -1,8 +1,10 @@
 add_subdirectory(tests)
 
 # Find llvm jit, interpreter and native
-FIND_LLVM_LIBS( ${LLVM_CONFIG_EXECUTABLE} "native bitwriter linker bitreader jit interpreter" LLVM_LIBS LLVM_NATIVE_OBJECTS )
+FIND_LLVM_LIBS( ${LLVM_CONFIG_EXECUTABLE} "native bitwriter linker bitreader jit interpreter support" LLVM_LIBS LLVM_NATIVE_OBJECTS )
 
+include_directories( ${LLVM_INCLUDE_DIR} )
+
 ## GTLCore library ##
 
 set(GTLCore_SRCS
@@ -62,7 +64,8 @@
 set_target_properties(GTLCore PROPERTIES VERSION ${OPENGTL_LIB_VERSION} SOVERSION ${OPENGTL_LIB_SOVERSION} )
 
 # Set some LLVM required properties
-add_definitions( "${LLVM_COMPILE_FLAGS}")
+# add_definitions( "${LLVM_COMPILE_FLAGS}")
+add_definitions( "-D__STDC_LIMIT_MACROS" )
 add_definitions( -DCOUMPONENT_NAME=\"\\\"GTLCore\\\"\" )
 
 

Modified: trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -112,7 +112,7 @@
 
 llvm::Constant* CodeGenerator::floatToConstant(float v)
 {
-  return llvm::ConstantFP::get(llvm::Type::FloatTy, llvm::APFloat(v));
+  return llvm::ConstantFP::get(llvm::APFloat(v));
 }
 
 
@@ -183,7 +183,7 @@
       llvm::FunctionType::get( llvm::Type::Int16Ty , llvmArguments, false ) ) );
   std::vector<llvm::Value*> convertedParams;
   convertedParams.push_back( convertValueTo( currentBlock, value, _valueType, GTLCore::Type::Float ) );
-  return new llvm::CallInst( func, convertedParams.begin(), convertedParams.end(), "", currentBlock );
+  return llvm::CallInst::Create( func, convertedParams.begin(), convertedParams.end(), "", currentBlock );
 }
 
 llvm::Value* CodeGenerator::convertFromHalf( GenerationContext& _generationContext, llvm::BasicBlock* currentBlock, llvm::Value* value)
@@ -194,7 +194,7 @@
       llvm::FunctionType::get( llvm::Type::FloatTy , llvmArguments, false ) ) );
   std::vector<llvm::Value*> convertedParams;
   convertedParams.push_back( convertValueTo( currentBlock, value, GTLCore::Type::Half, GTLCore::Type::Integer16 ) );
-  return new llvm::CallInst( func, convertedParams.begin(), convertedParams.end(), "", currentBlock );
+  return llvm::CallInst::Create( func, convertedParams.begin(), convertedParams.end(), "", currentBlock );
   
 }
 
@@ -216,45 +216,45 @@
 {
   if( not lastAction->getTerminator() )
   {
-    new llvm::BranchInst( after, lastAction );
+    llvm::BranchInst::Create( after, lastAction );
   }
-  new llvm::BranchInst( firstAction, after, convertValueTo( before, test, testType, GTLCore::Type::Boolean ), before);
+  llvm::BranchInst::Create( firstAction, after, convertValueTo( before, test, testType, GTLCore::Type::Boolean ), before);
 }
 
 void CodeGenerator::createIfElseStatement( llvm::BasicBlock* before, llvm::Value* test, const Type* testType, llvm::BasicBlock* firstAction, llvm::BasicBlock* lastAction, llvm::BasicBlock* firstElseAction, llvm::BasicBlock* lastElseAction, llvm::BasicBlock* after)
 {
   if( not lastAction->getTerminator() )
   {
-      new llvm::BranchInst( after, lastAction );
+      llvm::BranchInst::Create( after, lastAction );
   }
-  new llvm::BranchInst( firstAction, firstElseAction, convertValueTo( before, test, testType, GTLCore::Type::Boolean ), before);
+  llvm::BranchInst::Create( firstAction, firstElseAction, convertValueTo( before, test, testType, GTLCore::Type::Boolean ), before);
   if( not lastElseAction->getTerminator() )
   {
-      new llvm::BranchInst( after, lastElseAction );
+      llvm::BranchInst::Create( after, lastElseAction );
   }
 }
 
 void CodeGenerator::createForStatement(llvm::BasicBlock* before, llvm::BasicBlock* test, llvm::Value* testResult, const Type* testType, llvm::BasicBlock* update, llvm::BasicBlock* firstAction, llvm::BasicBlock* lastAction, llvm::BasicBlock* after)
 {
-  new llvm::BranchInst( test, before );
-  new llvm::BranchInst( firstAction, after, convertValueTo( before, testResult, testType, GTLCore::Type::Boolean ), test );
-  new llvm::BranchInst( update, lastAction);
-  new llvm::BranchInst( test, update);
+  llvm::BranchInst::Create( test, before );
+  llvm::BranchInst::Create( firstAction, after, convertValueTo( before, testResult, testType, GTLCore::Type::Boolean ), test );
+  llvm::BranchInst::Create( update, lastAction);
+  llvm::BranchInst::Create( test, update);
 }
 
 llvm::BasicBlock* CodeGenerator::createIterationForStatement( GenerationContext& generationContext, llvm::BasicBlock* before, GTLCore::VariableNG* variable, llvm::Value* maxValue, const Type* maxValueType, llvm::BasicBlock* firstAction, llvm::BasicBlock* lastAction)
 {
   // i < size
-  llvm::BasicBlock* forTestBlock = new llvm::BasicBlock("forTestBlock");
+  llvm::BasicBlock* forTestBlock = llvm::BasicBlock::Create("forTestBlock");
   generationContext.llvmFunction()->getBasicBlockList().push_back( forTestBlock);
   llvm::Value* forTest = createStrictInferiorExpression(forTestBlock, variable->get( generationContext, forTestBlock ), variable->type(), maxValue, maxValueType);
   GTL_ASSERT(forTest);
   // i += pixelSize
-  llvm::BasicBlock* updateBlock = new llvm::BasicBlock("updateBlock");
+  llvm::BasicBlock* updateBlock = llvm::BasicBlock::Create("updateBlock");
   generationContext.llvmFunction()->getBasicBlockList().push_back( updateBlock);
   createIncrementExpression( generationContext, updateBlock, variable );
   // Exit block
-  llvm::BasicBlock* finBlock = new llvm::BasicBlock("finBlock");
+  llvm::BasicBlock* finBlock = llvm::BasicBlock::Create("finBlock");
   generationContext.llvmFunction()->getBasicBlockList().push_back( finBlock);
   // Create for statement
   createForStatement(before, forTestBlock, forTest, Type::Boolean, updateBlock, firstAction, lastAction, finBlock);
@@ -263,16 +263,16 @@
 
 void CodeGenerator::createWhileStatement( llvm::BasicBlock* before, llvm::BasicBlock* test, llvm::Value* testResult, const Type* testType, llvm::BasicBlock* firstAction, llvm::BasicBlock* lastAction,  llvm::BasicBlock* after)
 {
-  new llvm::BranchInst( test, before);
-  new llvm::BranchInst( firstAction, after, convertValueTo( test, testResult, testType, GTLCore::Type::Boolean ), test);
-  new llvm::BranchInst( test, lastAction );
+  llvm::BranchInst::Create( test, before);
+  llvm::BranchInst::Create( firstAction, after, convertValueTo( test, testResult, testType, GTLCore::Type::Boolean ), test);
+  llvm::BranchInst::Create( test, lastAction );
 
 }
 
 
 llvm::Function* CodeGenerator::createFunction( llvm::FunctionType* type, const GTLCore::String& name)
 {
-  return  new llvm::Function( type, llvm::GlobalValue::InternalLinkage,
+  return llvm::Function::Create( type, llvm::GlobalValue::InternalLinkage,
                   name, d->module->llvmModule() );
 }
 
@@ -581,10 +581,10 @@
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 1)); // Access the size of the array
   
   // Select the pointer
-  llvm::Value* iptr = new llvm::GetElementPtrInst( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
+  llvm::Value* iptr = llvm::GetElementPtrInst::Create( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
   // pointer on the values
   llvm::Value* iptr_val = new llvm::LoadInst( iptr, "", _currentBlock);
-  return new llvm::GetElementPtrInst( iptr_val, _index, "", _currentBlock);
+  return llvm::GetElementPtrInst::Create( iptr_val, _index, "", _currentBlock);
 }
 
 GTLCore::ExpressionResult CodeGenerator::callFunction( GenerationContext& _gc, llvm::BasicBlock* bb, const GTLCore::Function* _function, const std::list<AST::Expression*>& _arguments )
@@ -654,7 +654,7 @@
   }
 #endif
   
-  llvm::CallInst *CallFunc = new llvm::CallInst(llvmFunction, convertedParams.begin(), convertedParams.end(), "", bb);
+  llvm::CallInst *CallFunc = llvm::CallInst::Create(llvmFunction, convertedParams.begin(), convertedParams.end(), "", bb);
   CallFunc->setTailCall();
   return GTLCore::ExpressionResult( CallFunc, _function->returnType(), true );
 }

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Version.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Version.h	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Version.h	2008-06-30 20:54:23 UTC (rev 276)
@@ -25,10 +25,10 @@
   const char* LibraryName = "Open Graphics Transformation Languages Core";
   const char* LibraryCopyright = "Copyright (c) 2007-2008 Cyrille Berger (cberger@xxxxxxxxxxx)";
   const char* LibraryLicence = "GNU Lesser General Public License Version 2";
-  const char* LibraryVersionString = "0.9.3";
+  const char* LibraryVersionString = "0.9.4";
   int LibraryVersionMajor = 0;
   int LibraryVersionMinor = 9;
-  int LibraryVersionRevision = 3;
+  int LibraryVersionRevision = 4;
 }
 
 #endif

Modified: trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Visitor_p.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -161,11 +161,11 @@
     // Check if size are identical or update the size of this array
     {
       llvm::Value* test= _generationContext.codeGenerator()->createDifferentExpression( _currentBlock, getSize( _generationContext, _currentBlock, _pointer ), Type::Integer32, getSize( _generationContext, _currentBlock, _value ), Type::Integer32);
-      llvm::BasicBlock* ifContent = new llvm::BasicBlock;
+      llvm::BasicBlock* ifContent = llvm::BasicBlock::Create();
       _generationContext.llvmFunction()->getBasicBlockList().push_back( ifContent );
       setSize( _generationContext, ifContent, _pointer, _pointerType, getSize( _generationContext, ifContent, _value ), _allocatedInMemory, true );
     
-      llvm::BasicBlock* afterIf = new llvm::BasicBlock;
+      llvm::BasicBlock* afterIf = llvm::BasicBlock::Create();
       _generationContext.llvmFunction()->getBasicBlockList().push_back( afterIf);
       _generationContext.codeGenerator()->createIfStatement( _currentBlock, test, Type::Boolean, ifContent, ifContent, afterIf );
       _currentBlock = afterIf;
@@ -176,7 +176,7 @@
     index->initialise( _generationContext, _currentBlock, ExpressionResult( _generationContext.codeGenerator()->integerToConstant(0), Type::Integer32), std::list<llvm::Value*>());
     
     // Construct the body of the for loop
-    llvm::BasicBlock* bodyBlock = new llvm::BasicBlock("bodyBlock");
+    llvm::BasicBlock* bodyBlock = llvm::BasicBlock::Create("bodyBlock");
     _generationContext.llvmFunction()->getBasicBlockList().push_back( bodyBlock);
     GTL_DEBUG( " value = " << *_pointer << " type = " << *_pointer->getType() << " " << *_pointerType->embeddedType() << " " << *_pointerType );
     GTL_DEBUG( " value = " << *_value << " type = " << *_value->getType() );
@@ -210,13 +210,13 @@
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); // Access the structure of the array
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); // Access the size of the array
   { // Init the size
-    llvm::Value* ptr = new llvm::GetElementPtrInst( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
+    llvm::Value* ptr = llvm::GetElementPtrInst::Create( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
     new llvm::StoreInst(_generationContext.codeGenerator()->convertValueTo( _currentBlock, _size, Type::Integer32, Type::Integer32 ), ptr, "", _currentBlock);
   }
   // Allocate the Array
   indexes[1] = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
   {
-    llvm::Value* ptr = new llvm::GetElementPtrInst( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
+    llvm::Value* ptr = llvm::GetElementPtrInst::Create( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
     llvm::Value* array = 0;
     if( _allocatedInMemory )
     {
@@ -239,7 +239,7 @@
   std::vector<llvm::Value*> indexes;
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); // Access the structure of the array
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0)); // Access the size of the array
-  llvm::Value* ptr = new llvm::GetElementPtrInst( _pointer, indexes.begin(), indexes.end(), "", currentBlock);
+  llvm::Value* ptr = llvm::GetElementPtrInst::Create( _pointer, indexes.begin(), indexes.end(), "", currentBlock);
   return new llvm::LoadInst( ptr, "", currentBlock);
 }
 
@@ -258,7 +258,7 @@
     index->initialise( _generationContext, _currentBlock, ExpressionResult(_generationContext.codeGenerator()->integerToConstant(0), Type::Integer32), std::list<llvm::Value*>());
     
     // Construct the body of the for loop
-    llvm::BasicBlock* bodyBlock = new llvm::BasicBlock("bodyBlock");
+    llvm::BasicBlock* bodyBlock = llvm::BasicBlock::Create("bodyBlock");
     _generationContext.llvmFunction()->getBasicBlockList().push_back( bodyBlock);
     
     const Visitor* visitor = Visitor::getVisitorFor( _pointerType->embeddedType() );
@@ -305,7 +305,7 @@
 {
   GTL_ASSERT( _pointerType->dataType() == Type::VECTOR );
   
-  return new llvm::GetElementPtrInst( 
+  return llvm::GetElementPtrInst::Create( 
               CodeGenerator::convertPointerTo( _currentBlock, _pointer, _pointerType->embeddedType()->d->type() ),
               _index, "", _currentBlock);
 }
@@ -359,7 +359,7 @@
   std::vector<llvm::Value*> indexes;
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, 0));
   indexes.push_back( llvm::ConstantInt::get(llvm::Type::Int32Ty, _index));
-  return new llvm::GetElementPtrInst( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
+  return llvm::GetElementPtrInst::Create( _pointer, indexes.begin(), indexes.end(), "", _currentBlock);
 }
 
 llvm::Value* StructureVisitor::pointerToIndex(GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const Type* _type, llvm::Value* _index) const

Modified: trunk/OpenGTL/OpenGTL/GTLTest/Version.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLTest/Version.h	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenGTL/GTLTest/Version.h	2008-06-30 20:54:23 UTC (rev 276)
@@ -25,10 +25,10 @@
   const char* LibraryName = "Open Graphics Transformation Languages Test";
   const char* LibraryCopyright = "Copyright (c) 2007-2008 Cyrille Berger (cberger@xxxxxxxxxxx)";
   const char* LibraryLicence = "GNU Lesser General Public License Version 2";
-  const char* LibraryVersionString = "0.9.3";
+  const char* LibraryVersionString = "0.9.4";
   int LibraryVersionMajor = 0;
   int LibraryVersionMinor = 9;
-  int LibraryVersionRevision = 3;
+  int LibraryVersionRevision = 4;
   }
 }
 

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CodeGenerator_p.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -68,7 +68,7 @@
       "llvm.memcpy.i32", memcpyTy); // (external, no body)
   func_llvm_memcpy_i32->setCallingConv(llvm::CallingConv::C);
   
-  const llvm::ParamAttrsList *func_llvm_memcpy_i32_PAL = 0;
+/*  const llvm::ParamAttrsList *func_llvm_memcpy_i32_PAL = 0;
   {
     llvm::ParamAttrsVector Attrs;
     llvm::ParamAttrsWithIndex PAWI;
@@ -76,7 +76,7 @@
     Attrs.push_back(PAWI);
     func_llvm_memcpy_i32_PAL = llvm::ParamAttrsList::get(Attrs);
   }
-  func_llvm_memcpy_i32->setParamAttrs(func_llvm_memcpy_i32_PAL);
+  func_llvm_memcpy_i32->setParamAttrs(func_llvm_memcpy_i32_PAL);*/
   return func_llvm_memcpy_i32;
 }
 
@@ -85,7 +85,7 @@
   std::vector<llvm::Value*> indexes;
   indexes.push_back( _gc.codeGenerator()->integerToConstant(0));
   indexes.push_back( _gc.codeGenerator()->integerToConstant(PixelWrap::INDEX_DATA));
-  return new llvm::GetElementPtrInst( _pixel, indexes.begin(), indexes.end(), "", _currentBlock );
+  return llvm::GetElementPtrInst::Create( _pixel, indexes.begin(), indexes.end(), "", _currentBlock );
 }
 
 llvm::Value* CodeGenerator::accessPixelDataAsU8Ptr( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, llvm::Value* _pixel)
@@ -115,7 +115,7 @@
   memcpy_params.push_back( _src );
   memcpy_params.push_back( _n );
   memcpy_params.push_back( GTLCore::CodeGenerator::integerToConstant( 1 ) );
-  llvm::CallInst* callMemCpy = new llvm::CallInst(
+  llvm::CallInst* callMemCpy = llvm::CallInst::Create(
                   func_llvm_memcpy_i32, memcpy_params.begin(), memcpy_params.end(), "", _currentBlock);
   callMemCpy->setCallingConv(llvm::CallingConv::C);
   callMemCpy->setTailCall( false );
@@ -155,13 +155,13 @@
   indexes.push_back( _gc.codeGenerator()->integerToConstant(PixelWrap::INDEX_X));
   new llvm::StoreInst(
         _gc.codeGenerator()->convertValueTo( _currentBlock, _iVal, GTLCore::Type::Integer32, GTLCore::Type::Float ),
-        new llvm::GetElementPtrInst( _pixel, indexes.begin(), indexes.end(), "", _currentBlock ),
+        llvm::GetElementPtrInst::Create( _pixel, indexes.begin(), indexes.end(), "", _currentBlock ),
         "",
         _currentBlock );
   indexes[1] = _gc.codeGenerator()->integerToConstant(PixelWrap::INDEX_Y);
   new llvm::StoreInst(
         _gc.codeGenerator()->convertValueTo( _currentBlock, _jVal, GTLCore::Type::Integer32, GTLCore::Type::Float ),
-        new llvm::GetElementPtrInst( _pixel, indexes.begin(), indexes.end(), "", _currentBlock ),
+        llvm::GetElementPtrInst::Create( _pixel, indexes.begin(), indexes.end(), "", _currentBlock ),
         "",
         _currentBlock );
 }
@@ -212,7 +212,7 @@
   GTLCore::GenerationContext generationContext( &codeGenerator, func, 0, _moduleData );
   
   // {
-    llvm::BasicBlock* initialBlock = new llvm::BasicBlock;
+    llvm::BasicBlock* initialBlock = llvm::BasicBlock::Create();
     func->getBasicBlockList().push_back( initialBlock );
   // Get the args.
     llvm::Function::arg_iterator arg_it = func->arg_begin();
@@ -247,7 +247,7 @@
     {
       evaluatePixel_params.push_back(
           new llvm::LoadInst(
-              new llvm::GetElementPtrInst( arg_sources, GTLCore::CodeGenerator::integerToConstant( i ), "", initialBlock ),
+              llvm::GetElementPtrInst::Create( arg_sources, GTLCore::CodeGenerator::integerToConstant( i ), "", initialBlock ),
               "", initialBlock ) );
     }
     evaluatePixel_params.push_back( resultVar->pointer() );
@@ -260,7 +260,7 @@
                       std::list<llvm::Value*>());
     
     // {
-      llvm::BasicBlock* firstBlockJLoop = new llvm::BasicBlock;
+      llvm::BasicBlock* firstBlockJLoop = llvm::BasicBlock::Create();
       func->getBasicBlockList().push_back( firstBlockJLoop );
       
       // int i = 0;
@@ -270,7 +270,7 @@
                         std::list<llvm::Value*>());
       
       // {
-        llvm::BasicBlock* firstBlockILoop = new llvm::BasicBlock;
+        llvm::BasicBlock* firstBlockILoop = llvm::BasicBlock::Create();
         func->getBasicBlockList().push_back( firstBlockILoop );
         llvm::Value* jVal = incJ->get( generationContext, firstBlockILoop );
         llvm::Value* iVal = incI->get( generationContext, firstBlockILoop );
@@ -282,7 +282,7 @@
         llvm::Function* llvmEPFunction = ePFunction->d->data->function( countArguments );
         SHIVA_ASSERT( llvmEPFunction );
         SHIVA_DEBUG( evaluatePixel_params.size() );
-        new llvm::CallInst( llvmEPFunction, evaluatePixel_params.begin(), evaluatePixel_params.end(), "", firstBlockILoop );
+        llvm::CallInst::Create( llvmEPFunction, evaluatePixel_params.begin(), evaluatePixel_params.end(), "", firstBlockILoop );
         
         // Synchronize the output pixel with input
         // Call image_wrap_data on the result to get the pointer on destination data
@@ -294,7 +294,7 @@
     // }
     
     llvm::BasicBlock* lastBlock = GTLCore::CodeGenerator::createIterationForStatement( generationContext, initialBlock, incJ, arg_height, GTLCore::Type::Integer32, firstBlockJLoop, lastBlockJLoop);
-    new llvm::ReturnInst(lastBlock);
+    llvm::ReturnInst::Create(lastBlock);
   // Cleanup
   
   delete resultVar;
@@ -353,7 +353,7 @@
     llvm::Value* arg_imgData = arg_it;
     
   // {
-    llvm::BasicBlock* currentBlock = new llvm::BasicBlock;
+    llvm::BasicBlock* currentBlock = llvm::BasicBlock::Create();
     func->getBasicBlockList().push_back( currentBlock );
     
   //    if( _TAllFloat_ )
@@ -375,7 +375,7 @@
   //        result[i] = convert(_imgData + pos(i) ) 
         // _imgData + pos(i);
         const GTLCore::Type* channelType = _pixelDescription.channelTypes()[i];
-        llvm::Value* posInP = new llvm::GetElementPtrInst( arg_imgData, GTLCore::CodeGenerator::integerToConstant( currentPos ), "", currentBlock );
+        llvm::Value* posInP = llvm::GetElementPtrInst::Create( arg_imgData, GTLCore::CodeGenerator::integerToConstant( currentPos ), "", currentBlock );
         llvm::Value* posInPNative = GTLCore::CodeGenerator::convertPointerTo( currentBlock, posInP, channelType->d->type() );
         llvm::Value* nativeValue = new llvm::LoadInst( posInPNative, "", currentBlock );
         // convert(_imgData + pos(i) )
@@ -402,7 +402,7 @@
         }
         
         // result[i] = convert(_imgData + pos(i) )
-        floatVec = new llvm::InsertElementInst( floatVec, floatValue, i, "", currentBlock);
+        floatVec = llvm::InsertElementInst::Create( floatVec, floatValue, i, "", currentBlock);
         GTL_ASSERT(channelType->bitsSize() % 8 == 0);
         currentPos += channelType->bitsSize() / 8;
   //      }
@@ -411,7 +411,7 @@
   //    }
     }
   //  }
-    new llvm::ReturnInst( currentBlock );
+    llvm::ReturnInst::Create( currentBlock );
   return func;
 }
 
@@ -466,7 +466,7 @@
     llvm::Value* arg_src = arg_it;
     
   // {
-    llvm::BasicBlock* currentBlock = new llvm::BasicBlock;
+    llvm::BasicBlock* currentBlock = llvm::BasicBlock::Create();
     func->getBasicBlockList().push_back( currentBlock );
   //    if( _TAllFloat_ )
     if( allFloat )
@@ -512,7 +512,7 @@
         // Convert back to native
         llvm::Value* nativeValue = GTLCore::CodeGenerator::convertValueTo( currentBlock, floatValue, GTLCore::Type::Float, channelType);
   //        *(_imgData + pos(i) ) = convert( _src[i] );
-        llvm::Value* posInP = new llvm::GetElementPtrInst( arg_imgData, GTLCore::CodeGenerator::integerToConstant( currentPos ), "", currentBlock );
+        llvm::Value* posInP = llvm::GetElementPtrInst::Create( arg_imgData, GTLCore::CodeGenerator::integerToConstant( currentPos ), "", currentBlock );
         llvm::Value* posInPNative = GTLCore::CodeGenerator::convertPointerTo( currentBlock, posInP, channelType->d->type() );
         new llvm::StoreInst( nativeValue, posInPNative, "", currentBlock );
   //      }
@@ -524,7 +524,7 @@
   //    }
     }
   //  }
-    new llvm::ReturnInst( currentBlock );
+    llvm::ReturnInst::Create( currentBlock );
   return func;
 }
 
@@ -534,8 +534,8 @@
   indexes.push_back( _gc.codeGenerator()->integerToConstant(0));
   indexes.push_back( _gc.codeGenerator()->integerToConstant(_member_index));
   
-  llvm::Value* funcPtr = new llvm::LoadInst( new llvm::GetElementPtrInst( _pointer, indexes.begin(), indexes.end(), "", _currentBlock ), "" , _currentBlock);
-  return new llvm::CallInst( funcPtr, _arguments.begin(), _arguments.end(), "", _currentBlock );
+  llvm::Value* funcPtr = new llvm::LoadInst( llvm::GetElementPtrInst::Create( _pointer, indexes.begin(), indexes.end(), "", _currentBlock ), "" , _currentBlock);
+  return llvm::CallInst::Create( funcPtr, _arguments.begin(), _arguments.end(), "", _currentBlock );
 }
 
 llvm::Value* CodeGenerator::callImageWrapData( GTLCore::GenerationContext& _gc, llvm::BasicBlock* _currentBlock, const GTLCore::Type* _imageType, llvm::Value* _imageWrap, llvm::Value* _x, llvm::Value* _y )
@@ -567,7 +567,7 @@
 #endif
 
   
-  return new llvm::CallInst(
+  return llvm::CallInst::Create(
       func, image_wrap_data_params.begin(), image_wrap_data_params.end(), "", _currentBlock ); // TODO get the real type of the output image (even if it doesn't matter much currently)
   
 }
@@ -601,7 +601,7 @@
     ++arg_it;
     llvm::Value* arg_pt = arg_it;
   //  {
-    llvm::BasicBlock* currentBlock = new llvm::BasicBlock;
+    llvm::BasicBlock* currentBlock = llvm::BasicBlock::Create();
     func->getBasicBlockList().push_back( currentBlock );
   //    int x = pt[0] + 0.5;
     llvm::Value* x_f = GTLCore::CodeGenerator::vectorValueAt( currentBlock, arg_pt,
@@ -617,6 +617,6 @@
                                callImageWrapData( generationContext, currentBlock, _imageType, arg_self, x_i, y_i ),
                                px_var, arg_self );
     setPixelCoordinates( generationContext, currentBlock, px_var, x_f, y_f );
-    new llvm::ReturnInst( px_var, currentBlock);
+    llvm::ReturnInst::Create( px_var, currentBlock);
   return func;
 }

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/PixelVisitor_p.cpp	2008-06-30 20:54:23 UTC (rev 276)
@@ -60,7 +60,7 @@
 llvm::Value* PixelVisitor::pointerToIndex( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer, const GTLCore::Type* _type, llvm::Value* _index) const
 {
   llvm::Value* ptr = CodeGenerator::accessPixelDataAsF32Ptr( _generationContext, _currentBlock, _pointer );
-  return new llvm::GetElementPtrInst( ptr, _index, "", _currentBlock);
+  return llvm::GetElementPtrInst::Create( ptr, _index, "", _currentBlock);
 }
 
 llvm::Value* PixelVisitor::get( GTLCore::GenerationContext& _generationContext, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer) const

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Version.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Version.h	2008-06-30 20:02:58 UTC (rev 275)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Version.h	2008-06-30 20:54:23 UTC (rev 276)
@@ -25,10 +25,10 @@
   const char* LibraryName = "OpenShiva Kernel Transformation Language";
   const char* LibraryCopyright = "Copyright (c) 2007-2008 Cyrille Berger (cberger@xxxxxxxxxxx)";
   const char* LibraryLicence = "GNU Lesser General Public License Version 2";
-  const char* LibraryVersionString = "0.9.3";
+  const char* LibraryVersionString = "0.9.4";
   int LibraryVersionMajor = 0;
   int LibraryVersionMinor = 9;
-  int LibraryVersionRevision = 3;
+  int LibraryVersionRevision = 4;
   /**
    * Give the latest version of the Shiva language supported by this library.
    */


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