33 #define DEBUG_TYPE "instr-emitter" 61 unsigned &NumImpUses) {
69 NumImpUses = N - NumExpUses;
70 for (
unsigned I = N;
I > NumExpUses; --
I) {
71 if (isa<RegisterMaskSDNode>(Node->
getOperand(
I - 1)))
86 EmitCopyFromReg(
SDNode *Node,
unsigned ResNo,
bool IsClone,
bool IsCloned,
94 bool isNew = VRBaseMap.
insert(std::make_pair(Op, SrcReg)).second;
96 assert(isNew &&
"Node emitted out of order - early");
102 bool MatchReg =
true;
110 if (!IsClone && !IsCloned)
120 }
else if (DestReg != SrcReg)
131 if (
User->isMachineOpcode()) {
164 "Incompatible phys register def and uses!");
178 VRBase).addReg(SrcReg);
184 bool isNew = VRBaseMap.
insert(std::make_pair(Op, VRBase)).second;
186 assert(isNew &&
"Node emitted out of order - early");
189 void InstrEmitter::CreateVirtualRegisters(
SDNode *Node,
192 bool IsClone,
bool IsCloned,
195 "IMPLICIT_DEF should have been handled as a special case elsewhere!");
198 for (
unsigned i = 0; i < II.
getNumDefs(); ++i) {
226 if (!VRBase && !IsClone && !IsCloned)
246 assert(RC &&
"Isn't a register operand!");
253 if (i < NumResults) {
257 bool isNew = VRBaseMap.
insert(std::make_pair(Op, VRBase)).second;
259 assert(isNew &&
"Node emitted out of order - early");
277 TII->
get(TargetOpcode::IMPLICIT_DEF), VReg);
282 assert(I != VRBaseMap.
end() &&
"Node emitted out of order - late");
296 bool IsDebug,
bool IsClone,
bool IsCloned) {
299 "Chain and glue operands should occur at end of operand list!");
301 unsigned VReg = getVR(Op, VRBaseMap);
313 if (IIOpNum < II->getNumOperands())
319 if (!ConstrainedRC) {
321 assert(OpRC &&
"Constraints cannot be fulfilled for allocation");
324 TII->
get(TargetOpcode::COPY), NewVReg).addReg(VReg);
328 "Constraining an allocatable VReg produced an unallocatable class?");
343 !(IsClone || IsCloned);
367 bool IsDebug,
bool IsClone,
bool IsCloned) {
369 AddRegisterOperand(MIB, Op, IIOpNum, II, VRBaseMap,
370 IsDebug, IsClone, IsCloned);
376 unsigned VReg = R->getReg();
391 TII->
get(TargetOpcode::COPY), NewVReg).addReg(VReg);
403 TGA->getTargetFlags());
405 MIB.
addMBB(BBNode->getBasicBlock());
412 unsigned Align =
CP->getAlignment();
425 if (
CP->isMachineConstantPoolEntry())
432 }
else if (
auto *SymNode = dyn_cast<MCSymbolSDNode>(Op)) {
433 MIB.
addSym(SymNode->getMCSymbol());
437 BA->getTargetFlags());
439 MIB.
addTargetIndex(TI->getIndex(), TI->getOffset(), TI->getTargetFlags());
443 "Chain and glue operands should occur at end of operand list!");
444 AddRegisterOperand(MIB, Op, IIOpNum, II, VRBaseMap,
445 IsDebug, IsClone, IsCloned);
449 unsigned InstrEmitter::ConstrainForSubReg(
unsigned VReg,
unsigned SubIdx,
466 assert(RC &&
"No legal register class for VT supports that SubIdx");
468 BuildMI(*MBB, InsertPos, DL, TII->
get(TargetOpcode::COPY), NewReg)
475 void InstrEmitter::EmitSubregNode(
SDNode *Node,
477 bool IsClone,
bool IsCloned) {
494 if (Opc == TargetOpcode::EXTRACT_SUBREG) {
498 unsigned SubIdx = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
513 unsigned SrcReg, DstReg, DefSubIdx;
516 SubIdx == DefSubIdx &&
525 TII->
get(TargetOpcode::COPY), VRBase).addReg(SrcReg);
532 Reg = ConstrainForSubReg(Reg, SubIdx,
542 TII->
get(TargetOpcode::COPY), VRBase);
544 CopyMI.
addReg(Reg, 0, SubIdx);
548 }
else if (Opc == TargetOpcode::INSERT_SUBREG ||
549 Opc == TargetOpcode::SUBREG_TO_REG) {
553 unsigned SubIdx = cast<ConstantSDNode>(N2)->getZExtValue();
572 assert(SRC &&
"No register class supports VT and SubIdx for INSERT_SUBREG");
583 if (Opc == TargetOpcode::SUBREG_TO_REG) {
587 AddOperand(MIB, N0, 0,
nullptr, VRBaseMap,
false,
590 AddOperand(MIB, N1, 0,
nullptr, VRBaseMap,
false,
593 MBB->
insert(InsertPos, MIB);
595 llvm_unreachable(
"Node is not insert_subreg, extract_subreg, or subreg_to_reg");
598 bool isNew = VRBaseMap.
insert(std::make_pair(Op, VRBase)).second;
600 assert(isNew &&
"Node emitted out of order - early");
608 InstrEmitter::EmitCopyToRegClassNode(
SDNode *Node,
610 unsigned VReg = getVR(Node->
getOperand(0), VRBaseMap);
613 unsigned DstRCIdx = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
618 NewVReg).addReg(VReg);
621 bool isNew = VRBaseMap.
insert(std::make_pair(Op, NewVReg)).second;
623 assert(isNew &&
"Node emitted out of order - early");
628 void InstrEmitter::EmitRegSequence(
SDNode *Node,
630 bool IsClone,
bool IsCloned) {
631 unsigned DstRCIdx = cast<ConstantSDNode>(Node->
getOperand(0))->getZExtValue();
643 assert((NumOps & 1) == 1 &&
644 "REG_SEQUENCE must have an odd number of operands!");
645 for (
unsigned i = 1; i != NumOps; ++i) {
652 unsigned SubIdx = cast<ConstantSDNode>(
Op)->getZExtValue();
657 if (SRC && SRC != RC) {
663 AddOperand(MIB, Op, i+1, &II, VRBaseMap,
false,
667 MBB->
insert(InsertPos, MIB);
669 bool isNew = VRBaseMap.
insert(std::make_pair(Op, NewVReg)).second;
671 assert(isNew &&
"Node emitted out of order - early");
682 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
683 "Expected inlined-at fields to agree");
691 auto MIB =
BuildMI(*MF, DL, TII->
get(TargetOpcode::DBG_VALUE));
702 auto FrameMI =
BuildMI(*MF, DL, TII->
get(TargetOpcode::DBG_VALUE))
724 if (I==VRBaseMap.
end())
733 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
734 if (CI->getBitWidth() > 64)
737 MIB.
addImm(CI->getSExtValue());
738 }
else if (
const ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
740 }
else if (isa<ConstantPointerNull>(V)) {
769 assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(DL) &&
770 "Expected inlined-at fields to agree");
783 EmitMachineNode(
SDNode *Node,
bool IsClone,
bool IsCloned,
788 if (Opc == TargetOpcode::EXTRACT_SUBREG ||
789 Opc == TargetOpcode::INSERT_SUBREG ||
790 Opc == TargetOpcode::SUBREG_TO_REG) {
791 EmitSubregNode(Node, VRBaseMap, IsClone, IsCloned);
796 if (Opc == TargetOpcode::COPY_TO_REGCLASS) {
797 EmitCopyToRegClassNode(Node, VRBaseMap);
802 if (Opc == TargetOpcode::REG_SEQUENCE) {
803 EmitRegSequence(Node, VRBaseMap, IsClone, IsCloned);
807 if (Opc == TargetOpcode::IMPLICIT_DEF)
817 if (Opc == TargetOpcode::STACKMAP || Opc == TargetOpcode::PATCHPOINT) {
822 if (Opc == TargetOpcode::PATCHPOINT) {
824 NumDefs = NumResults;
829 unsigned NumImpUses = 0;
830 unsigned NodeOperands =
832 bool HasPhysRegOuts = NumResults > NumDefs && II.
getImplicitDefs()!=
nullptr;
834 unsigned NumMIOperands = NodeOperands + NumResults;
837 "Too few operands for a variadic node!");
842 "#operands for dag node doesn't match .td file!");
851 CreateVirtualRegisters(Node, MIB, II, IsClone, IsCloned, VRBaseMap);
857 MI->
setFlag(MachineInstr::MIFlag::FmNsz);
860 MI->
setFlag(MachineInstr::MIFlag::FmArcp);
863 MI->
setFlag(MachineInstr::MIFlag::FmNoNans);
866 MI->
setFlag(MachineInstr::MIFlag::FmNoInfs);
869 MI->
setFlag(MachineInstr::MIFlag::FmContract);
872 MI->
setFlag(MachineInstr::MIFlag::FmAfn);
875 MI->
setFlag(MachineInstr::MIFlag::FmReassoc);
878 MI->
setFlag(MachineInstr::MIFlag::NoUWrap);
881 MI->
setFlag(MachineInstr::MIFlag::NoSWrap);
884 MI->
setFlag(MachineInstr::MIFlag::IsExact);
887 MI->
setFlag(MachineInstr::MIFlag::NoFPExcept);
892 bool HasOptPRefs = NumDefs > NumResults;
893 assert((!HasOptPRefs || !HasPhysRegOuts) &&
894 "Unable to cope with optional defs and phys regs defs!");
895 unsigned NumSkip = HasOptPRefs ? NumDefs - NumResults : 0;
896 for (
unsigned i = NumSkip; i != NodeOperands; ++i)
897 AddOperand(MIB, Node->
getOperand(i), i-NumSkip+NumDefs, &II,
898 VRBaseMap,
false, IsClone, IsCloned);
902 for (
unsigned i = 0; ScratchRegs[i]; ++i)
908 MIB.setMemRefs(cast<MachineSDNode>(Node)->memoperands());
913 MBB->
insert(InsertPos, MIB);
933 if (HasPhysRegOuts) {
934 for (
unsigned i = NumDefs; i < NumResults; ++i) {
940 EmitCopyFromReg(Node, i, IsClone, IsCloned, Reg, VRBaseMap);
960 for (
unsigned i = 0,
e =
F->getNumOperands(); i !=
e; ++i)
970 if (!UsedRegs.
empty() || II.getImplicitDefs() || II.hasOptionalDef())
971 MIB->setPhysRegsDeadExcept(UsedRegs, *TRI);
974 if (II.hasPostISelHook())
981 EmitSpecialNode(
SDNode *Node,
bool IsClone,
bool IsCloned,
988 llvm_unreachable(
"This target-independent node should have been selected!");
990 llvm_unreachable(
"EntryToken should have been excluded from the schedule!");
1002 TII->
get(TargetOpcode::IMPLICIT_DEF), DestReg);
1007 SrcReg = R->getReg();
1009 SrcReg = getVR(SrcVal, VRBaseMap);
1011 if (SrcReg == DestReg)
1015 DestReg).addReg(SrcReg);
1020 EmitCopyFromReg(Node, 0, IsClone, IsCloned, SrcReg, VRBaseMap);
1028 MCSymbol *S = cast<LabelSDNode>(Node)->getLabel();
1030 TII->
get(Opc)).addSym(S);
1060 const char *AsmStr = cast<ExternalSymbolSDNode>(AsmStrV)->getSymbol();
1079 cast<ConstantSDNode>(Node->
getOperand(i))->getZExtValue();
1089 for (
unsigned j = 0; j != NumVals; ++j, ++i) {
1101 for (
unsigned j = 0; j != NumVals; ++j, ++i) {
1114 for (
unsigned j = 0; j != NumVals; ++j, ++i)
1115 AddOperand(MIB, Node->
getOperand(i), 0,
nullptr, VRBaseMap,
1116 false, IsClone, IsCloned);
1120 unsigned DefGroup = 0;
1122 unsigned DefIdx = GroupIdx[DefGroup] + 1;
1123 unsigned UseIdx = GroupIdx.
back() + 1;
1124 for (
unsigned j = 0; j != NumVals; ++j)
1137 for (
unsigned Reg : ECRegs) {
1141 assert(MO &&
"No def operand for clobbered register?");
1148 const MDNode *MD = cast<MDNodeSDNode>(MDV)->getMD();
1152 MBB->
insert(InsertPos, MIB);
1162 : MF(mbb->
getParent()), MRI(&MF->getRegInfo()),
1163 TII(MF->getSubtarget().getInstrInfo()),
1164 TRI(MF->getSubtarget().getRegisterInfo()),
1165 TLI(MF->getSubtarget().getTargetLowering()), MBB(mbb),
1166 InsertPos(insertpos) {}
ANNOTATION_LABEL - Represents a mid basic block label used by annotations.
unsigned getNumImplicitUses() const
Return the number of implicit uses this instruction has.
const MachineInstrBuilder & addMetadata(const MDNode *MD) const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
EVT getValueType() const
Return the ValueType of the referenced return value.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
bool hasNoSignedZeros() const
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
InstrEmitter(MachineBasicBlock *mbb, MachineBasicBlock::iterator insertpos)
InstrEmitter - Construct an InstrEmitter and set it to start inserting at the given position in the g...
unsigned getNumImplicitDefs() const
Return the number of implicit defs this instruct has.
This class represents lattice values for constants.
SDNode * getSDNode() const
Returns the SDNode* for a register ref.
bool isInvalidated() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
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.
void setIsEmitted()
setIsEmitted / isEmitted - Getter/Setter for flag indicating that this SDDbgValue has been emitted to...
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned TargetFlags=0) const
Completely target-dependent object reference.
const Value * getConst() const
Returns the Value* for a constant.
static unsigned CountResults(SDNode *Node)
CountResults - The results of target nodes have register or immediate operands first, then an optional chain, and optional flag operands (which do not go into the machine instrs.)
MVT getSimpleValueType(unsigned ResNo) const
Return the type of a specified result as a simple type.
const SDNodeFlags getFlags() const
SDNode * getNode() const
get the SDNode which holds the desired result
const DebugLoc & getDebugLoc() const
Return the source location info.
EntryToken - This is the marker used to indicate the start of a region.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
static bool isUseOperandTiedToDef(unsigned Flag, unsigned &Idx)
isUseOperandTiedToDef - Return true if the flag of the inline asm operand indicates it is an use oper...
bool hasOneUse() const
Return true if there is exactly one node using value ResNo of Node.
Value is a virtual register.
const DebugLoc & getDebugLoc() const
unsigned getResNo() const
Returns the ResNo for a register ref.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
bool hasApproximateFuncs() const
unsigned getVReg() const
Returns the Virtual Register for a VReg.
const unsigned MinRCSize
MinRCSize - Smallest register class we allow when constraining virtual registers. ...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
bool hasNoFPExcept() const
unsigned getFrameIx() const
Returns the FrameIx for a stack object.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
unsigned getNumOperands() const
Retuns the total number of operands.
virtual const TargetRegisterClass * getRegClass(const MCInstrDesc &MCID, unsigned OpNum, const TargetRegisterInfo *TRI, const MachineFunction &MF) const
Given a machine instruction descriptor, returns the register class constraint for OpNum...
CopyToReg - This node has three operands: a chain, a register number to set to this value...
virtual const TargetRegisterClass * getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const
Returns the largest legal sub-class of RC that supports the sub-register index Idx.
INLINEASM - Represents an inline asm block.
MachineInstr * getVRegDef(unsigned Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned TargetFlags=0) const
void setIsEarlyClobber(bool Val=true)
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Value is contents of a stack location.
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
void clearKillFlags(unsigned Reg) const
clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the Mac...
Register getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
DIVariable * getVariable() const
Returns the DIVariable pointer for the variable.
virtual bool isDivergentRegClass(const TargetRegisterClass *RC) const
Returns true if the register class is considered divergent.
const MachineInstrBuilder & addFPImm(const ConstantFP *Val) const
bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned TargetFlags=0) const
DbgValueKind getKind() const
Returns the kind.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
bool isTypeLegalForClass(const TargetRegisterClass &RC, MVT T) const
Return true if the given TargetRegisterClass has the ValueType T.
const TargetRegisterClass * constrainRegClass(unsigned Reg, const TargetRegisterClass *RC, unsigned MinNumRegs=0)
constrainRegClass - Constrain the register class of the specified virtual register to be a common sub...
Value * getOperand(unsigned i) const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
unsigned getKillRegState(bool B)
unsigned getDebugRegState(bool B)
bool hasAllowReciprocal() const
This corresponds to the llvm.lifetime.
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
iterator find(const_arg_type_t< KeyT > Val)
bool hasAllowContract() const
unsigned getDefRegState(bool B)
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool erase(const KeyT &Val)
const MCPhysReg * getImplicitDefs() const
Return a list of registers that are potentially written by any instance of this machine instruction...
const MachineInstrBuilder & addCImm(const ConstantInt *Val) const
bool isOptionalDef() const
Set if this operand is a optional def.
The instances of the Type class are immutable: once they are created, they are never changed...
bool isVariadic() const
Return true if this instruction can have a variable number of operands.
bool hasAnyUseOfValue(unsigned Value) const
Return true if there are any use of the indicated value.
bool isMachineOpcode() const
SDNode * getGluedUser() const
If this node has a glue value with a user, return the user (there is at most one).
const SDValue & getOperand(unsigned Num) const
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
ConstantFP - Floating Point Values [float, double].
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag...
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
void setFlag(MIFlag Flag)
Set a MI flag.
unsigned getMachineOpcode() const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
static unsigned getKind(unsigned Flags)
virtual const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned Idx) const
Return a subclass of the specified register class A so that each register in it has a sub-register of...
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const MachineInstrBuilder & addFrameIndex(int Idx) const
DebugLoc getDebugLoc() const
Returns the DebugLoc.
unsigned getNumOperands() const
Return the number of values used by this operation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
MachineOperand * findRegisterDefOperand(Register Reg, bool isDead=false, bool Overlap=false, const TargetRegisterInfo *TRI=nullptr)
Wrapper for findRegisterDefOperandIdx, it returns a pointer to the MachineOperand rather than an inde...
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
virtual const MCPhysReg * getScratchRegisters(CallingConv::ID CC) const
Returns a 0 terminated array of registers that can be safely used as scratch registers.
int getOperandConstraint(unsigned OpNum, MCOI::OperandConstraint Constraint) const
Returns the value of the specific constraint if it is set.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
void dump() const
Dump this node, for debugging.
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
DIExpression * getExpression() const
Returns the DIExpression pointer for the expression.
unsigned getNumOperands() const
This is the shared class of boolean and integer constants.
DebugLoc getDebugLoc() const
Returns the DebugLoc.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
MachineInstrBuilder MachineInstrBuilder & DefMI
int getCopyCost() const
Return the cost of copying a value between two registers in this class.
virtual bool isCoalescableExtInstr(const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg, unsigned &SubIdx) const
Return true if the instruction is a "coalescable" extension instruction.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
Represents one node in the SelectionDAG.
virtual void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag...
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
iterator_range< use_iterator > uses()
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool hasNoSignedWrap() const
const TargetRegisterClass * getCommonSubClass(const TargetRegisterClass *A, const TargetRegisterClass *B) const
Find the largest common subclass of A and B.
Representation of each machine instruction.
These are IR-level optimization flags that may be propagated to SDNodes.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Value is the result of an expression.
Holds the information from a dbg_label node through SDISel.
LLVM_NODISCARD bool empty() const
static unsigned countOperands(SDNode *Node, unsigned NumExpUses, unsigned &NumImpUses)
countOperands - The inputs to target nodes have any actual inputs first, followed by an optional chai...
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
unsigned getImplRegState(bool B)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
MachineInstr * EmitDbgLabel(SDDbgLabel *SD)
Generate machine instruction for a dbg_label node.
bool isAllocatable() const
Return true if this register class may be used to create virtual registers.
MDNode * getLabel() const
Returns the MDNode pointer for the label.
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
const TargetRegisterClass * getMinimalPhysRegClass(unsigned Reg, MVT VT=MVT::Other) const
Returns the Register Class of a physical register of the given type, picking the most sub register cl...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineInstr * EmitDbgValue(SDDbgValue *SD, DenseMap< SDValue, unsigned > &VRBaseMap)
EmitDbgValue - Generate machine instruction for a dbg_value node.
INLINEASM_BR - Terminator version of inline asm. Used by asm-goto.
const TargetRegisterClass * getAllocatableClass(const TargetRegisterClass *RC) const
Return the maximal subclass of the given register class that is allocatable or NULL.
LLVM Value Representation.
uint64_t getConstantOperandVal(unsigned Num) const
Helper method returns the integer value of a ConstantSDNode operand.
unsigned getResNo() const
get the index which selects a specific result in the SDNode
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool hasNoUnsignedWrap() const
const MCOperandInfo * OpInfo
static const Function * getParent(const Value *V)
bool hasAllowReassociation() const
void setRegClass(unsigned Reg, const TargetRegisterClass *RC)
setRegClass - Set the register class of the specified virtual register.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
unsigned getNumOperands() const
bool isIndirect() const
Returns whether this is an indirect value.
uint64_t getZExtValue() const
const MachineOperand & getOperand(unsigned i) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
Holds the information from a dbg_value node through SDISel.
const MachineInstrBuilder & addTargetIndex(unsigned Idx, int64_t Offset=0, unsigned TargetFlags=0) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one...
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned TargetFlags=0) const
Wrapper class representing virtual and physical registers.
This file describes how to lower LLVM code to machine code.
const MachineInstrBuilder & addBlockAddress(const BlockAddress *BA, int64_t Offset=0, unsigned TargetFlags=0) const
void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.