1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
llvm-mirror/lib
Ulrich Weigand 41e116ee77 [PowerPC] ELFv2 function call changes
This patch builds upon the two preceding MC changes to implement the
basic ELFv2 function call convention.  In the ELFv1 ABI, a "function
descriptor" was associated with every function, pointing to both the
entry address and the related TOC base (and a static chain pointer
for nested functions).  Function pointers would actually refer to that
descriptor, and the indirect call sequence needed to load up both entry
address and TOC base.

In the ELFv2 ABI, there are no more function descriptors, and function
pointers simply refer to the (global) entry point of the function code.
Indirect function calls simply branch to that address, after loading it
up into r12 (as required by the ABI rules for a global entry point).
Direct function calls continue to just do a "bl" to the target symbol;
this will be resolved by the linker to the local entry point of the
target function if it is local, and to a PLT stub if it is global.
That PLT stub would then load the (global) entry point address of the
final target into r12 and branch to it.  Note that when performing a
local function call, r2 must be set up to point to the current TOC
base: if the target ends up local, the ABI requires that its local
entry point is called with r2 set up; if the target ends up global,
the PLT stub requires that r2 is set up.

This patch implements all LLVM changes to implement that scheme:
- No longer create a function descriptor when emitting a function
  definition (in EmitFunctionEntryLabel)
- Emit two entry points *if* the function needs the TOC base (r2)
  anywhere (this is done EmitFunctionBodyStart; note that this cannot
  be done in EmitFunctionBodyStart because the global entry point
  prologue code must be *part* of the function as covered by debug info).
- In order to make use tracking of r2 (as needed above) work correctly,
  mark direct function calls as implicitly using r2.
- Implement the ELFv2 indirect function call sequence (no function
  descriptors; load target address into r12).
- When creating an ELFv2 object file, emit the .abiversion 2 directive
  to tell the linker to create the appropriate version of PLT stubs.  

Reviewed by Hal Finkel.

llvm-svn: 213489
2014-07-20 23:31:44 +00:00
..
Analysis Remove braces around single-statement block and rangify outer loop. 2014-07-20 09:20:47 +00:00
AsmParser Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
Bitcode Add a dereferenceable attribute 2014-07-18 15:51:28 +00:00
CodeGen MachineRegionInfo.cpp: Another fix on MachineRegionInfo::MachineRegionInfo::recalculate() to appease msc17. 2014-07-20 11:14:55 +00:00
DebugInfo Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
ExecutionEngine [MCJIT] Add a 'decodeAddend' method to RuntimeDyldMachO and teach 2014-07-19 00:19:17 +00:00
IR [C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges. 2014-07-20 09:10:11 +00:00
IRReader Update the MemoryBuffer API to use ErrorOr. 2014-07-06 17:43:13 +00:00
LineEditor
Linker Include <tuple> to make buildbots happy 2014-06-27 18:38:12 +00:00
LTO MergedLoadStoreMotion pass 2014-07-18 19:13:09 +00:00
MC [MC] Pass MCSymbolData to needsRelocateWithSymbol 2014-07-20 23:15:06 +00:00
Object Namespace cleanup (no functional change) 2014-07-20 12:08:28 +00:00
Option Generic: add range-adapter for option parsing. 2014-07-09 13:03:37 +00:00
ProfileData Update the MemoryBuffer API to use ErrorOr. 2014-07-06 17:43:13 +00:00
Support Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()" 2014-07-19 01:05:11 +00:00
TableGen [TableGen] Allow shift operators to take bits<n> 2014-07-17 17:04:27 +00:00
Target [PowerPC] ELFv2 function call changes 2014-07-20 23:31:44 +00:00
Transforms [LoopVectorize] Remove an unused private AA pointer 2014-07-20 23:28:25 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile