Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- PPCMachineFunctionInfo.cpp - Private data used for PowerPC --------===// |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "PPCMachineFunctionInfo.h" |
Eugene Zelenko | 8187c19 | 2017-01-13 00:58:58 +0000 | [diff] [blame] | 10 | #include "llvm/ADT/Twine.h" |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 11 | #include "llvm/IR/DataLayout.h" |
| 12 | #include "llvm/MC/MCContext.h" |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 13 | |
| 14 | using namespace llvm; |
| 15 | |
Eugene Zelenko | 8187c19 | 2017-01-13 00:58:58 +0000 | [diff] [blame] | 16 | void PPCFunctionInfo::anchor() {} |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 17 | |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 18 | MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const { |
Mehdi Amini | bd7287e | 2015-07-16 06:11:10 +0000 | [diff] [blame] | 19 | const DataLayout &DL = MF.getDataLayout(); |
| 20 | return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) + |
Eric Christopher | 8b77065 | 2015-01-26 19:03:15 +0000 | [diff] [blame] | 21 | Twine(MF.getFunctionNumber()) + |
| 22 | "$poff"); |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 23 | } |
Ulrich Weigand | 46ff7ec | 2016-01-13 13:12:23 +0000 | [diff] [blame] | 24 | |
| 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())); |
| 30 | } |
| 31 | |
| 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())); |
| 37 | } |
| 38 | |
| 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())); |
| 44 | } |
Hiroshi Inoue | e3a3e3c | 2017-10-16 04:12:57 +0000 | [diff] [blame] | 45 | |
| 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; |
| 51 | } |
| 52 | |
| 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; |
| 58 | } |