OpenASIP  2.0
ControlFlowGraph.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2011 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ControlFlowGraph.hh
26  *
27  * Declaration of prototype control flow graph of TTA program
28  * representation.
29  *
30  * @author Andrea Cilio 2005 (cilio-no.spam-cs.tut.fi)
31  * @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
32  * @note rating: red
33  */
34 
35 #ifndef TTA_CONTROL_FLOW_GRAPH_HH
36 #define TTA_CONTROL_FLOW_GRAPH_HH
37 
38 
39 #include <map>
40 #include <vector>
41 
42 #include "CompilerWarnings.hh"
43 IGNORE_CLANG_WARNING("-Wunused-local-typedef")
44 IGNORE_COMPILER_WARNING("-Wunused-parameter")
45 #include <boost/graph/reverse_graph.hpp>
46 #include <boost/graph/depth_first_search.hpp>
49 
50 namespace llvm {
51  class MCSymbol;
52  class MachineInstr;
53 }
54 
55 #include "Exception.hh"
56 #include "BoostGraph.hh"
57 #include "BasicBlockNode.hh"
58 #include "ControlFlowEdge.hh"
59 #include "Address.hh"
60 #include "NullAddress.hh"
61 #include "hash_map.hh"
62 #include "ProgramOperation.hh"
63 
64 namespace TTAProgram {
65  class Program;
66  class Procedure;
67  class Instruction;
68  class Move;
69  class InstructionReferenceManager;
70  class POMRelocBookkeeper;
71  class Address;
72  class NullAddress;
73  class Immediate;
74  class Terminal;
75 }
76 
77 namespace TTAMachine {
78  class Machine;
79 }
80 
81 namespace llvm {
82  class MachineFunction;
83  class MachineBasicBlock;
84  class MCInstrDesc;
85  class MCInstrInfo;
86 }
87 
88 using boost::reverse_graph;
89 
90 class InterPassData;
92 class CFGStatistics;
93 
94 /**
95  * Control Flow Graph.
96  *
97  * The basic blocks are initially in the original program order when traversed
98  * with nodeCount()/node().
99  */
100 class ControlFlowGraph : public BoostGraph<BasicBlockNode, ControlFlowEdge> {
101 public:
103  const TCEString name,
104  TTAProgram::Program* program = NULL);
106  const TTAProgram::Procedure& procedure,
107  InterPassData& passData);
108  ControlFlowGraph(const TTAProgram::Procedure& procedure);
109  virtual ~ControlFlowGraph();
110 
111  TCEString procedureName() const;
112  int alignment() const;
113  TTAProgram::Program* program() const;
114 
115  BasicBlockNode& entryNode() const;
116  BasicBlockNode& exitNode() const;
118 
120  const CFGStatistics& statistics();
123 
124  void copyToProcedure(
125  TTAProgram::Procedure& proc,
127 
129  llvm::MachineFunction& mf,
131 
134 
135  ControlFlowEdge* incomingFTEdge(const BasicBlockNode& bbn) const;
136  EdgeSet incomingJumpEdges(const BasicBlockNode& bbn) const;
137  bool hasIncomingExternalJumps(const BasicBlockNode& bbn) const;
138 
140 
144  irm_ = &irm;
145  }
146 
150 
152  void detectBackEdges();
153 
154  void reverseGuardOnOutEdges(const BasicBlockNode& bbn);
155  void optimizeBBOrdering(
156  bool removeDeadCode,
158  DataDependenceGraph* ddg);
159  llvm::MachineBasicBlock& getMBB(
160  llvm::MachineFunction& mf,
161  const TTAProgram::BasicBlock& bb) const;
162 
164 
165  bool isSingleBBLoop(const BasicBlockNode& node) const;
167 
168  void addExit(NodeSet& retSourceNodes);
169 
170  void sanitize();
171 
173  TTAProgram::Move& move, BasicBlockNode& bb, int moveIndex);
174 
177 
178  BasicBlockNode* splitBB(BasicBlockNode& n, int remainingSize);
179 
180  bool hasFallThruPredecessor(const BasicBlockNode& bbn);
181 
183  const BasicBlockNode &src,
184  const TTAProgram::Terminal& jumpAddr,
185  const TTAMachine::Machine& mach) const;
186 
188  const BasicBlockNode& src, const BasicBlockNode& dst) const;
189 
190 private:
191  // For temporary storage
192  typedef hash_map<InstructionAddress, const TTAProgram::Instruction*>
194  typedef std::vector<InstructionAddress> InstructionAddressVector;
195  // Type of reversed underlying graph, needed for control dependence
196  // analysis
197  typedef reverse_graph<ControlFlowGraph::Graph> ReversedGraph;
200  typedef std::pair<InstructionAddress, ControlFlowEdge::CFGEdgePredicate>
202  typedef std::set<ReturnSource> ReturnSourceSet;
203  /// DFS visitor which when finding back edge marks such edge as
204  /// back edge
205  class DFSBackEdgeVisitor : public boost::default_dfs_visitor {
206  public:
208  template < typename EdgeDescriptor, typename Graph >
209  void back_edge(EdgeDescriptor e, const Graph & g)const {
210  g[e]->setBackEdge();
211  }
212  };
213 
214  void buildFrom(const TTAProgram::Procedure& procedure);
215  void createBBEdges(
216  const TTAProgram::Procedure& procedure,
217  InstructionAddressMap& leaders,
218  InstructionAddressMap& dataCodeRellocations);
219 
220  ReversedGraph& reversedGraph() const;
221 
223  const TTAProgram::Instruction& ins,
224  int moveIndex);
226  InstructionAddressMap& leaders,
227  const TTAProgram::Procedure& procedure);
229  InstructionAddressMap& leaders,
230  const TTAProgram::Procedure& procedure);
232  InstructionAddressMap& leaderSet,
233  InstructionAddressMap& dataCodeRellocations,
234  const TTAProgram::Procedure& procedure);
235 
236  void createAllBlocks(
237  InstructionAddressMap& leaders,
238  const TTAProgram::Procedure& procedure);
240  TTAProgram::Instruction& leader,
241  const TTAProgram::Instruction& endBlock);
243  const TTAProgram::Instruction& iTail,
244  const TTAProgram::Instruction& iHead,
245  ControlFlowEdge::CFGEdgePredicate edgePredicate =
249 
250  void directJump(
251  InstructionAddressMap& leaders,
252  const InstructionAddress& leaderAddr,
253  int insIndex,
254  int moveIndex,
255  const TTAProgram::Instruction& instructionTarget,
256  const TTAProgram::Procedure& procedure);
257  void indirectJump(
258  InstructionAddressMap& leaders,
259  const InstructionAddress& leaderAddr,
260  InstructionAddressMap& dataCodeRellocations,
261  int insIndex,
262  int moveIndex,
263  const TTAProgram::Procedure& procedure);
264  void createJumps(
265  InstructionAddressMap& leaders,
266  const InstructionAddress& leaderAddr,
267  InstructionAddressMap& dataCodeRellocations,
268  const TTAProgram::Procedure& procedure,
269  int insIndex,
270  int moveIndex);
271  unsigned int findNextIndex(
272  const TTAProgram::Procedure& proc,
273  int jumpInsIndex, int jumpMoveIndex);
274 
275  void addExit();
276  void addEntryExitEdge();
277  void removeEntryExitEdge();
278 
280  NodeSet findUnreachableNodes(const NodeSet& reachableNodes);
281 
283 
285  const NodeSet& unreachableNodes, DataDependenceGraph* ddg);
286  void mergeNodes(
287  BasicBlockNode& node1,
288  BasicBlockNode& node2,
289  DataDependenceGraph* ddg,
291 
292  bool jumpToBBN(
293  const TTAProgram::Terminal& jumpAddr, const BasicBlockNode& bbn) const;
294 
295 
297  JUMP_NOT_REMOVED = 0, /// nothing removed
298  JUMP_REMOVED, /// jump removed, other things remain in BB
299  LAST_ELEMENT_REMOVED /// last jump removed, no immeds in BB.
300  };
301 
304  const TTAProgram::Instruction& target,
305  int idx,
306  DataDependenceGraph* ddg = NULL);
307 
308  const llvm::MCInstrDesc&
309  findLLVMTargetInstrDesc(TCEString name, const llvm::MCInstrInfo& tii)
310  const;
311 
312  void buildMBBFromBB(
313  llvm::MachineBasicBlock& mbb,
314  const TTAProgram::BasicBlock& bb) const;
315 
316  // Data saved from original procedure object
323 
324  // Collection of all basic blocks of the control flow graph indexed by
325  // the address of their start instruction (leader).
326  hash_map<InstructionAddress, BasicBlockNode*> blocks_;
327 
328  // Mapping between original instructions and those in the cfg.
329  typedef hash_map<TTAProgram::Instruction*,TTAProgram::Instruction*>
331 
334 
335  // all basic blocks which contain a return instruction.
337 
338  // Optional interpass data to aid in the construction of the CFG.
340 
341  // IRM needs to be set explicitly if CFG is built and used without a
342  // Program object.
344 
345  // Maps BasicBlockNode onto it's MachineBasicBlock equivalent
346  mutable std::map<const TTAProgram::BasicBlock*, llvm::MachineBasicBlock*>
348 
349  /// For LLVM conversion: the dummy label instructions for SPU should be
350  /// created for with the given MCSymbol as argument after building.
351  mutable std::set<std::pair<ProgramOperationPtr, llvm::MCSymbol*> > tpos_;
352  /// For LLVM conversion: mapping of created MachineInstructions to TCE
353  /// ProgramOperations.
354  mutable std::map<ProgramOperation*, llvm::MachineInstr*>
356 };
357 #endif
ControlFlowGraph::buildMBBFromBB
void buildMBBFromBB(llvm::MachineBasicBlock &mbb, const TTAProgram::BasicBlock &bb) const
Definition: ControlFlowGraph.cc:1893
ControlFlowGraph::program
TTAProgram::Program * program() const
Definition: ControlFlowGraph.cc:1171
ControlFlowGraph::reverseGuardOnOutEdges
void reverseGuardOnOutEdges(const BasicBlockNode &bbn)
Definition: ControlFlowGraph.cc:2486
TTAProgram
Definition: Estimator.hh:65
ControlFlowGraph::findNextIndex
unsigned int findNextIndex(const TTAProgram::Procedure &proc, int jumpInsIndex, int jumpMoveIndex)
Definition: ControlFlowGraph.cc:877
llvm
Definition: InlineAsmParser.hh:49
TTAProgram::Program
Definition: Program.hh:63
ControlFlowGraph::endAddress_
TTAProgram::Address endAddress_
Definition: ControlFlowGraph.hh:321
POP_CLANG_DIAGS
#define POP_CLANG_DIAGS
Definition: CompilerWarnings.hh:96
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
ControlFlowGraph::~ControlFlowGraph
virtual ~ControlFlowGraph()
Definition: ControlFlowGraph.cc:133
ControlFlowGraph::jumpToBBN
bool jumpToBBN(const TTAProgram::Terminal &jumpAddr, const BasicBlockNode &bbn) const
Definition: ControlFlowGraph.cc:3120
ControlFlowGraph::splitBasicBlocksWithCallsAndRefs
void splitBasicBlocksWithCallsAndRefs()
Definition: ControlFlowGraph.cc:2850
ControlFlowGraph::InstructionAddressVector
std::vector< InstructionAddress > InstructionAddressVector
Definition: ControlFlowGraph.hh:194
ControlFlowGraph::returnSources_
ReturnSourceSet returnSources_
Definition: ControlFlowGraph.hh:336
ControlFlowGraph::RemovedJumpData
RemovedJumpData
Definition: ControlFlowGraph.hh:296
ControlFlowGraph::alignment
int alignment() const
Definition: ControlFlowGraph.cc:1160
TTAProgram::Address
Definition: Address.hh:51
ControlFlowGraph::JUMP_REMOVED
@ JUMP_REMOVED
nothing removed
Definition: ControlFlowGraph.hh:298
ControlFlowGraph::copyToProcedure
void copyToProcedure(TTAProgram::Procedure &proc, TTAProgram::InstructionReferenceManager *irm=NULL)
Definition: ControlFlowGraph.cc:1448
Exception.hh
BoostGraph< BasicBlockNode, ControlFlowEdge >::node
Node & node(const int index) const
ControlFlowGraph::findLimmWrite
TTAProgram::Immediate * findLimmWrite(TTAProgram::Move &move, BasicBlockNode &bb, int moveIndex)
Definition: ControlFlowGraph.cc:3037
CFGStatistics
Definition: CFGStatistics.hh:44
ControlFlowGraph::incomingFTEdge
ControlFlowEdge * incomingFTEdge(const BasicBlockNode &bbn) const
Definition: ControlFlowGraph.cc:2233
ControlFlowGraph::reversedGraph
ReversedGraph & reversedGraph() const
Definition: ControlFlowGraph.cc:989
ControlFlowGraph::alignment_
int alignment_
Definition: ControlFlowGraph.hh:322
ControlFlowGraph::removeJumpToTarget
RemovedJumpData removeJumpToTarget(TTAProgram::CodeSnippet &cs, const TTAProgram::Instruction &target, int idx, DataDependenceGraph *ddg=NULL)
Definition: ControlFlowGraph.cc:2291
ControlFlowGraph::buildFrom
void buildFrom(const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:200
BoostGraph< BasicBlockNode, ControlFlowEdge >::NodeSet
std::set< BasicBlockNode *, typename BasicBlockNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
TTAProgram::Instruction
Definition: Instruction.hh:57
BoostGraph.hh
ControlFlowGraph::printStatistics
TCEString printStatistics()
Definition: ControlFlowGraph.cc:1286
IGNORE_CLANG_WARNING
#define IGNORE_CLANG_WARNING(X)
Definition: CompilerWarnings.hh:85
BasicBlockNode.hh
ControlFlowGraph::createAllBlocks
void createAllBlocks(InstructionAddressMap &leaders, const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:503
ControlFlowGraph::startAddress_
TTAProgram::Address startAddress_
Definition: ControlFlowGraph.hh:320
ControlFlowGraph::hasMultipleUnconditionalSuccessors
bool hasMultipleUnconditionalSuccessors(const BasicBlockNode &node) const
Definition: ControlFlowGraph.cc:3103
ControlFlowGraph::updateReferencesFromProcToCfg
void updateReferencesFromProcToCfg()
Definition: ControlFlowGraph.cc:2207
ControlFlowGraph::computeLeadersFromRefManager
void computeLeadersFromRefManager(InstructionAddressMap &leaders, const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:351
ControlFlowGraph::irm_
TTAProgram::InstructionReferenceManager * irm_
Definition: ControlFlowGraph.hh:343
ControlFlowEdge::CFGEdgePredicate
CFGEdgePredicate
Definition: ControlFlowEdge.hh:52
ControlFlowGraph::createBlock
BasicBlockNode & createBlock(TTAProgram::Instruction &leader, const TTAProgram::Instruction &endBlock)
Definition: ControlFlowGraph.cc:540
ControlFlowGraph::ControlFlowGraph
ControlFlowGraph(const TCEString name, TTAProgram::Program *program=NULL)
Definition: ControlFlowGraph.cc:145
NullAddress.hh
ControlFlowGraph::ReturnSource
std::pair< InstructionAddress, ControlFlowEdge::CFGEdgePredicate > ReturnSource
Definition: ControlFlowGraph.hh:201
ControlFlowGraph::splitBasicBlockAtIndex
BasicBlockNode * splitBasicBlockAtIndex(BasicBlockNode &bbn, int index)
Definition: ControlFlowGraph.cc:2878
ControlFlowGraph::programOperationToMIMap_
std::map< ProgramOperation *, llvm::MachineInstr * > programOperationToMIMap_
For LLVM conversion: mapping of created MachineInstructions to TCE ProgramOperations.
Definition: ControlFlowGraph.hh:355
ControlFlowGraph::DFSBackEdgeVisitor::back_edge
void back_edge(EdgeDescriptor e, const Graph &g) const
Definition: ControlFlowGraph.hh:209
ControlFlowGraph::instructionReferenceManager
TTAProgram::InstructionReferenceManager & instructionReferenceManager()
Definition: ControlFlowGraph.cc:2401
ControlFlowGraph::originalToCfgInstructions_
InsMap originalToCfgInstructions_
Definition: ControlFlowGraph.hh:332
ControlFlowGraph::indirectJump
void indirectJump(InstructionAddressMap &leaders, const InstructionAddress &leaderAddr, InstructionAddressMap &dataCodeRellocations, int insIndex, int moveIndex, const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:779
ControlFlowGraph::directJump
void directJump(InstructionAddressMap &leaders, const InstructionAddress &leaderAddr, int insIndex, int moveIndex, const TTAProgram::Instruction &instructionTarget, const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:679
ControlFlowGraph::NodeDescriptor
BoostGraph< BasicBlockNode, ControlFlowEdge >::NodeDescriptor NodeDescriptor
Definition: ControlFlowGraph.hh:199
ControlFlowGraph::DFSBackEdgeVisitor
DFS visitor which when finding back edge marks such edge as back edge.
Definition: ControlFlowGraph.hh:205
ControlFlowGraph::createJumps
void createJumps(InstructionAddressMap &leaders, const InstructionAddress &leaderAddr, InstructionAddressMap &dataCodeRellocations, const TTAProgram::Procedure &procedure, int insIndex, int moveIndex)
Definition: ControlFlowGraph.cc:1190
ControlFlowGraph::bbMap_
std::map< const TTAProgram::BasicBlock *, llvm::MachineBasicBlock * > bbMap_
Definition: ControlFlowGraph.hh:347
ControlFlowEdge
Definition: ControlFlowEdge.hh:50
ControlFlowEdge::CFLOW_EDGE_NORMAL
@ CFLOW_EDGE_NORMAL
Definition: ControlFlowEdge.hh:53
ControlFlowGraph::removeEntryExitEdge
void removeEntryExitEdge()
Definition: ControlFlowGraph.cc:1125
ControlFlowGraph::findUnreachableNodes
NodeSet findUnreachableNodes(const NodeSet &reachableNodes)
Definition: ControlFlowGraph.cc:2503
ControlFlowGraph::findJumpAddress
TTAProgram::Terminal * findJumpAddress(BasicBlockNode &src, ControlFlowEdge &e)
Definition: ControlFlowGraph.cc:3006
ControlFlowGraph::ReversedGraph
reverse_graph< ControlFlowGraph::Graph > ReversedGraph
Definition: ControlFlowGraph.hh:197
TTAProgram::Immediate
Definition: Immediate.hh:54
ControlFlowGraph::InstructionAddressMap
hash_map< InstructionAddress, const TTAProgram::Instruction * > InstructionAddressMap
Definition: ControlFlowGraph.hh:193
BoostGraph< BasicBlockNode, ControlFlowEdge >::EdgeSet
std::set< ControlFlowEdge *, typename ControlFlowEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
ControlFlowGraph::addExit
void addExit()
Definition: ControlFlowGraph.cc:922
BoostGraph< BasicBlockNode, ControlFlowEdge >::connectingEdge
EdgeDescriptor connectingEdge(const Node &nTail, const Node &nHead) const
ControlFlowGraph::hasInstructionAnotherJump
bool hasInstructionAnotherJump(const TTAProgram::Instruction &ins, int moveIndex)
Definition: ControlFlowGraph.cc:758
ControlFlowGraph::findRelJumpDistance
int findRelJumpDistance(const BasicBlockNode &src, const TTAProgram::Terminal &jumpAddr, const TTAMachine::Machine &mach) const
Definition: ControlFlowGraph.cc:3137
ControlFlowGraph::ReturnSourceSet
std::set< ReturnSource > ReturnSourceSet
Definition: ControlFlowGraph.hh:202
ControlFlowGraph::computeLeadersFromJumpSuccessors
bool computeLeadersFromJumpSuccessors(InstructionAddressMap &leaders, const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:444
ControlFlowGraph::fallThroughPredecessor
BasicBlockNode * fallThroughPredecessor(const BasicBlockNode &bbn) const
Definition: ControlFlowGraph.cc:1379
BasicBlockNode
Definition: BasicBlockNode.hh:64
ControlFlowGraph::blocks_
hash_map< InstructionAddress, BasicBlockNode * > blocks_
Definition: ControlFlowGraph.hh:326
InterPassData
Definition: InterPassData.hh:48
ControlFlowGraph::firstNormalNode
BasicBlockNode & firstNormalNode() const
Definition: ControlFlowGraph.cc:1033
ProgramDependenceGraph
Definition: ProgramDependenceGraph.hh:51
ControlFlowGraph::jumpSuccessor
BasicBlockNode * jumpSuccessor(BasicBlockNode &bbn)
Definition: ControlFlowGraph.cc:2411
ControlFlowEdge::CFGEdgeType
CFGEdgeType
Definition: ControlFlowEdge.hh:59
TTAProgram::Move
Definition: Move.hh:55
BoostGraph< BasicBlockNode, ControlFlowEdge >::Graph
boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, Node *, Edge * > Graph
Internal graph type, providing actual graph-like operations. This type definition relies on bundled p...
Definition: BoostGraph.hh:247
ControlFlowGraph::isSingleBBLoop
bool isSingleBBLoop(const BasicBlockNode &node) const
Definition: ControlFlowGraph.cc:2919
ControlFlowGraph::DFSBackEdgeVisitor::DFSBackEdgeVisitor
DFSBackEdgeVisitor()
Definition: ControlFlowGraph.hh:207
BoostGraph< BasicBlockNode, ControlFlowEdge >::EdgeDescriptor
GraphTraits::edge_descriptor EdgeDescriptor
Type with which edges of the graph are seen internally.
Definition: BoostGraph.hh:262
ControlFlowGraph::allScheduledInBetween
bool allScheduledInBetween(const BasicBlockNode &src, const BasicBlockNode &dst) const
Definition: ControlFlowGraph.cc:3178
ControlFlowGraph::convertBBRefsToInstRefs
void convertBBRefsToInstRefs()
Definition: ControlFlowGraph.cc:2436
ControlFlowGraph::cfgToOriginalInstructions_
InsMap cfgToOriginalInstructions_
Definition: ControlFlowGraph.hh:333
ControlFlowGraph::passData_
InterPassData * passData_
Definition: ControlFlowGraph.hh:339
ControlFlowGraph::exitNode
BasicBlockNode & exitNode() const
Definition: ControlFlowGraph.cc:1058
TTAProgram::CodeSnippet
Definition: CodeSnippet.hh:59
ControlFlowGraph::computeLeadersFromRelocations
void computeLeadersFromRelocations(InstructionAddressMap &leaderSet, InstructionAddressMap &dataCodeRellocations, const TTAProgram::Procedure &procedure)
Definition: ControlFlowGraph.cc:397
ControlFlowGraph::findLLVMTargetInstrDesc
const llvm::MCInstrDesc & findLLVMTargetInstrDesc(TCEString name, const llvm::MCInstrInfo &tii) const
Definition: ControlFlowGraph.cc:1881
ProgramOperation.hh
ControlFlowGraph::sanitize
void sanitize()
Definition: ControlFlowGraph.cc:2938
ControlFlowGraph::procedureName_
TCEString procedureName_
Definition: ControlFlowGraph.hh:317
hash_map.hh
ControlFlowGraph::getMBB
llvm::MachineBasicBlock & getMBB(llvm::MachineFunction &mf, const TTAProgram::BasicBlock &bb) const
Definition: ControlFlowGraph.cc:2829
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
ControlFlowGraph::findReachableNodes
NodeSet findReachableNodes()
Definition: ControlFlowGraph.cc:1415
IGNORE_COMPILER_WARNING
#define IGNORE_COMPILER_WARNING(X)
Definition: CompilerWarnings.hh:51
ControlFlowGraph::setInstructionReferenceManager
void setInstructionReferenceManager(TTAProgram::InstructionReferenceManager &irm)
Definition: ControlFlowGraph.hh:142
TTAProgram::InstructionReferenceManager
Definition: InstructionReferenceManager.hh:82
ControlFlowGraph::detectBackEdges
void detectBackEdges()
Definition: ControlFlowGraph.cc:2426
ControlFlowGraph::hasIncomingExternalJumps
bool hasIncomingExternalJumps(const BasicBlockNode &bbn) const
Definition: ControlFlowGraph.cc:2253
Address.hh
ControlFlowGraph::copyToLLVMMachineFunction
void copyToLLVMMachineFunction(llvm::MachineFunction &mf, TTAProgram::InstructionReferenceManager *irm=NULL)
Definition: ControlFlowGraph.cc:1679
ControlFlowGraph::tpos_
std::set< std::pair< ProgramOperationPtr, llvm::MCSymbol * > > tpos_
For LLVM conversion: the dummy label instructions for SPU should be created for with the given MCSymb...
Definition: ControlFlowGraph.hh:351
ControlFlowGraph::InsMap
hash_map< TTAProgram::Instruction *, TTAProgram::Instruction * > InsMap
Definition: ControlFlowGraph.hh:330
TCEString
Definition: TCEString.hh:53
ControlFlowGraph::statistics
const CFGStatistics & statistics()
Definition: ControlFlowGraph.cc:1308
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
ControlFlowGraph::fallThruSuccessor
BasicBlockNode * fallThruSuccessor(const BasicBlockNode &bbn) const
Definition: ControlFlowGraph.cc:1358
POP_COMPILER_DIAGS
#define POP_COMPILER_DIAGS
Definition: CompilerWarnings.hh:68
ControlFlowGraph::entryNode
BasicBlockNode & entryNode() const
Definition: ControlFlowGraph.cc:1003
ControlFlowGraph::optimizeBBOrdering
void optimizeBBOrdering(bool removeDeadCode, TTAProgram::InstructionReferenceManager &irm, DataDependenceGraph *ddg)
Definition: ControlFlowGraph.cc:2522
ControlDependenceGraph
Definition: ControlDependenceGraph.hh:65
ControlFlowGraph::procedureName
TCEString procedureName() const
Definition: ControlFlowGraph.cc:1150
TTAProgram::Terminal
Definition: Terminal.hh:60
BoostGraph
Definition: BoostGraph.hh:83
ControlFlowGraph::LAST_ELEMENT_REMOVED
@ LAST_ELEMENT_REMOVED
jump removed, other things remain in BB
Definition: ControlFlowGraph.hh:299
ControlFlowGraph::addEntryExitEdge
void addEntryExitEdge()
Definition: ControlFlowGraph.cc:1097
ControlFlowGraph::createControlFlowEdge
ControlFlowEdge & createControlFlowEdge(const TTAProgram::Instruction &iTail, const TTAProgram::Instruction &iHead, ControlFlowEdge::CFGEdgePredicate edgePredicate=ControlFlowEdge::CFLOW_EDGE_NORMAL, ControlFlowEdge::CFGEdgeType edgeType=ControlFlowEdge::CFLOW_EDGE_JUMP)
Definition: ControlFlowGraph.cc:618
ControlFlowGraph::mergeNodes
void mergeNodes(BasicBlockNode &node1, BasicBlockNode &node2, DataDependenceGraph *ddg, const ControlFlowEdge &connectingEdge)
Definition: ControlFlowGraph.cc:2762
ControlFlowGraph::addExitFromSinkNodes
void addExitFromSinkNodes(BasicBlockNode *exitNode)
Definition: ControlFlowGraph.cc:966
TTAMachine
Definition: Assembler.hh:48
BoostGraph< BasicBlockNode, ControlFlowEdge >::name
virtual const TCEString & name() const
ControlFlowGraph::splitBB
BasicBlockNode * splitBB(BasicBlockNode &n, int remainingSize)
Definition: ControlFlowGraph.cc:3075
ControlFlowEdge.hh
TTAProgram::Procedure
Definition: Procedure.hh:55
ControlFlowGraph::procedure_
const TTAProgram::Procedure * procedure_
Definition: ControlFlowGraph.hh:319
ControlFlowGraph::JUMP_NOT_REMOVED
@ JUMP_NOT_REMOVED
Definition: ControlFlowGraph.hh:297
ControlFlowGraph::deleteNodeAndRefs
void deleteNodeAndRefs(BasicBlockNode &node)
Definition: ControlFlowGraph.cc:2395
ControlFlowEdge::CFLOW_EDGE_JUMP
@ CFLOW_EDGE_JUMP
Definition: ControlFlowEdge.hh:60
ControlFlowGraph::program_
TTAProgram::Program * program_
Definition: ControlFlowGraph.hh:318
CompilerWarnings.hh
ControlFlowGraph
Definition: ControlFlowGraph.hh:100
ControlFlowGraph::incomingJumpEdges
EdgeSet incomingJumpEdges(const BasicBlockNode &bbn) const
Definition: ControlFlowGraph.cc:2265
TTAMachine::Machine
Definition: Machine.hh:73
ControlFlowGraph::createBBEdges
void createBBEdges(const TTAProgram::Procedure &procedure, InstructionAddressMap &leaders, InstructionAddressMap &dataCodeRellocations)
Definition: ControlFlowGraph.cc:240
ControlFlowGraph::removeUnreachableNodes
void removeUnreachableNodes(const NodeSet &unreachableNodes, DataDependenceGraph *ddg)
Definition: ControlFlowGraph.cc:2740
ControlFlowGraph::hasFallThruPredecessor
bool hasFallThruPredecessor(const BasicBlockNode &bbn)
Definition: ControlFlowGraph.cc:1401