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 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "PPCMachineFunctionInfo.h" |
Eugene Zelenko | 8187c19 | 2017-01-13 00:58:58 +0000 | [diff] [blame] | 11 | #include "llvm/ADT/Twine.h" |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 12 | #include "llvm/IR/DataLayout.h" |
| 13 | #include "llvm/MC/MCContext.h" |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 14 | |
| 15 | using namespace llvm; |
| 16 | |
Eugene Zelenko | 8187c19 | 2017-01-13 00:58:58 +0000 | [diff] [blame] | 17 | void PPCFunctionInfo::anchor() {} |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 18 | |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 19 | MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const { |
Mehdi Amini | bd7287e | 2015-07-16 06:11:10 +0000 | [diff] [blame] | 20 | const DataLayout &DL = MF.getDataLayout(); |
| 21 | return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) + |
Eric Christopher | 8b77065 | 2015-01-26 19:03:15 +0000 | [diff] [blame] | 22 | Twine(MF.getFunctionNumber()) + |
| 23 | "$poff"); |
Hal Finkel | 3ee2af7 | 2014-07-18 23:29:49 +0000 | [diff] [blame] | 24 | } |
Ulrich Weigand | 46ff7ec | 2016-01-13 13:12:23 +0000 | [diff] [blame] | 25 | |
| 26 | MCSymbol *PPCFunctionInfo::getGlobalEPSymbol() const { |
| 27 | const DataLayout &DL = MF.getDataLayout(); |
| 28 | return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) + |
| 29 | "func_gep" + |
| 30 | Twine(MF.getFunctionNumber())); |
| 31 | } |
| 32 | |
| 33 | MCSymbol *PPCFunctionInfo::getLocalEPSymbol() const { |
| 34 | const DataLayout &DL = MF.getDataLayout(); |
| 35 | return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) + |
| 36 | "func_lep" + |
| 37 | Twine(MF.getFunctionNumber())); |
| 38 | } |
| 39 | |
| 40 | MCSymbol *PPCFunctionInfo::getTOCOffsetSymbol() const { |
| 41 | const DataLayout &DL = MF.getDataLayout(); |
| 42 | return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) + |
| 43 | "func_toc" + |
| 44 | Twine(MF.getFunctionNumber())); |
| 45 | } |
Hiroshi Inoue | e3a3e3c | 2017-10-16 04:12:57 +0000 | [diff] [blame] | 46 | |
| 47 | bool PPCFunctionInfo::isLiveInSExt(unsigned VReg) const { |
| 48 | for (const std::pair<unsigned, ISD::ArgFlagsTy> &LiveIn : LiveInAttrs) |
| 49 | if (LiveIn.first == VReg) |
| 50 | return LiveIn.second.isSExt(); |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | bool PPCFunctionInfo::isLiveInZExt(unsigned VReg) const { |
| 55 | for (const std::pair<unsigned, ISD::ArgFlagsTy> &LiveIn : LiveInAttrs) |
| 56 | if (LiveIn.first == VReg) |
| 57 | return LiveIn.second.isZExt(); |
| 58 | return false; |
| 59 | } |