14 #ifndef LLVM_LIB_TARGET_ARM_ARMBASEINSTRINFO_H
15 #define LLVM_LIB_TARGET_ARM_ARMBASEINSTRINFO_H
28 #define GET_INSTRINFO_HEADER
29 #include "ARMGenInstrInfo.inc"
33 class ARMBaseRegisterInfo;
44 unsigned LoadImmOpc,
unsigned LoadOpc)
const;
74 RegSubRegPairAndIdx &InputReg)
const override;
90 RegSubRegPair &BaseReg,
91 RegSubRegPairAndIdx &InsertedReg)
const override;
102 unsigned OpIdx2)
const override;
131 bool AllowModify =
false)
const override;
133 int *BytesRemoved =
nullptr)
const override;
137 int *BytesAdded =
nullptr)
const override;
158 std::vector<MachineOperand> &Pred)
const override;
194 unsigned SrcReg,
bool KillSrc,
197 unsigned DestReg,
bool KillSrc,
201 const DebugLoc &
DL,
unsigned DestReg,
unsigned SrcReg,
202 bool KillSrc)
const override;
219 unsigned DestReg,
unsigned SubIdx,
227 unsigned SubIdx,
unsigned State,
239 int64_t &Offset2)
const override;
250 int64_t Offset1, int64_t Offset2,
251 unsigned NumLoads)
const override;
258 unsigned NumCycles,
unsigned ExtraPredCycles,
263 unsigned NumF,
unsigned ExtraF,
268 return NumCycles == 1;
279 unsigned &SrcReg2,
int &CmpMask,
280 int &CmpValue)
const override;
287 unsigned SrcReg2,
int CmpMask,
int CmpValue,
292 unsigned &FalseOp,
bool &Optimizable)
const override;
296 bool)
const override;
309 unsigned UseIdx)
const override;
311 SDNode *DefNode,
unsigned DefIdx,
312 SDNode *UseNode,
unsigned UseIdx)
const override;
315 std::pair<uint16_t, uint16_t>
329 unsigned getInstBundleLength(
const MachineInstr &MI)
const;
334 unsigned DefIdx,
unsigned DefAlign)
const;
338 unsigned DefIdx,
unsigned DefAlign)
const;
342 unsigned UseIdx,
unsigned UseAlign)
const;
346 unsigned UseIdx,
unsigned UseAlign)
const;
349 unsigned DefIdx,
unsigned DefAlign,
351 unsigned UseIdx,
unsigned UseAlign)
const;
358 const MCInstrDesc &UseMCID,
unsigned UseAdj)
const;
360 unsigned getPredicationCost(
const MachineInstr &MI)
const override;
364 unsigned *PredCost =
nullptr)
const override;
367 SDNode *Node)
const override;
373 unsigned UseIdx)
const override;
376 unsigned DefIdx)
const override;
401 return MLxEntryMap.
count(Opcode);
408 unsigned &AddSubOpc,
bool &NegAcc,
409 bool &HasLane)
const;
415 return MLxHazardOpcodes.
count(Opcode);
440 unsigned PredReg = 0) {
462 return Opc ==
ARM::B || Opc == ARM::tB || Opc == ARM::t2B;
467 return Opc == ARM::Bcc || Opc == ARM::tBcc || Opc == ARM::t2Bcc;
472 return Opc == ARM::BR_JTr || Opc == ARM::BR_JTm || Opc == ARM::BR_JTadd ||
473 Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT;
478 return Opc == ARM::BX || Opc == ARM::MOVPCRX || Opc == ARM::tBRIND;
482 return Opc == ARM::tPOP_RET || Opc == ARM::LDMIA_RET ||
483 Opc == ARM::t2LDMIA_RET || Opc == ARM::tPOP || Opc == ARM::LDMIA_UPD ||
484 Opc == ARM::t2LDMIA_UPD || Opc == ARM::VLDMDIA_UPD;
488 return Opc == ARM::tPUSH || Opc == ARM::t2STMDB_UPD ||
489 Opc == ARM::STMDB_UPD || Opc == ARM::VSTMDDB_UPD;
503 const MachineRegisterInfo &
MRI);
515 const DebugLoc &dl,
unsigned DestReg,
516 unsigned BaseReg,
int NumBytes,
518 const ARMBaseInstrInfo &
TII,
unsigned MIFlags = 0);
522 const DebugLoc &dl,
unsigned DestReg,
523 unsigned BaseReg,
int NumBytes,
525 const ARMBaseInstrInfo &
TII,
unsigned MIFlags = 0);
528 const DebugLoc &dl,
unsigned DestReg,
529 unsigned BaseReg,
int NumBytes,
530 const TargetInstrInfo &
TII,
531 const ARMBaseRegisterInfo &
MRI,
532 unsigned MIFlags = 0);
540 MachineFunction &MF, MachineInstr *
MI,
548 unsigned FrameReg,
int &
Offset,
549 const ARMBaseInstrInfo &
TII);
552 unsigned FrameReg,
int &
Offset,
553 const ARMBaseInstrInfo &
TII);
557 #endif // LLVM_LIB_TARGET_ARM_ARMBASEINSTRINFO_H
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, unsigned ExtraPredCycles, BranchProbability Probability) const override
bool isProfitableToUnpredicate(MachineBasicBlock &TMBB, MachineBasicBlock &FMBB) const override
bool getInsertSubregLikeInputs(const MachineInstr &MI, unsigned DefIdx, RegSubRegPair &BaseReg, RegSubRegPairAndIdx &InsertedReg) const override
Build the equivalent inputs of a INSERT_SUBREG for the given MI and DefIdx.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
bool DefinesPredicate(MachineInstr &MI, std::vector< MachineOperand > &Pred) const override
bool isAddrMode3OpMinusReg(const MachineInstr &MI, unsigned Op) const
Describe properties that are true of each instruction in the target description file.
bool expandPostRAPseudo(MachineInstr &MI) const override
bool isPredicated(const MachineInstr &MI) const override
ARMCC::CondCodes getPredicate(const MachineInstr &MI) const
unsigned getPartialRegUpdateClearance(const MachineInstr &, unsigned, const TargetRegisterInfo *) const override
bool tryFoldSPUpdateIntoPushPop(const ARMSubtarget &Subtarget, MachineFunction &MF, MachineInstr *MI, unsigned NumBytes)
Tries to add registers to the reglist of a given base-updating push/pop instruction to adjust the sta...
bool isLDMBaseRegInList(const MachineInstr &MI) const
void expandLoadStackGuardBase(MachineBasicBlock::iterator MI, unsigned LoadImmOpc, unsigned LoadOpc) const
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool isLdstSoMinusReg(const MachineInstr &MI, unsigned Op) const
static bool isCPSRDefined(const MachineInstr &MI)
Provide an instruction scheduling machine model to CodeGen passes.
const HexagonInstrInfo * TII
static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false)
bool analyzeCompare(const MachineInstr &MI, unsigned &SrcReg, unsigned &SrcReg2, int &CmpMask, int &CmpValue) const override
analyzeCompare - For a comparison instruction, return the source registers in SrcReg and SrcReg2 if h...
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void emitT2RegPlusImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const DebugLoc &dl, unsigned DestReg, unsigned BaseReg, int NumBytes, ARMCC::CondCodes Pred, unsigned PredReg, const ARMBaseInstrInfo &TII, unsigned MIFlags=0)
bool rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned FrameReg, int &Offset, const ARMBaseInstrInfo &TII)
rewriteARMFrameIndex / rewriteT2FrameIndex - Rewrite MI to access 'Offset' bytes from the FP...
bool isLdstScaledReg(const MachineInstr &MI, unsigned Op) const
Reg
All possible values of the reg field in the ModR/M byte.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
void setExecutionDomain(MachineInstr &MI, unsigned Domain) const override
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
ScheduleHazardRecognizer * CreateTargetHazardRecognizer(const TargetSubtargetInfo *STI, const ScheduleDAG *DAG) const override
bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, int64_t Offset1, int64_t Offset2, unsigned NumLoads) const override
shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to determine (in conjunction w...
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
bool rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned FrameReg, int &Offset, const ARMBaseInstrInfo &TII)
bool analyzeSelect(const MachineInstr &MI, SmallVectorImpl< MachineOperand > &Cond, unsigned &TrueOp, unsigned &FalseOp, bool &Optimizable) const override
bool isFpMLxInstruction(unsigned Opcode) const
isFpMLxInstruction - Return true if the specified opcode is a fp MLA / MLS instruction.
bool PredicateInstruction(MachineInstr &MI, ArrayRef< MachineOperand > Pred) const override
bool FoldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, unsigned Reg, MachineRegisterInfo *MRI) const override
FoldImmediate - 'Reg' is known to be defined by a move immediate instruction, try to fold the immedia...
static std::array< MachineOperand, 2 > predOps(ARMCC::CondCodes Pred, unsigned PredReg=0)
Get the operands corresponding to the given Pred value.
bool canCauseFpMLxStall(unsigned Opcode) const
canCauseFpMLxStall - Return true if an instruction of the specified opcode will cause stalls when sch...
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned OpIdx1, unsigned OpIdx2) const override
Commutes the operands in the given instruction.
unsigned getNumMicroOps(const InstrItineraryData *ItinData, const MachineInstr &MI) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Itinerary data supplied by a subtarget to be used by a target.
unsigned getMatchingCondBranchOpcode(unsigned Opc)
static bool isCondBranchOpcode(int Opc)
MachineInstrBundleIterator< MachineInstr > iterator
unsigned const MachineRegisterInfo * MRI
bool SubsumesPredicate(ArrayRef< MachineOperand > Pred1, ArrayRef< MachineOperand > Pred2) const override
HazardRecognizer - This determines whether or not an instruction can be issued this cycle...
bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, int64_t &Offset1, int64_t &Offset2) const override
areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler to determine if two loads are lo...
MachineInstrBuilder & UseMI
unsigned isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
const MachineOperand & getOperand(unsigned i) const
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Returns the size of the specified MachineInstr.
static bool isJumpTableBranchOpcode(int Opc)
void copyFromCPSR(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned DestReg, bool KillSrc, const ARMSubtarget &Subtarget) const
MachineInstr * duplicate(MachineInstr &Orig, MachineFunction &MF) const override
unsigned convertAddSubFlagsOpcode(unsigned OldOpc)
Map pseudo instructions that imply an 'S' bit onto real opcodes.
void emitARMRegPlusImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const DebugLoc &dl, unsigned DestReg, unsigned BaseReg, int NumBytes, ARMCC::CondCodes Pred, unsigned PredReg, const ARMBaseInstrInfo &TII, unsigned MIFlags=0)
emitARMRegPlusImmediate / emitT2RegPlusImmediate - Emits a series of instructions to materializea des...
ARMCC::CondCodes getInstrPredicate(const MachineInstr &MI, unsigned &PredReg)
getInstrPredicate - If instruction is predicated, returns its predicate condition, otherwise returns AL.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
std::pair< uint16_t, uint16_t > getExecutionDomain(const MachineInstr &MI) const override
VFP/NEON execution domains.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
static bool isIndirectBranchOpcode(int Opc)
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, unsigned SubIdx, const MachineInstr &Orig, const TargetRegisterInfo &TRI) const override
Iterator for intrusive lists based on ilist_node.
static bool isUncondBranchOpcode(int Opc)
virtual unsigned getUnindexedOpcode(unsigned Opc) const =0
static MachineOperand t1CondCodeOp(bool isDead=false)
Get the operand corresponding to the conditional code result for Thumb1.
MachineOperand class - Representation of each machine instruction operand.
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
void breakPartialRegDependency(MachineInstr &, unsigned, const TargetRegisterInfo *TRI) const override
bool isSwiftFastImmShift(const MachineInstr *MI) const
Returns true if the instruction has a shift by immediate that can be executed in one cycle less...
Represents one node in the SelectionDAG.
static bool isPushOpcode(int Opc)
unsigned getFramePred(const MachineInstr &MI) const
Returns predicate register associated with the given frame instruction.
unsigned getLDMVariableDefsSize(const MachineInstr &MI) const
unsigned isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
void copyToCPSR(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, unsigned SrcReg, bool KillSrc, const ARMSubtarget &Subtarget) const
unsigned getNumLDMAddresses(const MachineInstr &MI) const
Get the number of addresses by LDM or VLDM or zero for unknown.
int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate...
unsigned canFoldARMInstrIntoMOVCC(unsigned Reg, MachineInstr *&MI, const MachineRegisterInfo &MRI)
Determine if MI can be folded into an ARM MOVCC instruction, and return the opcode of the SSA instruc...
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
ARMBaseInstrInfo(const ARMSubtarget &STI)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
TargetSubtargetInfo - Generic base class for all target subtargets.
static bool isPopOpcode(int Opc)
bool isPredicable(const MachineInstr &MI) const override
isPredicable - Return true if the specified instruction can be predicated.
Representation of each machine instruction.
static MachineOperand condCodeOp(unsigned CCReg=0)
Get the operand corresponding to the conditional code result.
bool isLdstScaledRegNotPlusLsl2(const MachineInstr &MI, unsigned Op) const
bool getExtractSubregLikeInputs(const MachineInstr &MI, unsigned DefIdx, RegSubRegPairAndIdx &InputReg) const override
Build the equivalent inputs of a EXTRACT_SUBREG for the given MI and DefIdx.
int getOperandLatency(const InstrItineraryData *ItinData, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
static MachineOperand CreateImm(int64_t Val)
bool getRegSequenceLikeInputs(const MachineInstr &MI, unsigned DefIdx, SmallVectorImpl< RegSubRegPairAndIdx > &InputRegs) const override
Build the equivalent inputs of a REG_SEQUENCE for the given MI and DefIdx.
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles, BranchProbability Probability) const override
void emitThumbRegPlusImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const DebugLoc &dl, unsigned DestReg, unsigned BaseReg, int NumBytes, const TargetInstrInfo &TII, const ARMBaseRegisterInfo &MRI, unsigned MIFlags=0)
emitThumbRegPlusImmediate - Emits a series of instructions to materialize a destreg = basereg + immed...
bool optimizeCompareInstr(MachineInstr &CmpInstr, unsigned SrcReg, unsigned SrcReg2, int CmpMask, int CmpValue, const MachineRegisterInfo *MRI) const override
optimizeCompareInstr - Convert the instruction to set the zero flag so that we can remove a "comparis...
unsigned isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
unsigned getReg() const
getReg - Returns the register number.
bool isAddrMode3OpImm(const MachineInstr &MI, unsigned Op) const
ScheduleHazardRecognizer * CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II, const ScheduleDAG *DAG) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual const ARMBaseRegisterInfo & getRegisterInfo() const =0
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
const ARMSubtarget & getSubtarget() const
StringRef - Represent a constant reference to a string, i.e.
bool produceSameValue(const MachineInstr &MI0, const MachineInstr &MI1, const MachineRegisterInfo *MRI) const override
MachineInstr * convertToThreeAddress(MachineFunction::iterator &MFI, MachineInstr &MI, LiveVariables *LV) const override
bool isAm2ScaledReg(const MachineInstr &MI, unsigned Op) const
const MachineInstrBuilder & AddDReg(MachineInstrBuilder &MIB, unsigned Reg, unsigned SubIdx, unsigned State, const TargetRegisterInfo *TRI) const
MachineInstr * optimizeSelect(MachineInstr &MI, SmallPtrSetImpl< MachineInstr * > &SeenMIs, bool) const override
unsigned isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override