Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: src/IceOperand.h

Issue 650613003: Subzero: Speed up VariablesMetadata initialization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceOperand.cpp » ('j') | src/IceOperand.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index 9a3160619bfd4468c1223cb45267828c5b8ecdea..68beee90bf2c01f435532322a7e60f4612ff801c 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -499,6 +499,11 @@ protected:
Variable *VarsReal[1];
};
+enum MetadataKind {
+ VMK_Uses, // Track only uses, not defs
+ VMK_SingleDefs, // Track uses+defs, but only record single def
+ VMK_All // Track uses+defs, including full def list
+};
typedef std::vector<const Inst *> InstDefList;
// VariableTracking tracks the metadata for a single variable. It is
@@ -519,16 +524,17 @@ public:
};
VariableTracking()
: MultiDef(MDS_Unknown), MultiBlock(MBS_Unknown), SingleUseNode(NULL),
- SingleDefNode(NULL) {}
+ SingleDefNode(NULL), FirstDefinition(NULL) {}
MultiDefState getMultiDef() const { return MultiDef; }
MultiBlockState getMultiBlock() const { return MultiBlock; }
const Inst *getFirstDefinition() const;
const Inst *getSingleDefinition() const;
const InstDefList &getDefinitions() const { return Definitions; }
const CfgNode *getNode() const { return SingleUseNode; }
- void markUse(const Inst *Instr, const CfgNode *Node, bool IsFromDef,
- bool IsImplicit);
- void markDef(const Inst *Instr, const CfgNode *Node);
+ void markUse(MetadataKind TrackingKind, const Inst *Instr,
+ const CfgNode *Node, bool IsFromDef, bool IsImplicit);
+ void markDef(MetadataKind TrackingKind, const Inst *Instr,
+ const CfgNode *Node);
private:
VariableTracking &operator=(const VariableTracking &) = delete;
@@ -538,7 +544,8 @@ private:
const CfgNode *SingleDefNode;
// All definitions of the variable are collected here, in increasing
// order of instruction number.
- InstDefList Definitions;
+ InstDefList Definitions; // Only used if Kind==VMK_All
+ const Inst *FirstDefinition; // A copy of Definitions[0] if Kind==VMK_All
};
// VariablesMetadata analyzes and summarizes the metadata for the
@@ -548,7 +555,7 @@ public:
VariablesMetadata(const Cfg *Func) : Func(Func) {}
// Initialize the state by traversing all instructions/variables in
// the CFG.
- void init();
+ void init(MetadataKind TrackingKind);
// Returns whether the given Variable is tracked in this object. It
// should only return false if changes were made to the CFG after
// running init(), in which case the state is stale and the results
@@ -588,6 +595,7 @@ public:
private:
const Cfg *Func;
+ MetadataKind Kind;
std::vector<VariableTracking> Metadata;
const static InstDefList NoDefinitions;
VariablesMetadata(const VariablesMetadata &) = delete;
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceOperand.cpp » ('j') | src/IceOperand.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698