OLD | NEW |
---|---|
1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- 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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2177 break; | 2177 break; |
2178 } | 2178 } |
2179 return; | 2179 return; |
2180 } | 2180 } |
2181 Variable *T_edx = nullptr; | 2181 Variable *T_edx = nullptr; |
2182 Variable *T = nullptr; | 2182 Variable *T = nullptr; |
2183 switch (Instr->getOp()) { | 2183 switch (Instr->getOp()) { |
2184 case InstArithmetic::_num: | 2184 case InstArithmetic::_num: |
2185 llvm_unreachable("Unknown arithmetic operator"); | 2185 llvm_unreachable("Unknown arithmetic operator"); |
2186 break; | 2186 break; |
2187 case InstArithmetic::Add: | 2187 case InstArithmetic::Add: { |
John
2016/07/11 21:28:43
LEA are pretty powerful. You can use it as a gener
| |
2188 _mov(T, Src0); | 2188 Constant *Const = llvm::dyn_cast<Constant>(Instr->getSrc(1)); |
2189 _add(T, Src1); | 2189 if (getFlags().getAggressiveLea() && Func->getOptLevel() == Opt_2 && |
2190 _mov(Dest, T); | 2190 Const != nullptr && (llvm::isa<ConstantInteger32>(Const) || |
2191 break; | 2191 llvm::isa<ConstantRelocatable>(Const)) && |
2192 (Ty == IceType_i32 || Ty == IceType_i64)) { | |
2193 auto Var = legalize(Src0, Legal_Reg); | |
2194 auto Mem = Traits::X86OperandMem::create( | |
2195 Func, IceType_void, llvm::cast<Variable>(Var), Const); | |
2196 T = makeReg(Ty); | |
2197 _lea(T, _sandbox_mem_reference(Mem)); | |
2198 _mov(Dest, T); | |
2199 } else { | |
2200 _mov(T, Src0); | |
2201 _add(T, Src1); | |
2202 _mov(Dest, T); | |
2203 } | |
2204 } break; | |
2192 case InstArithmetic::And: | 2205 case InstArithmetic::And: |
2193 _mov(T, Src0); | 2206 _mov(T, Src0); |
2194 _and(T, Src1); | 2207 _and(T, Src1); |
2195 _mov(Dest, T); | 2208 _mov(Dest, T); |
2196 break; | 2209 break; |
2197 case InstArithmetic::Or: | 2210 case InstArithmetic::Or: |
2198 _mov(T, Src0); | 2211 _mov(T, Src0); |
2199 _or(T, Src1); | 2212 _or(T, Src1); |
2200 _mov(Dest, T); | 2213 _mov(Dest, T); |
2201 break; | 2214 break; |
(...skipping 5830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8032 emitGlobal(*Var, SectionSuffix); | 8045 emitGlobal(*Var, SectionSuffix); |
8033 } | 8046 } |
8034 } | 8047 } |
8035 } break; | 8048 } break; |
8036 } | 8049 } |
8037 } | 8050 } |
8038 } // end of namespace X86NAMESPACE | 8051 } // end of namespace X86NAMESPACE |
8039 } // end of namespace Ice | 8052 } // end of namespace Ice |
8040 | 8053 |
8041 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 8054 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
OLD | NEW |