| 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;
|
|
|