LLVM  5.0.0
RDFCopy.h
Go to the documentation of this file.
1 //===--- RDFCopy.h ----------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H
11 #define LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H
12 
13 #include "RDFGraph.h"
14 #include "RDFLiveness.h"
16 
17 #include <map>
18 #include <vector>
19 
20 namespace llvm {
21 
22  class MachineBasicBlock;
24  class MachineInstr;
25 
26 namespace rdf {
27 
28  struct CopyPropagation {
29  CopyPropagation(DataFlowGraph &dfg) : MDT(dfg.getDT()), DFG(dfg),
30  L(dfg.getMF().getRegInfo(), dfg), Trace(false) {}
31 
32  virtual ~CopyPropagation() = default;
33 
34  bool run();
35  void trace(bool On) { Trace = On; }
36  bool trace() const { return Trace; }
37  DataFlowGraph &getDFG() { return DFG; }
38 
39  typedef std::map<RegisterRef, RegisterRef> EqualityMap;
40  virtual bool interpretAsCopy(const MachineInstr *MI, EqualityMap &EM);
41 
42  private:
43  const MachineDominatorTree &MDT;
44  DataFlowGraph &DFG;
45  Liveness L;
46  bool Trace;
47 
48  // map: statement -> (map: dst reg -> src reg)
49  std::map<NodeId, EqualityMap> CopyMap;
50  std::vector<NodeId> Copies;
51 
52  void recordCopy(NodeAddr<StmtNode*> SA, EqualityMap &EM);
53  bool scanBlock(MachineBasicBlock *B);
54  NodeId getLocalReachingDef(RegisterRef RefRR, NodeAddr<InstrNode*> IA);
55  };
56 
57 } // end namespace rdf
58 
59 } // end namespace llvm
60 
61 #endif // LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H
std::map< RegisterRef, RegisterRef > EqualityMap
Definition: RDFCopy.h:39
virtual ~CopyPropagation()=default
Function Alias Analysis false
bool trace() const
Definition: RDFCopy.h:36
CopyPropagation(DataFlowGraph &dfg)
Definition: RDFCopy.h:29
virtual bool interpretAsCopy(const MachineInstr *MI, EqualityMap &EM)
Definition: RDFCopy.cpp:30
#define B
Definition: LargeTest.cpp:24
DataFlowGraph & getDFG()
Definition: RDFCopy.h:37
void trace(bool On)
Definition: RDFCopy.h:35
Representation of each machine instruction.
Definition: MachineInstr.h:59
IRTranslator LLVM IR MI
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...