LLVM 24.0.0git
PPCMachineFunctionInfo.cpp
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
8
10#include "PPCSubtarget.h"
11#include "llvm/ADT/Twine.h"
13#include "llvm/IR/DataLayout.h"
14#include "llvm/MC/MCContext.h"
15
16using namespace llvm;
17
18void PPCFunctionInfo::anchor() {}
20 : DisableNonVolatileCR(!STI->getCLOpts().non_volatile_cr) {}
21
25 &Src2DstMBB) const {
26 return DestMF.cloneInfo<PPCFunctionInfo>(*this);
27}
28
30 const DataLayout &DL = MF.getDataLayout();
31 return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
33 "$poff");
34}
35
37 const DataLayout &DL = MF.getDataLayout();
38 return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
39 "func_gep" +
41}
42
44 const DataLayout &DL = MF.getDataLayout();
45 return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
46 "func_lep" +
48}
49
51 const DataLayout &DL = MF.getDataLayout();
52 return MF.getContext().getOrCreateSymbol(Twine(DL.getInternalSymbolPrefix()) +
53 "func_toc" +
55}
56
58 for (const std::pair<Register, ISD::ArgFlagsTy> &LiveIn : LiveInAttrs)
59 if (LiveIn.first == VReg)
60 return LiveIn.second.isSExt();
61 return false;
62}
63
65 for (const std::pair<Register, ISD::ArgFlagsTy> &LiveIn : LiveInAttrs)
66 if (LiveIn.first == VReg)
67 return LiveIn.second.isZExt();
68 return false;
69}
70
72
73 ParamtersType.push_back(Type);
74 switch (Type) {
75 case FixedType:
76 ++FixedParmsNum;
77 return;
80 ++FloatingParmsNum;
81 return;
82 case VectorChar:
83 case VectorShort:
84 case VectorInt:
85 case VectorFloat:
86 ++VectorParmsNum;
87 return;
88 }
89 llvm_unreachable("Error ParamType type.");
90}
91
93
94 uint32_t VectExtParamInfo = 0;
95 unsigned ShiftBits = 32 - XCOFF::TracebackTable::WidthOfParamType;
96 int Bits = 0;
97
98 if (!hasVectorParms())
99 return 0;
100
101 for (const auto &Elt : ParamtersType) {
102 switch (Elt) {
103 case VectorChar:
104 VectExtParamInfo <<= XCOFF::TracebackTable::WidthOfParamType;
105 VectExtParamInfo |=
108 break;
109 case VectorShort:
110 VectExtParamInfo <<= XCOFF::TracebackTable::WidthOfParamType;
111 VectExtParamInfo |=
114 break;
115 case VectorInt:
116 VectExtParamInfo <<= XCOFF::TracebackTable::WidthOfParamType;
117 VectExtParamInfo |=
120 break;
121 case VectorFloat:
122 VectExtParamInfo <<= XCOFF::TracebackTable::WidthOfParamType;
123 VectExtParamInfo |=
126 break;
127 default:
128 break;
129 }
130
131 // There are only 32bits in the VectExtParamInfo.
132 if (Bits >= 32)
133 break;
134 }
135 return Bits < 32 ? VectExtParamInfo << (32 - Bits) : VectExtParamInfo;
136}
137
139 uint32_t ParamsTypeInfo = 0;
140 unsigned ShiftBits = 32 - XCOFF::TracebackTable::WidthOfParamType;
141
142 int Bits = 0;
143 for (const auto &Elt : ParamtersType) {
144
145 if (Bits > 31 || (Bits > 30 && (Elt != FixedType || hasVectorParms())))
146 break;
147
148 switch (Elt) {
149 case FixedType:
150 if (hasVectorParms()) {
151 //'00' ==> fixed parameter if HasVectorParms is true.
153 ParamsTypeInfo |=
156 } else {
157 //'0' ==> fixed parameter if HasVectorParms is false.
158 ParamsTypeInfo <<= 1;
159 ++Bits;
160 }
161 break;
163 // '10'b => floating point short parameter.
165 ParamsTypeInfo |=
168 break;
170 // '11'b => floating point long parameter.
172 ParamsTypeInfo |=
175 break;
176 case VectorChar:
177 case VectorShort:
178 case VectorInt:
179 case VectorFloat:
180 // '01' ==> vector parameter
182 ParamsTypeInfo |=
185 break;
186 }
187 }
188
189 return Bits < 32 ? ParamsTypeInfo << (32 - Bits) : ParamsTypeInfo;
190}
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define F(x, y, z)
Definition MD5.cpp:54
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
MCContext & getContext() const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Ty * cloneInfo(const Ty &Old)
MCSymbol * getPICOffsetSymbol(MachineFunction &MF) const
bool isLiveInSExt(Register VReg) const
This function returns true if the specified vreg is a live-in register and sign-extended.
MCSymbol * getGlobalEPSymbol(MachineFunction &MF) const
MCSymbol * getLocalEPSymbol(MachineFunction &MF) const
bool isLiveInZExt(Register VReg) const
This function returns true if the specified vreg is a live-in register and zero-extended.
void appendParameterType(ParamType Type)
PPCFunctionInfo(const Function &F, const PPCSubtarget *STI)
MCSymbol * getTOCOffsetSymbol(MachineFunction &MF) const
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:391
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static constexpr uint8_t WidthOfParamType
Definition XCOFF.h:481
static constexpr uint32_t ParmTypeIsVectorShortBit
Definition XCOFF.h:477
static constexpr uint32_t ParmTypeIsDoubleBits
Definition XCOFF.h:463
static constexpr uint32_t ParmTypeIsVectorIntBit
Definition XCOFF.h:478
static constexpr uint32_t ParmTypeIsFixedBits
Definition XCOFF.h:460
static constexpr uint32_t ParmTypeIsVectorBits
Definition XCOFF.h:461
static constexpr uint32_t ParmTypeIsVectorCharBit
Definition XCOFF.h:476
static constexpr uint32_t ParmTypeIsVectorFloatBit
Definition XCOFF.h:479
static constexpr uint32_t ParmTypeIsFloatingBits
Definition XCOFF.h:462