OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
OperationDAGBuilder Class Reference

#include <OperationDAGBuilder.hh>

Collaboration diagram for OperationDAGBuilder:
Collaboration graph

Public Member Functions

 OperationDAGBuilder (const OperationPimpl &operation, OperationDAG &dag, const TokenizerData::TokenTreeNode &root)
 
void parse ()
 

Private Types

typedef std::pair< OperationDAGNode *, int > VariableBinding
 Node and operand which is referred by a variable. More...
 
typedef std::pair< TerminalNode *, unsigned int > TerminalBinding
 Information of object and index of operand of a variable. More...
 

Private Member Functions

void parseNode (const TokenizerData::TokenTreeNode *node)
 
void createOperationNode (const std::string &operation)
 
void connectOperandToNode (const TokenizerData::TokenTreeNode *var, unsigned int operandIndex)
 
void finalize ()
 
void declareVariable (const TokenizerData::TokenTreeNode *var)
 
void assignVariable (const TokenizerData::TokenTreeNode *dst, VariableBinding &src)
 
void assignVariable (const TokenizerData::TokenTreeNode *dst, const TokenizerData::TokenTreeNode *src)
 
std::string getVariableName (const TokenizerData::TokenTreeNode *var)
 
VariableBindinggetBinding (const TokenizerData::TokenTreeNode *var)
 
VariableBindinggetBinding (std::string varName)
 
VariableBindinggetBinding (unsigned int operandIndex)
 
VariableBindinggetConstantBinding (long value)
 
unsigned int getIOOperand (const TokenizerData::TokenTreeNode *var)
 

Private Attributes

OperationDAGdag_
 DAG where all nodes and edges are added. More...
 
const TokenizerData::TokenTreeNoderootNode_
 Root of tokenized data parsed from OSAL DAG source code. More...
 
OperationNodecurrentOperation_
 Currently created handled operation. More...
 
std::map< std::string, VariableBindingvariableBindings_
 Node and operand which are referred by IO(x) or declared variable. More...
 
std::map< long, VariableBindingconstantBindings_
 Node representing constant value. More...
 
std::map< std::string, TerminalBindingioVariables_
 IO(x) variables and corresponding TerminalNodes and operand indices. More...
 
const OperationPimploperation_
 

Detailed Description

Builds OperationDAG from parsed and tokenized OSAL code.

Definition at line 47 of file OperationDAGBuilder.hh.

Member Typedef Documentation

◆ TerminalBinding

typedef std::pair<TerminalNode*, unsigned int> OperationDAGBuilder::TerminalBinding
private

Information of object and index of operand of a variable.

Definition at line 61 of file OperationDAGBuilder.hh.

◆ VariableBinding

typedef std::pair<OperationDAGNode*, int> OperationDAGBuilder::VariableBinding
private

Node and operand which is referred by a variable.

Definition at line 58 of file OperationDAGBuilder.hh.

Constructor & Destructor Documentation

◆ OperationDAGBuilder()

OperationDAGBuilder::OperationDAGBuilder ( const OperationPimpl operation,
OperationDAG dag,
const TokenizerData::TokenTreeNode root 
)

Constructor.

Parameters
dagOperationDAG where to create DAG representation of operation.
rootTokenized OSAL DAG Language code.

Definition at line 53 of file OperationDAGBuilder.cc.

55  :
56  dag_(&dag), rootNode_(root), currentOperation_(NULL),
57  operation_(operation) {
58 }

Member Function Documentation

◆ assignVariable() [1/2]

void OperationDAGBuilder::assignVariable ( const TokenizerData::TokenTreeNode dst,
const TokenizerData::TokenTreeNode src 
)
private

Assign binding of destination variable to be same than source.

Parameters
srcTree node variable whose binding is set to destination.
dstTree node variable whose binding is set to same that source's.

Definition at line 311 of file OperationDAGBuilder.cc.

313  {
314  std::string dstName = getVariableName(dst);
315  variableBindings_[dstName] = getBinding(src);
316 }

References getBinding(), getVariableName(), and variableBindings_.

Here is the call graph for this function:

◆ assignVariable() [2/2]

void OperationDAGBuilder::assignVariable ( const TokenizerData::TokenTreeNode dst,
VariableBinding src 
)
private

Assign binding of destination variable to be source binding.

Parameters
srcTree node variable whose binding is set to destination.
dstBinding that is set to source's binding.

Definition at line 289 of file OperationDAGBuilder.cc.

290  {
291  std::string dstName = getVariableName(dst);
292 
293  if (variableBindings_.find(dstName) == variableBindings_.end() &&
294  ioVariables_.find(dstName) == ioVariables_.end()) {
295  throw IllegalParameters(
296  __FILE__, __LINE__, __func__,
297  "Variable \"" + dst->token().stringValue() +
298  "\" was not declared.");
299  }
300 
301  variableBindings_[dstName] = src;
302 }

References __func__, getVariableName(), ioVariables_, TokenizerData::Token::stringValue(), TokenizerData::TokenTreeNode::token(), and variableBindings_.

Referenced by connectOperandToNode(), and parseNode().

Here is the call graph for this function:

◆ connectOperandToNode()

void OperationDAGBuilder::connectOperandToNode ( const TokenizerData::TokenTreeNode var,
unsigned int  operandIndex 
)
private

Connects a variable node to given operand index of last created operation node.

Parameters
varVariable to connect to operand of created operation node.
operandIndexIndex of operand to which variable is connected.
Exceptions
IllegalParametersOperand with requested index doesn't exist.

Definition at line 162 of file OperationDAGBuilder.cc.

163  {
164 
165  // check if input or output
167  if (operandIndex > (unsigned)currOp.operandCount()) {
168  throw IllegalParameters(
169  __FILE__, __LINE__, __func__,
170  "Operation doesn't have operand number: " +
171  Conversion::toString(operandIndex));
172  }
173 
174  if (currOp.operand(operandIndex).isInput()) {
175  VariableBinding* srcNode = &getBinding(var);
176  if (srcNode->first == NULL) {
177  throw IllegalParameters(
178  __FILE__,__LINE__,__func__,
179  TCEString("Source node: ") + Conversion::toString(operandIndex)
180  + " of operation " + currentOperation_->toString()
181  + " is NULL. Maybe it is temp variable that has not been"
182  + " written yet? This happens in DAG of operation: " + operation_.name());
183  }
184 
185  if (!dag_->hasNode(*srcNode->first)) {
186  throw IllegalParameters(
187  __FILE__,__LINE__,__func__,
188  TCEString("Source node: ") + Conversion::toString(operandIndex)
189  + " of operation " + currentOperation_->toString()
190  + " not in dag. This happens in DAG of operation: " + operation_.name());
191  }
192 
193  OperationDAGEdge* newEdge =
194  new OperationDAGEdge(srcNode->second, operandIndex);
195  dag_->connectNodes(*srcNode->first, *currentOperation_, *newEdge);
196 
197  } else if (currOp.operand(operandIndex).isOutput()) {
198  // set node, operandIndex pair for the variable
199  VariableBinding varBind =
200  VariableBinding(currentOperation_, operandIndex);
201  assignVariable(var, varBind);
202 
203  } else {
204  throw IllegalParameters(
205  __FILE__, __LINE__, __func__,
206  "Operation doesn't have operand number: " +
207  Conversion::toString(operandIndex));
208  }
209 }

References __func__, assignVariable(), BoostGraph< GraphNode, GraphEdge >::connectNodes(), currentOperation_, dag_, getBinding(), BoostGraph< GraphNode, GraphEdge >::hasNode(), Operand::isInput(), Operand::isOutput(), OperationPimpl::name(), Operation::operand(), Operation::operandCount(), operation_, OperationNode::referencedOperation(), Conversion::toString(), and OperationNode::toString().

Referenced by parseNode().

Here is the call graph for this function:

◆ createOperationNode()

void OperationDAGBuilder::createOperationNode ( const std::string &  operation)
private

Starts creation of new operation node.

Parameters
operationName of operation which is referred by this node.
Exceptions
IllegalParametersOperation by requested name doesn't exist.

Definition at line 141 of file OperationDAGBuilder.cc.

141  {
142  OperationPool opPool;
143  Operation& op = opPool.operation(operation.c_str());
144 
145  if (&op == &NullOperation::instance()) {
146  throw IllegalParameters(__FILE__, __LINE__, __func__,
147  "Operation: \"" + operation + "\" doesn't exist.");
148  }
151 }

References __func__, BoostGraph< GraphNode, GraphEdge >::addNode(), currentOperation_, dag_, NullOperation::instance(), and OperationPool::operation().

Referenced by parseNode().

Here is the call graph for this function:

◆ declareVariable()

void OperationDAGBuilder::declareVariable ( const TokenizerData::TokenTreeNode var)
private

Declared new variable which can be used for temporary storage of IO() variables.

Parameters
varToken tree node containing variable name.
Exceptions
IllegalParametersIf variable already exists.

Definition at line 270 of file OperationDAGBuilder.cc.

271  {
272  std::string varName = getVariableName(var);
273  if (variableBindings_.find(varName) != variableBindings_.end()) {
274  throw IllegalParameters(
275  __FILE__, __LINE__, __func__,
276  "Variable \"" + var->token().stringValue() +
277  "\" already exists.");
278  }
279  variableBindings_[varName] = VariableBinding(NULL, 0);
280 }

References __func__, getVariableName(), TokenizerData::Token::stringValue(), TokenizerData::TokenTreeNode::token(), and variableBindings_.

Referenced by parseNode().

Here is the call graph for this function:

◆ finalize()

void OperationDAGBuilder::finalize ( )
private

Finalizes DAG by creating output terminals.

TerminalNode objects are created for Those IO() operands, which are referred, but doesn't already have TerminalNode objects.

Definition at line 218 of file OperationDAGBuilder.cc.

218  {
219  // find IO(x) references, which doesn't has yet terminal
220  unsigned int inputCount = operation_.numberOfInputs();
221  unsigned int outputCount = operation_.numberOfOutputs();
222 
223  std::set<unsigned int> unwrittenOutputs;
224  for (unsigned int i = 1; i <= outputCount; i++) {
225  unwrittenOutputs.insert(i + inputCount);
226  }
227 
228  for (std::map<std::string,TerminalBinding>::iterator iter =
229  ioVariables_.begin(); iter != ioVariables_.end(); iter++) {
230 
231  unwrittenOutputs.erase(iter->second.second);
232 
233  if (iter->second.first == NULL) {
234  VariableBinding& ioVar = getBinding(iter->second.second);
235  if (iter->second.second > inputCount + outputCount) {
236  throw IllegalParameters(
237  __FILE__, __LINE__, __func__,
238  TCEString("Operation ") + operation_.name() +
239  TCEString(" doesn't have result operand number: ") +
240  Conversion::toString(iter->second.second));
241  }
242  iter->second.first = new TerminalNode(iter->second.second);
243  dag_->addNode(*(iter->second.first));
244  OperationDAGEdge* newEdge =
245  new OperationDAGEdge(ioVar.second,1);
247  *(ioVar.first), *(iter->second.first), *newEdge);
248  }
249  }
250  if (!unwrittenOutputs.empty()) {
251  TCEString message = TCEString("DAG of operation: ") +
252  operation_.name() + " Does not write to output operand(s): ";
253  while (!unwrittenOutputs.empty()) {
254  message << Conversion::toString(*unwrittenOutputs.begin()) <<" ";
255  unwrittenOutputs.erase(unwrittenOutputs.begin());
256  }
257  throw IllegalParameters(__FILE__,__LINE__,__func__, message);
258  }
259  // TODO: verify IO variable information of operation description
260 }

References __func__, BoostGraph< GraphNode, GraphEdge >::addNode(), BoostGraph< GraphNode, GraphEdge >::connectNodes(), dag_, getBinding(), ioVariables_, OperationPimpl::name(), OperationPimpl::numberOfInputs(), OperationPimpl::numberOfOutputs(), operation_, and Conversion::toString().

Referenced by parse().

Here is the call graph for this function:

◆ getBinding() [1/3]

OperationDAGBuilder::VariableBinding & OperationDAGBuilder::getBinding ( const TokenizerData::TokenTreeNode var)
private

Returns node and operand index of any existing variable, IO() call or constant.

Parameters
varFuncion call or single identifier type of token tree node.
Returns
Node and operand index of any existing variable or IO() call.
Exceptions
IllegalParameterParameter isn't function call or variable name.

Definition at line 363 of file OperationDAGBuilder.cc.

363  {
364 
365  // check if variable is function IO(2) or normal var
366  if (var->isFunctionCall()) {
367  unsigned int srcOperand = getIOOperand(var);
368  return getBinding(srcOperand);
369 
370  } else if (var->token().isIdentifier()) {
371  std::string varName = getVariableName(var);
372  return getBinding(varName);
373 
374  } else if (var->isInteger()) {
375  return getConstantBinding(var->intValue());
376 
377  } else {
378  throw IllegalParameters(
379  __FILE__, __LINE__, __func__,
380  "Parameter \"" + var->token().stringValue() +
381  "\" is not variable.");
382  }
383 }

References __func__, getConstantBinding(), getIOOperand(), getVariableName(), TokenizerData::TokenTreeNode::intValue(), TokenizerData::TokenTreeNode::isFunctionCall(), TokenizerData::Token::isIdentifier(), TokenizerData::TokenTreeNode::isInteger(), TokenizerData::Token::stringValue(), and TokenizerData::TokenTreeNode::token().

Referenced by assignVariable(), connectOperandToNode(), finalize(), and getBinding().

Here is the call graph for this function:

◆ getBinding() [2/3]

OperationDAGBuilder::VariableBinding & OperationDAGBuilder::getBinding ( std::string  varName)
private

Returns node and operand index of any existing variable.

Parameters
varNameName of the variable whose current binding is requested.
Returns
Node and operand index where variable is currently assigned.
Exceptions
IllegalParametersVariable is not declared.

Definition at line 393 of file OperationDAGBuilder.cc.

393  {
394  if (variableBindings_.find(varName) == variableBindings_.end()) {
395  throw IllegalParameters(
396  __FILE__, __LINE__, __func__,
397  "Trying to use uninitialized variable: " + varName);
398  }
399  return variableBindings_[varName];
400 }

References __func__, and variableBindings_.

◆ getBinding() [3/3]

OperationDAGBuilder::VariableBinding & OperationDAGBuilder::getBinding ( unsigned int  operandIndex)
private

Returns node and operand index of IO() variable.

If called first time creates TerminalNode and binds IO() to that node with operand index 1.

Parameters
operandIndexNumber of IO whose current binding is requested.
Returns
Node and operand index where IO() is currently assigned.

Definition at line 430 of file OperationDAGBuilder.cc.

430  {
431 
432  // if first reference, and its never set before,
433  // create startnode for variable and set
434  // outputbind to be 1
435 
436  // if variable name is used, it has to be created
437  // and initialized before
438  std::string varName =
439  "IO(" + Conversion::toString(operandIndex) + ")";
440 
441  if (variableBindings_.find(varName) == variableBindings_.end()) {
442  TerminalNode* newNode = new TerminalNode(operandIndex);
443  variableBindings_[varName] = VariableBinding(newNode, 1);
444  dag_->addNode(*newNode);
445 
446  // mark terminal as created for check phase in finalize
447  ioVariables_[varName] = TerminalBinding(newNode, operandIndex);
448  }
449 
450  return getBinding(varName);
451 }

References BoostGraph< GraphNode, GraphEdge >::addNode(), dag_, getBinding(), ioVariables_, Conversion::toString(), and variableBindings_.

Here is the call graph for this function:

◆ getConstantBinding()

OperationDAGBuilder::VariableBinding & OperationDAGBuilder::getConstantBinding ( long  value)
private

Returns node and operand index of any existing variable.

Parameters
varNameName of the variable whose current binding is requested.
Returns
Node and operand index where variable is currently assigned.
Exceptions
IllegalParametersVariable is not declared.

Definition at line 410 of file OperationDAGBuilder.cc.

410  {
411  if (constantBindings_.find(value) == constantBindings_.end()) {
412  ConstantNode* newNode = new ConstantNode(value);
413  constantBindings_[value] = VariableBinding(newNode, 1);
414  dag_->addNode(*newNode);
415  }
416 
417  return constantBindings_[value];
418 }

References BoostGraph< GraphNode, GraphEdge >::addNode(), constantBindings_, and dag_.

Referenced by getBinding().

Here is the call graph for this function:

◆ getIOOperand()

unsigned int OperationDAGBuilder::getIOOperand ( const TokenizerData::TokenTreeNode var)
private

Returns operand's number of tree node, which contains reference to IO() variable.

Parameters
varToken tree node, which contains parsed IO(x) call.
Returns
Operand number of IO(x) type of token tree node.
Exceptions
IllegalParametersIf var isn't parsed IO() call.

Definition at line 462 of file OperationDAGBuilder.cc.

462  {
463  if (var->leafCount() != 2 ||
464  var->leaf(0).token().stringValue() != "IO" ||
465  !var->leaf(1).leaf(0).token().isIntegerLiteral()) {
466  throw IllegalParameters(
467  __FILE__, __LINE__, __func__,
468  "Invalid parameter node \"" + var->token().stringValue() +
469  "\" != \"IO(x)\" call.");
470  }
471  return var->leaf(1).leaf(0).token().intValue();
472 }

References __func__, TokenizerData::Token::intValue(), TokenizerData::Token::isIntegerLiteral(), TokenizerData::TokenTreeNode::leaf(), TokenizerData::TokenTreeNode::leafCount(), TokenizerData::Token::stringValue(), and TokenizerData::TokenTreeNode::token().

Referenced by getBinding(), and getVariableName().

Here is the call graph for this function:

◆ getVariableName()

std::string OperationDAGBuilder::getVariableName ( const TokenizerData::TokenTreeNode var)
private

Retuns name of variable, for token tree node containing IO() call or variable name.

Parameters
varIO() call or variable name.
Returns
Generated variable name for internal variable map.
Exceptions
IllegalParameterParameter is not variable..

Definition at line 327 of file OperationDAGBuilder.cc.

328  {
329  // check if variable is function IO(2) or normal var
330  if (var->isFunctionCall()) {
331  unsigned int srcOperand = getIOOperand(var);
332 
333  std::string retVal =
334  "IO(" + Conversion::toString(srcOperand) + ")";
335 
336  // mark terminal as referenced, but not created
337  if (ioVariables_.find(retVal) == ioVariables_.end()) {
338  ioVariables_[retVal] = TerminalBinding(NULL, srcOperand);
339  }
340 
341  return retVal;
342 
343  } else if (var->token().isIdentifier()) {
344  return var->token().stringValue();
345 
346  } else {
347  throw IllegalParameters(
348  __FILE__, __LINE__, __func__,
349  "Parameter \"" + var->token().stringValue() +
350  "\" is not variable.");
351  }
352 }

References __func__, getIOOperand(), ioVariables_, TokenizerData::TokenTreeNode::isFunctionCall(), TokenizerData::Token::isIdentifier(), TokenizerData::Token::stringValue(), TokenizerData::TokenTreeNode::token(), and Conversion::toString().

Referenced by assignVariable(), declareVariable(), and getBinding().

Here is the call graph for this function:

◆ parse()

void OperationDAGBuilder::parse ( )

Parses token tree presentation of OSAL DAG language to OperationDAG.

Definition at line 64 of file OperationDAGBuilder.cc.

64  {
65 
66  // Print out tokenized dag form...
67  // std::cerr << rootNode_.toStr() << std::endl;
68 
69  // Loop through all leafs of root node and call finalization.
70  for (int i = 0; i < rootNode_.leafCount();i++) {
71  const TokenizerData::TokenTreeNode* currNode =
72  &(rootNode_.leaf(i));
73  parseNode(currNode);
74  }
75  finalize();
76 }

References finalize(), TokenizerData::TokenTreeNode::leaf(), TokenizerData::TokenTreeNode::leafCount(), parseNode(), and rootNode_.

Referenced by OperationDAGConverter::createDAG().

Here is the call graph for this function:

◆ parseNode()

void OperationDAGBuilder::parseNode ( const TokenizerData::TokenTreeNode node)
private

Parses one token tree node to DAG representation.

Parameters
nodeNode to parse.

Definition at line 84 of file OperationDAGBuilder.cc.

85  {
86 
87  switch(node->token().type_) {
89  // ignore empty expressions
90  if (node->leafCount() == 1) {
91  parseNode(&node->leaf(0));
92  }
93  } break;
94 
96  for (int i = 1; i < node->leafCount(); i++) {
97  // TODO: check thata init declarator doesn't
98  // doesnt't have leafs
99  declareVariable(&node->leaf(i));
100  }
101  } break;
102 
104  if (node->leafCount() == 1) {
105  parseNode(&node->leaf(0));
106 
107  } else if (node->isAssignment()) {
108  assignVariable(&node->leaf(0), &node->leaf(2));
109 
110  } else if (node->isFunctionCall()) {
111  // TODO: check if is execution macro
112  // get postfixpart
113  node = &node->leaf(1);
114 
115  // leaf(0) create operation node
117 
118  // leaf(1)- ... connect nodes..
119  for (int i = 1; i < node->leafCount(); i++) {
120  connectOperandToNode(&node->leaf(i), i);
121  }
122 
123  } else {
124  std::cerr << "Cannot parse: " << node->toStr();
125  }
126  } break;
127 
128  default:
129  std::cerr << "Failed parsing: " << node->token().stringValue()
130  << std::endl;
131  }
132 }

References TokenizerData::ASSIGNMENT_EXPRESSION, assignVariable(), connectOperandToNode(), createOperationNode(), TokenizerData::DECLARATION, declareVariable(), TokenizerData::EXPRESSION_STATEMENT, TokenizerData::TokenTreeNode::isAssignment(), TokenizerData::TokenTreeNode::isFunctionCall(), TokenizerData::TokenTreeNode::leaf(), TokenizerData::TokenTreeNode::leafCount(), TokenizerData::Token::stringValue(), TokenizerData::TokenTreeNode::token(), TokenizerData::TokenTreeNode::toStr(), and TokenizerData::Token::type_.

Referenced by parse().

Here is the call graph for this function:

Member Data Documentation

◆ constantBindings_

std::map<long, VariableBinding> OperationDAGBuilder::constantBindings_
private

Node representing constant value.

Definition at line 101 of file OperationDAGBuilder.hh.

Referenced by getConstantBinding().

◆ currentOperation_

OperationNode* OperationDAGBuilder::currentOperation_
private

Currently created handled operation.

Definition at line 95 of file OperationDAGBuilder.hh.

Referenced by connectOperandToNode(), and createOperationNode().

◆ dag_

OperationDAG* OperationDAGBuilder::dag_
private

DAG where all nodes and edges are added.

Definition at line 89 of file OperationDAGBuilder.hh.

Referenced by connectOperandToNode(), createOperationNode(), finalize(), getBinding(), and getConstantBinding().

◆ ioVariables_

std::map<std::string, TerminalBinding> OperationDAGBuilder::ioVariables_
private

IO(x) variables and corresponding TerminalNodes and operand indices.

Definition at line 104 of file OperationDAGBuilder.hh.

Referenced by assignVariable(), finalize(), getBinding(), and getVariableName().

◆ operation_

const OperationPimpl& OperationDAGBuilder::operation_
private

Definition at line 106 of file OperationDAGBuilder.hh.

Referenced by connectOperandToNode(), and finalize().

◆ rootNode_

const TokenizerData::TokenTreeNode& OperationDAGBuilder::rootNode_
private

Root of tokenized data parsed from OSAL DAG source code.

Definition at line 92 of file OperationDAGBuilder.hh.

Referenced by parse().

◆ variableBindings_

std::map<std::string, VariableBinding> OperationDAGBuilder::variableBindings_
private

Node and operand which are referred by IO(x) or declared variable.

Definition at line 98 of file OperationDAGBuilder.hh.

Referenced by assignVariable(), declareVariable(), and getBinding().


The documentation for this class was generated from the following files:
TokenizerData::TokenTreeNode::intValue
long intValue() const
Definition: OperationDAGLanguageParser.hh:460
TokenizerData::EXPRESSION_STATEMENT
@ EXPRESSION_STATEMENT
Definition: OperationDAGLanguageParser.hh:214
OperationDAGBuilder::VariableBinding
std::pair< OperationDAGNode *, int > VariableBinding
Node and operand which is referred by a variable.
Definition: OperationDAGBuilder.hh:58
TokenizerData::Token::isIdentifier
bool isIdentifier() const
Definition: OperationDAGLanguageParser.hh:321
BoostGraph::connectNodes
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
OperationPool::operation
Operation & operation(const char *name)
Definition: OperationPool.cc:99
OperationPimpl::name
TCEString name() const
Definition: OperationPimpl.cc:121
TokenizerData::TokenTreeNode::isAssignment
bool isAssignment() const
Definition: OperationDAGLanguageParser.hh:427
OperationDAGBuilder::currentOperation_
OperationNode * currentOperation_
Currently created handled operation.
Definition: OperationDAGBuilder.hh:95
TokenizerData::Token::isIntegerLiteral
bool isIntegerLiteral() const
Definition: OperationDAGLanguageParser.hh:323
TerminalNode
Definition: TerminalNode.hh:47
OperationDAGBuilder::variableBindings_
std::map< std::string, VariableBinding > variableBindings_
Node and operand which are referred by IO(x) or declared variable.
Definition: OperationDAGBuilder.hh:98
OperationNode::referencedOperation
Operation & referencedOperation() const
Definition: OperationNode.cc:70
TokenizerData::TokenTreeNode::isInteger
bool isInteger() const
Definition: OperationDAGLanguageParser.hh:442
OperationDAGBuilder::rootNode_
const TokenizerData::TokenTreeNode & rootNode_
Root of tokenized data parsed from OSAL DAG source code.
Definition: OperationDAGBuilder.hh:92
BoostGraph::addNode
virtual void addNode(Node &node)
OperationNode
Definition: OperationNode.hh:47
Operand::isOutput
virtual bool isOutput() const
Definition: Operand.cc:155
NullOperation::instance
static NullOperation & instance()
OperationDAGEdge
Definition: OperationDAGEdge.hh:38
Conversion::toString
static std::string toString(const T &source)
OperationDAGBuilder::constantBindings_
std::map< long, VariableBinding > constantBindings_
Node representing constant value.
Definition: OperationDAGBuilder.hh:101
OperationPimpl::numberOfOutputs
int numberOfOutputs() const
TokenizerData::TokenTreeNode::leaf
TokenTreeNode & leaf(int index) const
Definition: OperationDAGLanguageParser.hh:513
OperationDAGBuilder::ioVariables_
std::map< std::string, TerminalBinding > ioVariables_
IO(x) variables and corresponding TerminalNodes and operand indices.
Definition: OperationDAGBuilder.hh:104
OperationDAGBuilder::getConstantBinding
VariableBinding & getConstantBinding(long value)
Definition: OperationDAGBuilder.cc:410
IllegalParameters
Definition: Exception.hh:113
OperationNode::toString
virtual std::string toString() const
Definition: OperationNode.cc:76
TokenizerData::DECLARATION
@ DECLARATION
Definition: OperationDAGLanguageParser.hh:184
TokenizerData::TokenTreeNode
Definition: OperationDAGLanguageParser.hh:397
__func__
#define __func__
Definition: Application.hh:67
TokenizerData::TokenTreeNode::leafCount
int leafCount() const
Definition: OperationDAGLanguageParser.hh:503
ConstantNode
Definition: ConstantNode.hh:43
TokenizerData::TokenTreeNode::toStr
std::string toStr() const
Definition: OperationDAGLanguageParser.hh:524
TokenizerData::TokenTreeNode::isFunctionCall
bool isFunctionCall() const
Definition: OperationDAGLanguageParser.hh:410
OperationDAGBuilder::assignVariable
void assignVariable(const TokenizerData::TokenTreeNode *dst, VariableBinding &src)
Definition: OperationDAGBuilder.cc:289
BoostGraph::hasNode
bool hasNode(const Node &) const
Operation
Definition: Operation.hh:59
Operation::operandCount
virtual int operandCount() const
Definition: Operation.cc:212
TokenizerData::Token::stringValue
std::string stringValue() const
Definition: OperationDAGLanguageParser.hh:341
OperationDAGBuilder::connectOperandToNode
void connectOperandToNode(const TokenizerData::TokenTreeNode *var, unsigned int operandIndex)
Definition: OperationDAGBuilder.cc:162
Operation::operand
virtual Operand & operand(int id) const
Definition: Operation.cc:541
OperationDAGBuilder::operation_
const OperationPimpl & operation_
Definition: OperationDAGBuilder.hh:106
OperationDAGBuilder::dag_
OperationDAG * dag_
DAG where all nodes and edges are added.
Definition: OperationDAGBuilder.hh:89
OperationDAGBuilder::getVariableName
std::string getVariableName(const TokenizerData::TokenTreeNode *var)
Definition: OperationDAGBuilder.cc:327
OperationDAGBuilder::parseNode
void parseNode(const TokenizerData::TokenTreeNode *node)
Definition: OperationDAGBuilder.cc:84
TCEString
Definition: TCEString.hh:53
TokenizerData::ASSIGNMENT_EXPRESSION
@ ASSIGNMENT_EXPRESSION
Definition: OperationDAGLanguageParser.hh:180
OperationDAGBuilder::createOperationNode
void createOperationNode(const std::string &operation)
Definition: OperationDAGBuilder.cc:141
TokenizerData::Token::intValue
long intValue() const
Definition: OperationDAGLanguageParser.hh:333
OperationDAGBuilder::declareVariable
void declareVariable(const TokenizerData::TokenTreeNode *var)
Definition: OperationDAGBuilder.cc:270
OperationDAGBuilder::finalize
void finalize()
Definition: OperationDAGBuilder.cc:218
OperationPool
Definition: OperationPool.hh:52
TokenizerData::Token::type_
OperationID type_
Definition: OperationDAGLanguageParser.hh:369
OperationDAGBuilder::getIOOperand
unsigned int getIOOperand(const TokenizerData::TokenTreeNode *var)
Definition: OperationDAGBuilder.cc:462
Operand::isInput
virtual bool isInput() const
Definition: Operand.cc:145
OperationDAGBuilder::TerminalBinding
std::pair< TerminalNode *, unsigned int > TerminalBinding
Information of object and index of operand of a variable.
Definition: OperationDAGBuilder.hh:61
TokenizerData::TokenTreeNode::token
const Token & token() const
Definition: OperationDAGLanguageParser.hh:494
OperationDAGBuilder::getBinding
VariableBinding & getBinding(const TokenizerData::TokenTreeNode *var)
Definition: OperationDAGBuilder.cc:363
OperationPimpl::numberOfInputs
int numberOfInputs() const