34 #define DEBUG_TYPE "instr-emitter" 62 unsigned &NumImpUses) {
70 NumImpUses = N - NumExpUses;
71 for (
unsigned I = N;
I > NumExpUses; --
I) {
72 if (isa<RegisterMaskSDNode>(Node->
getOperand(
I - 1)))
87 EmitCopyFromReg(
SDNode *Node,
unsigned ResNo,
bool IsClone,
bool IsCloned,
95 bool isNew = VRBaseMap.
insert(std::make_pair(Op, SrcReg)).second;
97 assert(isNew &&
"Node emitted out of order - early");
103 bool MatchReg =
true;
111 if (!IsClone && !IsCloned)
121 }
else if (DestReg != SrcReg)
132 if (
User->isMachineOpcode()) {
165 "Incompatible phys register def and uses!");
179 VRBase).addReg(SrcReg);
185 bool isNew = VRBaseMap.
insert(std::make_pair(Op, VRBase)).second;
187 assert(isNew &&
"Node emitted out of order - early");
192 unsigned InstrEmitter::getDstOfOnlyCopyToRegUse(
SDNode *Node,
193 unsigned ResNo)
const {
208 void InstrEmitter::CreateVirtualRegisters(
SDNode *Node,
211 bool IsClone,
bool IsCloned,
214 "IMPLICIT_DEF should have been handled as a special case elsewhere!");
217 for (
unsigned i = 0; i < II.
getNumDefs(); ++i) {
244 if (!VRBase && !IsClone && !IsCloned)
264 assert(RC &&
"Isn't a register operand!");
271 if (i < NumResults) {
275 bool isNew = VRBaseMap.
insert(std::make_pair(Op, VRBase)).second;
277 assert(isNew &&
"Node emitted out of order - early");
298 TII->
get(TargetOpcode::IMPLICIT_DEF), VReg);
303 assert(I != VRBaseMap.
end() &&
"Node emitted out of order - late");
317 bool IsDebug,
bool IsClone,
bool IsCloned) {
320 "Chain and glue operands should occur at end of operand list!");
322 unsigned VReg = getVR(Op, VRBaseMap);
334 if (IIOpNum < II->getNumOperands())
340 if (!ConstrainedRC) {
342 assert(OpRC &&
"Constraints cannot be fulfilled for allocation");
345 TII->
get(TargetOpcode::COPY), NewVReg).addReg(VReg);
349 "Constraining an allocatable VReg produced an unallocatable class?");
364 !(IsClone || IsCloned);
388 bool IsDebug,
bool IsClone,
bool IsCloned) {
390 AddRegisterOperand(MIB, Op, IIOpNum, II, VRBaseMap,
391 IsDebug, IsClone, IsCloned);
397 unsigned VReg = R->getReg();
405 if (OpRC && IIRC && OpRC != IIRC &&
409 TII->
get(TargetOpcode::COPY), NewVReg).addReg(VReg);
421 TGA->getTargetFlags());
423 MIB.
addMBB(BBNode->getBasicBlock());
430 unsigned Align =
CP->getAlignment();
443 if (
CP->isMachineConstantPoolEntry())
450 }
else if (
auto *SymNode = dyn_cast<MCSymbolSDNode>(Op)) {
451 MIB.
addSym(SymNode->getMCSymbol());
455 BA->getTargetFlags());
457 MIB.
addTargetIndex(TI->getIndex(), TI->getOffset(), TI->getTargetFlags());
461 "Chain and glue operands should occur at end of operand list!");
462 AddRegisterOperand(MIB, Op, IIOpNum, II, VRBaseMap,
463 IsDebug, IsClone, IsCloned);
467 unsigned InstrEmitter::ConstrainForSubReg(
unsigned VReg,
unsigned SubIdx,
484 assert(RC &&
"No legal register class for VT supports that SubIdx");
486 BuildMI(*MBB, InsertPos, DL, TII->
get(TargetOpcode::COPY), NewReg)
493 void InstrEmitter::EmitSubregNode(
SDNode *Node,
495 bool IsClone,
bool IsCloned) {
512 if (Opc == TargetOpcode::EXTRACT_SUBREG) {
516 unsigned SubIdx = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
531 unsigned SrcReg, DstReg, DefSubIdx;
534 SubIdx == DefSubIdx &&
543 TII->
get(TargetOpcode::COPY), VRBase).addReg(SrcReg);
550 Reg = ConstrainForSubReg(Reg, SubIdx,
561 TII->
get(TargetOpcode::COPY), VRBase);
563 CopyMI.
addReg(Reg, 0, SubIdx);
567 }
else if (Opc == TargetOpcode::INSERT_SUBREG ||
568 Opc == TargetOpcode::SUBREG_TO_REG) {
572 unsigned SubIdx = cast<ConstantSDNode>(N2)->getZExtValue();
590 assert(SRC &&
"No register class supports VT and SubIdx for INSERT_SUBREG");
601 if (Opc == TargetOpcode::SUBREG_TO_REG) {
605 AddOperand(MIB, N0, 0,
nullptr, VRBaseMap,
false,
608 AddOperand(MIB, N1, 0,
nullptr, VRBaseMap,
false,
611 MBB->
insert(InsertPos, MIB);
613 llvm_unreachable(
"Node is not insert_subreg, extract_subreg, or subreg_to_reg");
616 bool isNew = VRBaseMap.
insert(std::make_pair(Op, VRBase)).second;
618 assert(isNew &&
"Node emitted out of order - early");
626 InstrEmitter::EmitCopyToRegClassNode(
SDNode *Node,
628 unsigned VReg = getVR(Node->
getOperand(0), VRBaseMap);
631 unsigned DstRCIdx = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
636 NewVReg).addReg(VReg);
639 bool isNew = VRBaseMap.
insert(std::make_pair(Op, NewVReg)).second;
641 assert(isNew &&
"Node emitted out of order - early");
646 void InstrEmitter::EmitRegSequence(
SDNode *Node,
648 bool IsClone,
bool IsCloned) {
649 unsigned DstRCIdx = cast<ConstantSDNode>(Node->
getOperand(0))->getZExtValue();
661 assert((NumOps & 1) == 1 &&
662 "REG_SEQUENCE must have an odd number of operands!");
663 for (
unsigned i = 1; i != NumOps; ++i) {
670 unsigned SubIdx = cast<ConstantSDNode>(
Op)->getZExtValue();
675 if (SRC && SRC != RC) {
681 AddOperand(MIB, Op, i+1, &II, VRBaseMap,
false,
685 MBB->
insert(InsertPos, MIB);
687 bool isNew = VRBaseMap.
insert(std::make_pair(Op, NewVReg)).second;
689 assert(isNew &&
"Node emitted out of order - early");
700 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
701 "Expected inlined-at fields to agree");
709 auto MIB =
BuildMI(*MF, DL, TII->
get(TargetOpcode::DBG_VALUE));
720 auto FrameMI =
BuildMI(*MF, DL, TII->
get(TargetOpcode::DBG_VALUE))
742 if (I==VRBaseMap.
end())
751 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
752 if (CI->getBitWidth() > 64)
755 MIB.
addImm(CI->getSExtValue());
756 }
else if (
const ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
758 }
else if (isa<ConstantPointerNull>(V)) {
787 assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(DL) &&
788 "Expected inlined-at fields to agree");
801 EmitMachineNode(
SDNode *Node,
bool IsClone,
bool IsCloned,
806 if (Opc == TargetOpcode::EXTRACT_SUBREG ||
807 Opc == TargetOpcode::INSERT_SUBREG ||
808 Opc == TargetOpcode::SUBREG_TO_REG) {
809 EmitSubregNode(Node, VRBaseMap, IsClone, IsCloned);
814 if (Opc == TargetOpcode::COPY_TO_REGCLASS) {
815 EmitCopyToRegClassNode(Node, VRBaseMap);
820 if (Opc == TargetOpcode::REG_SEQUENCE) {
821 EmitRegSequence(Node, VRBaseMap, IsClone, IsCloned);
825 if (Opc == TargetOpcode::IMPLICIT_DEF)
835 if (Opc == TargetOpcode::STACKMAP || Opc == TargetOpcode::PATCHPOINT) {
840 if (Opc == TargetOpcode::PATCHPOINT) {
842 NumDefs = NumResults;
847 unsigned NumImpUses = 0;
848 unsigned NodeOperands =
850 bool HasPhysRegOuts = NumResults > NumDefs && II.
getImplicitDefs()!=
nullptr;
852 unsigned NumMIOperands = NodeOperands + NumResults;
855 "Too few operands for a variadic node!");
860 "#operands for dag node doesn't match .td file!");
869 CreateVirtualRegisters(Node, MIB, II, IsClone, IsCloned, VRBaseMap);
875 MI->
setFlag(MachineInstr::MIFlag::FmNsz);
878 MI->
setFlag(MachineInstr::MIFlag::FmArcp);
881 MI->
setFlag(MachineInstr::MIFlag::FmNoNans);
884 MI->
setFlag(MachineInstr::MIFlag::FmNoInfs);
887 MI->
setFlag(MachineInstr::MIFlag::FmContract);
890 MI->
setFlag(MachineInstr::MIFlag::FmAfn);
893 MI->
setFlag(MachineInstr::MIFlag::FmReassoc);
896 MI->
setFlag(MachineInstr::MIFlag::NoUWrap);
899 MI->
setFlag(MachineInstr::MIFlag::NoSWrap);
902 MI->
setFlag(MachineInstr::MIFlag::IsExact);
907 bool HasOptPRefs = NumDefs > NumResults;
908 assert((!HasOptPRefs || !HasPhysRegOuts) &&
909 "Unable to cope with optional defs and phys regs defs!");
910 unsigned NumSkip = HasOptPRefs ? NumDefs - NumResults : 0;
911 for (
unsigned i = NumSkip; i != NodeOperands; ++i)
912 AddOperand(MIB, Node->
getOperand(i), i-NumSkip+NumDefs, &II,
913 VRBaseMap,
false, IsClone, IsCloned);
917 for (
unsigned i = 0; ScratchRegs[i]; ++i)
923 MIB.setMemRefs(cast<MachineSDNode>(Node)->memoperands());
928 MBB->
insert(InsertPos, MIB);
948 if (HasPhysRegOuts) {
949 for (
unsigned i = NumDefs; i < NumResults; ++i) {
950 unsigned Reg = II.getImplicitDefs()[i - NumDefs];
955 EmitCopyFromReg(Node, i, IsClone, IsCloned, Reg, VRBaseMap);
975 for (
unsigned i = 0, e =
F->getNumOperands(); i != e; ++i)
977 unsigned Reg = R->getReg();
985 if (!UsedRegs.
empty() || II.getImplicitDefs() || II.hasOptionalDef())
986 MIB->setPhysRegsDeadExcept(UsedRegs, *TRI);
989 if (II.hasPostISelHook())
996 EmitSpecialNode(
SDNode *Node,
bool IsClone,
bool IsCloned,
1003 llvm_unreachable(
"This target-independent node should have been selected!");
1005 llvm_unreachable(
"EntryToken should have been excluded from the schedule!");
1013 SrcReg = R->getReg();
1015 SrcReg = getVR(SrcVal, VRBaseMap);
1018 if (SrcReg == DestReg)
1022 DestReg).addReg(SrcReg);
1027 EmitCopyFromReg(Node, 0, IsClone, IsCloned, SrcReg, VRBaseMap);
1035 MCSymbol *S = cast<LabelSDNode>(Node)->getLabel();
1037 TII->
get(Opc)).addSym(S);
1063 const char *AsmStr = cast<ExternalSymbolSDNode>(AsmStrV)->
getSymbol();
1082 cast<ConstantSDNode>(Node->
getOperand(i))->getZExtValue();
1092 for (
unsigned j = 0; j != NumVals; ++j, ++i) {
1103 for (
unsigned j = 0; j != NumVals; ++j, ++i) {
1115 for (
unsigned j = 0; j != NumVals; ++j, ++i)
1116 AddOperand(MIB, Node->
getOperand(i), 0,
nullptr, VRBaseMap,
1117 false, IsClone, IsCloned);
1121 unsigned DefGroup = 0;
1123 unsigned DefIdx = GroupIdx[DefGroup] + 1;
1124 unsigned UseIdx = GroupIdx.
back() + 1;
1125 for (
unsigned j = 0; j != NumVals; ++j)
1138 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 TargetRegisterClass * getCommonSubClass(const TargetRegisterClass *A, const TargetRegisterClass *B, const MVT::SimpleValueType SVT=MVT::SimpleValueType::Any) const
Find the largest common subclass of A and B.
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...
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
unsigned getNumImplicitDefs() const
Return the number of implicit defs this instruct has.
This class represents lattice values for constants.
MachineOperand * findRegisterDefOperand(unsigned Reg, bool isDead=false, const TargetRegisterInfo *TRI=nullptr)
Wrapper for findRegisterDefOperandIdx, it returns a pointer to the MachineOperand rather than an inde...
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 ...
void push_back(const T &Elt)
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
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...
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
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.)
virtual const TargetRegisterClass * getRegClassFor(MVT VT) const
Return the register class that should be used for the specified value type.
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 MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned char TargetFlags=0) const
const MachineInstrBuilder & addTargetIndex(unsigned Idx, int64_t Offset=0, unsigned char TargetFlags=0) const
const DebugLoc & getDebugLoc() const
Return the source location info.
EntryToken - This is the marker used to indicate the start of a region.
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.
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 hasOneUse() const
Return true if there is exactly one use of this node.
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.
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 ...
void setIsEarlyClobber(bool Val=true)
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Value is contents of a stack location.
void clearKillFlags(unsigned Reg) const
clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the Mac...
DIVariable * getVariable() const
Returns the DIVariable pointer for the variable.
const MachineInstrBuilder & addFPImm(const ConstantFP *Val) 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.
Expected< const typename ELFT::Sym * > getSymbol(typename ELFT::SymRange Symbols, uint32_t Index)
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)
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
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...
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
const MachineInstrBuilder & addBlockAddress(const BlockAddress *BA, int64_t Offset=0, unsigned char TargetFlags=0) const
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
ConstantFP - Floating Point Values [float, double].
unsigned getSubReg(unsigned Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo...
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.
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
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.
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.
MachineInstrBuilder MachineInstrBuilder & DefMI
int getCopyCost() const
Return the cost of copying a value between two registers in this class.
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned char TargetFlags=0) const
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)
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool hasNoSignedWrap() const
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
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...
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned char TargetFlags=0) const
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.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
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.
const MachineInstrBuilder & addJumpTableIndex(unsigned Idx, unsigned char TargetFlags=0) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineInstr * EmitDbgValue(SDDbgValue *SD, DenseMap< SDValue, unsigned > &VRBaseMap)
EmitDbgValue - Generate machine instruction for a dbg_value node.
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.
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.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
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.
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one...
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
This file describes how to lower LLVM code to machine code.
void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.