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

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: 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
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index 99bbd39dbcb442bc8d5ebb3d8bf05e429f44361a..e4f6bba5350d04a5f0155eb43a8c16e039bbaf63 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 < 0);
+ if (!NewName.empty())
+ NameIndex = Func->addIdentifierName(NewName);
}
bool getIsArg() const { return IsArgument; }
@@ -484,8 +483,8 @@ public:
~Variable() override {}
protected:
- Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name)
- : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false),
+ Variable(OperandKind K, Type Ty, SizeT Index)
+ : Operand(K, Ty), Number(Index), NameIndex(-1), IsArgument(false),
IsImplicitArgument(false), IgnoreLiveness(false), StackOffset(0),
RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), LoVar(NULL),
HiVar(NULL) {
@@ -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;
+ int32_t 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') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698