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

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: Split Definitions[] into first plus the rest 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/IceRegAlloc.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 9d864fcf12d69916f2ed05a641d4ab8c3933cbd2..38e0a4b7e49640409855df851ab7fc6e7f773944 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -511,6 +511,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
@@ -531,16 +536,17 @@ public:
};
VariableTracking()
: MultiDef(MDS_Unknown), MultiBlock(MBS_Unknown), SingleUseNode(NULL),
- SingleDefNode(NULL) {}
+ SingleDefNode(NULL), FirstOrSingleDefinition(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 InstDefList &getLatterDefinitions() 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;
@@ -550,7 +556,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 *FirstOrSingleDefinition; // == Definitions[0] if Kind==VMK_All
};
// VariablesMetadata analyzes and summarizes the metadata for the
@@ -560,7 +567,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
@@ -584,7 +591,7 @@ public:
const Inst *getSingleDefinition(const Variable *Var) const;
// Returns the list of all definition instructions of the given
// Variable.
- const InstDefList &getDefinitions(const Variable *Var) const;
+ const InstDefList &getLatterDefinitions(const Variable *Var) const;
// Returns whether the given Variable is live across multiple
// blocks. Mainly, this is used to partition Variables into
@@ -600,6 +607,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/IceRegAlloc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698