[opengtl-commits] [490] don't convert values inside the code generator

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


Revision: 490
Author:   cyrille
Date:     2008-11-22 20:02:16 +0100 (Sat, 22 Nov 2008)

Log Message:
-----------
don't convert values inside the code generator

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp


Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2008-11-22 11:26:51 UTC (rev 489)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2008-11-22 19:02:16 UTC (rev 490)
@@ -103,12 +103,7 @@
   // List of functions
   std::vector<llvm::Function*> functions( params.size() + 1 );
   // Generate the full function
-  const llvm::Type* returnType = m_function->returnType()->d->type();
-  if( m_function->returnType()->dataType() == Type::STRUCTURE
-      or m_function->returnType()->dataType() == Type::ARRAY )
-  {
-    returnType = llvm::PointerType::get( returnType, 0 );
-  }
+  const llvm::Type* returnType = m_function->returnType()->d->asArgumentType();
   llvm::FunctionType* definitionType = llvm::FunctionType::get( returnType, params, false );
   GTLCore::String fullFunctionName = GTLCore::Function::Data::symbolName( m_function->name(), m_function->parameters());
   llvm::Function* fullFunction = _codeGenerator->createFunction(definitionType, fullFunctionName );

Modified: trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp	2008-11-22 11:26:51 UTC (rev 489)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CodeGenerator_p.cpp	2008-11-22 19:02:16 UTC (rev 490)
@@ -162,6 +162,8 @@
   GTL_DEBUG( *_value << " to "  << *_targetType );
   GTL_ASSERT(_targetType->d->type()->isFirstClassType());
   GTL_ASSERT(_value->getType()->isFirstClassType());
+  GTL_ASSERT( _targetType->dataType() != Type::ARRAY );
+  GTL_ASSERT( _targetType->dataType() != Type::STRUCTURE );
   return llvm::CastInst::create(
                       llvm::CastInst::getCastOpcode(_value, _valueType->isSigned(), _targetType->d->type(), _targetType->isSigned()), _value, _targetType->d->type(), "", _currentBlock );
 }
@@ -623,10 +625,10 @@
       }
       GTL_ASSERT( value );
       GTL_DEBUG( "param's type = " << *oparam_it->type()->d->type() << " value = " << *value );
-      if( oparam_it->type()->d->type()->isFirstClassType() )
-      {
-        value = _gc.codeGenerator()-> convertValueTo( bb, value, (*it)->type(), oparam_it->type() );
-      }
+//       if( oparam_it->type()->d->type()->isFirstClassType() )
+//       {
+//         value = _gc.codeGenerator()-> convertValueTo( bb, value, (*it)->type(), oparam_it->type() );
+//       }
       convertedParams.push_back( value );
     }
     


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