diff options
author | Lei Huang <lei@ca.ibm.com> | 2018-02-20 15:09:45 +0000 |
---|---|---|
committer | Lei Huang <lei@ca.ibm.com> | 2018-02-20 15:09:45 +0000 |
commit | dfd41552f439f562a8ce9cbf13a7e2b9f3185388 (patch) | |
tree | b81cb91cf07a089b5c6017a62561cae90a3fff0b /llvm/lib/Target/PowerPC/PPCISelLowering.cpp | |
parent | b404fae9e3c2d757b4e11215fff8d88346835900 (diff) | |
download | bcm5719-llvm-dfd41552f439f562a8ce9cbf13a7e2b9f3185388.tar.gz bcm5719-llvm-dfd41552f439f562a8ce9cbf13a7e2b9f3185388.zip |
[PowerPC] Reduce stack frame for fastcc functions by only allocating parameter save area when needed
Current implementation always allocates the parameter save area conservatively
for fastcc functions. There is no reason to allocate the parameter save area if
all the parameters can be passed via registers.
Differential Revision: https://reviews.llvm.org/D42602
llvm-svn: 325581
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 00dcb0db6b4..38e77bb0192 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -5467,6 +5467,11 @@ SDValue PPCTargetLowering::LowerCall_64SVR4( // arguments that will be in registers. unsigned NumGPRsUsed = 0, NumFPRsUsed = 0, NumVRsUsed = 0; + // Avoid allocating parameter area for fastcc functions if all the arguments + // can be passed in the registers. + if (CallConv == CallingConv::Fast) + HasParameterArea = false; + // Add up all the space actually used. for (unsigned i = 0; i != NumOps; ++i) { ISD::ArgFlagsTy Flags = Outs[i].Flags; @@ -5477,9 +5482,11 @@ SDValue PPCTargetLowering::LowerCall_64SVR4( continue; if (CallConv == CallingConv::Fast) { - if (Flags.isByVal()) + if (Flags.isByVal()) { NumGPRsUsed += (Flags.getByValSize()+7)/8; - else + if (NumGPRsUsed > NumGPRs) + HasParameterArea = true; + } else { switch (ArgVT.getSimpleVT().SimpleTy) { default: llvm_unreachable("Unexpected ValueType for argument!"); case MVT::i1: @@ -5516,6 +5523,8 @@ SDValue PPCTargetLowering::LowerCall_64SVR4( continue; break; } + HasParameterArea = true; + } } /* Respect alignment of argument on the stack. */ |