1 //===- RDFCopy.h ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H
11 #define LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H
14 #include "RDFLiveness.h"
15 #include "RDFRegisters.h"
16 #include "llvm/CodeGen/MachineFunction.h"
22 class MachineBasicBlock;
23 class MachineDominatorTree;
28 struct CopyPropagation {
29 CopyPropagation(DataFlowGraph &dfg) : MDT(dfg.getDT()), DFG(dfg),
30 L(dfg.getMF().getRegInfo(), dfg) {}
32 virtual ~CopyPropagation() = default;
35 void trace(bool On) { Trace = On; }
36 bool trace() const { return Trace; }
37 DataFlowGraph &getDFG() { return DFG; }
39 using EqualityMap = std::map<RegisterRef, RegisterRef>;
41 virtual bool interpretAsCopy(const MachineInstr *MI, EqualityMap &EM);
44 const MachineDominatorTree &MDT;
49 // map: statement -> (map: dst reg -> src reg)
50 std::map<NodeId, EqualityMap> CopyMap;
51 std::vector<NodeId> Copies;
53 void recordCopy(NodeAddr<StmtNode*> SA, EqualityMap &EM);
54 bool scanBlock(MachineBasicBlock *B);
55 NodeId getLocalReachingDef(RegisterRef RefRR, NodeAddr<InstrNode*> IA);
58 } // end namespace rdf
60 } // end namespace llvm
62 #endif // LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H