39 #define GET_REGINFO_TARGET_DESC
40 #include "HexagonGenRegisterInfo.inc"
49 return R == Hexagon::R0 || R == Hexagon::R1 || R ==
Hexagon::R2 ||
50 R == Hexagon::R3 || R == Hexagon::D0 || R == Hexagon::D1;
56 using namespace Hexagon;
59 R0, R1,
R2, R3,
R4, R5,
R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, 0
62 D0, D1, D2, D3, D4, D5, D6, D7, 0
68 V0, V1,
V2, V3,
V4,
V5, V6, V7, V8, V9, V10, V11, V12, V13,
69 V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27,
73 W0, W1, W2, W3, W4, W5, W6, W7, W8, W9, W10, W11, W12, W13, W14, W15, 0
76 switch (RC->
getID()) {
77 case IntRegsRegClassID:
79 case DoubleRegsRegClassID:
81 case PredRegsRegClassID:
83 case VectorRegsRegClassID:
84 case VectorRegs128BRegClassID:
86 case VecDblRegsRegClassID:
87 case VecDblRegs128BRegClassID:
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
127 return HasEHReturn ? CalleeSavedRegsV3EHReturn : CalleeSavedRegsV3;
130 llvm_unreachable(
"Callee saved registers requested for unknown architecture "
137 return HexagonCSR_RegMask;
144 Reserved.
set(Hexagon::R29);
145 Reserved.
set(Hexagon::R30);
146 Reserved.
set(Hexagon::R31);
148 Reserved.
set(Hexagon::SA0);
149 Reserved.
set(Hexagon::LC0);
150 Reserved.
set(Hexagon::SA1);
151 Reserved.
set(Hexagon::LC1);
152 Reserved.
set(Hexagon::P3_0);
153 Reserved.
set(Hexagon::USR);
154 Reserved.
set(Hexagon::PC);
155 Reserved.
set(Hexagon::UGP);
156 Reserved.
set(Hexagon::GP);
157 Reserved.
set(Hexagon::CS0);
158 Reserved.
set(Hexagon::CS1);
159 Reserved.
set(Hexagon::UPCYCLELO);
160 Reserved.
set(Hexagon::UPCYCLEHI);
161 Reserved.
set(Hexagon::FRAMELIMIT);
162 Reserved.
set(Hexagon::FRAMEKEY);
163 Reserved.
set(Hexagon::PKTCOUNTLO);
164 Reserved.
set(Hexagon::PKTCOUNTHI);
165 Reserved.
set(Hexagon::UTIMERLO);
166 Reserved.
set(Hexagon::UTIMERHI);
170 Reserved.
set(Hexagon::C8);
171 Reserved.
set(Hexagon::USR_OVF);
174 markSuperRegs(Reserved, x);
181 int SPAdj,
unsigned FIOp,
185 assert(SPAdj == 0 &&
"Unexpected");
192 auto &HFI = *HST.getFrameLowering();
198 int Offset = HFI.getFrameIndexReference(MF, FI, BP);
205 case Hexagon::PS_fia:
206 MI.
setDesc(HII.get(Hexagon::A2_addi));
212 MI.
setDesc(HII.get(Hexagon::A2_addi));
216 if (!HII.isValidOffset(Opc, RealOffset)) {
220 unsigned TmpR =
MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
222 BuildMI(MB, II, DL, HII.get(Hexagon::A2_addi), TmpR)
263 static const unsigned ISub[] = { Hexagon::isub_lo, Hexagon::isub_hi };
264 static const unsigned VSub[] = { Hexagon::vsub_lo, Hexagon::vsub_hi };
266 switch (RC->
getID()) {
267 case Hexagon::CtrRegs64RegClassID:
268 case Hexagon::DoubleRegsRegClassID:
270 case Hexagon::VecDblRegsRegClassID:
271 case Hexagon::VecDblRegs128BRegClassID:
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MCPhysReg * getCallerSavedRegs(const MachineFunction *MF, const TargetRegisterClass *RC) const
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
const HexagonArchEnum & getHexagonArchVersion() const
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...
int find_next(unsigned Prev) const
find_next - Returns the index of the next set bit following the "Prev" bit.
unsigned getRARegister() const
unsigned getID() const
Return the register class ID number.
Hexagon target-specific information for each MachineFunction.
unsigned getHexagonSubRegIndex(const TargetRegisterClass *RC, unsigned GenIdx) const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
unsigned getFrameRegister() const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
void RemoveOperand(unsigned i)
Erase an operand from an instruction, leaving it with one fewer operand than it started with...
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
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...
const MachineBasicBlock * getParent() const
unsigned getFirstCallerSavedNonParamReg() const
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
This file declares the machine register scavenger class.
unsigned const MachineRegisterInfo * MRI
bool isEHReturnCalleeSaveReg(unsigned Reg) const
const MachineOperand & getOperand(unsigned i) const
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
llvm_unreachable("Unknown RegBank!")
Representation of each machine instruction.
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.
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
unsigned getStackRegister() const
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...
sc_iterator getSuperClasses() const
Returns a NULL-terminated list of super-classes.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...