[opengtl-commits] [491] output are pointers... |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 491
Author: cyrille
Date: 2008-11-22 22:32:00 +0100 (Sat, 22 Nov 2008)
Log Message:
-----------
output are pointers...
Modified Paths:
--------------
trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp 2008-11-22 19:02:16 UTC (rev 490)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/AccessorExpression.cpp 2008-11-22 21:32:00 UTC (rev 491)
@@ -82,8 +82,10 @@
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, ArrayWrap::POS_SIZE)); // Access the size of the array
- return llvm::GetElementPtrInst::Create( m_parent->pointer( _gc, _bb),
+ llvm::Value* val = llvm::GetElementPtrInst::Create( m_parent->pointer( _gc, _bb),
indexes.begin(), indexes.end(), "", _bb);
+ GTL_DEBUG( *val );
+ return val;
}
void ArraySizeAccessorExpression::markAsReturnExpression()
@@ -110,7 +112,9 @@
std::vector<llvm::Value*> indexes;
indexes.push_back( _gc.codeGenerator()->integerToConstant(0));
indexes.push_back( _gc.codeGenerator()->integerToConstant(m_index + STRUCT_FIRST_ELEMENT));
- return llvm::GetElementPtrInst::Create( m_parent->pointer( _gc, _bb) , indexes.begin(), indexes.end(), "", _bb);
+ llvm::Value* val = llvm::GetElementPtrInst::Create( m_parent->pointer( _gc, _bb) , indexes.begin(), indexes.end(), "", _bb);
+ GTL_DEBUG( val );
+ return val;
}
bool StructAccessorExpression::isConstant() const
@@ -147,7 +151,9 @@
GTL_ASSERT(ptr_);
const Visitor* visitor = Visitor::getVisitorFor( m_parent->type() );
llvm::Value* index = m_index->generateValue(_gc, _bb).value();
- return visitor->pointerToIndex(_gc, _bb, ptr_, m_parent->type(), index );
+ llvm::Value* val = visitor->pointerToIndex(_gc, _bb, ptr_, m_parent->type(), index );
+ GTL_DEBUG( *val );
+ return val;
}
bool ArrayAccessorExpression::isConstant() const
@@ -177,7 +183,9 @@
llvm::Value* VariableAccessorExpression::pointer(GenerationContext& _gc, llvm::BasicBlock* bb) const
{
GTL_DEBUG("VariableAccessorExpression::pointer");
- return m_variable->pointer(bb);
+ llvm::Value* val = m_variable->pointer(bb);
+ GTL_DEBUG(*val);
+ return val;
}
bool VariableAccessorExpression::isConstant() const
Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp 2008-11-22 19:02:16 UTC (rev 490)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp 2008-11-22 21:32:00 UTC (rev 491)
@@ -92,16 +92,17 @@
for(std::vector< Parameter >::const_iterator it = m_function->parameters().begin();
it != m_function->parameters().end(); ++it)
{
- params.push_back( it->type()->d->asArgumentType() );
-/* if( it->output() or not it->type()->d->type()->isFirstClassType() or not it- )
+ if( it->output() )
{
params.push_back( llvm::PointerType::get( it->type()->d->type(), 0 ) );
} else {
- params.push_back( it->type()->d->type() );
- }*/
+ params.push_back( it->type()->d->asArgumentType() );
+ }
}
+
// List of functions
std::vector<llvm::Function*> functions( params.size() + 1 );
+
// Generate the full function
const llvm::Type* returnType = m_function->returnType()->d->asArgumentType();
llvm::FunctionType* definitionType = llvm::FunctionType::get( returnType, params, false );
Modified: trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp 2008-11-22 19:02:16 UTC (rev 490)
+++ trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp 2008-11-22 21:32:00 UTC (rev 491)
@@ -99,6 +99,7 @@
void VariableNG::initialise( GTLCore::GenerationContext& /*_generationContext*/, llvm::BasicBlock* _currentBlock, llvm::Value* _pointer )
{
+ GTL_ASSERT( _pointer->getType()->getTypeID() == llvm::Type::PointerTyID );
GTL_ASSERT(not d->isInitialised);
d->isInitialised = true;
d->directlyOnTheStack = _currentBlock and ( d->type->dataType() == Type::ARRAY or d->type->dataType() == Type::STRUCTURE );
@@ -138,6 +139,7 @@
llvm::Value* VariableNG::pointer(llvm::BasicBlock* _currentBlock)
{
+ GTL_DEBUG( *d->pointer << " " << d->directlyOnTheStack );
if( d->directlyOnTheStack )
{
return new llvm::LoadInst( d->pointer, "", _currentBlock );