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

Unified Diff: src/IceOperand.cpp

Issue 1838753002: Subzero: Remove IceString. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 9 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/IceOperand.h ('k') | src/IceRegistersARM32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.cpp
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index 213318594e65ccf2d3a0dc085f13bd5be037e781..870ca175523ad20fc4ea9fb28b47b7a0526d6c5a 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -24,6 +24,10 @@
namespace Ice {
+void Constant::initShouldBePooled() {
+ ShouldBePooled = TargetLowering::shouldBePooled(this);
+}
+
bool operator==(const RelocatableTuple &A, const RelocatableTuple &B) {
// A and B are the same if:
// (1) they have the same name; and
@@ -187,21 +191,22 @@ void LiveRange::trim(InstNumberT Lower) {
++TrimmedBegin;
}
-IceString Variable::getName(const Cfg *Func) const {
- if (Func && NameIndex >= 0)
- return Func->getIdentifierName(NameIndex);
- return "__" + std::to_string(getIndex());
+std::string Variable::getName(const Cfg *Func) const {
+ if (Func == nullptr)
+ return "__" + std::to_string(getIndex());
+ return Name.toString();
}
-const Variable *Variable::asType(Type Ty, RegNumT NewRegNum) const {
+const Variable *Variable::asType(const Cfg *Func, Type Ty,
+ RegNumT NewRegNum) const {
// Note: This returns a Variable, even if the "this" object is a subclass of
// Variable.
if (!BuildDefs::dump() || getType() == Ty)
return this;
static constexpr SizeT One = 1;
Variable *V = new (CfgLocalAllocator<Variable>().allocate(One))
- Variable(kVariable, Ty, Number);
- V->NameIndex = NameIndex;
+ Variable(Func, kVariable, Ty, Number);
+ V->Name = Name;
V->RegNum = NewRegNum.hasValue() ? NewRegNum : RegNum;
V->StackOffset = StackOffset;
return V;
@@ -605,10 +610,11 @@ Ostream &operator<<(Ostream &Str, const RegWeight &W) {
// =========== Immediate Randomization and Pooling routines ==============
// Specialization of the template member function for ConstantInteger32
// TODO(stichnot): try to move this specialization into a target-specific file.
-template <>
-bool ConstantInteger32::shouldBeRandomizedOrPooled(const GlobalContext *Ctx) {
- uint32_t Threshold = Ctx->getFlags().getRandomizeAndPoolImmediatesThreshold();
- if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_None)
+template <> bool ConstantInteger32::shouldBeRandomizedOrPooled() const {
+ uint32_t Threshold =
+ GlobalContext::getFlags().getRandomizeAndPoolImmediatesThreshold();
+ if (GlobalContext::getFlags().getRandomizeAndPoolImmediatesOption() ==
+ RPI_None)
return false;
if (getType() != IceType_i32 && getType() != IceType_i16 &&
getType() != IceType_i8)
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegistersARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698