Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 1684 Operand *Src0Lo = loOperand(Src0); | 1684 Operand *Src0Lo = loOperand(Src0); |
| 1685 Operand *Src0Hi = hiOperand(Src0); | 1685 Operand *Src0Hi = hiOperand(Src0); |
| 1686 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); | 1686 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); |
| 1687 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); | 1687 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); |
| 1688 Variable *T_Lo = nullptr, *T_Hi = nullptr; | 1688 Variable *T_Lo = nullptr, *T_Hi = nullptr; |
| 1689 _mov(T_Lo, Src0Lo); | 1689 _mov(T_Lo, Src0Lo); |
| 1690 _mov(DestLo, T_Lo); | 1690 _mov(DestLo, T_Lo); |
| 1691 _mov(T_Hi, Src0Hi); | 1691 _mov(T_Hi, Src0Hi); |
| 1692 _mov(DestHi, T_Hi); | 1692 _mov(DestHi, T_Hi); |
| 1693 } else { | 1693 } else { |
| 1694 // If Dest is in memory, then RI is either a physical register or | 1694 Operand *RI; |
|
jvoung (off chromium)
2015/03/03 00:46:25
Besides Phi, it does seem like this could affect l
Jim Stichnoth
2015/03/03 00:53:50
For what it's worth, the asm code was the same bef
| |
| 1695 // an immediate, otherwise RI can be anything. | 1695 if (Dest->hasReg()) |
| 1696 Operand *RI = | 1696 // If Dest already has a physical register, then legalize the |
| 1697 legalize(Src0, Dest->hasReg() ? Legal_All : Legal_Reg | Legal_Imm); | 1697 // Src operand into a Variable with the same register |
| 1698 // assignment. This is mostly a workaround for advanced phi | |
| 1699 // lowering's ad-hoc register allocation which assumes no | |
| 1700 // register allocation is needed when at least one of the | |
| 1701 // operands is non-memory. | |
| 1702 RI = legalize(Src0, Legal_Reg, Dest->getRegNum()); | |
| 1703 else | |
| 1704 // If Dest could be a stack operand, then RI must be a physical | |
| 1705 // register or a scalar integer immediate. | |
| 1706 RI = legalize(Src0, Legal_Reg | Legal_Imm); | |
| 1698 if (isVectorType(Dest->getType())) | 1707 if (isVectorType(Dest->getType())) |
| 1699 _movp(Dest, RI); | 1708 _movp(Dest, RI); |
| 1700 else | 1709 else |
| 1701 _mov(Dest, RI); | 1710 _mov(Dest, RI); |
| 1702 } | 1711 } |
| 1703 } | 1712 } |
| 1704 | 1713 |
| 1705 void TargetX8632::lowerBr(const InstBr *Inst) { | 1714 void TargetX8632::lowerBr(const InstBr *Inst) { |
| 1706 if (Inst->isUnconditional()) { | 1715 if (Inst->isUnconditional()) { |
| 1707 _br(Inst->getTargetUnconditional()); | 1716 _br(Inst->getTargetUnconditional()); |
| (...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4156 Phi->setDeleted(); | 4165 Phi->setDeleted(); |
| 4157 } | 4166 } |
| 4158 } | 4167 } |
| 4159 } | 4168 } |
| 4160 | 4169 |
| 4161 namespace { | 4170 namespace { |
| 4162 | 4171 |
| 4163 bool isMemoryOperand(const Operand *Opnd) { | 4172 bool isMemoryOperand(const Operand *Opnd) { |
| 4164 if (const auto Var = llvm::dyn_cast<Variable>(Opnd)) | 4173 if (const auto Var = llvm::dyn_cast<Variable>(Opnd)) |
| 4165 return !Var->hasReg(); | 4174 return !Var->hasReg(); |
| 4175 // We treat vector undef values the same as a memory operand, | |
| 4176 // because they do in fact need a register to materialize the vector | |
| 4177 // of zeroes into. | |
| 4178 if (llvm::isa<ConstantUndef>(Opnd)) | |
| 4179 return isScalarFloatingType(Opnd->getType()) || | |
| 4180 isVectorType(Opnd->getType()); | |
| 4166 if (llvm::isa<Constant>(Opnd)) | 4181 if (llvm::isa<Constant>(Opnd)) |
| 4167 return isScalarFloatingType(Opnd->getType()); | 4182 return isScalarFloatingType(Opnd->getType()); |
| 4168 return true; | 4183 return true; |
| 4169 } | 4184 } |
| 4170 | 4185 |
| 4171 } // end of anonymous namespace | 4186 } // end of anonymous namespace |
| 4172 | 4187 |
| 4173 // Lower the pre-ordered list of assignments into mov instructions. | 4188 // Lower the pre-ordered list of assignments into mov instructions. |
| 4174 // Also has to do some ad-hoc register allocation as necessary. | 4189 // Also has to do some ad-hoc register allocation as necessary. |
| 4175 void TargetX8632::lowerPhiAssignments(CfgNode *Node, | 4190 void TargetX8632::lowerPhiAssignments(CfgNode *Node, |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4773 case FT_Asm: | 4788 case FT_Asm: |
| 4774 case FT_Iasm: { | 4789 case FT_Iasm: { |
| 4775 OstreamLocker L(Ctx); | 4790 OstreamLocker L(Ctx); |
| 4776 emitConstantPool<PoolTypeConverter<float>>(Ctx); | 4791 emitConstantPool<PoolTypeConverter<float>>(Ctx); |
| 4777 emitConstantPool<PoolTypeConverter<double>>(Ctx); | 4792 emitConstantPool<PoolTypeConverter<double>>(Ctx); |
| 4778 } break; | 4793 } break; |
| 4779 } | 4794 } |
| 4780 } | 4795 } |
| 4781 | 4796 |
| 4782 } // end of namespace Ice | 4797 } // end of namespace Ice |
| OLD | NEW |