Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceInstX86Base.h - Generic x86 instructions -*- C++ -*--===// | 1 //===- subzero/src/IceInstX86Base.h - Generic 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 /// \file | 10 /// \file |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 void emitIAS(const Cfg *Func) const override; | 398 void emitIAS(const Cfg *Func) const override; |
| 399 void dump(const Cfg *Func) const override; | 399 void dump(const Cfg *Func) const override; |
| 400 static bool classof(const Inst *Inst) { | 400 static bool classof(const Inst *Inst) { |
| 401 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::Jmp); | 401 return InstX86Base<Machine>::isClassof(Inst, InstX86Base<Machine>::Jmp); |
| 402 } | 402 } |
| 403 | 403 |
| 404 private: | 404 private: |
| 405 InstX86Jmp(Cfg *Func, Operand *Target); | 405 InstX86Jmp(Cfg *Func, Operand *Target); |
| 406 }; | 406 }; |
| 407 | 407 |
| 408 /// AdjustStack instruction - subtracts esp by the given amount and updates the | 408 /// AdjustStack instruction - grows the stack (moves esp down) by the given |
|
Jim Stichnoth
2015/11/13 23:30:33
Optional. I like your idea of breaking this into
sehr
2015/11/14 00:30:56
I like the idea too (obviously), but can't make th
| |
| 409 /// stack offset during code emission. | 409 /// amount. If the amount is negative, it shrinks the stack (moves esp up). |
| 410 /// It also updates the target lowering StackAdjustment during code emission. | |
| 410 template <class Machine> | 411 template <class Machine> |
| 411 class InstX86AdjustStack final : public InstX86Base<Machine> { | 412 class InstX86AdjustStack final : public InstX86Base<Machine> { |
| 412 InstX86AdjustStack() = delete; | 413 InstX86AdjustStack() = delete; |
| 413 InstX86AdjustStack(const InstX86AdjustStack &) = delete; | 414 InstX86AdjustStack(const InstX86AdjustStack &) = delete; |
| 414 InstX86AdjustStack &operator=(const InstX86AdjustStack &) = delete; | 415 InstX86AdjustStack &operator=(const InstX86AdjustStack &) = delete; |
| 415 | 416 |
| 416 public: | 417 public: |
| 417 static InstX86AdjustStack *create(Cfg *Func, SizeT Amount, Variable *Esp) { | 418 static InstX86AdjustStack *create(Cfg *Func, int32_t Amount, Variable *Esp) { |
| 418 return new (Func->allocate<InstX86AdjustStack>()) | 419 return new (Func->allocate<InstX86AdjustStack>()) |
| 419 InstX86AdjustStack(Func, Amount, Esp); | 420 InstX86AdjustStack(Func, Amount, Esp); |
| 420 } | 421 } |
| 421 void emit(const Cfg *Func) const override; | 422 void emit(const Cfg *Func) const override; |
| 422 void emitIAS(const Cfg *Func) const override; | 423 void emitIAS(const Cfg *Func) const override; |
| 423 void dump(const Cfg *Func) const override; | 424 void dump(const Cfg *Func) const override; |
| 424 static bool classof(const Inst *Inst) { | 425 static bool classof(const Inst *Inst) { |
| 425 return InstX86Base<Machine>::isClassof(Inst, | 426 return InstX86Base<Machine>::isClassof(Inst, |
| 426 InstX86Base<Machine>::Adjuststack); | 427 InstX86Base<Machine>::Adjuststack); |
| 427 } | 428 } |
| 428 | 429 |
| 429 private: | 430 private: |
| 430 InstX86AdjustStack(Cfg *Func, SizeT Amount, Variable *Esp); | 431 InstX86AdjustStack(Cfg *Func, int32_t Amount, Variable *Esp); |
| 431 SizeT Amount; | 432 int32_t Amount; |
|
Jim Stichnoth
2015/11/13 23:30:33
Oops, this should be const.
sehr
2015/11/14 00:30:56
Done.
| |
| 432 }; | 433 }; |
| 433 | 434 |
| 434 /// Call instruction. Arguments should have already been pushed. | 435 /// Call instruction. Arguments should have already been pushed. |
| 435 template <class Machine> class InstX86Call final : public InstX86Base<Machine> { | 436 template <class Machine> class InstX86Call final : public InstX86Base<Machine> { |
| 436 InstX86Call() = delete; | 437 InstX86Call() = delete; |
| 437 InstX86Call(const InstX86Call &) = delete; | 438 InstX86Call(const InstX86Call &) = delete; |
| 438 InstX86Call &operator=(const InstX86Call &) = delete; | 439 InstX86Call &operator=(const InstX86Call &) = delete; |
| 439 | 440 |
| 440 public: | 441 public: |
| 441 static InstX86Call *create(Cfg *Func, Variable *Dest, Operand *CallTarget) { | 442 static InstX86Call *create(Cfg *Func, Variable *Dest, Operand *CallTarget) { |
| (...skipping 2800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3242 &InstX86Base<Machine>::Traits::Assembler::psrl}; \ | 3243 &InstX86Base<Machine>::Traits::Assembler::psrl}; \ |
| 3243 } \ | 3244 } \ |
| 3244 } | 3245 } |
| 3245 | 3246 |
| 3246 } // end of namespace X86Internal | 3247 } // end of namespace X86Internal |
| 3247 } // end of namespace Ice | 3248 } // end of namespace Ice |
| 3248 | 3249 |
| 3249 #include "IceInstX86BaseImpl.h" | 3250 #include "IceInstX86BaseImpl.h" |
| 3250 | 3251 |
| 3251 #endif // SUBZERO_SRC_ICEINSTX86BASE_H | 3252 #endif // SUBZERO_SRC_ICEINSTX86BASE_H |
| OLD | NEW |