22 #define GET_REGINFO_TARGET_DESC 23 #include "SystemZGenRegisterInfo.inc" 35 if (SystemZ::GR32BitRegClass.hasSubClassEq(RC) ||
38 return &SystemZ::GR32BitRegClass;
39 if (SystemZ::GRH32BitRegClass.hasSubClassEq(RC) ||
42 return &SystemZ::GRH32BitRegClass;
46 if (SystemZ::GR32BitRegClass.
contains(PhysReg))
47 return &SystemZ::GR32BitRegClass;
49 "Phys reg not in GR32 or GRH32?");
50 return &SystemZ::GRH32BitRegClass;
53 assert (RC == &SystemZ::GRX32BitRegClass);
66 if (MRI->
getRegClass(VirtReg) == &SystemZ::GRX32BitRegClass) {
70 while (Worklist.
size()) {
72 if (!DoneRegs.
insert(Reg).second)
80 if (
Use.getOpcode() == SystemZ::LOCRMux) {
86 if (RC && RC != &SystemZ::GRX32BitRegClass) {
99 if (MRI->
getRegClass(OtherReg) == &SystemZ::GRX32BitRegClass)
113 return Subtarget.
hasVector()? CSR_SystemZ_AllRegs_Vector_SaveList
114 : CSR_SystemZ_AllRegs_SaveList;
117 Attribute::SwiftError))
118 return CSR_SystemZ_SwiftError_SaveList;
119 return CSR_SystemZ_SaveList;
127 return Subtarget.
hasVector()? CSR_SystemZ_AllRegs_Vector_RegMask
128 : CSR_SystemZ_AllRegs_RegMask;
131 Attribute::SwiftError))
132 return CSR_SystemZ_SwiftError_RegMask;
133 return CSR_SystemZ_RegMask;
141 if (TFI->
hasFP(MF)) {
143 Reserved.
set(SystemZ::R11D);
144 Reserved.
set(SystemZ::R11L);
145 Reserved.
set(SystemZ::R11H);
146 Reserved.
set(SystemZ::R10Q);
150 Reserved.
set(SystemZ::R15D);
151 Reserved.
set(SystemZ::R15L);
152 Reserved.
set(SystemZ::R15H);
153 Reserved.
set(SystemZ::R14Q);
156 Reserved.
set(SystemZ::A0);
157 Reserved.
set(SystemZ::A1);
164 int SPAdj,
unsigned FIOperandNum,
166 assert(SPAdj == 0 &&
"Outgoing arguments should be part of the frame");
176 int FrameIndex = MI->getOperand(FIOperandNum).getIndex();
179 MI->getOperand(FIOperandNum + 1).getImm());
182 if (MI->isDebugValue()) {
183 MI->getOperand(FIOperandNum).ChangeToRegister(BasePtr,
false);
184 MI->getOperand(FIOperandNum + 1).ChangeToImmediate(Offset);
190 unsigned Opcode = MI->getOpcode();
191 unsigned OpcodeForOffset =
TII->getOpcodeForOffset(Opcode, Offset);
192 if (OpcodeForOffset) {
196 OpcodeForOffset = SystemZ::LDE32;
198 MI->getOperand(FIOperandNum).ChangeToRegister(BasePtr,
false);
203 int64_t OldOffset =
Offset;
204 int64_t
Mask = 0xffff;
206 Offset = OldOffset &
Mask;
207 OpcodeForOffset =
TII->getOpcodeForOffset(Opcode, Offset);
209 assert(Mask &&
"One offset must be OK");
210 }
while (!OpcodeForOffset);
212 unsigned ScratchReg =
214 int64_t HighOffset = OldOffset -
Offset;
217 && MI->getOperand(FIOperandNum + 2).getReg() == 0) {
220 TII->loadImmediate(MBB, MI, ScratchReg, HighOffset);
221 MI->getOperand(FIOperandNum).ChangeToRegister(BasePtr,
false);
222 MI->getOperand(FIOperandNum + 2).ChangeToRegister(ScratchReg,
226 unsigned LAOpcode =
TII->getOpcodeForOffset(SystemZ::LA, HighOffset);
228 BuildMI(MBB, MI, DL,
TII->get(LAOpcode),ScratchReg)
233 TII->loadImmediate(MBB, MI, ScratchReg, HighOffset);
234 BuildMI(MBB, MI, DL,
TII->get(SystemZ::AGR),ScratchReg)
239 MI->getOperand(FIOperandNum).ChangeToRegister(ScratchReg,
243 MI->setDesc(
TII->get(OpcodeForOffset));
244 MI->getOperand(FIOperandNum + 1).ChangeToImmediate(Offset);
254 assert (MI->
isCopy() &&
"Only expecting COPY instructions");
258 (getRegSizeInBits(*SrcRC) <= 64 || getRegSizeInBits(*DstRC) <= 64)))
265 unsigned WideOpNo = (getRegSizeInBits(*SrcRC) == 128 ? 1 : 0);
286 assert (FirstMI && LastMI &&
"No instruction from index?");
293 for (; MII != MEE; ++MII) {
295 if (MO.isReg() && isPhysicalRegister(MO.getReg())) {
299 PhysClobbered.
set(*
SI);
306 unsigned const DemandedFreeGR128 = 3;
316 return TFI->
hasFP(MF) ? SystemZ::R11D : SystemZ::R15D;
321 if (RC == &SystemZ::CCRRegClass)
322 return &SystemZ::GR32BitRegClass;
virtual bool getRegAllocationHints(unsigned VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM=nullptr, const LiveRegMatrix *Matrix=nullptr) const
Get a list of 'hint' registers that the register allocator should try first when allocating a physica...
const TargetRegisterClass * getCommonSubClass(const TargetRegisterClass *A, const TargetRegisterClass *B, const MVT::SimpleValueType SVT=MVT::SimpleValueType::Any) const
Find the largest common subclass of A and B.
void push_back(const T &Elt)
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
bool contains(unsigned Reg) const
Return true if the specified register is included in this register class.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
Compute iterated dominance frontiers using a linear time algorithm.
unsigned getNumRegs() const
Return the number of registers in this class.
BitVector getReservedRegs(const MachineFunction &MF) const override
virtual int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
LiveInterval - This class represents the liveness of a register, or stack slot.
unsigned getReg() const
getReg - Returns the register number.
unsigned getSubReg() const
virtual const TargetLowering * getTargetLowering() const
unsigned const TargetRegisterInfo * TRI
return AArch64::GPR64RegClass contains(Reg)
bool getRegAllocationHints(unsigned VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
MCSuperRegIterator enumerates all super-registers of Reg.
const HexagonInstrInfo * TII
bool isLiveInToMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
A Use represents the edge between a Value definition and its users.
unsigned getFrameRegister(const MachineFunction &MF) const override
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
virtual bool supportSwiftError() const
Return true if the target supports swifterror attribute.
AttributeList getAttributes() const
Return the attribute list for this Function.
virtual const TargetInstrInfo * getInstrInfo() const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID CC) const override
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
SrcRC and DstRC will be morphed into NewRC if this returns true.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
SlotIndex endIndex() const
endNumber - return the maximum point of the range of the whole, exclusive.
unsigned const MachineRegisterInfo * MRI
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
getCrossCopyRegClass - Returns a legal register class to copy a register in the specified class to or...
bool hasSuperClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a super-class of or equal to this class.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
static const TargetRegisterClass * getRC32(MachineOperand &MO, const VirtRegMap *VRM, const MachineRegisterInfo *MRI)
size_type count() const
count - Returns the number of bits which are set.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
MachineOperand class - Representation of each machine instruction operand.
LLVM_NODISCARD T pop_back_val()
LiveInterval & getInterval(unsigned Reg)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool hasPhys(unsigned virtReg) const
returns true if the specified virtual register is mapped to a physical register
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
unsigned getPhys(unsigned virtReg) const
returns the physical register mapped to the specified virtual register
iterator_range< use_instr_iterator > use_instructions(unsigned Reg) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isLiveOutOfMBB(const LiveRange &LR, const MachineBasicBlock *mbb) const
SlotIndex beginIndex() const
beginIndex - Return the lowest numbered slot covered.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
const MachineOperand & getOperand(unsigned i) const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool isReserved(unsigned PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.