Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// | 1 //===- subzero/src/IceInstX86BaseImpl.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 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2018 Str << "storeq." << this->getSrc(0)->getType() << " "; | 2018 Str << "storeq." << this->getSrc(0)->getType() << " "; |
| 2019 this->getSrc(1)->dump(Func); | 2019 this->getSrc(1)->dump(Func); |
| 2020 Str << ", "; | 2020 Str << ", "; |
| 2021 this->getSrc(0)->dump(Func); | 2021 this->getSrc(0)->dump(Func); |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 template <typename TraitsType> | 2024 template <typename TraitsType> |
| 2025 void InstImpl<TraitsType>::InstX86Lea::emit(const Cfg *Func) const { | 2025 void InstImpl<TraitsType>::InstX86Lea::emit(const Cfg *Func) const { |
| 2026 if (!BuildDefs::dump()) | 2026 if (!BuildDefs::dump()) |
| 2027 return; | 2027 return; |
| 2028 | |
| 2029 auto *MemOp = llvm::dyn_cast<X86OperandMem>(this->getSrc(0)); | |
| 2030 if (MemOp != nullptr && getFlags().getAggressiveLea() && | |
| 2031 MemOp->getBase()->getRegNum() == this->getDest()->getRegNum() && | |
| 2032 MemOp->getIndex() == nullptr && MemOp->getShift() == 0) { | |
| 2033 // Reverts back to Add when the Lea is a 2-address instruction | |
| 2034 auto *Add = InstImpl<TraitsType>::InstX86Add::create( | |
| 2035 const_cast<Cfg *>(Func), this->getDest(), MemOp->getOffset()); | |
| 2036 //TODO: Remove const_cast by emitting code for add directly. | |
|
Jim Stichnoth
2016/08/01 21:08:41
TODO(owner)
also, odd that there's no spaced afte
manasijm
2016/08/01 23:14:58
Done.
| |
| 2037 // Using the allocator does not help because the constructor for | |
| 2038 // InstX86Lea takes a non-const Cfg * | |
| 2039 Add->emit(Func); | |
| 2040 return; | |
| 2041 } | |
| 2042 | |
| 2028 Ostream &Str = Func->getContext()->getStrEmit(); | 2043 Ostream &Str = Func->getContext()->getStrEmit(); |
| 2029 assert(this->getSrcSize() == 1); | 2044 assert(this->getSrcSize() == 1); |
| 2030 assert(this->getDest()->hasReg()); | 2045 assert(this->getDest()->hasReg()); |
| 2031 Str << "\t" | 2046 Str << "\t" |
| 2032 "lea" << this->getWidthString(this->getDest()->getType()) << "\t"; | 2047 "lea" << this->getWidthString(this->getDest()->getType()) << "\t"; |
| 2033 Operand *Src0 = this->getSrc(0); | 2048 Operand *Src0 = this->getSrc(0); |
| 2034 if (const auto *Src0Var = llvm::dyn_cast<Variable>(Src0)) { | 2049 if (const auto *Src0Var = llvm::dyn_cast<Variable>(Src0)) { |
| 2035 Type Ty = Src0Var->getType(); | 2050 Type Ty = Src0Var->getType(); |
| 2036 // lea on x86-32 doesn't accept mem128 operands, so cast VSrc0 to an | 2051 // lea on x86-32 doesn't accept mem128 operands, so cast VSrc0 to an |
| 2037 // acceptable type. | 2052 // acceptable type. |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2938 return; | 2953 return; |
| 2939 Ostream &Str = Func->getContext()->getStrDump(); | 2954 Ostream &Str = Func->getContext()->getStrDump(); |
| 2940 Str << "IACA_END"; | 2955 Str << "IACA_END"; |
| 2941 } | 2956 } |
| 2942 | 2957 |
| 2943 } // end of namespace X86NAMESPACE | 2958 } // end of namespace X86NAMESPACE |
| 2944 | 2959 |
| 2945 } // end of namespace Ice | 2960 } // end of namespace Ice |
| 2946 | 2961 |
| 2947 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H | 2962 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H |
| OLD | NEW |