Chromium Code Reviews| Index: src/IceInstX86Base.h |
| diff --git a/src/IceInstX86Base.h b/src/IceInstX86Base.h |
| index 655b38d36831fe47acf75e14ca419eedc11f6e9b..dcc1f695c64bd3c540e393a0051d9aae0d6f3d59 100644 |
| --- a/src/IceInstX86Base.h |
| +++ b/src/IceInstX86Base.h |
| @@ -620,6 +620,18 @@ template <typename TraitsType> struct InstImpl { |
| Type Ty = Var->getType(); |
| const Operand *Src = this->getSrc(0); |
| constexpr bool IsLea = K == InstX86Base::Lea; |
| + if (IsLea) { |
| + auto *MemOp = llvm::dyn_cast<X86OperandMem>(this->getSrc(0)); |
| + 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.
|
| + MemOp->getBase()->getRegNum() == this->getDest()->getRegNum() && |
| + MemOp->getIndex() == nullptr && MemOp->getShift() == 0) { |
| + // Reverts back to Add when the Lea is a 2-address instruction |
| + auto *Add = InstImpl<TraitsType>::InstX86Add::create( |
| + const_cast<Cfg *>(Func), this->getDest(), MemOp->getOffset()); |
| + Add->emitIAS(Func); |
| + return; |
| + } |
| + } |
| emitIASRegOpTyGPR(Func, IsLea, Ty, Var, Src, Emitter); |
| } |
| void dump(const Cfg *Func) const override { |