[PowerPC] Use the ABI indirect-call protocol for patchpoints

We used to take the address specified as the direct target of the patchpoint
and did no TOC-pointer handling.  This, however, as not all that useful,
because MCJIT tends to create a lot of modules, and they have their own TOC
sections. Thus, to call from the generated code to other generated code, you
really need to switch TOC pointers. Make this work as expected, and under
ELFv1, tread the address as the function descriptor address so that the correct
TOC pointer can be loaded.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hal Finkel
2015-07-14 22:26:06 +00:00
parent 7a6e3434ba
commit a8eaf29f90
5 changed files with 78 additions and 26 deletions

View File

@@ -221,12 +221,10 @@ lowered according to the calling convention specified at the
intrinsic's callsite. Variants of the intrinsic with non-void return
type also return a value according to calling convention.
On PowerPC, note that ``<target>`` must be the actual intended target of
the indirect call. Specifically, even when compiling for the ELF V1 ABI,
``<target>`` is not the function-descriptor address normally used as the C/C++
function-pointer representation. As a result, the call target must be local
because no adjustment or restoration of the TOC pointer (in register r2) will
be performed.
On PowerPC, note that ``<target>`` must be the ABI function pointer for the
intended target of the indirect call. Specifically, when compiling for the
ELF V1 ABI, ``<target>`` is the function-descriptor address normally used as
the C/C++ function-pointer representation.
Requesting zero patch point arguments is valid. In this case, all
variable operands are handled just like