diff options
Diffstat (limited to 'lib/Target/Hexagon/RDFLiveness.h')
| -rw-r--r-- | lib/Target/Hexagon/RDFLiveness.h | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/lib/Target/Hexagon/RDFLiveness.h b/lib/Target/Hexagon/RDFLiveness.h index 6f2615b7c4f37..8cfb6a1e9554c 100644 --- a/lib/Target/Hexagon/RDFLiveness.h +++ b/lib/Target/Hexagon/RDFLiveness.h @@ -1,4 +1,4 @@ -//===--- RDFLiveness.h ----------------------------------------------------===// +//===- RDFLiveness.h --------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -10,24 +10,27 @@ // Recalculate the liveness information given a data flow graph. // This includes block live-ins and kill flags. -#ifndef RDF_LIVENESS_H -#define RDF_LIVENESS_H +#ifndef LLVM_LIB_TARGET_HEXAGON_RDFLIVENESS_H +#define LLVM_LIB_TARGET_HEXAGON_RDFLIVENESS_H #include "RDFGraph.h" +#include "RDFRegisters.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/MC/LaneBitmask.h" #include <map> - -using namespace llvm; +#include <set> +#include <utility> namespace llvm { - class MachineBasicBlock; - class MachineFunction; - class MachineRegisterInfo; - class TargetRegisterInfo; - class MachineDominatorTree; - class MachineDominanceFrontier; + +class MachineBasicBlock; +class MachineDominanceFrontier; +class MachineDominatorTree; +class MachineRegisterInfo; +class TargetRegisterInfo; namespace rdf { + struct Liveness { public: // This is really a std::map, except that it provides a non-trivial @@ -38,32 +41,36 @@ namespace rdf { RegisterAggr &operator[] (MachineBasicBlock *B) { return Map.emplace(B, Empty).first->second; } + private: RegisterAggr Empty; std::map<MachineBasicBlock*,RegisterAggr> Map; }; - typedef std::pair<NodeId,LaneBitmask> NodeRef; - typedef std::set<NodeRef> NodeRefSet; + using NodeRef = std::pair<NodeId, LaneBitmask>; + using NodeRefSet = std::set<NodeRef>; // RegisterId in RefMap must be normalized. - typedef std::map<RegisterId,NodeRefSet> RefMap; + using RefMap = std::map<RegisterId, NodeRefSet>; Liveness(MachineRegisterInfo &mri, const DataFlowGraph &g) : DFG(g), TRI(g.getTRI()), PRI(g.getPRI()), MDT(g.getDT()), - MDF(g.getDF()), LiveMap(g.getPRI()), Empty(), - NoRegs(g.getPRI()), Trace(false) {} + MDF(g.getDF()), LiveMap(g.getPRI()), NoRegs(g.getPRI()) {} NodeList getAllReachingDefs(RegisterRef RefRR, NodeAddr<RefNode*> RefA, bool TopShadows, bool FullChain, const RegisterAggr &DefRRs); + NodeList getAllReachingDefs(NodeAddr<RefNode*> RefA) { return getAllReachingDefs(RefA.Addr->getRegRef(DFG), RefA, false, false, NoRegs); } + NodeList getAllReachingDefs(RegisterRef RefRR, NodeAddr<RefNode*> RefA) { return getAllReachingDefs(RefRR, RefA, false, false, NoRegs); } + NodeSet getAllReachedUses(RegisterRef RefRR, NodeAddr<DefNode*> DefA, const RegisterAggr &DefRRs); + NodeSet getAllReachedUses(RegisterRef RefRR, NodeAddr<DefNode*> DefA) { return getAllReachedUses(RefRR, DefA, NoRegs); } @@ -76,6 +83,7 @@ namespace rdf { LiveMapType &getLiveMap() { return LiveMap; } const LiveMapType &getLiveMap() const { return LiveMap; } + const RefMap &getRealUses(NodeId P) const { auto F = RealUseMap.find(P); return F == RealUseMap.end() ? Empty : F->second; @@ -98,12 +106,12 @@ namespace rdf { LiveMapType LiveMap; const RefMap Empty; const RegisterAggr NoRegs; - bool Trace; + bool Trace = false; // Cache of mapping from node ids (for RefNodes) to the containing // basic blocks. Not computing it each time for each node reduces // the liveness calculation time by a large fraction. - typedef DenseMap<NodeId,MachineBasicBlock*> NodeBlockMap; + using NodeBlockMap = DenseMap<NodeId, MachineBasicBlock *>; NodeBlockMap NBMap; // Phi information: @@ -134,7 +142,9 @@ namespace rdf { NodeAddr<RefNode*> RefA, NodeSet &Visited, const NodeSet &Defs, unsigned Nest, unsigned MaxNest); }; -} // namespace rdf -} // namespace llvm -#endif // RDF_LIVENESS_H +} // end namespace rdf + +} // end namespace llvm + +#endif // LLVM_LIB_TARGET_HEXAGON_RDFLIVENESS_H |
