15 #ifndef LLVM_MC_MCINSTRDESC_H 16 #define LLVM_MC_MCINSTRDESC_H 24 class MCSubtargetInfo;
104 assert(isGenericType() &&
"non-generic types don't have an index");
190 if (OpNum < NumOperands &&
191 (OpInfo[OpNum].Constraints & (1 << Constraint))) {
192 unsigned Pos = 16 + Constraint * 4;
193 return (
int)(OpInfo[OpNum].
Constraints >> Pos) & 0xf;
200 bool getDeprecatedInfo(
MCInst &
MI,
const MCSubtargetInfo &STI,
201 std::string &
Info)
const;
219 return make_range(opInfo_begin(), opInfo_end());
288 return isBranch() & !isBarrier() & !isIndirectBranch();
296 return isBranch() & isBarrier() & !isIndirectBranch();
531 for (; ImplicitUses[i]; ++i)
553 for (; ImplicitDefs[i]; ++i)
561 if (
const MCPhysReg *ImpUses = ImplicitUses)
562 for (; *ImpUses; ++ImpUses)
570 bool hasImplicitDefOfPhysReg(
unsigned Reg,
587 if (isPredicable()) {
588 for (
unsigned i = 0, e = getNumOperands(); i != e; ++i)
589 if (OpInfo[i].isPredicate())
597 bool hasDefOfPhysReg(
const MCInst &MI,
unsigned Reg,
unsigned getNumImplicitUses() const
Return the number of implicit uses this instruction has.
bool isMoveReg() const
Return true if the instruction is a register to register move.
unsigned getNumImplicitDefs() const
Return the number of implicit defs this instruct has.
This class represents lattice values for constants.
bool isLookupPtrRegClass() const
Set if this operand is a pointer value and it requires a callback to look up its register class...
bool isCommutable() const
Return true if this may be a 2- or 3-address instruction (of the form "X = op Y, Z, ..."), which produces the same result if Y and Z are exchanged.
uint8_t Flags
These are flags from the MCOI::OperandFlags enum.
const MCPhysReg * getImplicitUses() const
Return a list of registers that are potentially read by any instance of this machine instruction...
Describe properties that are true of each instruction in the target description file.
int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate...
bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by other flags.
bool isRegSequenceLike() const
Return true if this instruction behaves the same way as the generic REG_SEQUENCE instructions.
const_opInfo_iterator opInfo_begin() const
bool isPseudo() const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction...
bool mayLoad() const
Return true if this instruction could possibly read memory.
bool isReturn() const
Return true if the instruction is a return.
bool isBranch() const
Returns true if this is a conditional, unconditional, or indirect branch.
bool isCompare() const
Return true if this instruction is a comparison.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
bool isTrap() const
Return true if this instruction is a trap.
bool isExtractSubregLike() const
Return true if this instruction behaves the same way as the generic EXTRACT_SUBREG instructions...
bool isSelect() const
Return true if this is a select instruction.
uint8_t OperandType
Information about the type of the operand.
bool isConvertibleTo3Addr() const
Return true if this is a 2-address instruction which can be changed into a 3-address instruction if n...
bool isRematerializable() const
Returns true if this instruction is a candidate for remat.
uint32_t Constraints
The lower 16 bits are used to specify which constraints are set.
bool isAsCheapAsAMove() const
Returns true if this instruction has the same cost (or less) than a move instruction.
bool isPredicate() const
Set if this is one of the operands that made up of the predicate operand that controls an isPredicabl...
bool hasExtraDefRegAllocReq() const
Returns true if this instruction def operands have special register allocation requirements that are ...
bool isMoveImmediate() const
Return true if this instruction is a move immediate (including conditional moves) instruction...
Analysis containing CSE Info
Instances of this class represent a single low-level machine instruction.
unsigned short NumOperands
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
unsigned getSchedClass() const
Return the scheduling class for this instruction.
bool isGenericType() const
const MCPhysReg * getImplicitDefs() const
Return a list of registers that are potentially written by any instance of this machine instruction...
bool hasExtraSrcRegAllocReq() const
Returns true if this instruction source operands have special register allocation requirements that a...
unsigned const MachineRegisterInfo * MRI
bool isOptionalDef() const
Set if this operand is a optional def.
bool hasOptionalDef() const
Set if this instruction has an optional definition, e.g.
bool isBarrier() const
Returns true if the specified instruction stops control flow from executing the instruction immediate...
bool isVariadic() const
Return true if this instruction can have a variable number of operands.
bool isConditionalBranch() const
Return true if this is a branch which may fall through to the next instruction or may transfer contro...
int64_t DeprecatedFeature
OperandFlags
These are flags set on operands, but should be considered private, all access should go through the M...
const MCPhysReg * ImplicitDefs
bool isPredicable() const
Return true if this instruction has a predicate operand that controls execution.
bool isIndirectBranch() const
Return true if this is an indirect branch, such as a branch through a register.
bool hasPostISelHook() const
Return true if this instruction requires adjustment after instruction selection by calling a target h...
bool isAdd() const
Return true if the instruction is an add instruction.
bool isNotDuplicable() const
Return true if this instruction cannot be safely duplicated.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool isInsertSubregLike() const
Return true if this instruction behaves the same way as the generic INSERT_SUBREG instructions...
bool hasDelaySlot() const
Returns true if the specified instruction has a delay slot which must be filled by the code generator...
bool isBitcast() const
Return true if this instruction is a bitcast instruction.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
A range adaptor for a pair of iterators.
bool isConvergent() const
Return true if this instruction is convergent.
bool mayStore() const
Return true if this instruction could possibly modify memory.
bool isUnconditionalBranch() const
Return true if this is a branch which always transfers control flow to some other block...
OperandType
Operands are tagged with one of the values of this enum.
bool canFoldAsLoad() const
Return true for instructions that can be folded as memory operands in other instructions.
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
const_opInfo_iterator opInfo_end() const
bool isCall() const
Return true if the instruction is a call.
Generic base class for all target subtargets.
bool variadicOpsAreDefs() const
Return true if variadic operands of this instruction are definitions.
iterator_range< const_opInfo_iterator > operands() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isBranch(unsigned Opcode)
bool hasImplicitUseOfPhysReg(unsigned Reg) const
Return true if this instruction implicitly uses the specified physical register.
bool isTerminator() const
Returns true if this instruction part of the terminator for a basic block.
const MCOperandInfo * OpInfo
unsigned getOpcode() const
Return the opcode number for this descriptor.
unsigned getGenericTypeIndex() const
bool usesCustomInsertionHook() const
Return true if this instruction requires custom insertion support when the DAG scheduler is inserting...
This holds information about one operand of a machine instruction, indicating the register class for ...
uint64_t getFlags() const
Return flags of this instruction.
unsigned short SchedClass
const MCPhysReg * ImplicitUses
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...