OLD | NEW |
1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares the InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 Portion Part; | 135 Portion Part; |
136 }; | 136 }; |
137 | 137 |
138 // SpillVariable decorates a Variable by linking it to another | 138 // SpillVariable decorates a Variable by linking it to another |
139 // Variable. When stack frame offsets are computed, the SpillVariable | 139 // Variable. When stack frame offsets are computed, the SpillVariable |
140 // is given a distinct stack slot only if its linked Variable has a | 140 // is given a distinct stack slot only if its linked Variable has a |
141 // register. If the linked Variable has a stack slot, then the | 141 // register. If the linked Variable has a stack slot, then the |
142 // Variable and SpillVariable share that slot. | 142 // Variable and SpillVariable share that slot. |
143 class SpillVariable : public Variable { | 143 class SpillVariable : public Variable { |
144 public: | 144 public: |
145 static SpillVariable *create(Cfg *Func, Type Ty, const CfgNode *Node, | 145 static SpillVariable *create(Cfg *Func, Type Ty, SizeT Index, |
146 SizeT Index, const IceString &Name) { | 146 const IceString &Name) { |
147 return new (Func->allocate<SpillVariable>()) | 147 return new (Func->allocate<SpillVariable>()) SpillVariable(Ty, Index, Name); |
148 SpillVariable(Ty, Node, Index, Name); | |
149 } | 148 } |
150 const static OperandKind SpillVariableKind = | 149 const static OperandKind SpillVariableKind = |
151 static_cast<OperandKind>(kVariable_Target); | 150 static_cast<OperandKind>(kVariable_Target); |
152 static bool classof(const Operand *Operand) { | 151 static bool classof(const Operand *Operand) { |
153 return Operand->getKind() == SpillVariableKind; | 152 return Operand->getKind() == SpillVariableKind; |
154 } | 153 } |
155 void setLinkedTo(Variable *Var) { LinkedTo = Var; } | 154 void setLinkedTo(Variable *Var) { LinkedTo = Var; } |
156 Variable *getLinkedTo() const { return LinkedTo; } | 155 Variable *getLinkedTo() const { return LinkedTo; } |
157 // Inherit dump() and emit() from Variable. | 156 // Inherit dump() and emit() from Variable. |
158 private: | 157 private: |
159 SpillVariable(Type Ty, const CfgNode *Node, SizeT Index, | 158 SpillVariable(Type Ty, SizeT Index, const IceString &Name) |
160 const IceString &Name) | 159 : Variable(SpillVariableKind, Ty, Index, Name), LinkedTo(NULL) {} |
161 : Variable(SpillVariableKind, Ty, Node, Index, Name), LinkedTo(NULL) {} | |
162 Variable *LinkedTo; | 160 Variable *LinkedTo; |
163 }; | 161 }; |
164 | 162 |
165 class InstX8632 : public InstTarget { | 163 class InstX8632 : public InstTarget { |
166 public: | 164 public: |
167 enum InstKindX8632 { | 165 enum InstKindX8632 { |
168 k__Start = Inst::Target, | 166 k__Start = Inst::Target, |
169 Adc, | 167 Adc, |
170 Add, | 168 Add, |
171 Addps, | 169 Addps, |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 CondX86::BrCond Condition; | 384 CondX86::BrCond Condition; |
387 const CfgNode *TargetTrue; | 385 const CfgNode *TargetTrue; |
388 const CfgNode *TargetFalse; | 386 const CfgNode *TargetFalse; |
389 const InstX8632Label *Label; // Intra-block branch target | 387 const InstX8632Label *Label; // Intra-block branch target |
390 }; | 388 }; |
391 | 389 |
392 // AdjustStack instruction - subtracts esp by the given amount and | 390 // AdjustStack instruction - subtracts esp by the given amount and |
393 // updates the stack offset during code emission. | 391 // updates the stack offset during code emission. |
394 class InstX8632AdjustStack : public InstX8632 { | 392 class InstX8632AdjustStack : public InstX8632 { |
395 public: | 393 public: |
396 static InstX8632AdjustStack *create(Cfg *Func, SizeT Amount) { | 394 static InstX8632AdjustStack *create(Cfg *Func, SizeT Amount, Variable *Esp) { |
397 return new (Func->allocate<InstX8632AdjustStack>()) | 395 return new (Func->allocate<InstX8632AdjustStack>()) |
398 InstX8632AdjustStack(Func, Amount); | 396 InstX8632AdjustStack(Func, Amount, Esp); |
399 } | 397 } |
400 virtual void emit(const Cfg *Func) const; | 398 virtual void emit(const Cfg *Func) const; |
401 virtual void dump(const Cfg *Func) const; | 399 virtual void dump(const Cfg *Func) const; |
402 static bool classof(const Inst *Inst) { return isClassof(Inst, Adjuststack); } | 400 static bool classof(const Inst *Inst) { return isClassof(Inst, Adjuststack); } |
403 | 401 |
404 private: | 402 private: |
405 InstX8632AdjustStack(Cfg *Func, SizeT Amount); | 403 InstX8632AdjustStack(Cfg *Func, SizeT Amount, Variable *Esp); |
406 InstX8632AdjustStack(const InstX8632AdjustStack &) LLVM_DELETED_FUNCTION; | 404 InstX8632AdjustStack(const InstX8632AdjustStack &) LLVM_DELETED_FUNCTION; |
407 InstX8632AdjustStack &operator=(const InstX8632AdjustStack &) | 405 InstX8632AdjustStack &operator=(const InstX8632AdjustStack &) |
408 LLVM_DELETED_FUNCTION; | 406 LLVM_DELETED_FUNCTION; |
409 SizeT Amount; | 407 SizeT Amount; |
410 }; | 408 }; |
411 | 409 |
412 // Call instruction. Arguments should have already been pushed. | 410 // Call instruction. Arguments should have already been pushed. |
413 class InstX8632Call : public InstX8632 { | 411 class InstX8632Call : public InstX8632 { |
414 public: | 412 public: |
415 static InstX8632Call *create(Cfg *Func, Variable *Dest, Operand *CallTarget) { | 413 static InstX8632Call *create(Cfg *Func, Variable *Dest, Operand *CallTarget) { |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; | 1279 template <> void InstX8632Pmuludq::emit(const Cfg *Func) const; |
1282 template <> void InstX8632Psll::emit(const Cfg *Func) const; | 1280 template <> void InstX8632Psll::emit(const Cfg *Func) const; |
1283 template <> void InstX8632Psra::emit(const Cfg *Func) const; | 1281 template <> void InstX8632Psra::emit(const Cfg *Func) const; |
1284 template <> void InstX8632Psub::emit(const Cfg *Func) const; | 1282 template <> void InstX8632Psub::emit(const Cfg *Func) const; |
1285 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; | 1283 template <> void InstX8632Sqrtss::emit(const Cfg *Func) const; |
1286 template <> void InstX8632Subss::emit(const Cfg *Func) const; | 1284 template <> void InstX8632Subss::emit(const Cfg *Func) const; |
1287 | 1285 |
1288 } // end of namespace Ice | 1286 } // end of namespace Ice |
1289 | 1287 |
1290 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1288 #endif // SUBZERO_SRC_ICEINSTX8632_H |
OLD | NEW |