Chromium Code Reviews| Index: src/IceTargetLoweringX86BaseImpl.h |
| diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h |
| index fc0a8e207a44a0a8a1b98baa6fb581c9259bd9c6..e33df3fd813da3d8388d84eb2d2cdaf427f2212f 100644 |
| --- a/src/IceTargetLoweringX86BaseImpl.h |
| +++ b/src/IceTargetLoweringX86BaseImpl.h |
| @@ -756,12 +756,16 @@ void TargetX86Base<Machine>::emitVariable(const Variable *Var) const { |
| llvm_unreachable("Infinite-weight Variable has no register assigned"); |
| } |
| int32_t Offset = Var->getStackOffset(); |
| - if (!hasFramePointer()) |
| - Offset += getStackAdjustment(); |
| + 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
|
| + if (BaseRegNum == Variable::NoRegister) { |
| + BaseRegNum = getFrameOrStackReg(); |
| + if (!hasFramePointer()) |
| + Offset += getStackAdjustment(); |
| + } |
| if (Offset) |
| Str << Offset; |
| const Type FrameSPTy = IceType_i32; |
| - Str << "(%" << getRegName(getFrameOrStackReg(), FrameSPTy) << ")"; |
| + Str << "(%" << getRegName(BaseRegNum, FrameSPTy) << ")"; |
| } |
| template <class Machine> |
| @@ -773,10 +777,14 @@ TargetX86Base<Machine>::stackVarToAsmOperand(const Variable *Var) const { |
| llvm_unreachable("Infinite-weight Variable has no register assigned"); |
| } |
| int32_t Offset = Var->getStackOffset(); |
| - if (!hasFramePointer()) |
| - Offset += getStackAdjustment(); |
| + int32_t BaseRegNum = Var->getBaseRegNum(); |
| + if (Var->getBaseRegNum() == Variable::NoRegister) { |
| + BaseRegNum = getFrameOrStackReg(); |
| + if (!hasFramePointer()) |
| + Offset += getStackAdjustment(); |
| + } |
| return typename Traits::Address( |
| - Traits::RegisterSet::getEncodedGPR(getFrameOrStackReg()), Offset); |
| + Traits::RegisterSet::getEncodedGPR(BaseRegNum), Offset); |
| } |
| template <class Machine> void TargetX86Base<Machine>::lowerArguments() { |