OpenASIP  2.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
LiveRangeData Struct Reference

#include <LiveRangeData.hh>

Collaboration diagram for LiveRangeData:
Collaboration graph

Public Types

typedef std::set< MoveNodeUseMoveNodeUseSet
 
typedef std::map< TCEString, MoveNodeUseSetMoveNodeUseMapSet
 
typedef std::map< TCEString, MoveNodeUseMoveNodeUseMap
 
typedef std::map< TCEString, std::pair< MoveNodeUse, MoveNodeUse > > MoveNodeUseMapPair
 
typedef std::pair< TCEString, MoveNodeUseSetMoveNodeUseSetPair
 
typedef std::pair< TCEString, MoveNodeUseMoveNodeUsePair
 

Public Member Functions

std::set< TCEStringregistersAlive (int cycle, int delaySlots, class DataDependenceGraph &ddg)
 
const std::set< TCEString > & usedAfter ()
 
void merge (LiveRangeData &succ)
 

Static Public Member Functions

static bool appendUseMapSets (const MoveNodeUseMapSet &srcMap, MoveNodeUseMapSet &dstMap, bool addLoopProperty)
 
static void appendMoveNodeUse (const MoveNodeUseSet &src, MoveNodeUseSet &dst, bool setLoopProperty)
 

Public Attributes

MoveNodeUseMapSet regDefines_
 
MoveNodeUseMapSet regLastUses_
 
MoveNodeUseMapPair regLastKills_
 
std::map< TCEString, std::pair< MoveNodeUse, bool > > potentialRegKills_
 
MoveNodeUseMapPair regKills_
 
MoveNodeUseMapSet regFirstUses_
 
MoveNodeUseMapSet regFirstDefines_
 
MoveNodeUseMapSet regDefReaches_
 
MoveNodeUseMapSet regUseReaches_
 
MoveNodeUseMapSet regDefAfter_
 
MoveNodeUseMapSet regUseAfter_
 
MoveNodeUseMapSet memDefines_
 
MoveNodeUseMapSet memLastUses_
 
MoveNodeUseMap memLastKill_
 
MoveNodeUseMap memKills_
 
MoveNodeUseMapSet memFirstUses_
 
MoveNodeUseMapSet memFirstDefines_
 
MoveNodeUseMapSet memDefReaches_
 
MoveNodeUseMapSet memUseReaches_
 
MoveNodeUseMapSet memDefAfter_
 
MoveNodeUseMapSet memUseAfter_
 
MoveNodeUseSet fuDepReaches_
 
MoveNodeUseSet fuDeps_
 
MoveNodeUseSet fuDepAfter_
 
std::set< TCEStringregistersUsedAfter_
 
std::set< TCEStringregistersUsedInOrAfter_
 
std::set< TCEStringinlineAsmRegUses_
 
std::set< TCEStringinlineAsmRegDefs_
 
std::set< TCEStringinlineAsmClobbers_
 

Detailed Description

Definition at line 47 of file LiveRangeData.hh.

Member Typedef Documentation

◆ MoveNodeUseMap

Definition at line 53 of file LiveRangeData.hh.

◆ MoveNodeUseMapPair

Definition at line 55 of file LiveRangeData.hh.

◆ MoveNodeUseMapSet

Definition at line 52 of file LiveRangeData.hh.

◆ MoveNodeUsePair

Definition at line 58 of file LiveRangeData.hh.

◆ MoveNodeUseSet

Definition at line 51 of file LiveRangeData.hh.

◆ MoveNodeUseSetPair

Definition at line 57 of file LiveRangeData.hh.

Member Function Documentation

◆ appendMoveNodeUse()

void LiveRangeData::appendMoveNodeUse ( const MoveNodeUseSet src,
LiveRangeData::MoveNodeUseSet dst,
bool  setLoopProperty 
)
static

Appends a MoveNodeUseSet to another. May set loop property of copied moves to true.

Parameters
srcsource set
dstdestination set
setLoopPropertywhether to set loop property true in copied data

Definition at line 107 of file LiveRangeData.cc.

110  {
111 
112  for (LiveRangeData::MoveNodeUseSet::const_iterator i =
113  src.begin(); i != src.end(); i++) {
114  const MoveNodeUse& mnu = *i;
115  if (setLoopProperty || mnu.loop()) {
116  dst.insert(MoveNodeUse(mnu, MoveNodeUse::LOOP));
117  } else {
118  dst.insert(MoveNodeUse(mnu, MoveNodeUse::INTRA_BB));
119  }
120  }
121 }

References MoveNodeUse::INTRA_BB, MoveNodeUse::LOOP, and MoveNodeUse::loop().

Referenced by appendUseMapSets(), and DataDependenceGraphBuilder::setSucceedingPredepsForBB().

Here is the call graph for this function:

◆ appendUseMapSets()

bool LiveRangeData::appendUseMapSets ( const MoveNodeUseMapSet srcMap,
MoveNodeUseMapSet dstMap,
bool  addLoopProperty 
)
static

This appends the data from one MoveNodeUseMapSet to another.

it traverses the map, and for every string, set pair it finds or creates the corresponging set in the destination and appends the set to that set. This is used for copying alive definitions.

Parameters
srcMapsource where to copy from
dstMapdestination where to copy to.
addLoopPropertywhether to add loop property to the copied bookkeeping, ie create edges with loop property.
Returns
true if destination changed (needs updating)

Definition at line 79 of file LiveRangeData.cc.

81  {
82  bool changed = false;
83  for (MoveNodeUseMapSet::const_iterator srcIter = srcMap.begin();
84  srcIter != srcMap.end(); srcIter++) {
85  TCEString reg = srcIter->first;
86  const MoveNodeUseSet& srcSet = srcIter->second;
87  MoveNodeUseSet& dstSet = dstMap[reg];
88  // dest set size before appending.
89  size_t size = dstSet.size();
90  appendMoveNodeUse(srcSet, dstSet, addLoopProperty);
91  // if size has changed, dest is changed.
92  if (dstSet.size() > size) {
93  changed = true;
94  }
95  }
96  return changed;
97 }

References appendMoveNodeUse().

Referenced by merge(), DataDependenceGraphBuilder::setSucceedingPredepsForBB(), DataDependenceGraphBuilder::updateMemAndFuAliveAfter(), and DataDependenceGraphBuilder::updateRegistersAliveAfter().

Here is the call graph for this function:

◆ merge()

void LiveRangeData::merge ( LiveRangeData succ)

merges liverangedata of successor into this.

Parameters
succlater basic block which is merged into this one.

Definition at line 47 of file LiveRangeData.cc.

47  {
48 
49  // copy outgoing live information as it is from successor
52 
53  // after this BB alive regs are those that are alive after the latter bb.
55 
56  // then in incoming deps, merge from both.
57 
61 
62 }

References appendUseMapSets(), regDefines_, regDefReaches_, regFirstDefines_, regFirstUses_, registersUsedAfter_, and regLastUses_.

Referenced by ControlFlowGraph::mergeNodes().

Here is the call graph for this function:

◆ registersAlive()

std::set< TCEString > LiveRangeData::registersAlive ( int  cycle,
int  delaySlots,
class DataDependenceGraph ddg 
)

Returns the set of registers that are alive at the given cycle.

Definition at line 127 of file LiveRangeData.cc.

128  {
129 
130  std::set<TCEString> aliveRegs;
131 
132  // Part 1: Live ranges incoming to this BB.
133  // handles both incoming and overgoing live ranges
134  for (MoveNodeUseMapSet::iterator rdrIter = regDefReaches_.begin();
135  rdrIter != regDefReaches_.end(); rdrIter++) {
136  const TCEString& reg = rdrIter->first;
137 
138  // if use after and not killed here, alive for the whole BB.
139  if (registersUsedAfter_.find(reg) != registersUsedAfter_.end()) {
140  // nothing in this BB overwrites this.
141  if (regKills_.find(reg) == regKills_.end()) {
142  aliveRegs.insert(reg);
143  }
144  }
145 
146  // check for first uses in this BB. If before a read, is used.
147  MoveNodeUseSet& firstUses = regFirstUses_[reg];
148  for (MoveNodeUseSet::iterator iter = firstUses.begin();
149  iter != firstUses.end(); iter++) {
150  const MoveNode& mn = *(iter->mn());
151  if (mn.isScheduled()) {
152  int mnCycle = mn.cycle();
153  if (iter->pseudo()) {
154  mnCycle += delaySlots;
155  }
156  if (cycle <= mnCycle) {
157  aliveRegs.insert(reg);
158  }
159  } else { // unscheduled.. later?
160  aliveRegs.insert(reg);
161  }
162  }
163  }
164 
165  // Part 2: check deps going out from this.
166  for (std::set<TCEString>::iterator ruaIter = registersUsedAfter_.begin();
167  ruaIter != registersUsedAfter_.end(); ruaIter++) {
168  const TCEString& reg = *ruaIter;
169 
170  // check against last defines.
171  MoveNodeUseSet& lastDefs = regDefines_[reg];
172  for (MoveNodeUseSet::iterator iter = lastDefs.begin();
173  iter != lastDefs.end(); iter++) {
174  const MoveNode& mn = *iter->mn();
175  if (mn.isScheduled()) {
176  int mnCycle = mn.cycle();
177  if (iter->pseudo()) {
178  mnCycle += delaySlots;
179  }
180  if (cycle >= mnCycle) {
181  aliveRegs.insert(reg);
182  }
183  }
184  // if not scheduld, is at end?
185  }
186  }
187 
188  // part 3: Check edges inside this BB. done from DDG.
189 
190  // TODO: psedo-dep delay slots.
191  for (int i = 0; i < ddg.nodeCount(); i++) {
192  MoveNode& node = ddg.node(i);
193  // only check writes that are scheduled.
194  if (!node.isScheduled() || node.cycle() > cycle) {
195  continue; // write after the given cycle
196  }
197 
198  // Find all edges out from this
199  DataDependenceGraph::EdgeSet edges = ddg.outEdges(node);
200  for (DataDependenceGraph::EdgeSet::iterator eIter =
201  edges.begin(); eIter != edges.end(); eIter++) {
202  DataDependenceEdge& edge = **eIter;
203 
204  // we are only interested in register RAWs.
208  const TCEString& reg = edge.data();
209  MoveNode &headNode = ddg.headNode(edge);
210  // if tail pseudo, delay by delaySlots amount
211  if (edge.tailPseudo()) {
212  if (node.cycle() + delaySlots > cycle) {
213  continue;
214  }
215  }
216  // if pseudo, delay mncycle by delayslot amount
217  int delay = edge.headPseudo() ? delaySlots : 0;
218  // is the read after this
219  if (headNode.isScheduled() &&
220  headNode.cycle()+delay >= cycle) {
221  aliveRegs.insert(reg);
222  }
223  }
224  }
225  }
226  return aliveRegs;
227 }

References MoveNode::cycle(), DataDependenceEdge::data(), DataDependenceEdge::DEP_RAW, DataDependenceEdge::dependenceType(), DataDependenceEdge::EDGE_RA, DataDependenceEdge::EDGE_REGISTER, DataDependenceEdge::edgeReason(), BoostGraph< GraphNode, GraphEdge >::headNode(), DataDependenceEdge::headPseudo(), MoveNode::isScheduled(), BoostGraph< GraphNode, GraphEdge >::node(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), BoostGraph< GraphNode, GraphEdge >::outEdges(), regDefines_, regDefReaches_, regFirstUses_, registersUsedAfter_, regKills_, and DataDependenceEdge::tailPseudo().

Referenced by BasicBlockPass::executeDDGPass().

Here is the call graph for this function:

◆ usedAfter()

const std::set<TCEString>& LiveRangeData::usedAfter ( )
inline

Definition at line 60 of file LiveRangeData.hh.

60  {
61  return registersUsedAfter_;
62  }

References registersUsedAfter_.

Member Data Documentation

◆ fuDepAfter_

MoveNodeUseSet LiveRangeData::fuDepAfter_

◆ fuDepReaches_

MoveNodeUseSet LiveRangeData::fuDepReaches_

◆ fuDeps_

MoveNodeUseSet LiveRangeData::fuDeps_

◆ inlineAsmClobbers_

std::set<TCEString> LiveRangeData::inlineAsmClobbers_

◆ inlineAsmRegDefs_

std::set<TCEString> LiveRangeData::inlineAsmRegDefs_

◆ inlineAsmRegUses_

std::set<TCEString> LiveRangeData::inlineAsmRegUses_

◆ memDefAfter_

MoveNodeUseMapSet LiveRangeData::memDefAfter_

◆ memDefines_

MoveNodeUseMapSet LiveRangeData::memDefines_

◆ memDefReaches_

MoveNodeUseMapSet LiveRangeData::memDefReaches_

◆ memFirstDefines_

MoveNodeUseMapSet LiveRangeData::memFirstDefines_

◆ memFirstUses_

MoveNodeUseMapSet LiveRangeData::memFirstUses_

◆ memKills_

MoveNodeUseMap LiveRangeData::memKills_

◆ memLastKill_

MoveNodeUseMap LiveRangeData::memLastKill_

Definition at line 100 of file LiveRangeData.hh.

Referenced by DataDependenceGraphBuilder::processMemWrite().

◆ memLastUses_

MoveNodeUseMapSet LiveRangeData::memLastUses_

◆ memUseAfter_

MoveNodeUseMapSet LiveRangeData::memUseAfter_

◆ memUseReaches_

MoveNodeUseMapSet LiveRangeData::memUseReaches_

◆ potentialRegKills_

std::map<TCEString, std::pair<MoveNodeUse, bool> > LiveRangeData::potentialRegKills_

◆ regDefAfter_

MoveNodeUseMapSet LiveRangeData::regDefAfter_

◆ regDefines_

MoveNodeUseMapSet LiveRangeData::regDefines_

◆ regDefReaches_

MoveNodeUseMapSet LiveRangeData::regDefReaches_

◆ regFirstDefines_

MoveNodeUseMapSet LiveRangeData::regFirstDefines_

◆ regFirstUses_

MoveNodeUseMapSet LiveRangeData::regFirstUses_

◆ registersUsedAfter_

std::set<TCEString> LiveRangeData::registersUsedAfter_

◆ registersUsedInOrAfter_

std::set<TCEString> LiveRangeData::registersUsedInOrAfter_

◆ regKills_

MoveNodeUseMapPair LiveRangeData::regKills_

◆ regLastKills_

MoveNodeUseMapPair LiveRangeData::regLastKills_

◆ regLastUses_

MoveNodeUseMapSet LiveRangeData::regLastUses_

◆ regUseAfter_

MoveNodeUseMapSet LiveRangeData::regUseAfter_

◆ regUseReaches_

MoveNodeUseMapSet LiveRangeData::regUseReaches_

The documentation for this struct was generated from the following files:
LiveRangeData::appendMoveNodeUse
static void appendMoveNodeUse(const MoveNodeUseSet &src, MoveNodeUseSet &dst, bool setLoopProperty)
Definition: LiveRangeData.cc:107
LiveRangeData::MoveNodeUseSet
std::set< MoveNodeUse > MoveNodeUseSet
Definition: LiveRangeData.hh:51
MoveNodeUse
Definition: MoveNodeUse.hh:20
LiveRangeData::regDefines_
MoveNodeUseMapSet regDefines_
Definition: LiveRangeData.hh:78
MoveNode
Definition: MoveNode.hh:65
LiveRangeData::regKills_
MoveNodeUseMapPair regKills_
Definition: LiveRangeData.hh:85
DataDependenceEdge::EDGE_REGISTER
@ EDGE_REGISTER
Definition: DataDependenceEdge.hh:53
DataDependenceEdge::dependenceType
DependenceType dependenceType() const
Definition: DataDependenceEdge.hh:88
LiveRangeData::regDefReaches_
MoveNodeUseMapSet regDefReaches_
Definition: LiveRangeData.hh:90
DataDependenceEdge::tailPseudo
bool tailPseudo() const
Definition: DataDependenceEdge.hh:109
MoveNodeUse::loop
bool loop() const
Definition: MoveNodeUse.hh:43
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
BoostGraph< MoveNode, DataDependenceEdge >::EdgeSet
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
DataDependenceEdge::DEP_RAW
@ DEP_RAW
Definition: DataDependenceEdge.hh:47
LiveRangeData::regFirstDefines_
MoveNodeUseMapSet regFirstDefines_
Definition: LiveRangeData.hh:87
LiveRangeData::regLastUses_
MoveNodeUseMapSet regLastUses_
Definition: LiveRangeData.hh:79
MoveNodeUse::INTRA_BB
@ INTRA_BB
Definition: MoveNodeUse.hh:24
MoveNodeUse::LOOP
@ LOOP
Definition: MoveNodeUse.hh:26
DataDependenceEdge::data
const TCEString data() const
Definition: DataDependenceEdge.hh:142
LiveRangeData::registersUsedAfter_
std::set< TCEString > registersUsedAfter_
Definition: LiveRangeData.hh:121
TCEString
Definition: TCEString.hh:53
DataDependenceEdge
Definition: DataDependenceEdge.hh:43
MoveNode::isScheduled
bool isScheduled() const
Definition: MoveNode.cc:409
DataDependenceEdge::headPseudo
bool headPseudo() const
Definition: DataDependenceEdge.hh:115
LiveRangeData::appendUseMapSets
static bool appendUseMapSets(const MoveNodeUseMapSet &srcMap, MoveNodeUseMapSet &dstMap, bool addLoopProperty)
Definition: LiveRangeData.cc:79
DataDependenceEdge::EDGE_RA
@ EDGE_RA
Definition: DataDependenceEdge.hh:57
DataDependenceEdge::edgeReason
EdgeReason edgeReason() const
Definition: DataDependenceEdge.hh:91
LiveRangeData::regFirstUses_
MoveNodeUseMapSet regFirstUses_
Definition: LiveRangeData.hh:86