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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 void TargetX86Base<Machine>::emitVariable(const Variable *Var) const { | 749 void TargetX86Base<Machine>::emitVariable(const Variable *Var) const { |
| 750 Ostream &Str = Ctx->getStrEmit(); | 750 Ostream &Str = Ctx->getStrEmit(); |
| 751 if (Var->hasReg()) { | 751 if (Var->hasReg()) { |
| 752 Str << "%" << getRegName(Var->getRegNum(), Var->getType()); | 752 Str << "%" << getRegName(Var->getRegNum(), Var->getType()); |
| 753 return; | 753 return; |
| 754 } | 754 } |
| 755 if (Var->getWeight().isInf()) { | 755 if (Var->getWeight().isInf()) { |
| 756 llvm_unreachable("Infinite-weight Variable has no register assigned"); | 756 llvm_unreachable("Infinite-weight Variable has no register assigned"); |
| 757 } | 757 } |
| 758 int32_t Offset = Var->getStackOffset(); | 758 int32_t Offset = Var->getStackOffset(); |
| 759 if (!hasFramePointer()) | 759 int32_t BaseRegNum = Var->getBaseRegNum(); |
|
jvoung (off chromium)
2015/07/23 23:26:32
Well.. this is an extra virtual call, but I didn't
Jim Stichnoth
2015/07/24 22:08:29
No need to worry about performance in dump() or em
jvoung (off chromium)
2015/07/27 17:02:58
Okay stackVarToAsmOperand also does this though, a
| |
| 760 Offset += getStackAdjustment(); | 760 if (BaseRegNum == Variable::NoRegister) { |
| 761 BaseRegNum = getFrameOrStackReg(); | |
| 762 if (!hasFramePointer()) | |
| 763 Offset += getStackAdjustment(); | |
| 764 } | |
| 761 if (Offset) | 765 if (Offset) |
| 762 Str << Offset; | 766 Str << Offset; |
| 763 const Type FrameSPTy = IceType_i32; | 767 const Type FrameSPTy = IceType_i32; |
| 764 Str << "(%" << getRegName(getFrameOrStackReg(), FrameSPTy) << ")"; | 768 Str << "(%" << getRegName(BaseRegNum, FrameSPTy) << ")"; |
| 765 } | 769 } |
| 766 | 770 |
| 767 template <class Machine> | 771 template <class Machine> |
| 768 typename TargetX86Base<Machine>::Traits::Address | 772 typename TargetX86Base<Machine>::Traits::Address |
| 769 TargetX86Base<Machine>::stackVarToAsmOperand(const Variable *Var) const { | 773 TargetX86Base<Machine>::stackVarToAsmOperand(const Variable *Var) const { |
| 770 if (Var->hasReg()) | 774 if (Var->hasReg()) |
| 771 llvm_unreachable("Stack Variable has a register assigned"); | 775 llvm_unreachable("Stack Variable has a register assigned"); |
| 772 if (Var->getWeight().isInf()) { | 776 if (Var->getWeight().isInf()) { |
| 773 llvm_unreachable("Infinite-weight Variable has no register assigned"); | 777 llvm_unreachable("Infinite-weight Variable has no register assigned"); |
| 774 } | 778 } |
| 775 int32_t Offset = Var->getStackOffset(); | 779 int32_t Offset = Var->getStackOffset(); |
| 776 if (!hasFramePointer()) | 780 int32_t BaseRegNum = Var->getBaseRegNum(); |
| 777 Offset += getStackAdjustment(); | 781 if (Var->getBaseRegNum() == Variable::NoRegister) { |
| 782 BaseRegNum = getFrameOrStackReg(); | |
| 783 if (!hasFramePointer()) | |
| 784 Offset += getStackAdjustment(); | |
| 785 } | |
| 778 return typename Traits::Address( | 786 return typename Traits::Address( |
| 779 Traits::RegisterSet::getEncodedGPR(getFrameOrStackReg()), Offset); | 787 Traits::RegisterSet::getEncodedGPR(BaseRegNum), Offset); |
| 780 } | 788 } |
| 781 | 789 |
| 782 template <class Machine> void TargetX86Base<Machine>::lowerArguments() { | 790 template <class Machine> void TargetX86Base<Machine>::lowerArguments() { |
| 783 VarList &Args = Func->getArgs(); | 791 VarList &Args = Func->getArgs(); |
| 784 // The first four arguments of vector type, regardless of their | 792 // The first four arguments of vector type, regardless of their |
| 785 // position relative to the other arguments in the argument list, are | 793 // position relative to the other arguments in the argument list, are |
| 786 // passed in registers xmm0 - xmm3. | 794 // passed in registers xmm0 - xmm3. |
| 787 unsigned NumXmmArgs = 0; | 795 unsigned NumXmmArgs = 0; |
| 788 | 796 |
| 789 Context.init(Func->getEntryNode()); | 797 Context.init(Func->getEntryNode()); |
| (...skipping 4826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5616 } | 5624 } |
| 5617 // the offset is not eligible for blinding or pooling, return the original | 5625 // the offset is not eligible for blinding or pooling, return the original |
| 5618 // mem operand | 5626 // mem operand |
| 5619 return MemOperand; | 5627 return MemOperand; |
| 5620 } | 5628 } |
| 5621 | 5629 |
| 5622 } // end of namespace X86Internal | 5630 } // end of namespace X86Internal |
| 5623 } // end of namespace Ice | 5631 } // end of namespace Ice |
| 5624 | 5632 |
| 5625 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5633 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |