Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: src/IcePhiLoweringImpl.h

Issue 2619943003: [SubZero] Fix code generation issues occurred in Cross-test and PNaCL smoke-tests (Closed)
Patch Set: Addressed review comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceInstMIPS32.cpp ('k') | src/IceTargetLoweringMIPS32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 DestTy = Dest->getType();
40 if (DestTy == 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(DestTy) &&
56 Target->shouldSplitToVariableVecOn32(DestTy)) {
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
OLDNEW
« no previous file with comments | « src/IceInstMIPS32.cpp ('k') | src/IceTargetLoweringMIPS32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698