[opengtl-commits] [389] structures are allways allocated in memory |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 389
Author: cyrille
Date: 2008-09-13 09:31:21 +0200 (Sat, 13 Sep 2008)
Log Message:
-----------
structures are allways allocated in memory
Modified Paths:
--------------
trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp
trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.h
trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp 2008-09-12 20:52:12 UTC (rev 388)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp 2008-09-13 07:31:21 UTC (rev 389)
@@ -192,7 +192,6 @@
void VariableAccessorExpression::markAsReturnExpression()
{
- m_variable->setAllocateInMemory( true );
GTL_DEBUG( m_variable->allocatedInMemory() );
}
Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp 2008-09-12 20:52:12 UTC (rev 388)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp 2008-09-13 07:31:21 UTC (rev 389)
@@ -222,6 +222,7 @@
llvm::BasicBlock* ReturnStatement::generateStatement( GenerationContext& _context, llvm::BasicBlock* _bb) const
{
+ GTL_DEBUG( m_variablesToClean.size() << " " << _context.function()->name() );
// FIXME share the cleanup code
if( m_returnExpr )
{
@@ -231,7 +232,6 @@
_bb = Visitor::getVisitorFor( m_returnExpr->type() )->mark( _context, _bb, result.value(), m_returnExpr->type(), CodeGenerator::integerToConstant( 1 ) );
}
_bb = _context.flushDelayedStatement( _bb );
- GTL_DEBUG( result << " " << m_variablesToClean.size() << " " << _context.function()->name() );
for( std::list<VariableNG*>::const_iterator it = m_variablesToClean.begin();
it != m_variablesToClean.end(); ++it)
{
Modified: trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt 2008-09-12 20:52:12 UTC (rev 388)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt 2008-09-13 07:31:21 UTC (rev 389)
@@ -54,6 +54,7 @@
Type_p.cpp
TypeManager_p.cpp
VariableNG_p.cpp
+ VariablesManager_p.cpp
VirtualMachine_p.cpp
Visitor_p.cpp
${LLVM_NATIVE_OBJECTS}
Modified: trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp 2008-09-12 20:52:12 UTC (rev 388)
+++ trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp 2008-09-13 07:31:21 UTC (rev 389)
@@ -51,12 +51,8 @@
d->isInitialised = false;
d->visitor = Visitor::getVisitorFor( _type );
d->pointer = 0;
- d->allocatedInMemory = false;
d->constantPointer = false;
- if( _type->d->isNestedArray() or _type->d->isComplexStructure() )
- {
- setAllocateInMemory( true );
- }
+ d->allocatedInMemory = ( _type->dataType() == Type::ARRAY or _type->dataType() == Type::STRUCTURE );
}
VariableNG::~VariableNG()
@@ -79,12 +75,10 @@
if( _initialiser.value() and _initialiser.functionResult()
and (type()->dataType() == Type::ARRAY or type()->dataType() == Type::STRUCTURE ) )
{
- d->allocatedInMemory = true;
initialise( _generationContext, _initialiser.value() );
_bb = d->visitor->mark( _generationContext, _bb, d->pointer, d->type, CodeGenerator::integerToConstant( 1 ) );
} else {
- if( d->allocatedInMemory
- and (type()->dataType() == Type::ARRAY or type()->dataType() == Type::STRUCTURE ) )
+ if( d->allocatedInMemory )
{
pointer = new llvm::MallocInst( d->type->d->type(), llvm::ConstantInt::get(llvm::Type::Int32Ty, 1), "", _bb);
} else {
@@ -126,10 +120,10 @@
{
GTL_ASSERT( _pointer->getType() == d->pointer->getType() );
GTL_ASSERT( not d->constantPointer );
+ GTL_ASSERT( d->allocatedInMemory );
_currentBlock = cleanUp( _generationContext, _currentBlock, 0 );
d->pointer = _pointer;
_currentBlock = d->visitor->mark( _generationContext, _currentBlock, d->pointer, d->type, CodeGenerator::integerToConstant( 1 ) );
- d->allocatedInMemory = true;
return _currentBlock;
}
@@ -138,15 +132,6 @@
return d->pointer;
}
-void VariableNG::setAllocateInMemory( bool v )
-{
- GTL_ASSERT( not d->isInitialised );
- if(type()->dataType() == Type::ARRAY or type()->dataType() == Type::STRUCTURE )
- {
- d->allocatedInMemory = v;
- }
-}
-
bool VariableNG::allocatedInMemory() const
{
return d->allocatedInMemory;
Modified: trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.h 2008-09-12 20:52:12 UTC (rev 388)
+++ trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.h 2008-09-13 07:31:21 UTC (rev 389)
@@ -89,10 +89,6 @@
*/
llvm::Value* pointer();
/**
- * Mark the variable to be allocated in memory
- */
- void setAllocateInMemory( bool v );
- /**
* @return true if the variable is allocated in memory, false otherwise
*/
bool allocatedInMemory() const;
Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp 2008-09-12 20:52:12 UTC (rev 388)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Compiler_p.cpp 2008-09-13 07:31:21 UTC (rev 389)
@@ -73,6 +73,7 @@
if( tree and errorMessages().size() == 0)
{
tree->generate( d->moduleData, d->codeGenerator );
+ SHIVA_DEBUG( *d->module );
for( std::list<GTLCore::AST::FunctionDeclaration*>::const_iterator it = tree->functionsDeclarations().begin();
it != tree->functionsDeclarations().end(); ++it)
{