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

Unified Diff: src/IceOperand.h

Issue 2107073002: Subzero: Merge SpillVariable functionality directly into Variable. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review comments. Created 4 years, 6 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/IceCfg.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 d29d25eda9e826ebcb154d5b29fa09894dfd3ac0..29d27a205b4df42f7b9b40502f46849c04229b34 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -656,7 +656,7 @@ Ostream &operator<<(Ostream &Str, const LiveRange &L);
/// Variable represents an operand that is register-allocated or
/// stack-allocated. If it is register-allocated, it will ultimately have a
-/// non-negative RegNum field.
+/// valid RegNum field.
class Variable : public Operand {
Variable() = delete;
Variable(const Variable &) = delete;
@@ -773,6 +773,23 @@ public:
/// Return reg num of base register, if different from stack/frame register.
virtual RegNumT getBaseRegNum() const { return RegNumT(); }
+ void setLinkedTo(const Variable *Var) {
+ // If B is linked to A, and we now want to link C to B, we instead link C to
+ // A so that we have one root (A) and all leaves (B, C) link directly to the
+ // root.
+ if (Var->getLinkedTo() != nullptr) {
+ Var = Var->LinkedTo;
+ assert(Var->LinkedTo == nullptr);
+ }
+ LinkedTo = Var;
+ }
+ const Variable *getLinkedTo() const {
+ // Make sure a leaf links directly to the root.
+ if (LinkedTo != nullptr)
+ assert(LinkedTo->LinkedTo == nullptr);
+ return LinkedTo;
+ }
+
static bool classof(const Operand *Operand) {
OperandKind Kind = Operand->getKind();
return Kind >= kVariable && Kind <= kVariable_Max;
@@ -814,6 +831,9 @@ protected:
LiveRange Live;
/// VarsReal (and Operand::Vars) are set up such that Vars[0] == this.
Variable *VarsReal[1];
+ /// This Variable may be "linked" to another Variable, such that if neither
+ /// Variable gets a register, they are guaranteed to share a stack location.
+ const Variable *LinkedTo = nullptr;
};
// Variable64On32 represents a 64-bit variable on a 32-bit architecture. In
« no previous file with comments | « src/IceCfg.h ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698