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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1361803002: Subzero: Improve handling of alloca instructions of constant size. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a couple of basic tests Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8664.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 2a1a0b7bf7a8fa4b48c94487f76d7f913c025cb3..9d314acb9c17555709ec61e96fe94d533515a426 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -487,9 +487,16 @@ void TargetX8632::addProlog(CfgNode *Node) {
if (SpillAreaSizeBytes)
_sub(getPhysicalRegister(Traits::RegisterSet::Reg_esp),
Ctx->getConstantInt32(SpillAreaSizeBytes));
+
+ // Account for alloca instructions with known frame offsets.
+ SpillAreaSizeBytes += FixedAllocaSizeBytes;
+
Ctx->statsUpdateFrameBytes(SpillAreaSizeBytes);
+ // Initialize the stack adjustment so that after all the known-frame-offset
+ // alloca instructions are emitted, the stack adjustment will reach zero.
resetStackAdjustment();
+ updateStackAdjustment(-FixedAllocaSizeBytes);
// Fill in stack offsets for stack args, and copy args into registers for
// those that were register-allocated. Args are pushed right to left, so
@@ -509,7 +516,13 @@ void TargetX8632::addProlog(CfgNode *Node) {
++NumXmmArgs;
continue;
}
- finishArgumentLowering(Arg, FramePtr, BasicFrameOffset, InArgsSizeBytes);
+ // For esp-based frames, the esp value may not stabilize to its home value
+ // until after all the fixed-size alloca instructions have executed. In
+ // this case, a stack adjustment is needed when accessing in-args in order
+ // to copy them into registers.
+ size_t StackAdjBytes = IsEbpBasedFrame ? 0 : -FixedAllocaSizeBytes;
+ finishArgumentLowering(Arg, FramePtr, BasicFrameOffset, StackAdjBytes,
+ InArgsSizeBytes);
}
// Fill in stack offsets for locals.
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8664.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698