LLVM 24.0.0git
PISARegisterInfo.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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///
9/// \file
10/// This file declares register information for the PISA target.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_PISA_PISAREGISTERINFO_H
15#define LLVM_LIB_TARGET_PISA_PISAREGISTERINFO_H
16
17#include "PISADefines.h"
18#include "llvm/ADT/BitVector.h"
19#include "llvm/ADT/DenseMap.h"
21
22#define GET_REGINFO_HEADER
23#include "PISAGenRegisterInfo.inc"
24
25namespace llvm {
26
28public:
30 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
31 BitVector getReservedRegs(const MachineFunction &MF) const override;
33 unsigned FIOperandNum,
34 RegScavenger *RS = nullptr) const override {
35 llvm_unreachable("unexpected execution");
36 }
37 Register getFrameRegister(const MachineFunction &MF) const override {
38 return Register();
39 }
41 unsigned getNumEltsFromRegClass(const TargetRegisterClass *RC) const;
42 unsigned getBitSizeFromRegClass(const TargetRegisterClass *RC) const;
43 const TargetRegisterClass *getVectorRegClass(unsigned NumElts,
44 unsigned BitSize) const;
45 unsigned getSubRegIdx(unsigned Size, unsigned Elt) const;
46
47 // Return the composite sub-register index (.xy / .zw) covering `Count`
48 // consecutive elements of `Size` bits starting at element `Base`, or 0 if
49 // there is no nameable composite for that slice. Only 2-element pairs at
50 // base 0 (.xy) or base 2 (.zw) are supported.
51 unsigned getCompositeSubRegIdx(unsigned Size, unsigned Base,
52 unsigned Count) const;
53
54 PISA::Swizzle getSwizzle(unsigned SubReg) const;
55 const char *getSwizzleName(unsigned SubReg) const;
57
58 bool isSpecialReg(Register Reg) const;
59
61 unsigned SubReg, const TargetRegisterClass *DstRC,
62 unsigned DstSubReg, const TargetRegisterClass *NewRC,
63 LiveIntervals &LIS) const override;
64
68 unsigned SubIdx) const override;
69
70private:
71 unsigned getScalarBitSize(const TargetRegisterClass *RC,
72 unsigned NumElts) const;
73
74 struct RegClassDescription {
75 unsigned NumElements;
76 unsigned ScalarBitSize;
77 };
78
79 // Maps TargetRegisterClass -> RegClassDescription
80 DenseMap<const TargetRegisterClass *, std::unique_ptr<RegClassDescription>>
81 RegClassMap;
82 // Maps <NumElts, BitSize> -> TargetRegisterClass (vector reg class)
83 DenseMap<std::pair<unsigned, unsigned>, const TargetRegisterClass *>
84 VecRegClassMap;
85
86 // map SubReg info to Swizzle
87 struct SwizzleDesc {
89 const char *SwizzleName;
90 };
91 static const DenseMap<unsigned, SwizzleDesc> &getSwizzleMap();
92
93 BitVector SpecialRegs;
94};
95} // namespace llvm
96
97#endif // LLVM_LIB_TARGET_PISA_PISAREGISTERINFO_H
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines the DenseMap class.
IRTranslator LLVM IR MI
Register Reg
Promote Memory to Register
Definition Mem2Reg.cpp:110
This file declares definitions shared across the PISA backend.
static std::vector< std::pair< int, unsigned > > Swizzle(std::vector< std::pair< int, unsigned > > Src, R600InstrInfo::BankSwizzle Swz)
MachineInstrBundleIterator< MachineInstr > iterator
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
Register getFrameRegister(const MachineFunction &MF) const override
bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
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.
Definition Register.h:20
#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.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58