Aseba  1.5.5
Public Member Functions | Public Attributes | List of all members
Aseba::MemoryVectorNode Struct Reference

Node for accessing a memory as a vector, in read or write operations If write == true, will expand to StoreNode or ArrayWriteNode If write == false, will expand to LoadNode or ArrayReadNode children[0] is an optional index If children[0] is a TupleVectorNode of one elements (int), it will be foo[x] If children[0] is a TupleVectorNode of two elements (int), it will be foo[x:y] If children[0] is another type of node, it will be foo[whatever] If children[0] doesn't exist, access to the full array is considered. More...

#include <tree.h>

Inheritance diagram for Aseba::MemoryVectorNode:
Aseba::AbstractTreeNode Aseba::Node

Public Member Functions

 MemoryVectorNode (const SourcePos &sourcePos, unsigned arrayAddr, unsigned arraySize, const std::wstring &arrayName)
 Constructor.
 
virtual MemoryVectorNodeshallowCopy ()
 Return a shallow copy of the object (children point to the same objects)
 
virtual NodeexpandAbstractNodes (std::wostream *dump)
 Dummy function, the node will be expanded during the vectorial pass.
 
virtual NodeexpandVectorialNodes (std::wostream *dump, Compiler *compiler=0, unsigned int index=0)
 Expand to memory[index].
 
virtual std::wstring toWString () const
 Return a string representation of this node.
 
virtual std::wstring toNodeName () const
 Return a string representation of the name of this node.
 
virtual unsigned getVectorAddr () const
 return the compile-time base address of the memory range, taking into account an immediate index foo[n] or foo[n:m] return E_NOVAL if foo[expr]
 
virtual unsigned getVectorSize () const
 return the vector's length
 
bool isAddressStatic () const
 return whether this node accesses a static address
 
virtual void setWrite (bool write)
 
- Public Member Functions inherited from Aseba::AbstractTreeNode
 AbstractTreeNode (const SourcePos &sourcePos)
 Constructor.
 
virtual ReturnType typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual Nodeoptimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual unsigned getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
- Public Member Functions inherited from Aseba::Node
 Node (const SourcePos &sourcePos)
 Constructor.
 
virtual ~Node ()
 Destructor, delete all children.
 
virtual NodedeepCopy ()
 Return a deep copy of the object (children are also copied)
 
virtual void checkVectorSize () const
 Check the consistency in vectors' size.
 
virtual void dump (std::wostream &dest, unsigned &indent) const
 Dump this node and the rest of the tree.
 
std::wstring typeName (const Node::ReturnType &type) const
 Return the name of a type.
 
void expectType (const Node::ReturnType &expected, const Node::ReturnType &type) const
 Check for a specific type, throw an exception otherwise.
 

Public Attributes

unsigned arrayAddr
 address of the first element of the array
 
unsigned arraySize
 size of the array, might be used to assert compile-time access checks
 
std::wstring arrayName
 name of the array (for debug)
 
bool write
 expand to a node for storing or loading data?
 
- Public Attributes inherited from Aseba::Node
NodesVector children
 children of this node
 
SourcePos sourcePos
 position is source
 

Additional Inherited Members

- Public Types inherited from Aseba::Node
enum  ReturnType { TYPE_UNIT = 0, TYPE_BOOL, TYPE_INT }
 A type a node can return.
 
enum  MemoryErrorCode { E_NOVAL = UINT_MAX }
 
typedef std::vector< Node * > NodesVector
 Vector for children of a node.
 

Detailed Description

Node for accessing a memory as a vector, in read or write operations If write == true, will expand to StoreNode or ArrayWriteNode If write == false, will expand to LoadNode or ArrayReadNode children[0] is an optional index If children[0] is a TupleVectorNode of one elements (int), it will be foo[x] If children[0] is a TupleVectorNode of two elements (int), it will be foo[x:y] If children[0] is another type of node, it will be foo[whatever] If children[0] doesn't exist, access to the full array is considered.


The documentation for this struct was generated from the following files: