[PowerPC][Future] Add Support For Functions That Do Not Use A TOC.
authorStefan Pintilie <stefanp@ca.ibm.com>
Wed, 8 Apr 2020 13:07:35 +0000 (08:07 -0500)
committerKamau Bridgeman <kamau.bridgeman@ibm.com>
Wed, 8 Apr 2020 13:07:35 +0000 (08:07 -0500)
commit6c4b40def77622a5cf62a219ef4af63dc876e144
treeb6aa6f46d70b28ed79d8db0df4f21855acd9b365
parentf3bf25eb663c49e821120fd311677764d2bad79e
[PowerPC][Future] Add Support For Functions That Do Not Use A TOC.

On PowerPC most functions require a valid TOC pointer.

This is the case because either the function itself needs to use this
pointer to access the TOC or because other functions that are called
from that function expect a valid TOC pointer in the register R2.
The main exception to this is leaf functions that do not access the TOC
since they are guaranteed not to need a valid TOC pointer.

This patch introduces a feature that will allow more functions to not
require a valid TOC pointer in R2.

Differential Revision: https://reviews.llvm.org/D73664
25 files changed:
llvm/include/llvm/BinaryFormat/ELF.h
llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
llvm/include/llvm/MC/MCExpr.h
llvm/lib/MC/MCExpr.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/lib/Target/PowerPC/PPCInstr64Bit.td
llvm/lib/Target/PowerPC/PPCInstrInfo.td
llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/lib/Target/PowerPC/PPCScheduleP9.td
llvm/lib/Target/PowerPC/PPCSubtarget.cpp
llvm/lib/Target/PowerPC/PPCSubtarget.h
llvm/test/CodeGen/PowerPC/pcrel-call-linkage-leaf.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/pcrel-call-linkage-simple.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/pcrel-call-linkage-with-calls.ll [new file with mode: 0644]
llvm/test/MC/PowerPC/ppc64-localentry-error1.s
llvm/test/MC/PowerPC/ppc64-localentry-error2.s