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

Unified Diff: src/IceOperand.h

Issue 1866463002: Subzero: Improve non-MINIMAL string performance. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 8 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/IceInst.cpp ('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 04895f61b028d30c94ef4a46a57d39eab3573196..06b11e69ce32a70ef62b7f157dd9dc0d10e2c952 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -647,9 +647,12 @@ public:
}
SizeT getIndex() const { return Number; }
- std::string getName(const Cfg *Func) const;
+ std::string getName() const {
+ if (Name.hasStdString())
+ return Name.toString();
+ return "__" + std::to_string(getIndex());
+ }
virtual void setName(const Cfg *Func, const std::string &NewName) {
- (void)Func;
if (NewName.empty())
return;
Name = VariableString::createWithString(Func, NewName);
@@ -669,10 +672,10 @@ public:
void setStackOffset(int32_t Offset) { StackOffset = Offset; }
/// Returns the variable's stack offset in symbolic form, to improve
/// readability in DecorateAsm mode.
- std::string getSymbolicStackOffset(const Cfg *Func) const {
+ std::string getSymbolicStackOffset() const {
if (!BuildDefs::dump())
return "";
- return "lv$" + getName(Func);
+ return "lv$" + getName();
}
bool hasReg() const { return getRegNum().hasValue(); }
@@ -755,12 +758,6 @@ protected:
Vars = VarsReal;
Vars[0] = this;
NumVars = 1;
- if (BuildDefs::dump()) {
- Name = VariableString::createWithString(
- Func, "__" + std::to_string(getIndex()));
- } else {
- Name = VariableString::createWithoutString(Func);
- }
}
/// Number is unique across all variables, and is used as a (bit)vector index
/// for liveness analysis.
@@ -805,8 +802,8 @@ public:
void setName(const Cfg *Func, const std::string &NewName) override {
Variable::setName(Func, NewName);
if (LoVar && HiVar) {
- LoVar->setName(Func, getName(Func) + "__lo");
- HiVar->setName(Func, getName(Func) + "__hi");
+ LoVar->setName(Func, getName() + "__lo");
+ HiVar->setName(Func, getName() + "__hi");
}
}
@@ -835,8 +832,8 @@ public:
LoVar->setIsArg(getIsArg());
HiVar->setIsArg(getIsArg());
if (BuildDefs::dump()) {
- LoVar->setName(Func, getName(Func) + "__lo");
- HiVar->setName(Func, getName(Func) + "__hi");
+ LoVar->setName(Func, getName() + "__lo");
+ HiVar->setName(Func, getName() + "__hi");
}
}
« no previous file with comments | « src/IceInst.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698