22#define GET_REGINFO_TARGET_DESC
23#include "PISAGenRegisterInfo.inc"
28struct SpecialRegEntry {
33#pragma GCC diagnostic push
34#pragma GCC diagnostic ignored "-Wunused-function"
36#define GET_SpecialRegNames_IMPL
37#include "PISAGenSearchableTables.inc"
39#pragma GCC diagnostic pop
43static_assert(PISA::NUM_TARGET_SUBREGS == 63,
"updated needed!");
45PISARegisterInfo::getSwizzleMap() {
46 static const DenseMap<unsigned, SwizzleDesc> SwizzleMap = {
95 static_assert(std::size(PISAMCRegisterClassStorage.Classes) == 29);
96 unsigned NumRCs = getNumRegClasses();
97 for (
unsigned I = 0;
I < NumRCs;
I++) {
99 std::unique_ptr<RegClassDescription> RCD =
100 std::make_unique<RegClassDescription>();
101 if (RC == &PISA::RegV64_32bRegClass) {
105 RCD->NumElements = 64;
106 RCD->ScalarBitSize = 32;
109 RCD->ScalarBitSize = getScalarBitSize(RC, RCD->NumElements);
111 std::pair<unsigned, unsigned>
Key =
112 std::make_pair(RCD->NumElements, RCD->ScalarBitSize);
113 if (!VecRegClassMap[
Key])
114 VecRegClassMap[std::make_pair(RCD->NumElements, RCD->ScalarBitSize)] = RC;
115 RegClassMap[RC] = std::move(RCD);
119 SpecialRegs.resize(getNumRegs());
120 for (
unsigned I = 1, E = getNumRegs();
I < E; ++
I) {
122 if (lookupSpecialRegByName(
getName(Reg)))
151 unsigned NumElts)
const {
158 assert(Idx < 4 &&
"Only 4 sub-registers supported!");
160 static unsigned Subregs[4][4] = {
161 {PISA::sub8_0, PISA::sub8_1, PISA::sub8_2, PISA::sub8_3},
162 {PISA::sub16_0, PISA::sub16_1, PISA::sub16_2, PISA::sub16_3},
163 {PISA::sub32_0, PISA::sub32_1, PISA::sub32_2, PISA::sub32_3},
164 {PISA::sub64_0, PISA::sub64_1, PISA::sub64_2, PISA::sub64_3}};
168 return Subregs[0][Idx];
170 return Subregs[1][Idx];
172 return Subregs[2][Idx];
174 return Subregs[3][Idx];
181 unsigned Count)
const {
188 return Low ? PISA::sub8_xy : PISA::sub8_zw;
190 return Low ? PISA::sub16_xy : PISA::sub16_zw;
192 return Low ? PISA::sub32_xy : PISA::sub32_zw;
194 return Low ? PISA::sub64_xy : PISA::sub64_zw;
203 SwizzleMap.
find(SubReg);
204 assert((Swizzle != SwizzleMap.
end()) &&
"invalid swizzle!");
205 return Swizzle->second.Swizzle;
211 SwizzleMap.
find(SubReg);
212 assert((Swizzle != SwizzleMap.
end()) &&
"invalid swizzle!");
213 return Swizzle->second.SwizzleName;
229 if (Ty.isScalar() || Ty.isPointer()) {
230 switch (Ty.getSizeInBits()) {
232 return &PISA::PredRegClass;
234 return &PISA::Reg8bRegClass;
236 return &PISA::Reg16bRegClass;
238 return &PISA::Reg32bRegClass;
240 return &PISA::Reg64bRegClass;
242 return &PISA::Reg128bRegClass;
246 }
else if (Ty.isVector()) {
247 unsigned NumElts = Ty.getNumElements();
248 unsigned BitSize = Ty.getScalarSizeInBits();
259 RegClassMap.find(RC);
260 assert(
I != RegClassMap.end());
261 const std::unique_ptr<RegClassDescription> &RCD =
I->second;
262 return RCD->NumElements;
269 RegClassMap.find(RC);
270 assert(
I != RegClassMap.end());
271 const std::unique_ptr<RegClassDescription> &RCD =
I->second;
272 return RCD->ScalarBitSize;
277 std::pair<unsigned, unsigned>
P = std::make_pair(NumElts, BitSize);
280 VecRegClassMap.find(
P);
281 assert(
I != VecRegClassMap.end());
286 return Reg.isPhysical() && SpecialRegs.test(Reg.asMCReg());
292 unsigned SubIdx)
const {
295 return PISAGenRegisterInfo::getMatchingSuperRegClass(
A,
B, SubIdx);
302 return PISAGenRegisterInfo::getSubClassWithSubReg(
A, SubIdx);
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file declares register information for the PISA target.
This file declares the PISA subtarget.
This file declares the top-level interfaces for the PISA target.
static StringRef getName(Value *V)
static const MCPhysReg CalleeSavedReg
uint16_t RegSizeInBits(const MCRegisterInfo &MRI, MCRegister RegNo)
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
iterator find(const_arg_type_t< KeyT > Val)
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true > const_iterator
const LaneBitmask LaneMask
Wrapper class representing physical registers and target specific virtual registers.
Representation of each machine instruction.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
unsigned getBitSizeFromRegClass(const TargetRegisterClass *RC) const
const char * getSwizzleName(unsigned SubReg) const
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
unsigned getNumEltsFromRegClass(const TargetRegisterClass *RC) const
const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned SubIdx) const override
const TargetRegisterClass * getVectorRegClass(unsigned NumElts, unsigned BitSize) const
bool isSpecialReg(Register Reg) const
static bool isSelectorSwizzle(PISA::Swizzle Swizzle)
PISA::Swizzle getSwizzle(unsigned SubReg) const
const TargetRegisterClass * getRegClassFromLLT(LLT Ty) const
unsigned getSubRegIdx(unsigned Size, unsigned Elt) const
unsigned getCompositeSubRegIdx(unsigned Size, unsigned Base, unsigned Count) const
BitVector getReservedRegs(const MachineFunction &MF) const override
Wrapper class representing virtual and physical registers.
#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.
@ Low
Lower the current thread's priority such that it does not affect foreground tasks significantly.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
MCRegisterClass TargetRegisterClass
unsigned getNumLanes() const