Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===------ subzero/src/IcePhiLoweringImpl.h - Phi lowering -----*- C++ -*-===// | 1 //===------ subzero/src/IcePhiLoweringImpl.h - Phi 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 18 matching lines...) Expand all Loading... | |
| 29 /// assumes the 32-bit target has loOperand, hiOperand, and legalizeUndef | 29 /// assumes the 32-bit target has loOperand, hiOperand, and legalizeUndef |
| 30 /// methods. Undef values are also legalized, since loOperand() and hiOperand() | 30 /// methods. Undef values are also legalized, since loOperand() and hiOperand() |
| 31 /// don't expect Undef input. | 31 /// don't expect Undef input. |
| 32 template <class TargetT> | 32 template <class TargetT> |
| 33 void prelowerPhis32Bit(TargetT *Target, CfgNode *Node, Cfg *Func) { | 33 void prelowerPhis32Bit(TargetT *Target, CfgNode *Node, Cfg *Func) { |
| 34 for (Inst &I : Node->getPhis()) { | 34 for (Inst &I : Node->getPhis()) { |
| 35 auto *Phi = llvm::dyn_cast<InstPhi>(&I); | 35 auto *Phi = llvm::dyn_cast<InstPhi>(&I); |
| 36 if (Phi->isDeleted()) | 36 if (Phi->isDeleted()) |
| 37 continue; | 37 continue; |
| 38 Variable *Dest = Phi->getDest(); | 38 Variable *Dest = Phi->getDest(); |
| 39 if (Dest->getType() == IceType_i64) { | 39 Type DstTy = Dest->getType(); |
|
Jim Stichnoth
2017/01/11 05:23:58
The code base usually names this "DestTy".
jaydeep.patil
2017/01/11 05:45:10
Done.
| |
| 40 if (DstTy == IceType_i64) { | |
| 40 auto *DestLo = llvm::cast<Variable>(Target->loOperand(Dest)); | 41 auto *DestLo = llvm::cast<Variable>(Target->loOperand(Dest)); |
| 41 auto *DestHi = llvm::cast<Variable>(Target->hiOperand(Dest)); | 42 auto *DestHi = llvm::cast<Variable>(Target->hiOperand(Dest)); |
| 42 auto *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo); | 43 auto *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo); |
| 43 auto *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi); | 44 auto *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi); |
| 44 for (SizeT I = 0; I < Phi->getSrcSize(); ++I) { | 45 for (SizeT I = 0; I < Phi->getSrcSize(); ++I) { |
| 45 Operand *Src = Phi->getSrc(I); | 46 Operand *Src = Phi->getSrc(I); |
| 46 CfgNode *Label = Phi->getLabel(I); | 47 CfgNode *Label = Phi->getLabel(I); |
| 47 Src = Target->legalizeUndef(Src); | 48 Src = Target->legalizeUndef(Src); |
| 48 PhiLo->addArgument(Target->loOperand(Src), Label); | 49 PhiLo->addArgument(Target->loOperand(Src), Label); |
| 49 PhiHi->addArgument(Target->hiOperand(Src), Label); | 50 PhiHi->addArgument(Target->hiOperand(Src), Label); |
| 50 } | 51 } |
| 51 Node->getPhis().push_back(PhiLo); | 52 Node->getPhis().push_back(PhiLo); |
| 52 Node->getPhis().push_back(PhiHi); | 53 Node->getPhis().push_back(PhiHi); |
| 53 Phi->setDeleted(); | 54 Phi->setDeleted(); |
| 55 } else if (isVectorType(DstTy) && | |
| 56 Target->shouldSplitToVariableVecOn32(DstTy)) { | |
| 57 auto *DstVec = llvm::cast<VariableVecOn32>(Dest); | |
| 58 SizeT Idx = 0; | |
| 59 for (Variable *DestElem : DstVec->getContainers()) { | |
| 60 auto *PhiElem = InstPhi::create(Func, Phi->getSrcSize(), DestElem); | |
| 61 for (SizeT I = 0; I < Phi->getSrcSize(); ++I) { | |
| 62 Operand *Src = Phi->getSrc(I); | |
| 63 CfgNode *Label = Phi->getLabel(I); | |
| 64 Src = Target->legalizeUndef(Src); | |
| 65 auto *SrcVec = llvm::cast<VariableVecOn32>(Src); | |
| 66 PhiElem->addArgument(SrcVec->getContainers()[Idx], Label); | |
| 67 } | |
| 68 ++Idx; | |
| 69 Node->getPhis().push_back(PhiElem); | |
| 70 } | |
| 71 Phi->setDeleted(); | |
| 54 } | 72 } |
| 55 } | 73 } |
| 56 } | 74 } |
| 57 | 75 |
| 58 } // end of namespace PhiLowering | 76 } // end of namespace PhiLowering |
| 59 } // end of namespace Ice | 77 } // end of namespace Ice |
| 60 | 78 |
| 61 #endif // SUBZERO_SRC_ICEPHILOWERINGIMPL_H | 79 #endif // SUBZERO_SRC_ICEPHILOWERINGIMPL_H |
| OLD | NEW |