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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 this->getSrc(0)->emit(Func); | 613 this->getSrc(0)->emit(Func); |
| 614 Str << ", "; | 614 Str << ", "; |
| 615 this->getDest()->emit(Func); | 615 this->getDest()->emit(Func); |
| 616 } | 616 } |
| 617 void emitIAS(const Cfg *Func) const override { | 617 void emitIAS(const Cfg *Func) const override { |
| 618 assert(this->getSrcSize() == 1); | 618 assert(this->getSrcSize() == 1); |
| 619 const Variable *Var = this->getDest(); | 619 const Variable *Var = this->getDest(); |
| 620 Type Ty = Var->getType(); | 620 Type Ty = Var->getType(); |
| 621 const Operand *Src = this->getSrc(0); | 621 const Operand *Src = this->getSrc(0); |
| 622 constexpr bool IsLea = K == InstX86Base::Lea; | 622 constexpr bool IsLea = K == InstX86Base::Lea; |
| 623 if (IsLea) { | |
| 624 auto *MemOp = llvm::dyn_cast<X86OperandMem>(this->getSrc(0)); | |
| 625 if (MemOp != nullptr && getFlags().getAggressiveLea() && | |
|
Jim Stichnoth
2016/08/01 21:08:41
This would be better as a private method of the cl
manasijm
2016/08/01 23:14:58
Done.
| |
| 626 MemOp->getBase()->getRegNum() == this->getDest()->getRegNum() && | |
| 627 MemOp->getIndex() == nullptr && MemOp->getShift() == 0) { | |
| 628 // Reverts back to Add when the Lea is a 2-address instruction | |
| 629 auto *Add = InstImpl<TraitsType>::InstX86Add::create( | |
| 630 const_cast<Cfg *>(Func), this->getDest(), MemOp->getOffset()); | |
| 631 Add->emitIAS(Func); | |
| 632 return; | |
| 633 } | |
| 634 } | |
| 623 emitIASRegOpTyGPR(Func, IsLea, Ty, Var, Src, Emitter); | 635 emitIASRegOpTyGPR(Func, IsLea, Ty, Var, Src, Emitter); |
| 624 } | 636 } |
| 625 void dump(const Cfg *Func) const override { | 637 void dump(const Cfg *Func) const override { |
| 626 if (!BuildDefs::dump()) | 638 if (!BuildDefs::dump()) |
| 627 return; | 639 return; |
| 628 Ostream &Str = Func->getContext()->getStrDump(); | 640 Ostream &Str = Func->getContext()->getStrDump(); |
| 629 this->dumpDest(Func); | 641 this->dumpDest(Func); |
| 630 Str << " = " << Opcode << "." << this->getSrc(0)->getType() << " "; | 642 Str << " = " << Opcode << "." << this->getSrc(0)->getType() << " "; |
| 631 this->dumpSources(Func); | 643 this->dumpSources(Func); |
| 632 } | 644 } |
| (...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3611 &InstImpl<TraitsType>::Assembler::punpckldq}; \ | 3623 &InstImpl<TraitsType>::Assembler::punpckldq}; \ |
| 3612 } \ | 3624 } \ |
| 3613 } | 3625 } |
| 3614 | 3626 |
| 3615 } // end of namespace X86NAMESPACE | 3627 } // end of namespace X86NAMESPACE |
| 3616 } // end of namespace Ice | 3628 } // end of namespace Ice |
| 3617 | 3629 |
| 3618 #include "IceInstX86BaseImpl.h" | 3630 #include "IceInstX86BaseImpl.h" |
| 3619 | 3631 |
| 3620 #endif // SUBZERO_SRC_ICEINSTX86BASE_H | 3632 #endif // SUBZERO_SRC_ICEINSTX86BASE_H |
| OLD | NEW |