OSDN Git Service

[RISCV] Preserve stack space for outgoing arguments when the function contain variabl...
authorShiva Chen <shiva0217@gmail.com>
Tue, 20 Mar 2018 01:39:17 +0000 (01:39 +0000)
committerShiva Chen <shiva0217@gmail.com>
Tue, 20 Mar 2018 01:39:17 +0000 (01:39 +0000)
commit6a9321130f48bb4ab2974a4ebba97d4bea94637f
treec17d485a71abfbc642c15f743c00271fe3503d29
parent18df4f09ff78f808ffc1a4a728670d3a723847ba
[RISCV] Preserve stack space for outgoing arguments when the function contain variable size objects

E.g.

bar (int x)
{
  char p[x];

  push outgoing variables for foo.
  call foo
}

We need to generate stack adjustment instructions for outgoing arguments by
eliminateCallFramePseudoInstr when the function contains variable size
objects to avoid outgoing variables corrupt the variable size object.

Default hasReservedCallFrame will return !hasFP().
We don't want to generate extra sp adjustment instructions when hasFP()
return true, So We override hasReservedCallFrame as !hasVarSizedObjects().

Differential Revision: https://reviews.llvm.org/D43752

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327938 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/RISCV/RISCVFrameLowering.cpp
lib/Target/RISCV/RISCVFrameLowering.h
test/CodeGen/RISCV/alloca.ll
test/CodeGen/RISCV/calling-conv.ll