Index: src/IceOperand.h |
diff --git a/src/IceOperand.h b/src/IceOperand.h |
index 041adfd1556716e6e2b1acd4a7122782fa0eb0fd..dc223400d250ac744827774e7293c3334467906f 100644 |
--- a/src/IceOperand.h |
+++ b/src/IceOperand.h |
@@ -729,6 +729,7 @@ public: |
bool mustNotHaveReg() const { |
return RegRequirement == RR_MustNotHaveRegister; |
} |
+ bool mayHaveReg() const { return RegRequirement == RR_MayHaveRegister; } |
void setRematerializable(RegNumT NewRegNum, int32_t NewOffset) { |
IsRematerializable = true; |
setRegNum(NewRegNum); |
@@ -789,6 +790,17 @@ public: |
Root = Root->LinkedTo; |
return Root; |
} |
+ /// Follow the LinkedTo chain up to the furthest stack-allocated ancestor. |
+ /// This only makes sense after register allocation is complete. |
Eric Holk
2016/07/25 19:59:22
Is there an assertion you could add to make sure r
Jim Stichnoth
2016/07/26 05:59:09
I don't really think it could be done cleanly and
|
+ Variable *getLinkedToStackRoot() const { |
+ Variable *FurthestStackVar = nullptr; |
+ for (Variable *Root = LinkedTo; Root != nullptr; Root = Root->LinkedTo) { |
+ if (!Root->hasReg()) { |
+ FurthestStackVar = Root; |
+ } |
+ } |
+ return FurthestStackVar; |
+ } |
static bool classof(const Operand *Operand) { |
OperandKind Kind = Operand->getKind(); |