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

#include <ProgramGraph.hh>

Collaboration diagram for ProgramGraph:
Collaboration graph

Public Member Functions

 ProgramGraph (TTAProgram::Program &program, const TTAMachine::Machine &mach)
 
virtual ~ProgramGraph ()
 
TTAProgram::ProgramgenerateProgram () const
 
MoveNodenodeOf (const TTAProgram::Move &) const
 
int graphCount () const
 
ProgramDependenceGraphgraphAt (int)
 
ProgramDependenceGraphgraph (const std::string)
 

Private Member Functions

void clear ()
 
 ProgramGraph (const ProgramGraph &)
 Copying forbidden. More...
 
ProgramGraphoperator= (const ProgramGraph &)
 Assignment forbidden. More...
 

Private Attributes

TTAProgram::Programprogram_
 Original program. More...
 
std::vector< ControlFlowGraph * > cfgs_
 Vector of CFG's for each procedure. More...
 
std::vector< ControlDependenceGraph * > cdgs_
 Vector of CDG's for each procedure. More...
 
std::vector< DataDependenceGraph * > ddgs_
 Vector of DDG's for each procedure. More...
 
std::vector< ProgramDependenceGraph * > pdgs_
 Vector of PDG's for each procedure. More...
 

Detailed Description

Definition at line 60 of file ProgramGraph.hh.

Constructor & Destructor Documentation

◆ ProgramGraph() [1/2]

ProgramGraph::ProgramGraph ( TTAProgram::Program program,
const TTAMachine::Machine mach 
)

Constructor.

Creates a new ProgramGraph from Program

Parameters
programProgram in POM

Definition at line 54 of file ProgramGraph.cc.

56  : program_(program){
57  try {
58  for (int i = 0; i < program.procedureCount(); i++) {
59  ControlFlowGraph* cfg = NULL;
60  cfg = new ControlFlowGraph(program.procedure(i));
61  cfgs_.push_back(cfg);
62  ControlDependenceGraph* cdg = NULL;
63  try {
64  cdg = new ControlDependenceGraph(*cfg);
65  cdgs_.push_back(cdg);
66  } catch (const InvalidData& e) {
67  delete cdg;
68  continue;
69  }
71  DataDependenceGraph* ddg = NULL;
72  ddg = builder.build(*cfg, DataDependenceGraph::ALL_ANTIDEPS,mach);
73  ddgs_.push_back(ddg);
74  ProgramDependenceGraph* pdg = NULL;
75  pdg = new ProgramDependenceGraph(*cdg, *ddg);
76  pdgs_.push_back(pdg);
77  }
78  } catch (Exception&) {
79  clear();
80  throw;
81  }
82 }

References DataDependenceGraph::ALL_ANTIDEPS, DataDependenceGraphBuilder::build(), cdgs_, cfgs_, clear(), ddgs_, pdgs_, program, and ProgramDependenceGraph::ProgramDependenceGraph().

Here is the call graph for this function:

◆ ~ProgramGraph()

ProgramGraph::~ProgramGraph ( )
virtual

Destructor.

Removes the graphs.

Definition at line 99 of file ProgramGraph.cc.

99  {
100  clear();
101 }

References clear().

Here is the call graph for this function:

◆ ProgramGraph() [2/2]

ProgramGraph::ProgramGraph ( const ProgramGraph )
private

Copying forbidden.

Member Function Documentation

◆ clear()

void ProgramGraph::clear ( )
private

Deletes all graphs owned by this.

Definition at line 87 of file ProgramGraph.cc.

References cdgs_, cfgs_, ddgs_, SequenceTools::deleteAllItems(), and pdgs_.

Referenced by ProgramGraph(), and ~ProgramGraph().

Here is the call graph for this function:

◆ generateProgram()

TTAProgram::Program & ProgramGraph::generateProgram ( ) const

Convert Program Graph to Program Object Model and returns POM

Returns
POM

TODO: convert PDG to POM this is basically scheduling

Definition at line 109 of file ProgramGraph.cc.

109  {
110  ///TODO: convert PDG to POM
111  /// this is basically scheduling
113 }

References TTAProgram::NullProgram::instance().

Here is the call graph for this function:

◆ graph()

ProgramDependenceGraph * ProgramGraph::graph ( const std::string  name)

Returns a PDG for procedure identified by procedure name.

Parameters
namename of a procedure
Returns
PDG for given procedure

Definition at line 157 of file ProgramGraph.cc.

157  {
158  for (int i = 0; i < graphCount(); i++) {
159  if (pdgs_.at(i)->name() == name) {
160  return pdgs_.at(i);
161  }
162  }
163  throw InvalidData(__FILE__, __LINE__, __func__, "Can not find graph of "
164  "procedure " + name);
165 }

References __func__, graphCount(), BoostGraph< ProgramDependenceNode, ProgramDependenceEdge >::name(), and pdgs_.

Here is the call graph for this function:

◆ graphAt()

ProgramDependenceGraph * ProgramGraph::graphAt ( int  i)

Returns a PDG for procedure identified by index.

Parameters
iindex of a procedure
Returns
PDG for given procedure

Definition at line 143 of file ProgramGraph.cc.

143  {
144  if (i < 0 || i >= graphCount()){
145  throw InvalidData(__FILE__, __LINE__, __func__, "Trying to access"
146  " graph out of a scope!");
147  }
148  return pdgs_.at(i);
149 }

References __func__, graphCount(), and pdgs_.

Here is the call graph for this function:

◆ graphCount()

int ProgramGraph::graphCount ( ) const

Returns number of PDG's in a program graph, equals number of procedures in program.

Returns
number of PDG's in a graph

Definition at line 133 of file ProgramGraph.cc.

133  {
134  return pdgs_.size();
135 }

References pdgs_.

Referenced by graph(), and graphAt().

◆ nodeOf()

MoveNode & ProgramGraph::nodeOf ( const TTAProgram::Move ) const

Returns MoveNode of program representation corresponding to Move of POM.

Parameters
movemove from POM
Returns
MoveNode corresponding to move

TODO: find a move and return corresponding MoveNode

Definition at line 122 of file ProgramGraph.cc.

122  {
123  ///TODO: find a move and return corresponding MoveNode
124  return *(new MoveNode());
125 }

◆ operator=()

ProgramGraph& ProgramGraph::operator= ( const ProgramGraph )
private

Assignment forbidden.

Member Data Documentation

◆ cdgs_

std::vector<ControlDependenceGraph*> ProgramGraph::cdgs_
private

Vector of CDG's for each procedure.

Definition at line 86 of file ProgramGraph.hh.

Referenced by clear(), and ProgramGraph().

◆ cfgs_

std::vector<ControlFlowGraph*> ProgramGraph::cfgs_
private

Vector of CFG's for each procedure.

Definition at line 84 of file ProgramGraph.hh.

Referenced by clear(), and ProgramGraph().

◆ ddgs_

std::vector<DataDependenceGraph*> ProgramGraph::ddgs_
private

Vector of DDG's for each procedure.

Definition at line 88 of file ProgramGraph.hh.

Referenced by clear(), and ProgramGraph().

◆ pdgs_

std::vector<ProgramDependenceGraph*> ProgramGraph::pdgs_
private

Vector of PDG's for each procedure.

Definition at line 90 of file ProgramGraph.hh.

Referenced by clear(), graph(), graphAt(), graphCount(), and ProgramGraph().

◆ program_

TTAProgram::Program& ProgramGraph::program_
private

Original program.

Definition at line 81 of file ProgramGraph.hh.


The documentation for this class was generated from the following files:
ProgramGraph::pdgs_
std::vector< ProgramDependenceGraph * > pdgs_
Vector of PDG's for each procedure.
Definition: ProgramGraph.hh:90
MoveNode
Definition: MoveNode.hh:65
ProgramGraph::program_
TTAProgram::Program & program_
Original program.
Definition: ProgramGraph.hh:81
ProgramGraph::ddgs_
std::vector< DataDependenceGraph * > ddgs_
Vector of DDG's for each procedure.
Definition: ProgramGraph.hh:88
TTAProgram::NullProgram::instance
static NullProgram & instance()
Definition: NullProgram.cc:72
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
ProgramGraph::cdgs_
std::vector< ControlDependenceGraph * > cdgs_
Vector of CDG's for each procedure.
Definition: ProgramGraph.hh:86
DataDependenceGraph::ALL_ANTIDEPS
@ ALL_ANTIDEPS
Definition: DataDependenceGraph.hh:82
InvalidData
Definition: Exception.hh:149
__func__
#define __func__
Definition: Application.hh:67
ProgramDependenceGraph
Definition: ProgramDependenceGraph.hh:51
Exception
Definition: Exception.hh:54
ProgramGraph::cfgs_
std::vector< ControlFlowGraph * > cfgs_
Vector of CFG's for each procedure.
Definition: ProgramGraph.hh:84
ProgramGraph::graphCount
int graphCount() const
Definition: ProgramGraph.cc:133
DataDependenceGraphBuilder
Definition: DataDependenceGraphBuilder.hh:70
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
DataDependenceGraphBuilder::build
virtual DataDependenceGraph * build(ControlFlowGraph &cGraph, DataDependenceGraph::AntidependenceLevel antidependenceLevel, const TTAMachine::Machine &mach, const UniversalMachine *um=NULL, bool createMemAndFUDeps=true, bool createDeathInformation=true, llvm::AliasAnalysis *AA=NULL)
Definition: DataDependenceGraphBuilder.cc:2120
ControlDependenceGraph
Definition: ControlDependenceGraph.hh:65
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
ProgramGraph::clear
void clear()
Definition: ProgramGraph.cc:87
ControlFlowGraph
Definition: ControlFlowGraph.hh:100