summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Hexagon/RDFGraph.h
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-07-22 16:09:47 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-07-22 16:09:47 +0000
commit047149f7452ac3eeeff226683d7fb1d354fc36cf (patch)
tree0410ea998146d4843d4bbedf534426804af80191 /llvm/lib/Target/Hexagon/RDFGraph.h
parent71fef77dcbef3884e98e2caf50cf69f071383e55 (diff)
downloadbcm5719-llvm-047149f7452ac3eeeff226683d7fb1d354fc36cf.tar.gz
bcm5719-llvm-047149f7452ac3eeeff226683d7fb1d354fc36cf.zip
[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. llvm-svn: 276429
Diffstat (limited to 'llvm/lib/Target/Hexagon/RDFGraph.h')
-rw-r--r--llvm/lib/Target/Hexagon/RDFGraph.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Target/Hexagon/RDFGraph.h b/llvm/lib/Target/Hexagon/RDFGraph.h
index 49b05374126..56ae6a7c507 100644
--- a/llvm/lib/Target/Hexagon/RDFGraph.h
+++ b/llvm/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;
OpenPOWER on IntegriCloud