Recommit r373598 "[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG sections."
[llvm-complete.git] / lib / Target / PowerPC / PPCMachineFunctionInfo.cpp
blob2f65d6a2855be5b54ab095c1823249e2518b144c
1 //===-- PPCMachineFunctionInfo.cpp - Private data used for PowerPC --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "PPCMachineFunctionInfo.h"
10 #include "llvm/ADT/Twine.h"
11 #include "llvm/IR/DataLayout.h"
12 #include "llvm/MC/MCContext.h"
14 using namespace llvm;
16 void PPCFunctionInfo::anchor() {}
18 MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const {
19 const DataLayout &DL = MF.getDataLayout();
20 return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
21 Twine(MF.getFunctionNumber()) +
22 "$poff");
25 MCSymbol *PPCFunctionInfo::getGlobalEPSymbol() const {
26 const DataLayout &DL = MF.getDataLayout();
27 return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
28 "func_gep" +
29 Twine(MF.getFunctionNumber()));
32 MCSymbol *PPCFunctionInfo::getLocalEPSymbol() const {
33 const DataLayout &DL = MF.getDataLayout();
34 return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
35 "func_lep" +
36 Twine(MF.getFunctionNumber()));
39 MCSymbol *PPCFunctionInfo::getTOCOffsetSymbol() const {
40 const DataLayout &DL = MF.getDataLayout();
41 return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
42 "func_toc" +
43 Twine(MF.getFunctionNumber()));
46 bool PPCFunctionInfo::isLiveInSExt(unsigned VReg) const {
47 for (const std::pair<unsigned, ISD::ArgFlagsTy> &LiveIn : LiveInAttrs)
48 if (LiveIn.first == VReg)
49 return LiveIn.second.isSExt();
50 return false;
53 bool PPCFunctionInfo::isLiveInZExt(unsigned VReg) const {
54 for (const std::pair<unsigned, ISD::ArgFlagsTy> &LiveIn : LiveInAttrs)
55 if (LiveIn.first == VReg)
56 return LiveIn.second.isZExt();
57 return false;