[PowerPC] Refactor byval handling in LowerFormalArguments_64SVR4
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Sun, 20 Jul 2014 22:36:52 +0000 (22:36 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Sun, 20 Jul 2014 22:36:52 +0000 (22:36 +0000)
commit241959722e5433617a96818e2938a4b9926e3650
tree0cd1e5c47d93b32d30929429fad54737cb34119c
parent55a96650d9f9baab10ed88fa1239c8ff2413c821
[PowerPC] Refactor byval handling in LowerFormalArguments_64SVR4

When handling an incoming byval argument, we need to possibly write
incoming registers to the stack in order to create an on-stack image
of the parameter, so we can return its address to common code.

This currently uses CreateFixedObject to access the parts of the
parameter save area where the argument is (or needs to be) stored.
However, sometimes we need to access multiple parts of that area,
e.g. to write multiple registers.  The code currently uses a new
CreateFixedObject call for each of these accesses, resulting in
a patchwork of overlapping (fixed) stack objects.

This doesn't really matter in the case of fixed objects, since
any access to those turns into a fixed stackpointer + offset
address anyway.  However, with the upcoming ELFv2 patches, we
may actually need to place an incoming argument into our *own*
stack frame instead of the caller's.  This means we need to use
CreateStackObject instead, and we cannot have multiple overlapping
instances of those.

To make the rest of the argument handling code work equally in
both situations, this patch refactors it to always use just a
single call to CreateFixedObject, and access parts of that object
as required using address arithmetic.  This way, we can in a future
patch substitute CreateStackObject without further changes.

No change to generated code intended.

llvm-svn: 213483
llvm/lib/Target/PowerPC/PPCISelLowering.cpp