16 #ifndef LLVM_CODEGEN_MACHINEINSTR_H
17 #define LLVM_CODEGEN_MACHINEINSTR_H
35 template <
typename T>
class SmallVectorImpl;
37 class TargetInstrInfo;
38 class TargetRegisterClass;
39 class TargetRegisterInfo;
40 class MachineFunction;
41 class MachineMemOperand;
77 OperandCapacity CapOperands;
83 uint8_t AsmPrinterFlags;
96 void operator=(const
MachineInstr&) LLVM_DELETED_FUNCTION;
103 void setParent(MachineBasicBlock *
P) { Parent =
P; }
113 const DebugLoc dl,
bool NoImp =
false);
133 return AsmPrinterFlags & Flag;
139 AsmPrinterFlags |= (uint8_t)Flag;
145 AsmPrinterFlags &= ~Flag;
160 Flags |= (uint8_t)Flag;
171 Flags &= ~((uint8_t)Flag);
298 return NumMemRefs == 1;
321 return hasPropertyInBundle(1 << MCFlag,
Type);
468 if (ExtraInfo & InlineAsm::Extra_MayLoad)
482 if (ExtraInfo & InlineAsm::Extra_MayStore)
694 default:
return false;
793 bool isDead =
false,
bool Overlap =
false,
839 void tieOperands(
unsigned DefIdx,
unsigned UseIdx);
886 bool AddIfNotFound =
false);
897 bool AddIfNotFound =
false);
956 bool SkipOpers =
false)
const;
1004 MemRefs = NewMemRefs;
1005 NumMemRefs = uint8_t(NewMemRefsEnd - NewMemRefs);
1006 assert(NumMemRefs == NewMemRefsEnd - NewMemRefs &&
"Too many memrefs");
1016 void untieRegOperand(
unsigned OpIdx) {
1031 void RemoveRegOperandsFromUseLists(MachineRegisterInfo&);
1036 void AddRegOperandsToUseLists(MachineRegisterInfo&);
1040 bool hasPropertyInBundle(
unsigned Mask,
QueryType Type)
const;
bool isPrologLabel() const
bool isInsideBundle() const
static bool Check(DecodeStatus &Out, DecodeStatus In)
COFF::RelocationTypeX86 Type
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=0) const
mop_iterator operands_end()
bool hasPostISelHook(QueryType Type=IgnoreBundle) const
friend class MachineFunction
bool isBranch(QueryType Type=AnyInBundle) const
bool isConvertibleTo3Addr(QueryType Type=IgnoreBundle) const
unsigned getFlags() const
Return flags of this instruction.
bool addRegisterDead(unsigned Reg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
bool isPseudo(QueryType Type=IgnoreBundle) const
bool mayStore(QueryType Type=AnyInBundle) const
static bool isEqual(const MachineInstr *const &LHS, const MachineInstr *const &RHS)
bool isPredicable(QueryType Type=AllInBundle) const
bool readsVirtualRegister(unsigned Reg) const
bool hasOrderedMemoryRef() const
void clearAsmPrinterFlag(CommentFlag Flag)
const MCInstrDesc & getDesc() const
bool registerDefIsDead(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
MachineOperand & getOperand(unsigned i)
bool canFoldAsLoad(QueryType Type=IgnoreBundle) const
bool isConditionalBranch(QueryType Type=AnyInBundle) const
void setPhysRegsDeadExcept(ArrayRef< unsigned > UsedRegs, const TargetRegisterInfo &TRI)
bool isSelect(QueryType Type=IgnoreBundle) const
bool isTerminator(QueryType Type=AnyInBundle) const
const_mop_iterator operands_end() const
bool allDefsAreDead() const
unsigned getBundleSize() const
bool getAsmPrinterFlag(CommentFlag Flag) const
const HexagonInstrInfo * TII
INITIALIZE_PASS(DeadMachineInstructionElim,"dead-mi-elimination","Remove dead machine instructions", false, false) bool DeadMachineInstructionElim bool SawStore
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool mayLoad(QueryType Type=AnyInBundle) const
MachineMemOperand ** mmo_iterator
unsigned getNumOperands() const
bool isBundledWithSucc() const
void unbundleFromPred()
Break bundle above this instruction.
void RemoveOperand(unsigned i)
bool definesRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
bool hasDelaySlot(QueryType Type=AnyInBundle) const
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
uint8_t getAsmPrinterFlags() const
bool hasExtraSrcRegAllocReq(QueryType Type=AnyInBundle) const
bool isBitcast(QueryType Type=IgnoreBundle) const
static MachineInstr * getEmptyKey()
MachineBasicBlock * getParent()
void addMemOperand(MachineFunction &MF, MachineMemOperand *MO)
void clearRegisterKills(unsigned Reg, const TargetRegisterInfo *RegInfo)
const MachineBasicBlock * getParent() const
bool isDebugValue() const
bool isImplicitDef() const
mmo_iterator memoperands_end() const
bool isInsertSubreg() const
unsigned findTiedOperandIdx(unsigned OpIdx) const
static MachineInstr * getTombstoneKey()
MachineOperand * findRegisterDefOperand(unsigned Reg, bool isDead=false, const TargetRegisterInfo *TRI=NULL)
bool isReturn(QueryType Type=AnyInBundle) const
bool isAsCheapAsAMove(QueryType Type=AllInBundle) const
bool isIndirectDebugValue() const
const MachineOperand & getOperand(unsigned i) const
bool isIndirectBranch(QueryType Type=AnyInBundle) const
void setFlag(MIFlag Flag)
setFlag - Set a MI flag.
void clearFlag(MIFlag Flag)
clearFlag - Clear a MI flag.
unsigned getNumExplicitOperands() const
bool isVariadic(QueryType Type=IgnoreBundle) const
bool getFlag(MIFlag Flag) const
getFlag - Return whether an MI flag is set.
bool hasOneMemOperand() const
bool hasUnmodeledSideEffects() const
std::pair< bool, bool > readsWritesVirtualRegister(unsigned Reg, SmallVectorImpl< unsigned > *Ops=0) const
bool isBundledWithPred() const
bool isInvariantLoad(AliasAnalysis *AA) const
unsigned getSubReg() const
static unsigned getHashValue(const MachineInstr *const &MI)
bool isNotDuplicable(QueryType Type=AnyInBundle) const
void emitError(StringRef Msg) const
const_mop_iterator operands_begin() const
MachineOperand * findRegisterUseOperand(unsigned Reg, bool isKill=false, const TargetRegisterInfo *TRI=NULL)
int findInlineAsmFlagIdx(unsigned OpIdx, unsigned *GroupNo=0) const
MachineInstr * removeFromBundle()
bool memoperands_empty() const
void setDesc(const MCInstrDesc &tid)
void substituteRegister(unsigned FromReg, unsigned ToReg, unsigned SubIdx, const TargetRegisterInfo &RegInfo)
void addOperand(MachineFunction &MF, const MachineOperand &Op)
bool isMSInlineAsm() const
bool isIdenticalTo(const MachineInstr *Other, MICheckType Check=CheckDefs) const
void setFlags(unsigned flags)
bool hasExtraDefRegAllocReq(QueryType Type=AnyInBundle) const
MachineOperand * mop_iterator
iterator/begin/end - Iterate over all operands of a machine instruction.
bool isIdentityCopy() const
isIdentityCopy - Return true is the instruction is an identity copy.
bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const
int findRegisterUseOperandIdx(unsigned Reg, bool isKill=false, const TargetRegisterInfo *TRI=NULL) const
bool isCompare(QueryType Type=IgnoreBundle) const
isCompare - Return true if this instruction is a comparison.
void print(raw_ostream &OS, const TargetMachine *TM=0, bool SkipOpers=false) const
#define LLVM_DELETED_FUNCTION
const TargetRegisterClass * getRegClassConstraint(unsigned OpIdx, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const
bool isSubregToReg() const
bool isSafeToMove(const TargetInstrInfo *TII, AliasAnalysis *AA, bool &SawStore) const
int findFirstPredOperandIdx() const
bool hasProperty(unsigned MCFlag, QueryType Type=AnyInBundle) const
void copyImplicitOps(MachineFunction &MF, const MachineInstr *MI)
IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
void setDebugLoc(const DebugLoc dl)
DBG_VALUE - a mapping of the llvm.dbg.value intrinsic.
bool isCall(QueryType Type=AnyInBundle) const
bool usesCustomInsertionHook(QueryType Type=IgnoreBundle) const
int findRegisterDefOperandIdx(unsigned Reg, bool isDead=false, bool Overlap=false, const TargetRegisterInfo *TRI=NULL) const
uint8_t getFlags() const
getFlags - Return the MI flags bitvector.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
MachineInstr * removeFromParent()
unsigned getReg() const
getReg - Returns the register number.
bool isCommutable(QueryType Type=IgnoreBundle) const
void clearAsmPrinterFlags()
void unbundleFromSucc()
Break bundle below this instruction.
unsigned isConstantValuePHI() const
bool isRematerializable(QueryType Type=AllInBundle) const
mop_iterator operands_begin()
void addRegisterDefined(unsigned Reg, const TargetRegisterInfo *RegInfo=0)
bool addRegisterKilled(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
bool hasOptionalDef(QueryType Type=IgnoreBundle) const
bool isStackAligningInlineAsm() const
void setAsmPrinterFlag(CommentFlag Flag)
bool isRegSequence() const
bool isMoveImmediate(QueryType Type=IgnoreBundle) const
bool isRegTiedToUseOperand(unsigned DefOpIdx, unsigned *UseOpIdx=0) const
InlineAsm::AsmDialect getInlineAsmDialect() const
void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd)
const MachineOperand * const_mop_iterator
bool modifiesRegister(unsigned Reg, const TargetRegisterInfo *TRI) const
bool isBarrier(QueryType Type=AnyInBundle) const
DebugLoc getDebugLoc() const
bool isUnconditionalBranch(QueryType Type=AnyInBundle) const
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
void tieOperands(unsigned DefIdx, unsigned UseIdx)