| 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 5634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5645 // it doesn't need another level of transformation. | 5645 // it doesn't need another level of transformation. |
| 5646 Variable *DestLoad = Load->getDest(); | 5646 Variable *DestLoad = Load->getDest(); |
| 5647 Type Ty = DestLoad->getType(); | 5647 Type Ty = DestLoad->getType(); |
| 5648 Operand *Src0 = formMemoryOperand(Load->getSourceAddress(), Ty); | 5648 Operand *Src0 = formMemoryOperand(Load->getSourceAddress(), Ty); |
| 5649 doMockBoundsCheck(Src0); | 5649 doMockBoundsCheck(Src0); |
| 5650 auto *Assign = InstAssign::create(Func, DestLoad, Src0); | 5650 auto *Assign = InstAssign::create(Func, DestLoad, Src0); |
| 5651 lowerAssign(Assign); | 5651 lowerAssign(Assign); |
| 5652 } | 5652 } |
| 5653 | 5653 |
| 5654 template <typename TraitsType> | 5654 template <typename TraitsType> |
| 5655 void TargetX86Base<TraitsType>::doAddressOptOther() { |
| 5656 // Inverts some Icmp instructions which helps doAddressOptLoad later. |
| 5657 Inst *Instr = Context.getCur(); |
| 5658 auto *VMetadata = Func->getVMetadata(); |
| 5659 if (auto *Icmp = llvm::dyn_cast<InstIcmp>(Instr)) { |
| 5660 if (llvm::isa<Constant>(Icmp->getSrc(0)) || |
| 5661 llvm::isa<Constant>(Icmp->getSrc(1))) |
| 5662 return; |
| 5663 auto *Var0 = llvm::dyn_cast<Variable>(Icmp->getSrc(0)); |
| 5664 if (Var0 == nullptr) |
| 5665 return; |
| 5666 if (!VMetadata->isTracked(Var0)) |
| 5667 return; |
| 5668 auto *Op0Def = VMetadata->getFirstDefinitionSingleBlock(Var0); |
| 5669 if (Op0Def == nullptr || !llvm::isa<InstLoad>(Op0Def)) |
| 5670 return; |
| 5671 if (VMetadata->getLocalUseNode(Var0) != Context.getNode()) |
| 5672 return; |
| 5673 |
| 5674 auto *Var1 = llvm::dyn_cast<Variable>(Icmp->getSrc(1)); |
| 5675 if (Var1 != nullptr && VMetadata->isTracked(Var1)) { |
| 5676 auto *Op1Def = VMetadata->getFirstDefinitionSingleBlock(Var1); |
| 5677 if (Op1Def != nullptr && !VMetadata->isMultiBlock(Var1) && |
| 5678 llvm::isa<InstLoad>(Op1Def)) { |
| 5679 return; // Both are loads |
| 5680 } |
| 5681 } |
| 5682 Icmp->invertConditionAndSwapOperands(); |
| 5683 } |
| 5684 } |
| 5685 |
| 5686 template <typename TraitsType> |
| 5655 void TargetX86Base<TraitsType>::doAddressOptLoad() { | 5687 void TargetX86Base<TraitsType>::doAddressOptLoad() { |
| 5656 Inst *Instr = Context.getCur(); | 5688 Inst *Instr = Context.getCur(); |
| 5657 Operand *Addr = Instr->getSrc(0); | 5689 Operand *Addr = Instr->getSrc(0); |
| 5658 Variable *Dest = Instr->getDest(); | 5690 Variable *Dest = Instr->getDest(); |
| 5659 if (auto *OptAddr = computeAddressOpt(Instr, Dest->getType(), Addr)) { | 5691 if (auto *OptAddr = computeAddressOpt(Instr, Dest->getType(), Addr)) { |
| 5660 Instr->setDeleted(); | 5692 Instr->setDeleted(); |
| 5661 Context.insert<InstLoad>(Dest, OptAddr); | 5693 Context.insert<InstLoad>(Dest, OptAddr); |
| 5662 } | 5694 } |
| 5663 } | 5695 } |
| 5664 | 5696 |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8032 emitGlobal(*Var, SectionSuffix); | 8064 emitGlobal(*Var, SectionSuffix); |
| 8033 } | 8065 } |
| 8034 } | 8066 } |
| 8035 } break; | 8067 } break; |
| 8036 } | 8068 } |
| 8037 } | 8069 } |
| 8038 } // end of namespace X86NAMESPACE | 8070 } // end of namespace X86NAMESPACE |
| 8039 } // end of namespace Ice | 8071 } // end of namespace Ice |
| 8040 | 8072 |
| 8041 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 8073 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |