26#define DEBUG_TYPE "ve-register-info"
28#define GET_REGINFO_TARGET_DESC
29#include "VEGenRegisterInfo.inc"
42 return CSR_preserve_all_SaveList;
54 return CSR_preserve_all_RegMask;
59 return CSR_NoRegs_RegMask;
83 for (
auto R : ReservedRegs)
97 unsigned Kind)
const {
98 return &VE::I64RegClass;
103 unsigned OffDisp = 2;
105#define RRCAS_multi_cases(NAME) NAME##rir : case NAME##rii
109 switch (
MI.getOpcode()) {
120#undef RRCAS_multi_cases
126class EliminateFrameIndex {
140 return TII.get(Opcode);
146 return build(
get(InstOpc), DestReg);
197 int64_t &
Offset, int64_t Bytes) {
210 build(VE::ANDrm, clobber).addReg(clobber).addImm(
M0(32));
211 build(VE::LEASLrri, clobber)
223 int64_t
Offset,
int FIOperandNum) {
228 MI.getOperand(FIOperandNum).ChangeToRegister(FrameReg,
false);
233 int64_t
Offset,
int FIOperandNum) {
234 assert(
MI.getOpcode() == VE::STQrii);
237 prepareReplaceFI(
MI, FrameReg,
Offset, 8);
240 Register SrcHiReg = getSubReg(SrcReg, VE::sub_even);
241 Register SrcLoReg = getSubReg(SrcReg, VE::sub_odd);
244 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(SrcLoReg);
247 MI.setDesc(
get(VE::STrii));
248 MI.getOperand(3).setReg(SrcHiReg);
254 int64_t
Offset,
int FIOperandNum) {
255 assert(
MI.getOpcode() == VE::LDQrii);
258 prepareReplaceFI(
MI, FrameReg,
Offset, 8);
261 Register DestHiReg = getSubReg(DestReg, VE::sub_even);
262 Register DestLoReg = getSubReg(DestReg, VE::sub_odd);
265 build(VE::LDrii, DestLoReg).addReg(FrameReg).addImm(0).addImm(0);
267 MI.setDesc(
get(VE::LDrii));
268 MI.getOperand(0).setReg(DestHiReg);
274 int64_t
Offset,
int FIOperandNum) {
275 assert(
MI.getOpcode() == VE::STVMrii);
290 prepareReplaceFI(
MI, FrameReg,
Offset, 24);
293 bool isKill =
MI.getOperand(3).isKill();
297 for (
int i = 0; i < 3; ++i) {
298 build(VE::SVMmr, TmpReg).addReg(SrcReg).addImm(i);
300 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(
306 MI.setDesc(
get(VE::STrii));
307 MI.getOperand(3).ChangeToRegister(TmpReg,
false,
false,
true);
312 int64_t
Offset,
int FIOperandNum) {
313 assert(
MI.getOpcode() == VE::LDVMrii);
328 prepareReplaceFI(
MI, FrameReg,
Offset, 24);
333 unsigned TmpReg = VE::SX16;
334 for (
int i = 0; i < 4; ++i) {
337 build(VE::LDrii, TmpReg).addReg(FrameReg).addImm(0).addImm(0);
342 MI.setDesc(
get(VE::LDrii));
343 MI.getOperand(0).ChangeToRegister(TmpReg,
true);
350 build(VE::LVMir_m, DestReg)
364 int64_t
Offset,
int FIOperandNum) {
365 assert(
MI.getOpcode() == VE::STVM512rii);
368 prepareReplaceFI(
MI, FrameReg,
Offset, 56);
371 Register SrcLoReg = getSubReg(SrcReg, VE::sub_vm_odd);
372 Register SrcHiReg = getSubReg(SrcReg, VE::sub_vm_even);
373 bool isKill =
MI.getOperand(3).isKill();
379 for (
int i = 0; i < 4; ++i) {
380 LastMI =
build(VE::SVMmr, TmpReg).addReg(SrcLoReg).addImm(i);
382 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(
390 for (
int i = 0; i < 3; ++i) {
391 build(VE::SVMmr, TmpReg).addReg(SrcHiReg).addImm(i);
393 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(
398 LastMI =
build(VE::SVMmr, TmpReg).addReg(SrcHiReg).addImm(3);
404 MI.setDesc(
get(VE::STrii));
405 MI.getOperand(3).ChangeToRegister(TmpReg,
false,
false,
true);
410 int64_t
Offset,
int FIOperandNum) {
411 assert(
MI.getOpcode() == VE::LDVM512rii);
414 prepareReplaceFI(
MI, FrameReg,
Offset, 56);
417 Register DestLoReg = getSubReg(DestReg, VE::sub_vm_odd);
418 Register DestHiReg = getSubReg(DestReg, VE::sub_vm_even);
422 build(VE::IMPLICIT_DEF, DestReg);
423 for (
int i = 0; i < 4; ++i) {
425 build(VE::LDrii, TmpReg).addReg(FrameReg).addImm(0).addImm(0);
427 build(VE::LVMir_m, DestLoReg)
433 for (
int i = 0; i < 3; ++i) {
435 build(VE::LDrii, TmpReg).addReg(FrameReg).addImm(0).addImm(0);
437 build(VE::LVMir_m, DestHiReg)
443 MI.setDesc(
get(VE::LDrii));
444 MI.getOperand(0).ChangeToRegister(TmpReg,
true);
453 int64_t
Offset,
int FIOperandNum) {
454 switch (
MI.getOpcode()) {
456 processSTQ(
MI, FrameReg,
Offset, FIOperandNum);
459 processLDQ(
MI, FrameReg,
Offset, FIOperandNum);
462 processSTVM(
MI, FrameReg,
Offset, FIOperandNum);
465 processLDVM(
MI, FrameReg,
Offset, FIOperandNum);
468 processSTVM512(
MI, FrameReg,
Offset, FIOperandNum);
471 processLDVM512(
MI, FrameReg,
Offset, FIOperandNum);
474 prepareReplaceFI(
MI, FrameReg,
Offset);
479 int SPAdj,
unsigned FIOperandNum,
481 assert(SPAdj == 0 &&
"Unexpected");
484 int FrameIndex =
MI.getOperand(FIOperandNum).getIndex();
492 EliminateFrameIndex EFI(
TII,
TRI,
DL, *
MI.getParent(),
II);
497 TFI.getFrameIndexReference(MF, FrameIndex, FrameReg).getFixed();
500 EFI.processMI(
MI, FrameReg,
Offset, FIOperandNum);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file implements the BitVector class.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
const HexagonInstrInfo * TII
unsigned const TargetRegisterInfo * TRI
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void replaceFI(MachineFunction &MF, MachineBasicBlock::iterator II, MachineInstr &MI, const DebugLoc &dl, unsigned FIOperandNum, int Offset, unsigned FramePtr)
static unsigned offsetToDisp(MachineInstr &MI)
#define RRCAS_multi_cases(NAME)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Describe properties that are true of each instruction in the target description file.
MCRegAliasIterator enumerates all registers aliasing Reg.
Wrapper class representing physical registers. Should be passed by value.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Representation of each machine instruction.
bool addRegisterKilled(Register IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
Wrapper class representing virtual and physical registers.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const VEInstrInfo * getInstrInfo() const override
const VERegisterInfo * getRegisterInfo() const override
@ PreserveAll
Used for runtime calls that preserves (almost) all registers.
@ Fast
Attempts to make calls as fast as possible (e.g.
Error build(ArrayRef< Module * > Mods, SmallVector< char, 0 > &Symtab, StringTableBuilder &StrtabBuilder, BumpPtrAllocator &Alloc)
Fills in Symtab and StrtabBuilder with a valid symbol and string table for Mods.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
constexpr uint32_t Hi_32(uint64_t Value)
Return the high 32 bits of a 64 bit value.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
constexpr uint32_t Lo_32(uint64_t Value)
Return the low 32 bits of a 64 bit value.
unsigned getKillRegState(bool B)
unsigned M0(unsigned Val)
const TargetRegisterClass * getPointerRegClass(const MachineFunction &MF, unsigned Kind) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
const uint32_t * getNoPreservedMask() const override
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID CC) const override
Register getFrameRegister(const MachineFunction &MF) const override