diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-07-22 16:09:47 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-07-22 16:09:47 +0000 |
commit | 09986069b904e683a1135f21e50a01996b215c2c (patch) | |
tree | aaf566489bc29418afca3c7fe5509f3ea5432d33 /lib/Target/Hexagon/RDFGraph.h | |
parent | 44bd3bd7dc3ab285ad4cf32c000e56d6d750886f (diff) |
[RDF] Make the graph construction/use less expensive
- FuncNode::findBlock traverses the function every time. Avoid using it,
and keep a cache of block addresses in DataFlowGraph instead.
- The operator[] in the map of definition stacks was very slow. Replace
the map with unordered_map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Hexagon/RDFGraph.h')
-rw-r--r-- | lib/Target/Hexagon/RDFGraph.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Target/Hexagon/RDFGraph.h b/lib/Target/Hexagon/RDFGraph.h index 49b05374126..56ae6a7c507 100644 --- a/lib/Target/Hexagon/RDFGraph.h +++ b/lib/Target/Hexagon/RDFGraph.h @@ -210,6 +210,7 @@ #include <functional> #include <map> #include <set> +#include <unordered_map> #include <vector> namespace llvm { @@ -679,7 +680,14 @@ namespace rdf { StorageType Stack; }; - typedef std::map<RegisterRef,DefStack> DefStackMap; + struct RegisterRefHasher { + unsigned operator() (RegisterRef RR) const { + return RR.Reg | (RR.Sub << 24); + } + }; + // Make this std::unordered_map for speed of accessing elements. + typedef std::unordered_map<RegisterRef,DefStack,RegisterRefHasher> + DefStackMap; void build(unsigned Options = BuildOptions::None); void pushDefs(NodeAddr<InstrNode*> IA, DefStackMap &DM); @@ -783,9 +791,15 @@ namespace rdf { IA.Addr->removeMember(RA, *this); } + NodeAddr<BlockNode*> findBlock(MachineBasicBlock *BB) { + return BlockNodes[BB]; + } + TimerGroup TimeG; NodeAddr<FuncNode*> Func; NodeAllocator Memory; + // Local map: MachineBasicBlock -> NodeAddr<BlockNode*> + std::map<MachineBasicBlock*,NodeAddr<BlockNode*>> BlockNodes; MachineFunction &MF; const TargetInstrInfo &TII; |