[PowerPC] Convert r+r instructions to r+i (pre and post RA)
[llvm-core.git] / lib / Target / PowerPC / PPCMachineFunctionInfo.cpp
blob3923417257e8ca85ca0dfc4e6ca55fad3c67f10d
1 //===-- PPCMachineFunctionInfo.cpp - Private data used for PowerPC --------===//
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 //===----------------------------------------------------------------------===//
10 #include "PPCMachineFunctionInfo.h"
11 #include "llvm/ADT/Twine.h"
12 #include "llvm/IR/DataLayout.h"
13 #include "llvm/MC/MCContext.h"
15 using namespace llvm;
17 void PPCFunctionInfo::anchor() {}
19 MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const {
20 const DataLayout &DL = MF.getDataLayout();
21 return MF.getContext().getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
22 Twine(MF.getFunctionNumber()) +
23 "$poff");
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()));
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()));
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()));
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;
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;