30#define DEBUG_TYPE "ve-register-info"
32#define GET_REGINFO_TARGET_DESC
33#include "VEGenRegisterInfo.inc"
46 return CSR_preserve_all_SaveList;
58 return CSR_preserve_all_RegMask;
63 return CSR_NoRegs_RegMask;
87 for (
auto R : ReservedRegs)
101 unsigned Kind)
const {
102 return &VE::I64RegClass;
107 unsigned OffDisp = 2;
109#define RRCAS_multi_cases(NAME) NAME##rir : case NAME##rii
113 switch (
MI.getOpcode()) {
124#undef RRCAS_multi_cases
130class EliminateFrameIndex {
144 return TII.get(Opcode);
150 return build(
get(InstOpc), DestReg);
201 int64_t &
Offset, int64_t Bytes) {
214 build(VE::ANDrm, clobber).addReg(clobber).addImm(
M0(32));
215 build(VE::LEASLrri, clobber)
227 int64_t
Offset,
int FIOperandNum) {
232 MI.getOperand(FIOperandNum).ChangeToRegister(FrameReg,
false);
237 int64_t
Offset,
int FIOperandNum) {
238 assert(
MI.getOpcode() == VE::STQrii);
241 prepareReplaceFI(
MI, FrameReg,
Offset, 8);
244 Register SrcHiReg = getSubReg(SrcReg, VE::sub_even);
245 Register SrcLoReg = getSubReg(SrcReg, VE::sub_odd);
248 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(SrcLoReg);
251 MI.setDesc(
get(VE::STrii));
252 MI.getOperand(3).setReg(SrcHiReg);
258 int64_t
Offset,
int FIOperandNum) {
259 assert(
MI.getOpcode() == VE::LDQrii);
262 prepareReplaceFI(
MI, FrameReg,
Offset, 8);
265 Register DestHiReg = getSubReg(DestReg, VE::sub_even);
266 Register DestLoReg = getSubReg(DestReg, VE::sub_odd);
269 build(VE::LDrii, DestLoReg).addReg(FrameReg).addImm(0).addImm(0);
271 MI.setDesc(
get(VE::LDrii));
272 MI.getOperand(0).setReg(DestHiReg);
278 int64_t
Offset,
int FIOperandNum) {
279 assert(
MI.getOpcode() == VE::STVMrii);
294 prepareReplaceFI(
MI, FrameReg,
Offset, 24);
297 bool isKill =
MI.getOperand(3).isKill();
301 for (
int i = 0; i < 3; ++i) {
302 build(VE::SVMmr, TmpReg).addReg(SrcReg).addImm(i);
304 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(
310 MI.setDesc(
get(VE::STrii));
311 MI.getOperand(3).ChangeToRegister(TmpReg,
false,
false,
true);
316 int64_t
Offset,
int FIOperandNum) {
317 assert(
MI.getOpcode() == VE::LDVMrii);
332 prepareReplaceFI(
MI, FrameReg,
Offset, 24);
337 unsigned TmpReg = VE::SX16;
338 for (
int i = 0; i < 4; ++i) {
341 build(VE::LDrii, TmpReg).addReg(FrameReg).addImm(0).addImm(0);
346 MI.setDesc(
get(VE::LDrii));
347 MI.getOperand(0).ChangeToRegister(TmpReg,
true);
354 build(VE::LVMir_m, DestReg)
368 int64_t
Offset,
int FIOperandNum) {
369 assert(
MI.getOpcode() == VE::STVM512rii);
372 prepareReplaceFI(
MI, FrameReg,
Offset, 56);
375 Register SrcLoReg = getSubReg(SrcReg, VE::sub_vm_odd);
376 Register SrcHiReg = getSubReg(SrcReg, VE::sub_vm_even);
377 bool isKill =
MI.getOperand(3).isKill();
383 for (
int i = 0; i < 4; ++i) {
384 LastMI =
build(VE::SVMmr, TmpReg).addReg(SrcLoReg).addImm(i);
386 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(
394 for (
int i = 0; i < 3; ++i) {
395 build(VE::SVMmr, TmpReg).addReg(SrcHiReg).addImm(i);
397 build(VE::STrii).addReg(FrameReg).addImm(0).addImm(0).addReg(
402 LastMI =
build(VE::SVMmr, TmpReg).addReg(SrcHiReg).addImm(3);
408 MI.setDesc(
get(VE::STrii));
409 MI.getOperand(3).ChangeToRegister(TmpReg,
false,
false,
true);
414 int64_t
Offset,
int FIOperandNum) {
415 assert(
MI.getOpcode() == VE::LDVM512rii);
418 prepareReplaceFI(
MI, FrameReg,
Offset, 56);
421 Register DestLoReg = getSubReg(DestReg, VE::sub_vm_odd);
422 Register DestHiReg = getSubReg(DestReg, VE::sub_vm_even);
426 build(VE::IMPLICIT_DEF, DestReg);
427 for (
int i = 0; i < 4; ++i) {
429 build(VE::LDrii, TmpReg).addReg(FrameReg).addImm(0).addImm(0);
431 build(VE::LVMir_m, DestLoReg)
437 for (
int i = 0; i < 3; ++i) {
439 build(VE::LDrii, TmpReg).addReg(FrameReg).addImm(0).addImm(0);
441 build(VE::LVMir_m, DestHiReg)
447 MI.setDesc(
get(VE::LDrii));
448 MI.getOperand(0).ChangeToRegister(TmpReg,
true);
457 int64_t
Offset,
int FIOperandNum) {
458 switch (
MI.getOpcode()) {
460 processSTQ(
MI, FrameReg,
Offset, FIOperandNum);
463 processLDQ(
MI, FrameReg,
Offset, FIOperandNum);
466 processSTVM(
MI, FrameReg,
Offset, FIOperandNum);
469 processLDVM(
MI, FrameReg,
Offset, FIOperandNum);
472 processSTVM512(
MI, FrameReg,
Offset, FIOperandNum);
475 processLDVM512(
MI, FrameReg,
Offset, FIOperandNum);
478 prepareReplaceFI(
MI, FrameReg,
Offset);
483 int SPAdj,
unsigned FIOperandNum,
485 assert(SPAdj == 0 &&
"Unexpected");
488 int FrameIndex =
MI.getOperand(FIOperandNum).getIndex();
496 EliminateFrameIndex EFI(
TII,
TRI,
DL, *
MI.getParent(),
II);
501 TFI.getFrameIndexReference(MF, FrameIndex, FrameReg).getFixed();
504 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