37 return "<<Unknown DAG Node>>";
48 if (Name)
return Name;
87 if (cast<ConstantSDNode>(
this)->isOpaque())
88 return "OpaqueConstant";
113 unsigned IID = cast<ConstantSDNode>(
getOperand(OpNo))->getZExtValue();
117 return TII->getName(IID);
123 if (cast<ConstantSDNode>(
this)->isOpaque())
124 return "OpaqueTargetConstant";
125 return "TargetConstant";
253 switch (cast<CvtRndSatSDNode>(
this)->getCvtCode()) {
312 switch (cast<CondCodeSDNode>(
this)->
get()) {
362 OS << (
const void*)
this <<
": ";
375 if (
const MachineSDNode *MN = dyn_cast<MachineSDNode>(
this)) {
376 if (!MN->memoperands_empty()) {
380 e = MN->memoperands_end(); i != e; ++i) {
382 if (std::next(i) != e)
388 dyn_cast<ShuffleVectorSDNode>(
this)) {
390 for (
unsigned i = 0, e = ValueList[0].getVectorNumElements(); i != e; ++i) {
391 int Idx = SVN->getMaskElt(i);
399 }
else if (
const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(
this)) {
400 OS <<
'<' << CSDN->getAPIntValue() <<
'>';
401 }
else if (
const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(
this)) {
403 OS <<
'<' << CSDN->getValueAPF().convertToFloat() <<
'>';
405 OS <<
'<' << CSDN->getValueAPF().convertToDouble() <<
'>';
408 CSDN->getValueAPF().bitcastToAPInt().dump();
412 dyn_cast<GlobalAddressSDNode>(
this)) {
413 int64_t offset = GADN->getOffset();
415 GADN->getGlobal()->printAsOperand(OS);
418 OS << " + " << offset;
421 if (unsigned int TF = GADN->getTargetFlags())
422 OS << " [TF=" << TF << ']
';
423 } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(this)) {
424 OS << "<" << FIDN->getIndex() << ">";
425 } else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(this)) {
426 OS << "<" << JTDN->getIndex() << ">";
427 if (unsigned int TF = JTDN->getTargetFlags())
428 OS << " [TF=" << TF << ']
';
429 } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
430 int offset = CP->getOffset();
431 if (CP->isMachineConstantPoolEntry())
432 OS << "<" << *CP->getMachineCPVal() << ">";
434 OS << "<" << *CP->getConstVal() << ">";
436 OS << " + " << offset;
439 if (unsigned int TF = CP->getTargetFlags())
440 OS << " [TF=" << TF << ']
';
441 } else if (const TargetIndexSDNode *TI = dyn_cast<TargetIndexSDNode>(this)) {
442 OS << "<" << TI->getIndex() << '+
' << TI->getOffset() << ">";
443 if (unsigned TF = TI->getTargetFlags())
444 OS << " [TF=" << TF << ']
';
445 } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
447 const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
449 OS << LBB->getName() << " ";
450 OS << (const void*)BBDN->getBasicBlock() << ">";
451 } else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(this)) {
452 OS << ' ' << PrintReg(R->getReg(),
453 G ? G->getSubtarget().getRegisterInfo() : nullptr);
454 } else if (const ExternalSymbolSDNode *ES =
455 dyn_cast<ExternalSymbolSDNode>(this)) {
456 OS << "'" << ES->getSymbol() << "'";
457 if (unsigned int TF = ES->getTargetFlags())
458 OS << " [TF=" << TF << ']
';
459 } else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(this)) {
461 OS << "<" << M->getValue() << ">";
464 } else if (const MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(this)) {
466 OS << "<" << MD->getMD() << ">";
469 } else if (const VTSDNode *N = dyn_cast<VTSDNode>(this)) {
470 OS << ":" << N->getVT().getEVTString();
472 else if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(this)) {
473 OS << "<" << *LD->getMemOperand();
476 switch (LD->getExtensionType()) {
477 default: doExt = false; break;
478 case ISD::EXTLOAD: OS << ", anyext"; break;
479 case ISD::SEXTLOAD: OS << ", sext"; break;
480 case ISD::ZEXTLOAD: OS << ", zext"; break;
483 OS << " from " << LD->getMemoryVT().getEVTString();
485 const char *AM = getIndexedModeName(LD->getAddressingMode());
490 } else if (const StoreSDNode *ST = dyn_cast<StoreSDNode>(this)) {
491 OS << "<" << *ST->getMemOperand();
493 if (ST->isTruncatingStore())
494 OS << ", trunc to " << ST->getMemoryVT().getEVTString();
496 const char *AM = getIndexedModeName(ST->getAddressingMode());
501 } else if (const MemSDNode* M = dyn_cast<MemSDNode>(this)) {
502 OS << "<" << *M->getMemOperand() << ">";
503 } else if (const BlockAddressSDNode *BA =
504 dyn_cast<BlockAddressSDNode>(this)) {
505 int64_t offset = BA->getOffset();
507 BA->getBlockAddress()->getFunction()->printAsOperand(OS, false);
509 BA->getBlockAddress()->getBasicBlock()->printAsOperand(OS, false);
512 OS << " + " << offset;
515 if (unsigned int TF = BA->getTargetFlags())
516 OS << " [TF=" << TF << ']
';
517 } else if (const AddrSpaceCastSDNode *ASC =
518 dyn_cast<AddrSpaceCastSDNode>(this)) {
520 << ASC->getSrcAddressSpace()
522 << ASC->getDestAddressSpace()
526 if (unsigned Order = getIROrder())
527 OS << " [ORD=" << Order << ']
';
529 if (getNodeId() != -1)
530 OS << " [ID=" << getNodeId() << ']
';
535 DILocation *L = getDebugLoc();
539 if (auto *Scope = L->getScope())
540 OS << Scope->getFilename();
543 OS << ':
' << L->getLine();
544 if (unsigned C = L->getColumn())
548 static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {
549 for (const SDValue &Op : N->op_values())
550 if (Op.getNode()->hasOneUse())
551 DumpNodes(Op.getNode(), indent+2, G);
553 dbgs() << "\n" << std::string(indent+2, ' ')
554 << (void*)Op.getNode() << ": <multiple use>";
557 dbgs().indent(indent);
561 void SelectionDAG::dump() const {
562 dbgs() << "SelectionDAG has " << AllNodes.size() << " nodes:";
564 for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end();
567 if (!N->hasOneUse() && N != getRoot().getNode())
568 DumpNodes(N, 2, this);
571 if (getRoot().getNode()) DumpNodes(getRoot().getNode(), 2, this);
575 void SDNode::printr(raw_ostream &OS, const SelectionDAG *G) const {
577 print_details(OS, G);
580 typedef SmallPtrSet<const SDNode *, 128> VisitedSDNodeSet;
581 static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent,
582 const SelectionDAG *G, VisitedSDNodeSet &once) {
583 if (!once.insert(N).second) // If we've been here before,
return now.
591 for (
unsigned i = 0, e =
N->getNumOperands(); i != e; ++i) {
592 const SDNode *child =
N->getOperand(i).getNode();
602 OS << (
const void*)child;
603 if (
unsigned RN =
N->getOperand(i).getResNo())
611 for (
const SDValue &Op :
N->op_values())
648 unsigned depth)
const {
669 if (i) OS <<
", ";
else OS <<
" ";
ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type down to the precision of the ...
BUILTIN_OP_END - This must be the last enum value in this list.
EXTRACT_ELEMENT - This is used to get the lower or upper (determined by a Constant, which is required to be operand #1) half of the integer or float value specified as operand #0.
void dumprFull(const SelectionDAG *G=nullptr) const
printrFull to dbgs().
void dump() const
Dump this node, for debugging.
DELETED_NODE - This is an illegal value that is used to catch errors.
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR...
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
BR_CC - Conditional branch.
static const fltSemantics IEEEdouble
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
Carry-setting nodes for multiple precision addition and subtraction.
const TargetMachine & getTarget() const
const TargetSubtargetInfo & getSubtarget() const
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
unsigned getNumOperands() const
Return the number of values used by this operation.
const SDValue & getOperand(unsigned Num) const
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
EntryToken - This is the marker used to indicate the start of a region.
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
void dumpr() const
Dump (recursively) this node and its use-def subgraph.
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic...
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
void print_types(raw_ostream &OS, const SelectionDAG *G) const
void dumprWithDepth(const SelectionDAG *G=nullptr, unsigned depth=100) const
printrWithDepth to dbgs().
MachineMemOperand - A description of a memory reference used in the backend.
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
std::string getEVTString() const
getEVTString - This function returns value type as a string, e.g.
PCMARKER - This corresponds to the pcmarker intrinsic.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
const HexagonInstrInfo * TII
Shift and rotation operations.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
CopyToReg - This node has three operands: a chain, a register number to set to this value...
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of a call sequence, and carry arbitrary information that target might want to know.
Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) For double-word atomic operations: ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) These correspond to the atomicrmw instruction.
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
static void printrWithDepthHelper(raw_ostream &OS, const SDNode *N, const SelectionDAG *G, unsigned depth, unsigned indent)
INLINEASM - Represents an inline asm block.
STACKSAVE - STACKSAVE has one operand, an input chain.
FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to first (possible) on-stack ar...
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Simple integer binary arithmetic operators.
static std::string utostr(uint64_t X, bool isNeg=false)
static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent, const SelectionDAG *G, VisitedSDNodeSet &once)
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
static const char * getIndexedModeName(ISD::MemIndexedMode AM)
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
UNDEF - An undefined node.
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
std::string getOperationName(const SelectionDAG *G=nullptr) const
Return the opcode of this operation for printing.
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
TargetInstrInfo - Interface to description of machine instruction set.
This corresponds to the llvm.lifetime.
SDNode * getNode() const
get the SDNode which holds the desired result
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
Control flow instructions. These all have token chains.
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
GC_TRANSITION_START/GC_TRANSITION_END - These operators mark the beginning and end of GC transition s...
LOCAL_RECOVER - Represents the llvm.localrecover intrinsic.
Simple binary floating point operators.
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
Carry-using nodes for multiple precision addition and subtraction.
INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
void printrFull(raw_ostream &O, const SelectionDAG *G=nullptr) const
Print a SelectionDAG node and all children down to the leaves.
TRAP - Trapping instruction.
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
DEBUGTRAP - Trap intended to get the attention of a debugger.
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
Bit counting operators with an undefined result for zero inputs.
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
HANDLENODE node - Used as a handle for various purposes.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
void print(raw_ostream &OS, const SelectionDAG *G=nullptr) const
TargetIntrinsicInfo - Interface to description of machine instruction set.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and rounds it to a floating point val...
ADDRSPACECAST - This operator converts between pointers of different address spaces.
BRCOND - Conditional branch.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Byte Swap and Counting operators.
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
Represents one node in the SelectionDAG.
void print_details(raw_ostream &OS, const SelectionDAG *G) const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void printr(raw_ostream &OS, const SelectionDAG *G=nullptr) const
Select(COND, TRUEVAL, FALSEVAL).
ZERO_EXTEND - Used for integer types, zeroing the new bits.
ANY_EXTEND - Used for integer types. The high bits are undefined.
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
iterator_range< value_op_iterator > op_values() const
BR_JT - Jumptable branch.
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the source.
static const fltSemantics IEEEsingle
Bitwise operators - logical and, logical or, logical xor.
std::string getName(ID id, ArrayRef< Type * > Tys=None)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
virtual const TargetIntrinsicInfo * getIntrinsicInfo() const
If intrinsic information is available, return it. If not, return null.
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
FSINCOS - Compute both fsin and fcos as a single operation.
RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.setjmp intrinsic.
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 'eh_return' gcc dwarf builtin...
CONVERT_RNDSAT - This operator is used to support various conversions between various types (float...
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
virtual const TargetInstrInfo * getInstrInfo() const
FMA - Perform a * b + c with no intermediate rounding step.
PREFETCH - This corresponds to a prefetch intrinsic.
void printrWithDepth(raw_ostream &O, const SelectionDAG *G=nullptr, unsigned depth=100) const
Print a SelectionDAG node and children up to depth "depth." The given SelectionDAG allows target-spec...
const TargetLowering & getTargetLoweringInfo() const
This class implements an extremely fast bulk output stream that can only output to a stream...
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
SetCC operator - This evaluates to a true value iff the condition is true.
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
TRUNCATE - Completely drop the high bits.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, FLOG, FLOG2, FLOG10, FEXP, FEXP2, FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR - Perform various unary floating point operations.
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
static sys::TimeValue now(bool Deterministic)
CARRY_FALSE - This node is used when folding other nodes, like ADDC/SUBC, which indicate the carry re...
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
SRCVALUE - This is a node type that holds a Value* that is used to make reference to a value in the L...
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...