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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 969703002: Subzero: Fix a register allocation issue for "advanced phi lowering". (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | tests_lit/llvm2ice_tests/phi.ll » ('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/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===//
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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 Operand *Src0Hi = hiOperand(Src0); 1684 Operand *Src0Hi = hiOperand(Src0);
1685 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); 1685 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest));
1686 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); 1686 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest));
1687 Variable *T_Lo = nullptr, *T_Hi = nullptr; 1687 Variable *T_Lo = nullptr, *T_Hi = nullptr;
1688 _mov(T_Lo, Src0Lo); 1688 _mov(T_Lo, Src0Lo);
1689 _mov(DestLo, T_Lo); 1689 _mov(DestLo, T_Lo);
1690 _mov(T_Hi, Src0Hi); 1690 _mov(T_Hi, Src0Hi);
1691 _mov(DestHi, T_Hi); 1691 _mov(DestHi, T_Hi);
1692 } else { 1692 } else {
1693 // If Dest is in memory, then RI is either a physical register or 1693 // If Dest is in memory, then RI is either a physical register or
1694 // an immediate, otherwise RI can be anything. 1694 // an immediate, otherwise RI can be anything.
jvoung (off chromium) 2015/03/02 19:27:56 The "can be anything" comment seems to go with Leg
Jim Stichnoth 2015/03/02 23:33:53 Done.
1695 Operand *RI = 1695 Operand *RI =
1696 legalize(Src0, Dest->hasReg() ? Legal_All : Legal_Reg | Legal_Imm); 1696 legalize(Src0, Dest->hasReg() ? Legal_Reg : Legal_Reg | Legal_Imm,
1697 Dest->getRegNum());
1697 if (isVectorType(Dest->getType())) 1698 if (isVectorType(Dest->getType()))
1698 _movp(Dest, RI); 1699 _movp(Dest, RI);
1699 else 1700 else
1700 _mov(Dest, RI); 1701 _mov(Dest, RI);
1701 } 1702 }
1702 } 1703 }
1703 1704
1704 void TargetX8632::lowerBr(const InstBr *Inst) { 1705 void TargetX8632::lowerBr(const InstBr *Inst) {
1705 if (Inst->isUnconditional()) { 1706 if (Inst->isUnconditional()) {
1706 _br(Inst->getTargetUnconditional()); 1707 _br(Inst->getTargetUnconditional());
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 Phi->setDeleted(); 4150 Phi->setDeleted();
4150 } 4151 }
4151 } 4152 }
4152 } 4153 }
4153 4154
4154 namespace { 4155 namespace {
4155 4156
4156 bool isMemoryOperand(const Operand *Opnd) { 4157 bool isMemoryOperand(const Operand *Opnd) {
4157 if (const auto Var = llvm::dyn_cast<Variable>(Opnd)) 4158 if (const auto Var = llvm::dyn_cast<Variable>(Opnd))
4158 return !Var->hasReg(); 4159 return !Var->hasReg();
4160 // We treat vector undef values the same as a memory operand,
4161 // because they do in fact need a register to materialize the vector
4162 // of zeroes into.
4163 if (llvm::isa<ConstantUndef>(Opnd))
4164 return isScalarFloatingType(Opnd->getType()) ||
4165 isVectorType(Opnd->getType());
4159 if (llvm::isa<Constant>(Opnd)) 4166 if (llvm::isa<Constant>(Opnd))
4160 return isScalarFloatingType(Opnd->getType()); 4167 return isScalarFloatingType(Opnd->getType());
4161 return true; 4168 return true;
4162 } 4169 }
4163 4170
4164 } // end of anonymous namespace 4171 } // end of anonymous namespace
4165 4172
4166 // Lower the pre-ordered list of assignments into mov instructions. 4173 // Lower the pre-ordered list of assignments into mov instructions.
4167 // Also has to do some ad-hoc register allocation as necessary. 4174 // Also has to do some ad-hoc register allocation as necessary.
4168 void TargetX8632::lowerPhiAssignments(CfgNode *Node, 4175 void TargetX8632::lowerPhiAssignments(CfgNode *Node,
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
4766 case FT_Asm: 4773 case FT_Asm:
4767 case FT_Iasm: { 4774 case FT_Iasm: {
4768 OstreamLocker L(Ctx); 4775 OstreamLocker L(Ctx);
4769 emitConstantPool<PoolTypeConverter<float>>(Ctx); 4776 emitConstantPool<PoolTypeConverter<float>>(Ctx);
4770 emitConstantPool<PoolTypeConverter<double>>(Ctx); 4777 emitConstantPool<PoolTypeConverter<double>>(Ctx);
4771 } break; 4778 } break;
4772 } 4779 }
4773 } 4780 }
4774 4781
4775 } // end of namespace Ice 4782 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/phi.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698