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 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 return; | |
|
Jim Stichnoth
2016/07/08 11:45:46
wat ?
manasijm
2016/07/08 18:11:40
Sorry, remnant of testing with this turned off.
| |
| 5657 // Inverts some Icmp instructions which helps doAddressOptLoad later. | |
| 5658 Inst *Instr = Context.getCur(); | |
| 5659 auto *VMetadata = Func->getVMetadata(); | |
| 5660 if (auto *Icmp = llvm::dyn_cast<InstIcmp>(Instr)) { | |
| 5661 if (llvm::isa<Constant>(Icmp->getSrc(0)) || | |
| 5662 llvm::isa<Constant>(Icmp->getSrc(1))) | |
| 5663 return; | |
| 5664 auto *Var0 = llvm::dyn_cast<Variable>(Icmp->getSrc(0)); | |
| 5665 if (Var0 == nullptr) | |
| 5666 return; | |
| 5667 if (!VMetadata->isTracked(Var0)) | |
| 5668 return; | |
| 5669 auto *Op0Def = VMetadata->getFirstDefinitionSingleBlock(Var0); | |
| 5670 if (Op0Def == nullptr || !llvm::isa<InstLoad>(Op0Def)) | |
| 5671 return; | |
| 5672 if (VMetadata->getLocalUseNode(Var0) != Context.getNode()) | |
| 5673 return; | |
| 5674 | |
| 5675 auto *Var1 = llvm::dyn_cast<Variable>(Icmp->getSrc(1)); | |
| 5676 if (Var1 != nullptr && VMetadata->isTracked(Var1)) { | |
| 5677 auto *Op1Def = VMetadata->getFirstDefinitionSingleBlock(Var1); | |
| 5678 if (Op1Def != nullptr && !VMetadata->isMultiBlock(Var1) && | |
| 5679 llvm::isa<InstLoad>(Op1Def)) { | |
| 5680 return; // Both are loads | |
| 5681 } | |
| 5682 } | |
| 5683 Icmp->invert(); | |
| 5684 } | |
| 5685 } | |
| 5686 | |
| 5687 template <typename TraitsType> | |
| 5655 void TargetX86Base<TraitsType>::doAddressOptLoad() { | 5688 void TargetX86Base<TraitsType>::doAddressOptLoad() { |
| 5656 Inst *Instr = Context.getCur(); | 5689 Inst *Instr = Context.getCur(); |
| 5657 Operand *Addr = Instr->getSrc(0); | 5690 Operand *Addr = Instr->getSrc(0); |
| 5658 Variable *Dest = Instr->getDest(); | 5691 Variable *Dest = Instr->getDest(); |
| 5659 if (auto *OptAddr = computeAddressOpt(Instr, Dest->getType(), Addr)) { | 5692 if (auto *OptAddr = computeAddressOpt(Instr, Dest->getType(), Addr)) { |
| 5660 Instr->setDeleted(); | 5693 Instr->setDeleted(); |
| 5661 Context.insert<InstLoad>(Dest, OptAddr); | 5694 Context.insert<InstLoad>(Dest, OptAddr); |
| 5662 } | 5695 } |
| 5663 } | 5696 } |
| 5664 | 5697 |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8032 emitGlobal(*Var, SectionSuffix); | 8065 emitGlobal(*Var, SectionSuffix); |
| 8033 } | 8066 } |
| 8034 } | 8067 } |
| 8035 } break; | 8068 } break; |
| 8036 } | 8069 } |
| 8037 } | 8070 } |
| 8038 } // end of namespace X86NAMESPACE | 8071 } // end of namespace X86NAMESPACE |
| 8039 } // end of namespace Ice | 8072 } // end of namespace Ice |
| 8040 | 8073 |
| 8041 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 8074 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |