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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringX86Base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 } 5316 }
5317 5317
5318 // Pause constant blinding or pooling, blinding or pooling will be done later 5318 // Pause constant blinding or pooling, blinding or pooling will be done later
5319 // during phi lowering assignments 5319 // during phi lowering assignments
5320 BoolFlagSaver B(RandomizationPoolingPaused, true); 5320 BoolFlagSaver B(RandomizationPoolingPaused, true);
5321 PhiLowering::prelowerPhis32Bit<TargetX86Base<Machine>>( 5321 PhiLowering::prelowerPhis32Bit<TargetX86Base<Machine>>(
5322 this, Context.getNode(), Func); 5322 this, Context.getNode(), Func);
5323 } 5323 }
5324 5324
5325 template <class Machine> 5325 template <class Machine>
5326 uint32_t
5327 TargetX86Base<Machine>::getCallStackArgumentsSizeBytes(const InstCall *Instr) {
5328 uint32_t OutArgumentsSizeBytes = 0;
5329 uint32_t XmmArgCount = 0;
5330 uint32_t GprArgCount = 0;
5331 // Classify each argument operand according to the location where the
5332 // argument is passed.
5333 for (SizeT i = 0, NumArgs = Instr->getNumArgs(); i < NumArgs; ++i) {
5334 Operand *Arg = Instr->getArg(i);
5335 Type Ty = Arg->getType();
5336 // The PNaCl ABI requires the width of arguments to be at least 32 bits.
5337 assert(typeWidthInBytes(Ty) >= 4);
5338 if (isVectorType(Ty) && XmmArgCount < Traits::X86_MAX_XMM_ARGS) {
5339 ++XmmArgCount;
5340 } else if (isScalarIntegerType(Ty) &&
5341 GprArgCount < Traits::X86_MAX_GPR_ARGS) {
5342 // The 64 bit ABI allows some integers to be passed in GPRs.
5343 ++GprArgCount;
5344 } else {
5345 if (isVectorType(Arg->getType())) {
5346 OutArgumentsSizeBytes =
5347 Traits::applyStackAlignment(OutArgumentsSizeBytes);
5348 }
5349 OutArgumentsSizeBytes += typeWidthInBytesOnStack(Arg->getType());
5350 }
5351 }
5352 if (Traits::Is64Bit)
5353 return OutArgumentsSizeBytes;
5354 // The 32 bit ABI requires floating point values to be returned on the x87 FP
5355 // stack. Ensure there is enough space for the fstp/movs for floating returns.
5356 Variable *Dest = Instr->getDest();
5357 if (Dest == nullptr)
5358 return OutArgumentsSizeBytes;
5359 const Type DestType = Dest->getType();
5360 if (isScalarFloatingType(Dest->getType())) {
Jim Stichnoth 2015/11/22 04:12:16 use DestType instead of Dest->getType()
5361 OutArgumentsSizeBytes =
5362 std::max(OutArgumentsSizeBytes,
5363 static_cast<uint32_t>(typeWidthInBytesOnStack(DestType)));
5364 }
5365 return OutArgumentsSizeBytes;
5366 }
5367
5368 template <class Machine>
5326 Variable *TargetX86Base<Machine>::makeZeroedRegister(Type Ty, int32_t RegNum) { 5369 Variable *TargetX86Base<Machine>::makeZeroedRegister(Type Ty, int32_t RegNum) {
5327 Variable *Reg = makeReg(Ty, RegNum); 5370 Variable *Reg = makeReg(Ty, RegNum);
5328 switch (Ty) { 5371 switch (Ty) {
5329 case IceType_i1: 5372 case IceType_i1:
5330 case IceType_i8: 5373 case IceType_i8:
5331 case IceType_i16: 5374 case IceType_i16:
5332 case IceType_i32: 5375 case IceType_i32:
5333 case IceType_i64: 5376 case IceType_i64:
5334 // Conservatively do "mov reg, 0" to avoid modifying FLAGS. 5377 // Conservatively do "mov reg, 0" to avoid modifying FLAGS.
5335 _mov(Reg, Ctx->getConstantZero(Ty)); 5378 _mov(Reg, Ctx->getConstantZero(Ty));
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
6023 } 6066 }
6024 // the offset is not eligible for blinding or pooling, return the original 6067 // the offset is not eligible for blinding or pooling, return the original
6025 // mem operand 6068 // mem operand
6026 return MemOperand; 6069 return MemOperand;
6027 } 6070 }
6028 6071
6029 } // end of namespace X86Internal 6072 } // end of namespace X86Internal
6030 } // end of namespace Ice 6073 } // end of namespace Ice
6031 6074
6032 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 6075 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
OLDNEW
« 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