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

Unified Diff: src/IceTargetLoweringMIPS32.cpp

Issue 2533563002: [SubZero] Fix size of arguments on stack (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addressed review comments Created 4 years, 1 month 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 | « no previous file | tests_lit/llvm2ice_tests/fused-alloca-arg.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringMIPS32.cpp
diff --git a/src/IceTargetLoweringMIPS32.cpp b/src/IceTargetLoweringMIPS32.cpp
index e97fc5a576a69ce2a05569d0e69c2245c9243eff..1104a493a109990d274d37abbbce7fab21cbe4f8 100644
--- a/src/IceTargetLoweringMIPS32.cpp
+++ b/src/IceTargetLoweringMIPS32.cpp
@@ -225,18 +225,32 @@ uint32_t TargetMIPS32::getCallStackArgumentsSizeBytes(const InstCall *Call) {
TargetMIPS32::CallingConv CC;
RegNumT DummyReg;
size_t OutArgsSizeBytes = 0;
+ Variable *Dest = Call->getDest();
+ bool PartialOnStack = false;
+ if (Dest != nullptr && isVectorFloatingType(Dest->getType())) {
+ CC.discardReg(RegMIPS32::Reg_A0);
+ // Next vector is partially on stack
+ PartialOnStack = true;
+ }
for (SizeT i = 0, NumArgs = Call->getNumArgs(); i < NumArgs; ++i) {
Operand *Arg = legalizeUndef(Call->getArg(i));
const Type Ty = Arg->getType();
RegNumT RegNum;
if (CC.argInReg(Ty, i, &RegNum)) {
+ // If PartialOnStack is true and if this is a vector type then last two
+ // elements are on stack
+ if (PartialOnStack && isVectorType(Ty)) {
+ OutArgsSizeBytes = applyStackAlignmentTy(OutArgsSizeBytes, IceType_i32);
+ OutArgsSizeBytes += typeWidthInBytesOnStack(IceType_i32) * 2;
+ }
continue;
}
-
OutArgsSizeBytes = applyStackAlignmentTy(OutArgsSizeBytes, Ty);
OutArgsSizeBytes += typeWidthInBytesOnStack(Ty);
}
-
+ // Add size of argument save area
+ constexpr int BytesPerStackArg = 4;
+ OutArgsSizeBytes += MIPS32_MAX_GPR_ARG * BytesPerStackArg;
return applyStackAlignment(OutArgsSizeBytes);
}
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/fused-alloca-arg.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698