LLVM  13.0.0git
SystemZRegisterInfo.h
Go to the documentation of this file.
1 //===-- SystemZRegisterInfo.h - SystemZ register information ----*- C++ -*-===//
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 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZREGISTERINFO_H
10 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZREGISTERINFO_H
11 
12 #include "SystemZ.h"
14 
15 #define GET_REGINFO_HEADER
16 #include "SystemZGenRegisterInfo.inc"
17 
18 namespace llvm {
19 
20 class LiveIntervals;
21 
22 namespace SystemZ {
23 // Return the subreg to use for referring to the even and odd registers
24 // in a GR128 pair. Is32Bit says whether we want a GR32 or GR64.
25 inline unsigned even128(bool Is32bit) {
26  return Is32bit ? subreg_hl32 : subreg_h64;
27 }
28 inline unsigned odd128(bool Is32bit) {
29  return Is32bit ? subreg_l32 : subreg_l64;
30 }
31 
32 // Reg should be a 32-bit GPR. Return true if it is a high register rather
33 // than a low register.
34 inline bool isHighReg(unsigned int Reg) {
35  if (SystemZ::GRH32BitRegClass.contains(Reg))
36  return true;
37  assert(SystemZ::GR32BitRegClass.contains(Reg) && "Invalid GRX32");
38  return false;
39 }
40 } // end namespace SystemZ
41 
43 public:
45 
46  /// getPointerRegClass - Return the register class to use to hold pointers.
47  /// This is currently only used by LOAD_STACK_GUARD, which requires a non-%r0
48  /// register, hence ADDR64.
49  const TargetRegisterClass *
51  unsigned Kind=0) const override {
52  return &SystemZ::ADDR64BitRegClass;
53  }
54 
55  /// getCrossCopyRegClass - Returns a legal register class to copy a register
56  /// in the specified class to or from. Returns NULL if it is possible to copy
57  /// between a two registers of the specified class.
58  const TargetRegisterClass *
59  getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
60 
63  const MachineFunction &MF, const VirtRegMap *VRM,
64  const LiveRegMatrix *Matrix) const override;
65 
66  // Override TargetRegisterInfo.h.
67  bool requiresRegisterScavenging(const MachineFunction &MF) const override {
68  return true;
69  }
70  bool requiresFrameIndexScavenging(const MachineFunction &MF) const override {
71  return true;
72  }
73  const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
75  CallingConv::ID CC) const override;
76  BitVector getReservedRegs(const MachineFunction &MF) const override;
78  int SPAdj, unsigned FIOperandNum,
79  RegScavenger *RS) const override;
80 
81  /// SrcRC and DstRC will be morphed into NewRC if this returns true.
83  const TargetRegisterClass *SrcRC,
84  unsigned SubReg,
85  const TargetRegisterClass *DstRC,
86  unsigned DstSubReg,
87  const TargetRegisterClass *NewRC,
88  LiveIntervals &LIS) const override;
89 
90  Register getFrameRegister(const MachineFunction &MF) const override;
91 };
92 
93 } // end namespace llvm
94 
95 #endif
llvm::EngineKind::Kind
Kind
Definition: ExecutionEngine.h:524
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:100
llvm
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
contains
return AArch64::GPR64RegClass contains(Reg)
llvm::VirtRegMap
Definition: VirtRegMap.h:33
llvm::SystemZRegisterInfo::getFrameRegister
Register getFrameRegister(const MachineFunction &MF) const override
Definition: SystemZRegisterInfo.cpp:421
llvm::SystemZRegisterInfo::eliminateFrameIndex
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const override
Definition: SystemZRegisterInfo.cpp:255
llvm::SystemZRegisterInfo::getReservedRegs
BitVector getReservedRegs(const MachineFunction &MF) const override
Definition: SystemZRegisterInfo.cpp:226
llvm::SystemZRegisterInfo::shouldCoalesce
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.
Definition: SystemZRegisterInfo.cpp:349
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::SystemZRegisterInfo::SystemZRegisterInfo
SystemZRegisterInfo()
Definition: SystemZRegisterInfo.cpp:25
llvm::SystemZ::isHighReg
bool isHighReg(unsigned int Reg)
Definition: SystemZRegisterInfo.h:34
llvm::BitVector
Definition: BitVector.h:74
SystemZ.h
llvm::SystemZRegisterInfo::getRegAllocationHints
bool getRegAllocationHints(Register VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const override
Definition: SystemZRegisterInfo.cpp:77
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::SystemZ::odd128
unsigned odd128(bool Is32bit)
Definition: SystemZRegisterInfo.h:28
llvm::SystemZRegisterInfo::requiresFrameIndexScavenging
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override
Definition: SystemZRegisterInfo.h:70
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::SystemZRegisterInfo::getCrossCopyRegClass
const TargetRegisterClass * getCrossCopyRegClass(const TargetRegisterClass *RC) const override
getCrossCopyRegClass - Returns a legal register class to copy a register in the specified class to or...
Definition: SystemZRegisterInfo.cpp:427
llvm::RegScavenger
Definition: RegisterScavenging.h:34
llvm::SystemZRegisterInfo::getCallPreservedMask
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID CC) const override
Definition: SystemZRegisterInfo.cpp:210
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MachineFunction
Definition: MachineFunction.h:227
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:33
Matrix
Live Register Matrix
Definition: LiveRegMatrix.cpp:44
uint32_t
llvm::SystemZRegisterInfo::getCalleeSavedRegs
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Definition: SystemZRegisterInfo.cpp:195
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::SystemZ::even128
unsigned even128(bool Is32bit)
Definition: SystemZRegisterInfo.h:25
uint16_t
SystemZGenRegisterInfo
llvm::LiveIntervals
Definition: LiveIntervals.h:54
llvm::SystemZRegisterInfo
Definition: SystemZRegisterInfo.h:42
llvm::SystemZRegisterInfo::requiresRegisterScavenging
bool requiresRegisterScavenging(const MachineFunction &MF) const override
Definition: SystemZRegisterInfo.h:67
llvm::SmallVectorImpl< MCPhysReg >
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::SystemZRegisterInfo::getPointerRegClass
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
getPointerRegClass - Return the register class to use to hold pointers.
Definition: SystemZRegisterInfo.h:50
TargetRegisterInfo.h
SubReg
unsigned SubReg
Definition: AArch64AdvSIMDScalarPass.cpp:104
llvm::LiveRegMatrix
Definition: LiveRegMatrix.h:40