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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1276 template <class Machine> | 1276 template <class Machine> |
1277 void TargetX86Base<Machine>::lowerArithmetic(const InstArithmetic *Inst) { | 1277 void TargetX86Base<Machine>::lowerArithmetic(const InstArithmetic *Inst) { |
1278 Variable *Dest = Inst->getDest(); | 1278 Variable *Dest = Inst->getDest(); |
1279 Operand *Src0 = legalize(Inst->getSrc(0)); | 1279 Operand *Src0 = legalize(Inst->getSrc(0)); |
1280 Operand *Src1 = legalize(Inst->getSrc(1)); | 1280 Operand *Src1 = legalize(Inst->getSrc(1)); |
1281 if (Inst->isCommutative()) { | 1281 if (Inst->isCommutative()) { |
1282 if (!llvm::isa<Variable>(Src0) && llvm::isa<Variable>(Src1)) | 1282 if (!llvm::isa<Variable>(Src0) && llvm::isa<Variable>(Src1)) |
1283 std::swap(Src0, Src1); | 1283 std::swap(Src0, Src1); |
1284 if (llvm::isa<Constant>(Src0) && !llvm::isa<Constant>(Src1)) | 1284 if (llvm::isa<Constant>(Src0) && !llvm::isa<Constant>(Src1)) |
1285 std::swap(Src0, Src1); | 1285 std::swap(Src0, Src1); |
1286 // Improve two-address code patterns by avoiding a copy to the dest | |
1287 // register when one of the source operands ends its lifetime here. | |
1288 if (!Inst->isLastUse(Src0) && Inst->isLastUse(Src1)) | |
1289 std::swap(Src0, Src1); | |
Jim Stichnoth
2015/09/25 21:12:09
I'm starting to get nervous about "swap wars". Co
sehr
2015/10/06 18:42:00
I added the counter.
| |
1290 | |
1286 } | 1291 } |
1287 if (!Traits::Is64Bit && Dest->getType() == IceType_i64) { | 1292 if (!Traits::Is64Bit && Dest->getType() == IceType_i64) { |
1288 // These x86-32 helper-call-involved instructions are lowered in this | 1293 // These x86-32 helper-call-involved instructions are lowered in this |
1289 // separate switch. This is because loOperand() and hiOperand() may insert | 1294 // separate switch. This is because loOperand() and hiOperand() may insert |
1290 // redundant instructions for constant blinding and pooling. Such redundant | 1295 // redundant instructions for constant blinding and pooling. Such redundant |
1291 // instructions will fail liveness analysis under -Om1 setting. And, | 1296 // instructions will fail liveness analysis under -Om1 setting. And, |
1292 // actually these arguments do not need to be processed with loOperand() | 1297 // actually these arguments do not need to be processed with loOperand() |
1293 // and hiOperand() to be used. | 1298 // and hiOperand() to be used. |
1294 switch (Inst->getOp()) { | 1299 switch (Inst->getOp()) { |
1295 case InstArithmetic::Udiv: { | 1300 case InstArithmetic::Udiv: { |
(...skipping 4175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5471 } | 5476 } |
5472 // the offset is not eligible for blinding or pooling, return the original | 5477 // the offset is not eligible for blinding or pooling, return the original |
5473 // mem operand | 5478 // mem operand |
5474 return MemOperand; | 5479 return MemOperand; |
5475 } | 5480 } |
5476 | 5481 |
5477 } // end of namespace X86Internal | 5482 } // end of namespace X86Internal |
5478 } // end of namespace Ice | 5483 } // end of namespace Ice |
5479 | 5484 |
5480 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5485 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
OLD | NEW |