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

Unified Diff: src/IceOperand.h

Issue 798693003: Subzero: Don't store std::string objects inside Variable. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 6 years 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/IceInstX8632.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
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 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
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698