OSDN Git Service

[AIX] Implement function descriptor on SDAG
authorJason Liu <jasonliu.development@gmail.com>
Thu, 6 Jun 2019 19:13:36 +0000 (19:13 +0000)
committerJason Liu <jasonliu.development@gmail.com>
Thu, 6 Jun 2019 19:13:36 +0000 (19:13 +0000)
commit3d1f1eb0455a6b169b1cbf9af755dcf7416300d2
treeb077b7b478532e24d11d603151c0fa6fcbbe82dc
parentb942589e417836aa62e1f93c62e3db4056f0d50b
[AIX] Implement function descriptor on SDAG

Summary:
(1) Function descriptor on AIX
On AIX, a called routine may have 2 distinct symbols associated with it:
 * A function descriptor (Name)
 * A function entry point (.Name)

The descriptor structure on AIX is the same as those in the ELF V1 ABI:
 * The address of the entry point of the function.
 * The TOC base address for the function.
 * The environment pointer.

The descriptor symbol uses the same name as the source level function in C.
The function entry point is analogous to the symbol we would generate for a
 function in a non-descriptor-based ABI, except that it is renamed by
prepending a ".".

Which symbol gets referenced depends on the context:
 * Taking the address of the function references the descriptor symbol.
 * Calling the function references the entry point symbol.

(2) Speaking of implementation on AIX, for direct function call target, we
 create proper MCSymbol SDNode(e.g . ".foo") while constructing SDAG to
 replace original TargetGlobalAddress SDNode. Then down the path, we can
 take advantage of this MCSymbol.

Patch by: Xiangling_L

Reviewed by: sfertile, hubert.reinterpretcast, jasonliu, syzaara

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362735 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCSymbol.h
include/llvm/MC/MCSymbolXCOFF.h [new file with mode: 0644]
lib/CodeGen/LLVMTargetMachine.cpp
lib/CodeGen/SelectionDAG/FastISel.cpp
lib/MC/MCContext.cpp
lib/Target/PowerPC/PPCFastISel.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCInstr64Bit.td
lib/Target/PowerPC/PPCInstrInfo.td
test/CodeGen/PowerPC/aix_gpr_param.ll
test/CodeGen/PowerPC/test_call_aix.ll