40 #define GET_REGINFO_TARGET_DESC 41 #include "HexagonGenRegisterInfo.inc" 51 return R == Hexagon::R0 || R == Hexagon::R1 || R ==
Hexagon::R2 ||
52 R == Hexagon::R3 || R == Hexagon::D0 || R == Hexagon::D1;
58 using namespace Hexagon;
61 R0, R1,
R2, R3,
R4, R5,
R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, 0
64 D0, D1, D2, D3, D4, D5, D6, D7, 0
70 V0, V1,
V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
71 V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27,
75 W0, W1, W2, W3, W4, W5, W6, W7, W8, W9, W10, W11, W12, W13, W14, W15, 0
78 switch (RC->
getID()) {
79 case IntRegsRegClassID:
81 case DoubleRegsRegClassID:
83 case PredRegsRegClassID:
95 dbgs() <<
"Register class: " << getRegClassName(RC) <<
"\n";
104 static const MCPhysReg CalleeSavedRegsV3[] = {
105 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
106 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23,
107 Hexagon::R24, Hexagon::R25, Hexagon::R26, Hexagon::R27, 0
112 static const MCPhysReg CalleeSavedRegsV3EHReturn[] = {
113 Hexagon::R0, Hexagon::R1,
Hexagon::R2, Hexagon::R3,
114 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
115 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23,
116 Hexagon::R24, Hexagon::R25, Hexagon::R26, Hexagon::R27, 0
128 return HasEHReturn ? CalleeSavedRegsV3EHReturn : CalleeSavedRegsV3;
131 llvm_unreachable(
"Callee saved registers requested for unknown architecture " 138 return HexagonCSR_RegMask;
145 Reserved.
set(Hexagon::R29);
146 Reserved.
set(Hexagon::R30);
147 Reserved.
set(Hexagon::R31);
148 Reserved.
set(Hexagon::VTMP);
151 Reserved.
set(Hexagon::GELR);
152 Reserved.
set(Hexagon::GSR);
153 Reserved.
set(Hexagon::GOSP);
154 Reserved.
set(Hexagon::G3);
157 Reserved.
set(Hexagon::SA0);
158 Reserved.
set(Hexagon::LC0);
159 Reserved.
set(Hexagon::SA1);
160 Reserved.
set(Hexagon::LC1);
161 Reserved.
set(Hexagon::P3_0);
162 Reserved.
set(Hexagon::USR);
163 Reserved.
set(Hexagon::PC);
164 Reserved.
set(Hexagon::UGP);
165 Reserved.
set(Hexagon::GP);
166 Reserved.
set(Hexagon::CS0);
167 Reserved.
set(Hexagon::CS1);
168 Reserved.
set(Hexagon::UPCYCLELO);
169 Reserved.
set(Hexagon::UPCYCLEHI);
170 Reserved.
set(Hexagon::FRAMELIMIT);
171 Reserved.
set(Hexagon::FRAMEKEY);
172 Reserved.
set(Hexagon::PKTCOUNTLO);
173 Reserved.
set(Hexagon::PKTCOUNTHI);
174 Reserved.
set(Hexagon::UTIMERLO);
175 Reserved.
set(Hexagon::UTIMERHI);
179 Reserved.
set(Hexagon::C8);
180 Reserved.
set(Hexagon::USR_OVF);
183 Reserved.
set(Hexagon::R19);
186 markSuperRegs(Reserved, x);
193 int SPAdj,
unsigned FIOp,
197 assert(SPAdj == 0 &&
"Unexpected");
204 auto &HFI = *HST.getFrameLowering();
210 int Offset = HFI.getFrameIndexReference(MF, FI, BP);
217 case Hexagon::PS_fia:
218 MI.
setDesc(HII.get(Hexagon::A2_addi));
224 MI.
setDesc(HII.get(Hexagon::A2_addi));
228 if (!HII.isValidOffset(Opc, RealOffset,
this)) {
232 unsigned TmpR =
MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
234 BuildMI(MB, II, DL, HII.get(Hexagon::A2_addi), TmpR)
257 if (!HST.
useHVXOps() || NewRC->
getID() != Hexagon::HvxWRRegClass.getID())
259 bool SmallSrc = SrcRC->
getID() == Hexagon::HvxVRRegClass.getID();
260 bool SmallDst = DstRC->
getID() == Hexagon::HvxVRRegClass.getID();
261 if (!SmallSrc && !SmallDst)
268 for (
SlotIndex I = S.start.getBaseIndex(),
E = S.end.getBaseIndex();
269 I !=
E;
I =
I.getNextIndex()) {
277 if (SmallSrc == SmallDst) {
289 unsigned SmallReg = SmallSrc ? SrcReg : DstReg;
290 unsigned LargeReg = SmallSrc ? DstReg : SrcReg;
324 static const unsigned ISub[] = { Hexagon::isub_lo, Hexagon::isub_hi };
325 static const unsigned VSub[] = { Hexagon::vsub_lo, Hexagon::vsub_hi };
327 switch (RC.
getID()) {
328 case Hexagon::CtrRegs64RegClassID:
329 case Hexagon::DoubleRegsRegClassID:
331 case Hexagon::HvxWRRegClassID:
348 unsigned Kind)
const {
349 return &Hexagon::IntRegsRegClass;
bool isCall(QueryType Type=AnyInBundle) const
Compute iterated dominance frontiers using a linear time algorithm.
void ChangeToRegister(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value...
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned getReg() const
getReg - Returns the register number.
Hexagon target-specific information for each MachineFunction.
This represents a simple continuous liveness interval for a value.
const Hexagon::ArchEnum & getHexagonArchVersion() const
unsigned getStackRegister() const
bool isEHReturnCalleeSaveReg(unsigned Reg) const
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
int find_next(unsigned Prev) const
find_next - Returns the index of the next set bit following the "Prev" bit.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned getID() const
Return the register class ID number.
bool hasReservedR19() const
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
const MCPhysReg * getCallerSavedRegs(const MachineFunction *MF, const TargetRegisterClass *RC) const
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
void ChangeToImmediate(int64_t ImmVal)
ChangeToImmediate - Replace this operand with a new immediate operand of the specified value...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
sc_iterator getSuperClasses() const
Returns a NULL-terminated list of super-classes.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
This file declares the machine register scavenger class.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const override
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
HexagonRegisterInfo(unsigned HwMode)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
unsigned getFirstCallerSavedNonParamReg() const
LiveInterval & getInterval(unsigned Reg)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const MachineBasicBlock * getParent() const
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 useFPForScavengingIndex(const MachineFunction &MF) const override
Returns true if the frame pointer is valid.
unsigned getRARegister() const
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
SlotIndexes * getSlotIndexes() const
BitVector getReservedRegs(const MachineFunction &MF) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const HexagonInstrInfo * getInstrInfo() const override
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
void RemoveOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
const MachineOperand & getOperand(unsigned i) const
SlotIndex - An opaque wrapper around machine indexes.
unsigned getHexagonSubRegIndex(const TargetRegisterClass &RC, unsigned GenIdx) const
unsigned getFrameRegister() const
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...