28 "loongarch-disable-reloc-sched",
29 cl::desc(
"Disable scheduling of instructions with target flags"),
32#define GET_INSTRINFO_CTOR_DTOR
33#include "LoongArchGenInstrInfo.inc"
52 bool RenamableSrc)
const {
53 if (LoongArch::GPRRegClass.
contains(DstReg, SrcReg)) {
61 if (LoongArch::LSX128RegClass.
contains(DstReg, SrcReg)) {
69 if (LoongArch::LASX256RegClass.
contains(DstReg, SrcReg)) {
77 if (LoongArch::CFRRegClass.
contains(DstReg) &&
78 LoongArch::GPRRegClass.
contains(SrcReg)) {
84 if (LoongArch::GPRRegClass.
contains(DstReg) &&
85 LoongArch::CFRRegClass.
contains(SrcReg)) {
91 if (LoongArch::CFRRegClass.
contains(DstReg, SrcReg)) {
99 if (LoongArch::FPR32RegClass.
contains(DstReg, SrcReg)) {
100 Opc = LoongArch::FMOV_S;
101 }
else if (LoongArch::FPR64RegClass.
contains(DstReg, SrcReg)) {
102 Opc = LoongArch::FMOV_D;
103 }
else if (LoongArch::GPRRegClass.
contains(DstReg) &&
104 LoongArch::FPR32RegClass.
contains(SrcReg)) {
106 Opc = LoongArch::MOVFR2GR_S;
107 }
else if (LoongArch::GPRRegClass.
contains(DstReg) &&
108 LoongArch::FPR64RegClass.
contains(SrcReg)) {
110 Opc = LoongArch::MOVFR2GR_D;
129 if (LoongArch::GPRRegClass.hasSubClassEq(RC))
130 Opcode =
TRI.getRegSizeInBits(LoongArch::GPRRegClass) == 32
133 else if (LoongArch::FPR32RegClass.hasSubClassEq(RC))
134 Opcode = LoongArch::FST_S;
135 else if (LoongArch::FPR64RegClass.hasSubClassEq(RC))
136 Opcode = LoongArch::FST_D;
137 else if (LoongArch::LSX128RegClass.hasSubClassEq(RC))
138 Opcode = LoongArch::VST;
139 else if (LoongArch::LASX256RegClass.hasSubClassEq(RC))
140 Opcode = LoongArch::XVST;
141 else if (LoongArch::CFRRegClass.hasSubClassEq(RC))
142 Opcode = LoongArch::PseudoST_CFR;
165 DL =
I->getDebugLoc();
168 if (LoongArch::GPRRegClass.hasSubClassEq(RC))
169 Opcode = RegInfo.getRegSizeInBits(LoongArch::GPRRegClass) == 32
172 else if (LoongArch::FPR32RegClass.hasSubClassEq(RC))
173 Opcode = LoongArch::FLD_S;
174 else if (LoongArch::FPR64RegClass.hasSubClassEq(RC))
175 Opcode = LoongArch::FLD_D;
176 else if (LoongArch::LSX128RegClass.hasSubClassEq(RC))
177 Opcode = LoongArch::VLD;
178 else if (LoongArch::LASX256RegClass.hasSubClassEq(RC))
179 Opcode = LoongArch::XVLD;
180 else if (LoongArch::CFRRegClass.hasSubClassEq(RC))
181 Opcode = LoongArch::PseudoLD_CFR;
207 for (
auto &Inst : Seq) {
209 case LoongArch::LU12I_W:
214 case LoongArch::ADDI_W:
216 case LoongArch::LU32I_D:
217 case LoongArch::LU52I_D:
223 case LoongArch::BSTRINS_D:
232 assert(
false &&
"Unknown insn emitted by LoongArchMatInt");
241 unsigned Opcode =
MI.getOpcode();
243 if (Opcode == TargetOpcode::INLINEASM ||
244 Opcode == TargetOpcode::INLINEASM_BR) {
247 return getInlineAsmLength(
MI.getOperand(0).getSymbolName(), *MAI);
250 unsigned NumBytes = 0;
256 switch (
Desc.getOpcode()) {
258 return Desc.getSize();
259 case TargetOpcode::STATEPOINT:
261 assert(NumBytes % 4 == 0 &&
"Invalid number of NOP bytes requested!");
266 case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
269 if (
F.hasFnAttribute(
"patchable-function-entry")) {
271 if (
F.getFnAttribute(
"patchable-function-entry")
273 .getAsInteger(10, Num))
279 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
280 case TargetOpcode::PATCHABLE_TAIL_CALL:
288 const unsigned Opcode =
MI.getOpcode();
292 case LoongArch::ADDI_D:
294 case LoongArch::XORI:
295 return (
MI.getOperand(1).isReg() &&
296 MI.getOperand(1).getReg() == LoongArch::R0) ||
297 (
MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0);
299 return MI.isAsCheapAsAMove();
304 assert(
MI.getDesc().isBranch() &&
"Unexpected opcode!");
306 return MI.getOperand(
MI.getNumExplicitOperands() - 1).getMBB();
313 "Unknown conditional branch");
318 for (
int i = 0; i < NumOp - 1; i++)
326 bool AllowModify)
const {
332 if (
I ==
MBB.end() || !isUnpredicatedTerminator(*
I))
338 int NumTerminators = 0;
339 for (
auto J =
I.getReverse(); J !=
MBB.rend() && isUnpredicatedTerminator(*J);
342 if (J->getDesc().isUnconditionalBranch() ||
343 J->getDesc().isIndirectBranch()) {
350 if (AllowModify && FirstUncondOrIndirectBr !=
MBB.end()) {
351 while (std::next(FirstUncondOrIndirectBr) !=
MBB.end()) {
352 std::next(FirstUncondOrIndirectBr)->eraseFromParent();
355 I = FirstUncondOrIndirectBr;
359 if (NumTerminators == 1 &&
I->getDesc().isUnconditionalBranch()) {
365 if (NumTerminators == 1 &&
I->getDesc().isConditionalBranch()) {
371 if (NumTerminators == 2 && std::prev(
I)->getDesc().isConditionalBranch() &&
372 I->getDesc().isUnconditionalBranch()) {
383 int64_t BrOffset)
const {
391 case LoongArch::BLTU:
392 case LoongArch::BGEU:
394 case LoongArch::BEQZ:
395 case LoongArch::BNEZ:
396 case LoongArch::BCEQZ:
397 case LoongArch::BCNEZ:
400 case LoongArch::PseudoBR:
410 if (MO.getTargetFlags())
414 auto MII =
MI.getIterator();
415 auto MIE =
MBB->end();
446 switch (
MI.getOpcode()) {
447 case LoongArch::PCALAU12I: {
448 auto AddI = std::next(MII);
449 if (AddI == MIE || AddI->getOpcode() != LoongArch::ADDI_D)
451 auto Lu32I = std::next(AddI);
452 if (Lu32I == MIE || Lu32I->getOpcode() != LoongArch::LU32I_D)
454 auto MO0 =
MI.getOperand(1).getTargetFlags();
455 auto MO1 = AddI->getOperand(2).getTargetFlags();
456 auto MO2 = Lu32I->getOperand(2).getTargetFlags();
473 case LoongArch::LU52I_D: {
474 auto MO =
MI.getOperand(2).getTargetFlags();
485 if (
STI.hasFeature(LoongArch::FeatureRelax)) {
502 unsigned AddiOp =
STI.is64Bit() ? LoongArch::ADDI_D : LoongArch::ADDI_W;
503 unsigned LdOp =
STI.is64Bit() ? LoongArch::LD_D : LoongArch::LD_W;
504 switch (
MI.getOpcode()) {
505 case LoongArch::PCALAU12I: {
507 auto SecondOp = std::next(MII);
509 if (SecondOp == MIE || SecondOp->getOpcode() != AddiOp)
511 auto Ld = std::next(SecondOp);
512 if (Ld == MIE || Ld->getOpcode() != LdOp)
520 if (SecondOp == MIE ||
521 (SecondOp->getOpcode() != AddiOp && SecondOp->getOpcode() != LdOp))
536 case LoongArch::ADDI_W:
537 case LoongArch::ADDI_D: {
543 case LoongArch::LD_W:
544 case LoongArch::LD_D: {
550 case LoongArch::PseudoDESC_CALL: {
577 int *BytesRemoved)
const {
584 if (!
I->getDesc().isBranch())
590 I->eraseFromParent();
594 if (
I ==
MBB.begin())
597 if (!
I->getDesc().isConditionalBranch())
603 I->eraseFromParent();
616 assert(
TBB &&
"insertBranch must not be told to insert a fallthrough");
618 "LoongArch branch conditions have at most two components!");
630 for (
unsigned i = 1; i <
Cond.size(); ++i)
653 assert(RS &&
"RegScavenger required for long branching");
655 "new block should be inserted for expanding unconditional branch");
663 bool Has32S =
STI.hasFeature(LoongArch::Feature32S);
667 "Branch offsets outside of the signed 32-bit range not supported");
673 unsigned ADDIOp =
STI.is64Bit() ? LoongArch::ADDI_D : LoongArch::ADDI_W;
694 RS->enterBasicBlockEnd(
MBB);
695 Register Scav = RS->scavengeRegisterBackwards(
696 LoongArch::GPRRegClass, PCAI->
getIterator(),
false,
698 if (Scav != LoongArch::NoRegister)
699 RS->setRegUsed(Scav);
703 Scav = LoongArch::R20;
705 if (FrameIndex == -1)
708 &LoongArch::GPRRegClass,
Register());
715 &LoongArch::GPRRegClass,
Register());
716 TRI->eliminateFrameIndex(RestoreBB.
back(),
728 return LoongArch::BNE;
730 return LoongArch::BEQ;
731 case LoongArch::BEQZ:
732 return LoongArch::BNEZ;
733 case LoongArch::BNEZ:
734 return LoongArch::BEQZ;
735 case LoongArch::BCEQZ:
736 return LoongArch::BCNEZ;
737 case LoongArch::BCNEZ:
738 return LoongArch::BCEQZ;
740 return LoongArch::BGE;
742 return LoongArch::BLT;
743 case LoongArch::BLTU:
744 return LoongArch::BGEU;
745 case LoongArch::BGEU:
746 return LoongArch::BLTU;
752 assert((
Cond.size() &&
Cond.size() <= 3) &&
"Invalid branch condition!");
757std::pair<unsigned, unsigned>
760 return std::make_pair(TF & Mask, TF & ~Mask);
767 static const std::pair<unsigned, const char *> TargetFlags[] = {
768 {MO_CALL,
"loongarch-call"},
769 {MO_CALL_PLT,
"loongarch-call-plt"},
770 {MO_PCREL_HI,
"loongarch-pcrel-hi"},
771 {MO_PCREL_LO,
"loongarch-pcrel-lo"},
772 {MO_PCREL64_LO,
"loongarch-pcrel64-lo"},
773 {MO_PCREL64_HI,
"loongarch-pcrel64-hi"},
774 {MO_GOT_PC_HI,
"loongarch-got-pc-hi"},
775 {MO_GOT_PC_LO,
"loongarch-got-pc-lo"},
776 {MO_GOT_PC64_LO,
"loongarch-got-pc64-lo"},
777 {MO_GOT_PC64_HI,
"loongarch-got-pc64-hi"},
778 {MO_LE_HI,
"loongarch-le-hi"},
779 {MO_LE_LO,
"loongarch-le-lo"},
780 {MO_LE64_LO,
"loongarch-le64-lo"},
781 {MO_LE64_HI,
"loongarch-le64-hi"},
782 {MO_IE_PC_HI,
"loongarch-ie-pc-hi"},
783 {MO_IE_PC_LO,
"loongarch-ie-pc-lo"},
784 {MO_IE_PC64_LO,
"loongarch-ie-pc64-lo"},
785 {MO_IE_PC64_HI,
"loongarch-ie-pc64-hi"},
786 {MO_LD_PC_HI,
"loongarch-ld-pc-hi"},
787 {MO_GD_PC_HI,
"loongarch-gd-pc-hi"},
788 {MO_CALL30,
"loongarch-call30"},
789 {MO_CALL36,
"loongarch-call36"},
790 {MO_DESC_PC_HI,
"loongarch-desc-pc-hi"},
791 {MO_DESC_PC_LO,
"loongarch-desc-pc-lo"},
792 {MO_DESC64_PC_LO,
"loongarch-desc64-pc-lo"},
793 {MO_DESC64_PC_HI,
"loongarch-desc64-pc-hi"},
794 {MO_DESC_LD,
"loongarch-desc-ld"},
795 {MO_DESC_CALL,
"loongarch-desc-call"},
796 {MO_LE_HI_R,
"loongarch-le-hi-r"},
797 {MO_LE_ADD_R,
"loongarch-le-add-r"},
798 {MO_LE_LO_R,
"loongarch-le-lo-r"},
799 {MO_PCADD_HI,
"loongarch-pcadd-hi"},
800 {MO_PCADD_LO,
"loongarch-pcadd-lo"},
801 {MO_GOT_PCADD_HI,
"loongarch-got-pcadd-hi"},
802 {MO_GOT_PCADD_LO,
"loongarch-got-pcadd-lo"},
803 {MO_IE_PCADD_HI,
"loongarch-ie-pcadd-hi"},
804 {MO_IE_PCADD_LO,
"loongarch-ie-pcadd-lo"},
805 {MO_LD_PCADD_HI,
"loongarch-ld-pcadd-hi"},
806 {MO_LD_PCADD_LO,
"loongarch-ld-pcadd-lo"},
807 {MO_GD_PCADD_HI,
"loongarch-gd-pcadd-hi"},
808 {MO_GD_PCADD_LO,
"loongarch-gd-pcadd-lo"},
809 {MO_DESC_PCADD_HI,
"loongarch-pcadd-desc-hi"},
810 {MO_DESC_PCADD_LO,
"loongarch-pcadd-desc-lo"}};
817 static const std::pair<unsigned, const char *> TargetFlags[] = {
818 {MO_RELAX,
"loongarch-relax"}};
826 enum MemIOffsetType {
842 case LoongArch::LDPTR_W:
843 case LoongArch::LDPTR_D:
844 case LoongArch::STPTR_W:
845 case LoongArch::STPTR_D:
848 case LoongArch::LD_B:
849 case LoongArch::LD_H:
850 case LoongArch::LD_W:
851 case LoongArch::LD_D:
852 case LoongArch::LD_BU:
853 case LoongArch::LD_HU:
854 case LoongArch::LD_WU:
855 case LoongArch::ST_B:
856 case LoongArch::ST_H:
857 case LoongArch::ST_W:
858 case LoongArch::ST_D:
859 case LoongArch::FLD_S:
860 case LoongArch::FLD_D:
861 case LoongArch::FST_S:
862 case LoongArch::FST_D:
865 case LoongArch::XVLD:
866 case LoongArch::XVST:
867 case LoongArch::VLDREPL_B:
868 case LoongArch::XVLDREPL_B:
871 case LoongArch::VLDREPL_H:
872 case LoongArch::XVLDREPL_H:
875 case LoongArch::VLDREPL_W:
876 case LoongArch::XVLDREPL_W:
879 case LoongArch::VLDREPL_D:
880 case LoongArch::XVLDREPL_D:
883 case LoongArch::VSTELM_B:
884 case LoongArch::XVSTELM_B:
887 case LoongArch::VSTELM_H:
888 case LoongArch::XVSTELM_H:
891 case LoongArch::VSTELM_W:
892 case LoongArch::XVSTELM_W:
895 case LoongArch::VSTELM_D:
896 case LoongArch::XVSTELM_D:
904 if ((AddrI.
getOpcode() != LoongArch::ADDI_W &&
905 AddrI.
getOpcode() != LoongArch::ADDI_D) ||
911 int64_t NewOffset = OldOffset + Disp;
916 !(OT == Imm12 &&
isInt<12>(NewOffset)) &&
920 !(OT == Imm8 &&
isInt<8>(NewOffset)) &&
941 "Addressing mode not supported for folding");
952 case LoongArch::VSTELM_B:
953 case LoongArch::VSTELM_H:
954 case LoongArch::VSTELM_W:
955 case LoongArch::VSTELM_D:
956 case LoongArch::XVSTELM_B:
957 case LoongArch::XVSTELM_H:
958 case LoongArch::XVSTELM_W:
959 case LoongArch::XVSTELM_D:
972 return MI.getOpcode() == LoongArch::ADDI_W &&
MI.getOperand(1).isReg() &&
973 MI.getOperand(2).isImm() &&
MI.getOperand(2).getImm() == 0;
static void parseCondBranch(MachineInstr *LastInst, MachineBasicBlock *&Target, SmallVectorImpl< MachineOperand > &Cond)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static unsigned getOppositeBranchOpc(unsigned Opcode)
static cl::opt< bool > DisableRelocSched("loongarch-disable-reloc-sched", cl::desc("Disable scheduling of instructions with target flags"), cl::init(false), cl::Hidden)
Register const TargetRegisterInfo * TRI
Promote Memory to Register
uint64_t IntrinsicInst * II
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
This file declares the machine register scavenger class.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register DstReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
ArrayRef< std::pair< unsigned, const char * > > getSerializableBitmaskMachineOperandTargetFlags() const override
const LoongArchSubtarget & STI
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
bool isSafeToMove(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool IsKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
bool isAsCheapAsAMove(const MachineInstr &MI) const override
MCInst getNop() const override
LoongArchInstrInfo(const LoongArchSubtarget &STI)
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
void movImm(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, Register DstReg, uint64_t Val, MachineInstr::MIFlag Flag=MachineInstr::NoFlags) const
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &dl, int *BytesAdded=nullptr) const override
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DstReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t BrOffset) const override
bool canFoldIntoAddrMode(const MachineInstr &MemI, Register Reg, const MachineInstr &AddrI, ExtAddrMode &AM) const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
MachineInstr * emitLdStWithAddr(MachineInstr &MemI, const ExtAddrMode &AM) const override
LoongArchMachineFunctionInfo - This class is derived from MachineFunctionInfo and contains private Lo...
int getBranchRelaxationSpillFrameIndex()
This class is intended to be used as a base class for asm properties and features specific to the tar...
LLVM_ABI MCSymbol * createNamedTempSymbol()
Create a temporary symbol with a unique name whose name cannot be omitted in the symbol table.
MCInstBuilder & addReg(MCRegister Reg)
Add a new register operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
bool isConditionalBranch() const
Return true if this is a branch which may fall through to the next instruction or may transfer contro...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MachineInstrBundleIterator< MachineInstr > iterator
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MCContext & getContext() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & setMemRefs(ArrayRef< MachineMemOperand * > MMOs) const
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
LLVM_ABI void setPreInstrSymbol(MachineFunction &MF, MCSymbol *Symbol)
Set a symbol that will be emitted just prior to the instruction itself.
LLVM_ABI unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
ArrayRef< MachineMemOperand * > memoperands() const
Access to memory operands of the instruction.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
uint32_t getFlags() const
Return the MI flags bitvector.
A description of a memory reference used in the backend.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
void setMBB(MachineBasicBlock *MBB)
static MachineOperand CreateImm(int64_t Val)
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
LLVM_ABI void clearVirtRegs()
clearVirtRegs - Remove all virtual registers (after physreg assignment).
LLVM_ABI void replaceRegWith(Register FromReg, Register ToReg)
replaceRegWith - Replace all instances of FromReg with ToReg in the machine function.
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
MI-level Statepoint operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given statepoint should emit.
virtual bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const
Test if the given instruction should be considered a scheduling boundary.
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
Target - Wrapper for Target specific information.
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static unsigned getDirectFlags(const MachineOperand &MO)
InstSeq generateInstSeq(int64_t Val)
bool isSEXT_W(const MachineInstr &MI)
initializer< Ty > init(const Ty &Val)
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.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
@ Kill
The last use of a register.
constexpr RegState getKillRegState(bool B)
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr RegState getDefRegState(bool B)
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr bool isShiftedInt(int64_t x)
Checks if a signed integer is an N bit number shifted left by S.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Used to describe addressing mode similar to ExtAddrMode in CodeGenPrepare.
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.