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

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1458713002: Compute out arguments size (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Merge 32 and 64 bit argument size Created 5 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 | « src/IceTargetLoweringX86Base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 26539252f6fa4bfae7542f46ad5a60ad2f513dd6..22dd67d85fd45cf1cb29053bc505521ce2dbd755 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -5323,6 +5323,49 @@ template <class Machine> void TargetX86Base<Machine>::prelowerPhis() {
}
template <class Machine>
+uint32_t
+TargetX86Base<Machine>::getCallStackArgumentsSizeBytes(const InstCall *Instr) {
+ uint32_t OutArgumentsSizeBytes = 0;
+ uint32_t XmmArgCount = 0;
+ uint32_t GprArgCount = 0;
+ // Classify each argument operand according to the location where the
+ // argument is passed.
+ for (SizeT i = 0, NumArgs = Instr->getNumArgs(); i < NumArgs; ++i) {
+ Operand *Arg = Instr->getArg(i);
+ Type Ty = Arg->getType();
+ // The PNaCl ABI requires the width of arguments to be at least 32 bits.
+ assert(typeWidthInBytes(Ty) >= 4);
+ if (isVectorType(Ty) && XmmArgCount < Traits::X86_MAX_XMM_ARGS) {
+ ++XmmArgCount;
+ } else if (isScalarIntegerType(Ty) &&
+ GprArgCount < Traits::X86_MAX_GPR_ARGS) {
+ // The 64 bit ABI allows some integers to be passed in GPRs.
+ ++GprArgCount;
+ } else {
+ if (isVectorType(Arg->getType())) {
+ OutArgumentsSizeBytes =
+ Traits::applyStackAlignment(OutArgumentsSizeBytes);
+ }
+ OutArgumentsSizeBytes += typeWidthInBytesOnStack(Arg->getType());
+ }
+ }
+ if (Traits::Is64Bit)
+ return OutArgumentsSizeBytes;
+ // The 32 bit ABI requires floating point values to be returned on the x87 FP
+ // stack. Ensure there is enough space for the fstp/movs for floating returns.
+ Variable *Dest = Instr->getDest();
+ if (Dest == nullptr)
+ return OutArgumentsSizeBytes;
+ const Type DestType = Dest->getType();
+ if (isScalarFloatingType(Dest->getType())) {
Jim Stichnoth 2015/11/22 04:12:16 use DestType instead of Dest->getType()
+ OutArgumentsSizeBytes =
+ std::max(OutArgumentsSizeBytes,
+ static_cast<uint32_t>(typeWidthInBytesOnStack(DestType)));
+ }
+ return OutArgumentsSizeBytes;
+}
+
+template <class Machine>
Variable *TargetX86Base<Machine>::makeZeroedRegister(Type Ty, int32_t RegNum) {
Variable *Reg = makeReg(Ty, RegNum);
switch (Ty) {
« no previous file with comments | « src/IceTargetLoweringX86Base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698