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

#include <LLVMTCEDataDependenceGraphBuilder.hh>

Inheritance diagram for LLVMTCEDataDependenceGraphBuilder:
Inheritance graph
Collaboration diagram for LLVMTCEDataDependenceGraphBuilder:
Collaboration graph

Public Member Functions

 LLVMTCEDataDependenceGraphBuilder (InterPassData &ipd)
 
virtual ~LLVMTCEDataDependenceGraphBuilder ()
 
virtual DataDependenceGraphbuildFromCFG (ControlFlowGraph &cGraph, const UniversalMachine *um=NULL)
 
virtual DataDependenceGraphbuildFromBB (TTAProgram::BasicBlock &bb, const UniversalMachine *um=NULL)
 
- Public Member Functions inherited from DataDependenceGraphBuilder
 DataDependenceGraphBuilder ()
 
 DataDependenceGraphBuilder (InterPassData &ipd)
 
virtual ~DataDependenceGraphBuilder ()
 
void addAliasAnalyzer (MemoryAliasAnalyzer *analyzer)
 
virtual DataDependenceGraphbuild (ControlFlowGraph &cGraph, DataDependenceGraph::AntidependenceLevel antidependenceLevel, const TTAMachine::Machine &mach, const UniversalMachine *um=NULL, bool createMemAndFUDeps=true, bool createDeathInformation=true, llvm::AliasAnalysis *AA=NULL)
 
virtual DataDependenceGraphbuild (TTAProgram::BasicBlock &bb, DataDependenceGraph::AntidependenceLevel antidependenceLevel, const TTAMachine::Machine &mach, const TCEString &ddgname="small bb", const UniversalMachine *um=NULL, bool createMemAndFUDeps=true, llvm::AliasAnalysis *AA=NULL)
 

Private Member Functions

void buildLocalDDG (TTAProgram::BasicBlock &bb)
 

Additional Inherited Members

- Protected Types inherited from DataDependenceGraphBuilder
enum  BBState { BB_UNREACHED = 0, BB_QUEUED, BB_READY, BB_STATES }
 
enum  ConstructionPhase { REGISTERS_AND_PROGRAM_OPERATIONS = 0, MEMORY_AND_SIDE_EFFECTS }
 
typedef ControlFlowGraph::NodeSet BasicBlockNodeSet
 
typedef DataDependenceGraph::NodeSet MNodeSet
 
typedef LiveRangeData::MoveNodeUseSet MoveNodeUseSet
 
typedef LiveRangeData::MoveNodeUseMapSet MoveNodeUseMapSet
 
typedef LiveRangeData::MoveNodeUseMap MoveNodeUseMap
 
typedef LiveRangeData::MoveNodeUseSetPair MoveNodeUseSetPair
 
typedef LiveRangeData::MoveNodeUsePair MoveNodeUsePair
 
typedef std::map< int, TCEStringSpecialRegisters
 
typedef std::vector< MemoryAliasAnalyzer * > AliasAnalyzerVector
 
typedef std::map< BasicBlockNode *, BBData * > BBDataMap
 
typedef std::list< BBData * > BBDataList
 
- Protected Member Functions inherited from DataDependenceGraphBuilder
bool isTriggering (const MoveNode &mn)
 
void updatePreceedingRegistersUsedAfter (BBData &bbd, bool firstTime)
 
bool updateRegistersUsedInOrAfter (BBData &bbd)
 
bool updateRegistersAliveAfter (BBData &bbd)
 
bool updateMemAndFuAliveAfter (BBData &bbd)
 
void createMemAndFUstateDeps ()
 
void createRegisterDeps ()
 
void initializeBBStates ()
 
BasicBlockNodequeueFirstBB ()
 
void clearUnneededBookkeeping ()
 
void clearUnneededBookkeeping (TTAProgram::BasicBlock &bb, bool aliveInformationNeeded=true)
 
void iterateBBs (ConstructionPhase phase)
 
void searchRegisterDeaths ()
 
void iterateRegisterDeaths ()
 
void setSucceedingPredeps (BBData &bbd, bool queueAll, ConstructionPhase phase)
 
bool appendUseMapSets (const MoveNodeUseMapSet &srcMap, MoveNodeUseMapSet &dstMap, bool addLoopProperty)
 
void setSucceedingPredepsForBB (TTAProgram::BasicBlock &processedBB, BasicBlockNode &successor, bool queueAll, bool loop, ConstructionPhase phase)
 
void updateBB (BBData &bbd, ConstructionPhase phase)
 
void constructIndividualBB (ConstructionPhase phase)
 
void constructIndividualFromInlineAsmBB (ConstructionPhase phase)
 
void constructIndividualBB (BBData &bbd, ConstructionPhase)
 
void constructBB (BasicBlockNodeSet &inputBlocks)
 
void createOperationEdges (ProgramOperationPtr po)
 
void processGuard (MoveNode &moveNode)
 
void processSource (MoveNode &moveNode)
 
void processResultRead (MoveNode &moveNode)
 
void processCall (MoveNode &mn)
 
void processReturn (MoveNode &moveNode)
 
void processEntryNode (MoveNode &mn)
 
void processDestination (class MoveNode &moveNode, ConstructionPhase phase)
 
void processRegUse (MoveNodeUse mn, const TCEString &reg)
 
void updateMemUse (MoveNodeUse mnd, const TCEString &category)
 
void processRegWrite (MoveNodeUse mn, const TCEString &reg)
 
void updateMemWrite (MoveNodeUse mnd, const TCEString &category)
 
void processTriggerPO (class MoveNode &moveNode, Operation &dop)
 
void processTriggerRegistersAndOperations (MoveNode &moveNode, Operation &dop)
 
void processTriggerMemoryAndFUStates (MoveNode &moveNode, Operation &dop)
 
void createTriggerDependencies (class MoveNode &moveNode, class Operation &dop)
 
void createSideEffectEdges (MoveNodeUseSet &prevMoves, const MoveNode &mn, Operation &dop)
 
void processMemWrite (MoveNodeUse mnd)
 
void processMemUse (MoveNodeUse mnd)
 
void processOperand (class MoveNode &moveNode, Operation &dop)
 
MemoryAliasAnalyzer::AliasingResult analyzeMemoryAlias (const ProgramOperation &pop1, const ProgramOperation &pop2, MoveNodeUse::BBRelation bbInfo)
 
bool isAddressTraceable (const ProgramOperation &pop)
 
TCEString memoryCategory (const MoveNodeUse &mnd)
 
bool checkAndCreateMemDep (MoveNodeUse prev, MoveNodeUse mnd, DataDependenceEdge::DependenceType depType)
 
void checkAndCreateMemAntideps (MoveNodeUse &mnd, std::set< MoveNodeUse > &prevNodes, DataDependenceEdge::DependenceType depType, bool traceable)
 
bool hasEarlierMemWriteToSameAddressWithSameGuard (MoveNodeUse &mnd, std::set< MoveNodeUse > &defines)
 
std::set< MoveNodeUseearlierWritesWithSameGuard (MoveNodeUse &mnd, std::set< MoveNodeUse > &defines)
 
bool hasEarlierWriteWithSameGuard (MoveNodeUse &mnd, std::set< MoveNodeUse > &defines)
 
void createRegisterAntideps (const TCEString &reg, MoveNodeUse &mnd, MoveNodeUseSet &predecessorNodes, DataDependenceEdge::DependenceType depType, bool guardedKillFound)
 
void changeState (BBData &bbd, BBState newState, bool priorize=false)
 
bool isAlwaysDifferentFU (const MoveNode *srcMN, const MoveNode *dstMN)
 
void findStaticRegisters (TTAProgram::CodeSnippet &cs, std::map< int, TCEString > &registers)
 find special register data from old frontend code More...
 
void findStaticRegisters (ControlFlowGraph &cfg, std::map< int, TCEString > &registers)
 
void findStaticRegisters (TTAProgram::Instruction &ins, std::map< int, TCEString > &registers)
 
void findStaticRegisters (const UniversalMachine &um, std::map< int, TCEString > &registers)
 
void appendMoveNodeUse (const LiveRangeData::MoveNodeUseSet &src, LiveRangeData::MoveNodeUseSet &dst, bool setLoopProperty)
 
- Protected Attributes inherited from DataDependenceGraphBuilder
std::set< TCEStringallParamRegs_
 
BBDataList blocksByState_ [BB_STATES]
 
BBDataMap bbData_
 
BasicBlockNodecurrentBB_
 
BBDatacurrentData_
 
DataDependenceGraphcurrentDDG_
 
AliasAnalyzerVector aliasAnalyzers_
 
SpecialRegisters specialRegisters_
 contains stack pointer, RV and parameter registers. More...
 
InterPassDatainterPassData_
 
ControlFlowGraphcfg_
 
bool rvIsParamReg_
 
const TTAMachine::Machinemach_
 
- Static Protected Attributes inherited from DataDependenceGraphBuilder
static const TCEString RA_NAME = "RA"
 

Detailed Description

LLVMTCEDataDependenceGraphBuilder class is repsonsible for building data dependence graphs with assistance from LLVM internal representation data.

Currently used to produce DDGs from the prebypassed sequential code input from the TTA-like LLVM backend.

Definition at line 49 of file LLVMTCEDataDependenceGraphBuilder.hh.

Constructor & Destructor Documentation

◆ LLVMTCEDataDependenceGraphBuilder()

LLVMTCEDataDependenceGraphBuilder::LLVMTCEDataDependenceGraphBuilder ( InterPassData ipd)
inline

Definition at line 52 of file LLVMTCEDataDependenceGraphBuilder.hh.

52  :

◆ ~LLVMTCEDataDependenceGraphBuilder()

virtual LLVMTCEDataDependenceGraphBuilder::~LLVMTCEDataDependenceGraphBuilder ( )
inlinevirtual

Definition at line 54 of file LLVMTCEDataDependenceGraphBuilder.hh.

54 {}

Member Function Documentation

◆ buildFromBB()

DataDependenceGraph * LLVMTCEDataDependenceGraphBuilder::buildFromBB ( TTAProgram::BasicBlock bb,
const UniversalMachine um = NULL 
)
virtual

Definition at line 54 of file LLVMTCEDataDependenceGraphBuilder.cc.

55  {
57  buildLocalDDG(bb);
58  return currentDDG_;
59 }

References DataDependenceGraphBuilder::allParamRegs_, buildLocalDDG(), and DataDependenceGraphBuilder::currentDDG_.

Here is the call graph for this function:

◆ buildFromCFG()

DataDependenceGraph * LLVMTCEDataDependenceGraphBuilder::buildFromCFG ( ControlFlowGraph cGraph,
const UniversalMachine um = NULL 
)
virtual

Definition at line 38 of file LLVMTCEDataDependenceGraphBuilder.cc.

39  {
40 
42  for (int bbi = 0; bbi < cGraph.nodeCount(); ++bbi) {
43  BasicBlockNode& bbnode = cGraph.node(bbi);
44  buildLocalDDG(bbnode.basicBlock());
45  }
46  /* TODO:
47  buildGlobalEdges(cGraph);
48  */
49  currentDDG_->writeToDotFile("ddg.dot");
50  return currentDDG_;
51 }

References DataDependenceGraphBuilder::allParamRegs_, BasicBlockNode::basicBlock(), buildLocalDDG(), DataDependenceGraphBuilder::currentDDG_, BoostGraph< GraphNode, GraphEdge >::node(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Here is the call graph for this function:

◆ buildLocalDDG()

void LLVMTCEDataDependenceGraphBuilder::buildLocalDDG ( TTAProgram::BasicBlock bb)
private

Definition at line 62 of file LLVMTCEDataDependenceGraphBuilder.cc.

62  {
65  mngb.build(bb);
66 
67  /*
68  For starters, ensure the original order by chaining the
69  MNs with UNKNOWN edges and add operation edges also.
70 
71  This should trigger the problems with RM so those can be
72  worked on simultaneously.
73  */
74  MoveNode* lastMN = NULL;
75  for (MoveNodeGroupBuilder::MoveNodeGroupList::const_iterator i =
76  mngs->begin(); i != mngs->end(); ++i) {
77  MoveNodeGroup& mng = **i;
78 // PRINT_VAR(mng.toString());
79  if (mng.isOperation()) {
81  }
82  MoveNode* newLastMN = &mng.node(0);
83  for (int mni = 0; mni < mng.nodeCount(); ++mni) {
84  MoveNode& mn = mng.node(mni);
85  currentDDG_->addNode(mn);
86  if (lastMN != NULL) {
87  DataDependenceEdge* edge =
91  currentDDG_->connectNodes(*lastMN, mn, *edge);
92  }
93  if (mn.move().source().isFUPort())
94  newLastMN = &mn;
95  }
96  lastMN = newLastMN;
97  }
98 
99  for (MoveNodeGroupBuilder::MoveNodeGroupList::const_iterator i =
100  mngs->begin(); i != mngs->end(); ++i) {
101  MoveNodeGroup& mng = **i;
102  if (mng.isOperation()) {
104  }
105  }
106 }

References DataDependenceGraph::addNode(), DataDependenceGraph::addProgramOperation(), MoveNodeGroupBuilder::build(), BoostGraph< GraphNode, GraphEdge >::connectNodes(), DataDependenceGraphBuilder::createOperationEdges(), DataDependenceGraphBuilder::currentDDG_, DataDependenceEdge::DEP_UNKNOWN, DataDependenceEdge::EDGE_REGISTER, TTAProgram::Terminal::isFUPort(), MoveNodeGroup::isOperation(), MoveNode::move(), MoveNodeGroup::node(), MoveNodeGroup::nodeCount(), MoveNodeGroup::programOperationPtr(), and TTAProgram::Move::source().

Referenced by buildFromBB(), and buildFromCFG().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TTAProgram::Terminal::isFUPort
virtual bool isFUPort() const
Definition: Terminal.cc:118
BoostGraph::connectNodes
virtual void connectNodes(const Node &nTail, const Node &nHead, Edge &e)
MoveNodeGroupBuilder
Definition: MoveNodeGroupBuilder.hh:52
MoveNodeGroup::node
MoveNode & node(int index) const
Definition: MoveNodeGroup.cc:152
BoostGraph::node
Node & node(const int index) const
DataDependenceGraphBuilder::DataDependenceGraphBuilder
DataDependenceGraphBuilder()
Definition: DataDependenceGraphBuilder.cc:118
DataDependenceGraph::addProgramOperation
void addProgramOperation(ProgramOperationPtr po)
Definition: DataDependenceGraph.cc:298
MoveNode
Definition: MoveNode.hh:65
LLVMTCEDataDependenceGraphBuilder::buildLocalDDG
void buildLocalDDG(TTAProgram::BasicBlock &bb)
Definition: LLVMTCEDataDependenceGraphBuilder.cc:62
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
MoveNodeGroup::nodeCount
int nodeCount() const
Definition: MoveNodeGroup.cc:140
BasicBlockNode::basicBlock
TTAProgram::BasicBlock & basicBlock()
Definition: BasicBlockNode.cc:126
MoveNodeGroup::programOperationPtr
ProgramOperationPtr programOperationPtr() const
Definition: MoveNodeGroup.hh:75
MoveNodeGroupBuilder::build
MoveNodeGroupList * build(TTAProgram::BasicBlock &bb)
Definition: MoveNodeGroupBuilder.cc:57
DataDependenceEdge::DEP_UNKNOWN
@ DEP_UNKNOWN
Definition: DataDependenceEdge.hh:46
MoveNodeGroup::isOperation
bool isOperation() const
Definition: MoveNodeGroup.hh:74
BasicBlockNode
Definition: BasicBlockNode.hh:64
DataDependenceGraphBuilder::createOperationEdges
void createOperationEdges(ProgramOperationPtr po)
Definition: DataDependenceGraphBuilder.cc:1141
GraphBase::writeToDotFile
virtual void writeToDotFile(const TCEString &fileName) const
DataDependenceGraph::addNode
void addNode(MoveNode &moveNode)
Definition: DataDependenceGraph.cc:144
MoveNode::move
TTAProgram::Move & move()
DataDependenceGraphBuilder::currentDDG_
DataDependenceGraph * currentDDG_
Definition: DataDependenceGraphBuilder.hh:314
DataDependenceGraphBuilder::allParamRegs_
std::set< TCEString > allParamRegs_
Definition: DataDependenceGraphBuilder.hh:100
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
DataDependenceEdge
Definition: DataDependenceEdge.hh:43
TTAProgram::Move::source
Terminal & source() const
Definition: Move.cc:302
MoveNodeGroup
Definition: MoveNodeGroup.hh:48
BoostGraph::nodeCount
int nodeCount() const
MoveNodeGroupBuilder::MoveNodeGroupList
std::list< MoveNodeGroup * > MoveNodeGroupList
Definition: MoveNodeGroupBuilder.hh:54