Index: src/IceInstX8632.h |
diff --git a/src/IceInstX8632.h b/src/IceInstX8632.h |
index a24f9863583778507d9b4d749d7980ab9671bb69..ac391701f3dec84bf679e4954aa17f44d2cd527d 100644 |
--- a/src/IceInstX8632.h |
+++ b/src/IceInstX8632.h |
@@ -135,6 +135,33 @@ private: |
Portion Part; |
}; |
+// SpillVariable decorates a Variable by linking it to another |
+// Variable. When stack frame offsets are computed, the SpillVariable |
+// is given a distinct stack slot only if its linked Variable has a |
+// register. If the linked Variable has a stack slot, then the |
+// Variable and SpillVariable share that slot. |
+class SpillVariable : public Variable { |
+public: |
+ static SpillVariable *create(Cfg *Func, Type Ty, const CfgNode *Node, |
+ SizeT Index, const IceString &Name) { |
+ return new (Func->allocate<SpillVariable>()) |
+ SpillVariable(Ty, Node, Index, Name); |
+ } |
+ const static OperandKind SpillVariableKind = |
+ static_cast<OperandKind>(kVariable_Target); |
+ static bool classof(const Operand *Operand) { |
+ return Operand->getKind() == SpillVariableKind; |
+ } |
+ void setLinkedTo(Variable *Var) { LinkedTo = Var; } |
+ Variable *getLinkedTo() const { return LinkedTo; } |
+ // Inherit dump() and emit() from Variable. |
+private: |
+ SpillVariable(Type Ty, const CfgNode *Node, SizeT Index, |
+ const IceString &Name) |
+ : Variable(SpillVariableKind, Ty, Node, Index, Name), LinkedTo(NULL) {} |
+ Variable *LinkedTo; |
+}; |
+ |
class InstX8632 : public InstTarget { |
public: |
enum InstKindX8632 { |