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();
655 assert((NumOps & 1) == 1 &&
656 "REG_SEQUENCE must have an odd number of operands!");
657 for (
unsigned i = 1; i != NumOps; ++i) {
664 unsigned SubIdx = cast<ConstantSDNode>(
Op)->getZExtValue();
669 if (SRC && SRC != RC) {
675 AddOperand(MIB, Op, i+1, &II, VRBaseMap,
false,
679 MBB->
insert(InsertPos, MIB);
681 bool isNew = VRBaseMap.
insert(std::make_pair(Op, NewVReg)).second;
683 assert(isNew &&
"Node emitted out of order - early");
694 assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
695 "Expected inlined-at fields to agree");
700 auto FrameMI =
BuildMI(*MF, DL, TII->
get(TargetOpcode::DBG_VALUE))
722 if (I==VRBaseMap.
end())
731 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
732 if (CI->getBitWidth() > 64)
735 MIB.
addImm(CI->getSExtValue());
736 }
else if (
const ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
764 assert(cast<DILabel>(Label)->isValidLocationForIntrinsic(DL) &&
765 "Expected inlined-at fields to agree");
778 EmitMachineNode(
SDNode *Node,
bool IsClone,
bool IsCloned,
783 if (Opc == TargetOpcode::EXTRACT_SUBREG ||
784 Opc == TargetOpcode::INSERT_SUBREG ||
785 Opc == TargetOpcode::SUBREG_TO_REG) {
786 EmitSubregNode(Node, VRBaseMap, IsClone, IsCloned);
791 if (Opc == TargetOpcode::COPY_TO_REGCLASS) {
792 EmitCopyToRegClassNode(Node, VRBaseMap);
797 if (Opc == TargetOpcode::REG_SEQUENCE) {
798 EmitRegSequence(Node, VRBaseMap, IsClone, IsCloned);
802 if (Opc == TargetOpcode::IMPLICIT_DEF)
812 if (Opc == TargetOpcode::STACKMAP || Opc == TargetOpcode::PATCHPOINT) {
817 if (Opc == TargetOpcode::PATCHPOINT) {
819 NumDefs = NumResults;
824 unsigned NumImpUses = 0;
825 unsigned NodeOperands =
827 bool HasPhysRegOuts = NumResults > NumDefs && II.
getImplicitDefs()!=
nullptr;
829 unsigned NumMIOperands = NodeOperands + NumResults;
832 "Too few operands for a variadic node!");
837 "#operands for dag node doesn't match .td file!");
846 CreateVirtualRegisters(Node, MIB, II, IsClone, IsCloned, VRBaseMap);
852 MI->
setFlag(MachineInstr::MIFlag::FmNsz);
855 MI->
setFlag(MachineInstr::MIFlag::FmArcp);
858 MI->
setFlag(MachineInstr::MIFlag::FmNoNans);
861 MI->
setFlag(MachineInstr::MIFlag::FmNoInfs);
864 MI->
setFlag(MachineInstr::MIFlag::FmContract);
867 MI->
setFlag(MachineInstr::MIFlag::FmAfn);
870 MI->
setFlag(MachineInstr::MIFlag::FmReassoc);
875 bool HasOptPRefs = NumDefs > NumResults;
876 assert((!HasOptPRefs || !HasPhysRegOuts) &&
877 "Unable to cope with optional defs and phys regs defs!");
878 unsigned NumSkip = HasOptPRefs ? NumDefs - NumResults : 0;
879 for (
unsigned i = NumSkip; i != NodeOperands; ++i)
880 AddOperand(MIB, Node->
getOperand(i), i-NumSkip+NumDefs, &II,
881 VRBaseMap,
false, IsClone, IsCloned);
885 for (
unsigned i = 0; ScratchRegs[i]; ++i)
890 MIB.setMemRefs(cast<MachineSDNode>(Node)->memoperands_begin(),
891 cast<MachineSDNode>(Node)->memoperands_end());
896 MBB->
insert(InsertPos, MIB);
916 if (HasPhysRegOuts) {
917 for (
unsigned i = NumDefs; i < NumResults; ++i) {
918 unsigned Reg = II.getImplicitDefs()[i - NumDefs];
923 EmitCopyFromReg(Node, i, IsClone, IsCloned, Reg, VRBaseMap);
943 for (
unsigned i = 0, e =
F->getNumOperands(); i != e; ++i)
945 unsigned Reg = R->getReg();
953 if (!UsedRegs.
empty() || II.getImplicitDefs())
954 MIB->setPhysRegsDeadExcept(UsedRegs, *TRI);
957 if (II.hasPostISelHook())
964 EmitSpecialNode(
SDNode *Node,
bool IsClone,
bool IsCloned,
971 llvm_unreachable(
"This target-independent node should have been selected!");
973 llvm_unreachable(
"EntryToken should have been excluded from the schedule!");
981 SrcReg = R->getReg();
983 SrcReg = getVR(SrcVal, VRBaseMap);
986 if (SrcReg == DestReg)
990 DestReg).addReg(SrcReg);
995 EmitCopyFromReg(Node, 0, IsClone, IsCloned, SrcReg, VRBaseMap);
1003 MCSymbol *S = cast<LabelSDNode>(Node)->getLabel();
1005 TII->
get(Opc)).addSym(S);
1031 const char *AsmStr = cast<ExternalSymbolSDNode>(AsmStrV)->
getSymbol();
1050 cast<ConstantSDNode>(Node->
getOperand(i))->getZExtValue();
1060 for (
unsigned j = 0; j != NumVals; ++j, ++i) {
1071 for (
unsigned j = 0; j != NumVals; ++j, ++i) {
1083 for (
unsigned j = 0; j != NumVals; ++j, ++i)
1084 AddOperand(MIB, Node->
getOperand(i), 0,
nullptr, VRBaseMap,
1085 false, IsClone, IsCloned);
1089 unsigned DefGroup = 0;
1091 unsigned DefIdx = GroupIdx[DefGroup] + 1;
1092 unsigned UseIdx = GroupIdx.
back() + 1;
1093 for (
unsigned j = 0; j != NumVals; ++j)
1106 for (
unsigned Reg : ECRegs) {
1109 assert(MO &&
"No def operand for clobbered register?");
1116 const MDNode *MD = cast<MDNodeSDNode>(MDV)->getMD();
1120 MBB->
insert(InsertPos, MIB);
1130 : MF(mbb->
getParent()), MRI(&MF->getRegInfo()),
1131 TII(MF->getSubtarget().getInstrInfo()),
1132 TRI(MF->getSubtarget().getRegisterInfo()),
1133 TLI(MF->getSubtarget().getTargetLowering()), MBB(mbb),
1134 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
void push_back(const T &Elt)
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.
Compute iterated dominance frontiers using a linear time algorithm.
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.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
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.
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
Access to explicit operands of the instruction.
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.
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.
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.