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
19 class MachineBasicBlock;
20 class MachineDominatorTree;
25 struct CopyPropagation {
26 CopyPropagation(DataFlowGraph &dfg) : MDT(dfg.getDT()), DFG(dfg),
29 virtual ~CopyPropagation() = default;
32 void trace(bool On) { Trace = On; }
33 bool trace() const { return Trace; }
34 DataFlowGraph &getDFG() { return DFG; }
36 typedef std::map<RegisterRef, RegisterRef> EqualityMap;
37 virtual bool interpretAsCopy(const MachineInstr *MI, EqualityMap &EM);
40 const MachineDominatorTree &MDT;
42 DataFlowGraph::DefStackMap DefM;
45 // map: register -> (map: stmt -> reaching def)
46 std::map<RegisterRef,std::map<NodeId,NodeId>> RDefMap;
47 // map: statement -> (map: dst reg -> src reg)
48 std::map<NodeId, EqualityMap> CopyMap;
49 std::vector<NodeId> Copies;
51 void recordCopy(NodeAddr<StmtNode*> SA, EqualityMap &EM);
52 void updateMap(NodeAddr<InstrNode*> IA);
53 bool scanBlock(MachineBasicBlock *B);
56 } // end namespace rdf
58 } // end namespace llvm
60 #endif // LLVM_LIB_TARGET_HEXAGON_RDFCOPY_H