Chromium Code Reviews| 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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2176 break; | 2176 break; |
| 2177 } | 2177 } |
| 2178 return; | 2178 return; |
| 2179 } | 2179 } |
| 2180 Variable *T_edx = nullptr; | 2180 Variable *T_edx = nullptr; |
| 2181 Variable *T = nullptr; | 2181 Variable *T = nullptr; |
| 2182 switch (Instr->getOp()) { | 2182 switch (Instr->getOp()) { |
| 2183 case InstArithmetic::_num: | 2183 case InstArithmetic::_num: |
| 2184 llvm_unreachable("Unknown arithmetic operator"); | 2184 llvm_unreachable("Unknown arithmetic operator"); |
| 2185 break; | 2185 break; |
| 2186 case InstArithmetic::Add: | 2186 case InstArithmetic::Add: { |
| 2187 _mov(T, Src0); | 2187 bool ConvertedToLea = false; |
| 2188 _add(T, Src1); | 2188 if (getFlags().getAggressiveLea() && Func->getOptLevel() == Opt_2 && |
|
Jim Stichnoth
2016/07/19 21:29:08
Do you really need OptLevel=2? or is getAggressiv
manasijm
2016/07/28 18:01:39
Done.
| |
| 2189 _mov(Dest, T); | 2189 (Ty == IceType_i32 || (Ty == IceType_i64 && Traits::Is64Bit))) { |
| 2190 break; | 2190 Constant *Const = llvm::dyn_cast<Constant>(Instr->getSrc(1)); |
| 2191 if (Const != nullptr && (llvm::isa<ConstantInteger32>(Const) || | |
| 2192 llvm::isa<ConstantRelocatable>(Const))) { | |
| 2193 auto Var = legalize(Src0, Legal_Reg); | |
|
Jim Stichnoth
2016/07/19 21:29:08
auto *
Also, in this case you can use legalizeToR
manasijm
2016/07/28 18:01:39
Done.
| |
| 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 | |
| 2200 ConvertedToLea = true; | |
| 2201 } /*else { // Both are Variables | |
|
Jim Stichnoth
2016/07/19 21:29:09
Why is the rest of this commented out?
manasijm
2016/07/19 21:54:59
Enabling that increases code size.
And doesn't see
Jim Stichnoth
2016/07/19 22:30:29
OK. Either remove the code, or leave it in but di
manasijm
2016/07/28 18:01:39
Done.
| |
| 2202 auto Var0 = legalize(Src0, Legal_Reg); | |
| 2203 auto Var1 = legalize(Src1, Legal_Reg); | |
| 2204 auto Mem = Traits::X86OperandMem::create( | |
| 2205 Func, IceType_void, llvm::cast<Variable>(Var0), nullptr, | |
|
Jim Stichnoth
2016/07/19 21:29:08
If you use legalizeToReg() as above, you won't nee
manasijm
2016/07/28 18:01:39
Done.
| |
| 2206 llvm::cast<Variable>(Var1)); | |
| 2207 | |
| 2208 T = makeReg(Ty); | |
| 2209 _lea(T, _sandbox_mem_reference(Mem)); | |
| 2210 _mov(Dest, T); | |
| 2211 | |
| 2212 ConvertedToLea = true; | |
| 2213 }*/ | |
| 2214 } | |
| 2215 if (!ConvertedToLea) { | |
| 2216 _mov(T, Src0); | |
| 2217 _add(T, Src1); | |
| 2218 _mov(Dest, T); | |
| 2219 } | |
| 2220 } break; | |
| 2191 case InstArithmetic::And: | 2221 case InstArithmetic::And: |
| 2192 _mov(T, Src0); | 2222 _mov(T, Src0); |
| 2193 _and(T, Src1); | 2223 _and(T, Src1); |
| 2194 _mov(Dest, T); | 2224 _mov(Dest, T); |
| 2195 break; | 2225 break; |
| 2196 case InstArithmetic::Or: | 2226 case InstArithmetic::Or: |
| 2197 _mov(T, Src0); | 2227 _mov(T, Src0); |
| 2198 _or(T, Src1); | 2228 _or(T, Src1); |
| 2199 _mov(Dest, T); | 2229 _mov(Dest, T); |
| 2200 break; | 2230 break; |
| (...skipping 5833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8034 emitGlobal(*Var, SectionSuffix); | 8064 emitGlobal(*Var, SectionSuffix); |
| 8035 } | 8065 } |
| 8036 } | 8066 } |
| 8037 } break; | 8067 } break; |
| 8038 } | 8068 } |
| 8039 } | 8069 } |
| 8040 } // end of namespace X86NAMESPACE | 8070 } // end of namespace X86NAMESPACE |
| 8041 } // end of namespace Ice | 8071 } // end of namespace Ice |
| 8042 | 8072 |
| 8043 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 8073 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |