Chromium Code Reviews| Index: src/IceOperand.h |
| diff --git a/src/IceOperand.h b/src/IceOperand.h |
| index 99bbd39dbcb442bc8d5ebb3d8bf05e429f44361a..3b92dfb0ca9e91ddf273572f9263f8d3667dce7e 100644 |
| --- a/src/IceOperand.h |
| +++ b/src/IceOperand.h |
| @@ -388,18 +388,17 @@ class Variable : public Operand { |
| Variable(Variable &&V) = default; |
| public: |
| - static Variable *create(Cfg *Func, Type Ty, SizeT Index, |
| - const IceString &Name) { |
| - return new (Func->allocate<Variable>()) |
| - Variable(kVariable, Ty, Index, Name); |
| + static Variable *create(Cfg *Func, Type Ty, SizeT Index) { |
| + return new (Func->allocate<Variable>()) Variable(kVariable, Ty, Index); |
| } |
| SizeT getIndex() const { return Number; } |
| - IceString getName() const; |
| - void setName(IceString &NewName) { |
| + IceString getName(const Cfg *Func) const; |
| + void setName(Cfg *Func, const IceString &NewName) { |
| // Make sure that the name can only be set once. |
| - assert(Name.empty()); |
| - Name = NewName; |
| + assert(NameIndex == Cfg::IdentifierIndexInvalid); |
| + if (!NewName.empty()) |
| + NameIndex = Func->addIdentifierName(NewName); |
| } |
| bool getIsArg() const { return IsArgument; } |
| @@ -484,11 +483,11 @@ public: |
| ~Variable() override {} |
| protected: |
| - Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) |
| - : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), |
| - IsImplicitArgument(false), IgnoreLiveness(false), StackOffset(0), |
| - RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), LoVar(NULL), |
| - HiVar(NULL) { |
| + Variable(OperandKind K, Type Ty, SizeT Index) |
| + : Operand(K, Ty), Number(Index), NameIndex(Cfg::IdentifierIndexInvalid), |
| + IsArgument(false), IsImplicitArgument(false), IgnoreLiveness(false), |
| + StackOffset(0), RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), |
| + LoVar(NULL), HiVar(NULL) { |
| Vars = VarsReal; |
| Vars[0] = this; |
| NumVars = 1; |
| @@ -496,8 +495,7 @@ protected: |
| // Number is unique across all variables, and is used as a |
| // (bit)vector index for liveness analysis. |
| const SizeT Number; |
| - // Name is optional. |
| - IceString Name; |
|
JF
2014/12/11 23:45:19
That would allow you to remove the ugly default mo
Jim Stichnoth
2014/12/11 23:51:25
Unfortunately, Variable::Live is still there and i
|
| + Cfg::IdentifierIndexType NameIndex; |
| bool IsArgument; |
| bool IsImplicitArgument; |
| // IgnoreLiveness means that the variable should be ignored when |