LLVM  7.0.0svn
SelectionDAGDumper.cpp
Go to the documentation of this file.
1 //===- SelectionDAGDumper.cpp - Implement SelectionDAG::dump() ------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This implements the SelectionDAG::dump method and friends.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/ADT/APFloat.h"
15 #include "llvm/ADT/APInt.h"
16 #include "llvm/ADT/None.h"
17 #include "llvm/ADT/SmallPtrSet.h"
18 #include "llvm/ADT/StringExtras.h"
31 #include "llvm/IR/BasicBlock.h"
32 #include "llvm/IR/Constants.h"
34 #include "llvm/IR/DebugLoc.h"
35 #include "llvm/IR/Function.h"
36 #include "llvm/IR/Intrinsics.h"
37 #include "llvm/IR/Value.h"
38 #include "llvm/Support/Casting.h"
40 #include "llvm/Support/Compiler.h"
41 #include "llvm/Support/Debug.h"
43 #include "llvm/Support/Printable.h"
47 #include <cstdint>
48 #include <iterator>
49 
50 using namespace llvm;
51 
52 static cl::opt<bool>
53 VerboseDAGDumping("dag-dump-verbose", cl::Hidden,
54  cl::desc("Display more information when dumping selection "
55  "DAG nodes."));
56 
57 std::string SDNode::getOperationName(const SelectionDAG *G) const {
58  switch (getOpcode()) {
59  default:
61  return "<<Unknown DAG Node>>";
62  if (isMachineOpcode()) {
63  if (G)
64  if (const TargetInstrInfo *TII = G->getSubtarget().getInstrInfo())
65  if (getMachineOpcode() < TII->getNumOpcodes())
66  return TII->getName(getMachineOpcode());
67  return "<<Unknown Machine Node #" + utostr(getOpcode()) + ">>";
68  }
69  if (G) {
70  const TargetLowering &TLI = G->getTargetLoweringInfo();
71  const char *Name = TLI.getTargetNodeName(getOpcode());
72  if (Name) return Name;
73  return "<<Unknown Target Node #" + utostr(getOpcode()) + ">>";
74  }
75  return "<<Unknown Node #" + utostr(getOpcode()) + ">>";
76 
77 #ifndef NDEBUG
78  case ISD::DELETED_NODE: return "<<Deleted Node!>>";
79 #endif
80  case ISD::PREFETCH: return "Prefetch";
81  case ISD::ATOMIC_FENCE: return "AtomicFence";
82  case ISD::ATOMIC_CMP_SWAP: return "AtomicCmpSwap";
83  case ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS: return "AtomicCmpSwapWithSuccess";
84  case ISD::ATOMIC_SWAP: return "AtomicSwap";
85  case ISD::ATOMIC_LOAD_ADD: return "AtomicLoadAdd";
86  case ISD::ATOMIC_LOAD_SUB: return "AtomicLoadSub";
87  case ISD::ATOMIC_LOAD_AND: return "AtomicLoadAnd";
88  case ISD::ATOMIC_LOAD_CLR: return "AtomicLoadClr";
89  case ISD::ATOMIC_LOAD_OR: return "AtomicLoadOr";
90  case ISD::ATOMIC_LOAD_XOR: return "AtomicLoadXor";
91  case ISD::ATOMIC_LOAD_NAND: return "AtomicLoadNand";
92  case ISD::ATOMIC_LOAD_MIN: return "AtomicLoadMin";
93  case ISD::ATOMIC_LOAD_MAX: return "AtomicLoadMax";
94  case ISD::ATOMIC_LOAD_UMIN: return "AtomicLoadUMin";
95  case ISD::ATOMIC_LOAD_UMAX: return "AtomicLoadUMax";
96  case ISD::ATOMIC_LOAD: return "AtomicLoad";
97  case ISD::ATOMIC_STORE: return "AtomicStore";
98  case ISD::PCMARKER: return "PCMarker";
99  case ISD::READCYCLECOUNTER: return "ReadCycleCounter";
100  case ISD::SRCVALUE: return "SrcValue";
101  case ISD::MDNODE_SDNODE: return "MDNode";
102  case ISD::EntryToken: return "EntryToken";
103  case ISD::TokenFactor: return "TokenFactor";
104  case ISD::AssertSext: return "AssertSext";
105  case ISD::AssertZext: return "AssertZext";
106 
107  case ISD::BasicBlock: return "BasicBlock";
108  case ISD::VALUETYPE: return "ValueType";
109  case ISD::Register: return "Register";
110  case ISD::RegisterMask: return "RegisterMask";
111  case ISD::Constant:
112  if (cast<ConstantSDNode>(this)->isOpaque())
113  return "OpaqueConstant";
114  return "Constant";
115  case ISD::ConstantFP: return "ConstantFP";
116  case ISD::GlobalAddress: return "GlobalAddress";
117  case ISD::GlobalTLSAddress: return "GlobalTLSAddress";
118  case ISD::FrameIndex: return "FrameIndex";
119  case ISD::JumpTable: return "JumpTable";
120  case ISD::GLOBAL_OFFSET_TABLE: return "GLOBAL_OFFSET_TABLE";
121  case ISD::RETURNADDR: return "RETURNADDR";
122  case ISD::ADDROFRETURNADDR: return "ADDROFRETURNADDR";
123  case ISD::FRAMEADDR: return "FRAMEADDR";
124  case ISD::LOCAL_RECOVER: return "LOCAL_RECOVER";
125  case ISD::READ_REGISTER: return "READ_REGISTER";
126  case ISD::WRITE_REGISTER: return "WRITE_REGISTER";
127  case ISD::FRAME_TO_ARGS_OFFSET: return "FRAME_TO_ARGS_OFFSET";
128  case ISD::EH_DWARF_CFA: return "EH_DWARF_CFA";
129  case ISD::EH_RETURN: return "EH_RETURN";
130  case ISD::EH_SJLJ_SETJMP: return "EH_SJLJ_SETJMP";
131  case ISD::EH_SJLJ_LONGJMP: return "EH_SJLJ_LONGJMP";
132  case ISD::EH_SJLJ_SETUP_DISPATCH: return "EH_SJLJ_SETUP_DISPATCH";
133  case ISD::ConstantPool: return "ConstantPool";
134  case ISD::TargetIndex: return "TargetIndex";
135  case ISD::ExternalSymbol: return "ExternalSymbol";
136  case ISD::BlockAddress: return "BlockAddress";
138  case ISD::INTRINSIC_VOID:
139  case ISD::INTRINSIC_W_CHAIN: {
140  unsigned OpNo = getOpcode() == ISD::INTRINSIC_WO_CHAIN ? 0 : 1;
141  unsigned IID = cast<ConstantSDNode>(getOperand(OpNo))->getZExtValue();
142  if (IID < Intrinsic::num_intrinsics)
143  return Intrinsic::getName((Intrinsic::ID)IID, None);
144  else if (const TargetIntrinsicInfo *TII = G->getTarget().getIntrinsicInfo())
145  return TII->getName(IID);
146  llvm_unreachable("Invalid intrinsic ID");
147  }
148 
149  case ISD::BUILD_VECTOR: return "BUILD_VECTOR";
150  case ISD::TargetConstant:
151  if (cast<ConstantSDNode>(this)->isOpaque())
152  return "OpaqueTargetConstant";
153  return "TargetConstant";
154  case ISD::TargetConstantFP: return "TargetConstantFP";
155  case ISD::TargetGlobalAddress: return "TargetGlobalAddress";
156  case ISD::TargetGlobalTLSAddress: return "TargetGlobalTLSAddress";
157  case ISD::TargetFrameIndex: return "TargetFrameIndex";
158  case ISD::TargetJumpTable: return "TargetJumpTable";
159  case ISD::TargetConstantPool: return "TargetConstantPool";
160  case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
161  case ISD::MCSymbol: return "MCSymbol";
162  case ISD::TargetBlockAddress: return "TargetBlockAddress";
163 
164  case ISD::CopyToReg: return "CopyToReg";
165  case ISD::CopyFromReg: return "CopyFromReg";
166  case ISD::UNDEF: return "undef";
167  case ISD::MERGE_VALUES: return "merge_values";
168  case ISD::INLINEASM: return "inlineasm";
169  case ISD::EH_LABEL: return "eh_label";
170  case ISD::HANDLENODE: return "handlenode";
171 
172  // Unary operators
173  case ISD::FABS: return "fabs";
174  case ISD::FMINNUM: return "fminnum";
175  case ISD::FMAXNUM: return "fmaxnum";
176  case ISD::FMINNAN: return "fminnan";
177  case ISD::FMAXNAN: return "fmaxnan";
178  case ISD::FNEG: return "fneg";
179  case ISD::FSQRT: return "fsqrt";
180  case ISD::STRICT_FSQRT: return "strict_fsqrt";
181  case ISD::FSIN: return "fsin";
182  case ISD::STRICT_FSIN: return "strict_fsin";
183  case ISD::FCOS: return "fcos";
184  case ISD::STRICT_FCOS: return "strict_fcos";
185  case ISD::FSINCOS: return "fsincos";
186  case ISD::FTRUNC: return "ftrunc";
187  case ISD::FFLOOR: return "ffloor";
188  case ISD::FCEIL: return "fceil";
189  case ISD::FRINT: return "frint";
190  case ISD::STRICT_FRINT: return "strict_frint";
191  case ISD::FNEARBYINT: return "fnearbyint";
192  case ISD::STRICT_FNEARBYINT: return "strict_fnearbyint";
193  case ISD::FROUND: return "fround";
194  case ISD::FEXP: return "fexp";
195  case ISD::STRICT_FEXP: return "strict_fexp";
196  case ISD::FEXP2: return "fexp2";
197  case ISD::STRICT_FEXP2: return "strict_fexp2";
198  case ISD::FLOG: return "flog";
199  case ISD::STRICT_FLOG: return "strict_flog";
200  case ISD::FLOG2: return "flog2";
201  case ISD::STRICT_FLOG2: return "strict_flog2";
202  case ISD::FLOG10: return "flog10";
203  case ISD::STRICT_FLOG10: return "strict_flog10";
204 
205  // Binary operators
206  case ISD::ADD: return "add";
207  case ISD::SUB: return "sub";
208  case ISD::MUL: return "mul";
209  case ISD::MULHU: return "mulhu";
210  case ISD::MULHS: return "mulhs";
211  case ISD::SDIV: return "sdiv";
212  case ISD::UDIV: return "udiv";
213  case ISD::SREM: return "srem";
214  case ISD::UREM: return "urem";
215  case ISD::SMUL_LOHI: return "smul_lohi";
216  case ISD::UMUL_LOHI: return "umul_lohi";
217  case ISD::SDIVREM: return "sdivrem";
218  case ISD::UDIVREM: return "udivrem";
219  case ISD::AND: return "and";
220  case ISD::OR: return "or";
221  case ISD::XOR: return "xor";
222  case ISD::SHL: return "shl";
223  case ISD::SRA: return "sra";
224  case ISD::SRL: return "srl";
225  case ISD::ROTL: return "rotl";
226  case ISD::ROTR: return "rotr";
227  case ISD::FADD: return "fadd";
228  case ISD::STRICT_FADD: return "strict_fadd";
229  case ISD::FSUB: return "fsub";
230  case ISD::STRICT_FSUB: return "strict_fsub";
231  case ISD::FMUL: return "fmul";
232  case ISD::STRICT_FMUL: return "strict_fmul";
233  case ISD::FDIV: return "fdiv";
234  case ISD::STRICT_FDIV: return "strict_fdiv";
235  case ISD::FMA: return "fma";
236  case ISD::STRICT_FMA: return "strict_fma";
237  case ISD::FMAD: return "fmad";
238  case ISD::FREM: return "frem";
239  case ISD::STRICT_FREM: return "strict_frem";
240  case ISD::FCOPYSIGN: return "fcopysign";
241  case ISD::FGETSIGN: return "fgetsign";
242  case ISD::FCANONICALIZE: return "fcanonicalize";
243  case ISD::FPOW: return "fpow";
244  case ISD::STRICT_FPOW: return "strict_fpow";
245  case ISD::SMIN: return "smin";
246  case ISD::SMAX: return "smax";
247  case ISD::UMIN: return "umin";
248  case ISD::UMAX: return "umax";
249 
250  case ISD::FPOWI: return "fpowi";
251  case ISD::STRICT_FPOWI: return "strict_fpowi";
252  case ISD::SETCC: return "setcc";
253  case ISD::SETCCE: return "setcce";
254  case ISD::SETCCCARRY: return "setcccarry";
255  case ISD::SELECT: return "select";
256  case ISD::VSELECT: return "vselect";
257  case ISD::SELECT_CC: return "select_cc";
258  case ISD::INSERT_VECTOR_ELT: return "insert_vector_elt";
259  case ISD::EXTRACT_VECTOR_ELT: return "extract_vector_elt";
260  case ISD::CONCAT_VECTORS: return "concat_vectors";
261  case ISD::INSERT_SUBVECTOR: return "insert_subvector";
262  case ISD::EXTRACT_SUBVECTOR: return "extract_subvector";
263  case ISD::SCALAR_TO_VECTOR: return "scalar_to_vector";
264  case ISD::VECTOR_SHUFFLE: return "vector_shuffle";
265  case ISD::CARRY_FALSE: return "carry_false";
266  case ISD::ADDC: return "addc";
267  case ISD::ADDE: return "adde";
268  case ISD::ADDCARRY: return "addcarry";
269  case ISD::SADDO: return "saddo";
270  case ISD::UADDO: return "uaddo";
271  case ISD::SSUBO: return "ssubo";
272  case ISD::USUBO: return "usubo";
273  case ISD::SMULO: return "smulo";
274  case ISD::UMULO: return "umulo";
275  case ISD::SUBC: return "subc";
276  case ISD::SUBE: return "sube";
277  case ISD::SUBCARRY: return "subcarry";
278  case ISD::SHL_PARTS: return "shl_parts";
279  case ISD::SRA_PARTS: return "sra_parts";
280  case ISD::SRL_PARTS: return "srl_parts";
281 
282  // Conversion operators.
283  case ISD::SIGN_EXTEND: return "sign_extend";
284  case ISD::ZERO_EXTEND: return "zero_extend";
285  case ISD::ANY_EXTEND: return "any_extend";
286  case ISD::SIGN_EXTEND_INREG: return "sign_extend_inreg";
287  case ISD::ANY_EXTEND_VECTOR_INREG: return "any_extend_vector_inreg";
288  case ISD::SIGN_EXTEND_VECTOR_INREG: return "sign_extend_vector_inreg";
289  case ISD::ZERO_EXTEND_VECTOR_INREG: return "zero_extend_vector_inreg";
290  case ISD::TRUNCATE: return "truncate";
291  case ISD::FP_ROUND: return "fp_round";
292  case ISD::FLT_ROUNDS_: return "flt_rounds";
293  case ISD::FP_ROUND_INREG: return "fp_round_inreg";
294  case ISD::FP_EXTEND: return "fp_extend";
295 
296  case ISD::SINT_TO_FP: return "sint_to_fp";
297  case ISD::UINT_TO_FP: return "uint_to_fp";
298  case ISD::FP_TO_SINT: return "fp_to_sint";
299  case ISD::FP_TO_UINT: return "fp_to_uint";
300  case ISD::BITCAST: return "bitcast";
301  case ISD::ADDRSPACECAST: return "addrspacecast";
302  case ISD::FP16_TO_FP: return "fp16_to_fp";
303  case ISD::FP_TO_FP16: return "fp_to_fp16";
304 
305  // Control flow instructions
306  case ISD::BR: return "br";
307  case ISD::BRIND: return "brind";
308  case ISD::BR_JT: return "br_jt";
309  case ISD::BRCOND: return "brcond";
310  case ISD::BR_CC: return "br_cc";
311  case ISD::CALLSEQ_START: return "callseq_start";
312  case ISD::CALLSEQ_END: return "callseq_end";
313 
314  // EH instructions
315  case ISD::CATCHRET: return "catchret";
316  case ISD::CLEANUPRET: return "cleanupret";
317 
318  // Other operators
319  case ISD::LOAD: return "load";
320  case ISD::STORE: return "store";
321  case ISD::MLOAD: return "masked_load";
322  case ISD::MSTORE: return "masked_store";
323  case ISD::MGATHER: return "masked_gather";
324  case ISD::MSCATTER: return "masked_scatter";
325  case ISD::VAARG: return "vaarg";
326  case ISD::VACOPY: return "vacopy";
327  case ISD::VAEND: return "vaend";
328  case ISD::VASTART: return "vastart";
329  case ISD::DYNAMIC_STACKALLOC: return "dynamic_stackalloc";
330  case ISD::EXTRACT_ELEMENT: return "extract_element";
331  case ISD::BUILD_PAIR: return "build_pair";
332  case ISD::STACKSAVE: return "stacksave";
333  case ISD::STACKRESTORE: return "stackrestore";
334  case ISD::TRAP: return "trap";
335  case ISD::DEBUGTRAP: return "debugtrap";
336  case ISD::LIFETIME_START: return "lifetime.start";
337  case ISD::LIFETIME_END: return "lifetime.end";
338  case ISD::GC_TRANSITION_START: return "gc_transition.start";
339  case ISD::GC_TRANSITION_END: return "gc_transition.end";
340  case ISD::GET_DYNAMIC_AREA_OFFSET: return "get.dynamic.area.offset";
341 
342  // Bit manipulation
343  case ISD::ABS: return "abs";
344  case ISD::BITREVERSE: return "bitreverse";
345  case ISD::BSWAP: return "bswap";
346  case ISD::CTPOP: return "ctpop";
347  case ISD::CTTZ: return "cttz";
348  case ISD::CTTZ_ZERO_UNDEF: return "cttz_zero_undef";
349  case ISD::CTLZ: return "ctlz";
350  case ISD::CTLZ_ZERO_UNDEF: return "ctlz_zero_undef";
351 
352  // Trampolines
353  case ISD::INIT_TRAMPOLINE: return "init_trampoline";
354  case ISD::ADJUST_TRAMPOLINE: return "adjust_trampoline";
355 
356  case ISD::CONDCODE:
357  switch (cast<CondCodeSDNode>(this)->get()) {
358  default: llvm_unreachable("Unknown setcc condition!");
359  case ISD::SETOEQ: return "setoeq";
360  case ISD::SETOGT: return "setogt";
361  case ISD::SETOGE: return "setoge";
362  case ISD::SETOLT: return "setolt";
363  case ISD::SETOLE: return "setole";
364  case ISD::SETONE: return "setone";
365 
366  case ISD::SETO: return "seto";
367  case ISD::SETUO: return "setuo";
368  case ISD::SETUEQ: return "setueq";
369  case ISD::SETUGT: return "setugt";
370  case ISD::SETUGE: return "setuge";
371  case ISD::SETULT: return "setult";
372  case ISD::SETULE: return "setule";
373  case ISD::SETUNE: return "setune";
374 
375  case ISD::SETEQ: return "seteq";
376  case ISD::SETGT: return "setgt";
377  case ISD::SETGE: return "setge";
378  case ISD::SETLT: return "setlt";
379  case ISD::SETLE: return "setle";
380  case ISD::SETNE: return "setne";
381 
382  case ISD::SETTRUE: return "settrue";
383  case ISD::SETTRUE2: return "settrue2";
384  case ISD::SETFALSE: return "setfalse";
385  case ISD::SETFALSE2: return "setfalse2";
386  }
387  case ISD::VECREDUCE_FADD: return "vecreduce_fadd";
388  case ISD::VECREDUCE_STRICT_FADD: return "vecreduce_strict_fadd";
389  case ISD::VECREDUCE_FMUL: return "vecreduce_fmul";
390  case ISD::VECREDUCE_STRICT_FMUL: return "vecreduce_strict_fmul";
391  case ISD::VECREDUCE_ADD: return "vecreduce_add";
392  case ISD::VECREDUCE_MUL: return "vecreduce_mul";
393  case ISD::VECREDUCE_AND: return "vecreduce_and";
394  case ISD::VECREDUCE_OR: return "vecreduce_or";
395  case ISD::VECREDUCE_XOR: return "vecreduce_xor";
396  case ISD::VECREDUCE_SMAX: return "vecreduce_smax";
397  case ISD::VECREDUCE_SMIN: return "vecreduce_smin";
398  case ISD::VECREDUCE_UMAX: return "vecreduce_umax";
399  case ISD::VECREDUCE_UMIN: return "vecreduce_umin";
400  case ISD::VECREDUCE_FMAX: return "vecreduce_fmax";
401  case ISD::VECREDUCE_FMIN: return "vecreduce_fmin";
402  }
403 }
404 
406  switch (AM) {
407  default: return "";
408  case ISD::PRE_INC: return "<pre-inc>";
409  case ISD::PRE_DEC: return "<pre-dec>";
410  case ISD::POST_INC: return "<post-inc>";
411  case ISD::POST_DEC: return "<post-dec>";
412  }
413 }
414 
416  return Printable([&Node](raw_ostream &OS) {
417 #ifndef NDEBUG
418  OS << 't' << Node.PersistentId;
419 #else
420  OS << (const void*)&Node;
421 #endif
422  });
423 }
424 
425 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
426 LLVM_DUMP_METHOD void SDNode::dump() const { dump(nullptr); }
427 
429  print(dbgs(), G);
430  dbgs() << '\n';
431 }
432 #endif
433 
435  for (unsigned i = 0, e = getNumValues(); i != e; ++i) {
436  if (i) OS << ",";
437  if (getValueType(i) == MVT::Other)
438  OS << "ch";
439  else
440  OS << getValueType(i).getEVTString();
441  }
442 }
443 
445  if (getFlags().hasNoUnsignedWrap())
446  OS << " nuw";
447 
448  if (getFlags().hasNoSignedWrap())
449  OS << " nsw";
450 
451  if (getFlags().hasExact())
452  OS << " exact";
453 
454  if (getFlags().hasUnsafeAlgebra())
455  OS << " unsafe";
456 
457  if (getFlags().hasNoNaNs())
458  OS << " nnan";
459 
460  if (getFlags().hasNoInfs())
461  OS << " ninf";
462 
463  if (getFlags().hasNoSignedZeros())
464  OS << " nsz";
465 
466  if (getFlags().hasAllowReciprocal())
467  OS << " arcp";
468 
469  if (getFlags().hasAllowContract())
470  OS << " contract";
471 
472  if (getFlags().hasVectorReduction())
473  OS << " vector-reduction";
474 
475  if (const MachineSDNode *MN = dyn_cast<MachineSDNode>(this)) {
476  if (!MN->memoperands_empty()) {
477  OS << "<";
478  OS << "Mem:";
479  for (MachineSDNode::mmo_iterator i = MN->memoperands_begin(),
480  e = MN->memoperands_end(); i != e; ++i) {
481  OS << **i;
482  if (std::next(i) != e)
483  OS << " ";
484  }
485  OS << ">";
486  }
487  } else if (const ShuffleVectorSDNode *SVN =
488  dyn_cast<ShuffleVectorSDNode>(this)) {
489  OS << "<";
490  for (unsigned i = 0, e = ValueList[0].getVectorNumElements(); i != e; ++i) {
491  int Idx = SVN->getMaskElt(i);
492  if (i) OS << ",";
493  if (Idx < 0)
494  OS << "u";
495  else
496  OS << Idx;
497  }
498  OS << ">";
499  } else if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(this)) {
500  OS << '<' << CSDN->getAPIntValue() << '>';
501  } else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(this)) {
502  if (&CSDN->getValueAPF().getSemantics() == &APFloat::IEEEsingle())
503  OS << '<' << CSDN->getValueAPF().convertToFloat() << '>';
504  else if (&CSDN->getValueAPF().getSemantics() == &APFloat::IEEEdouble())
505  OS << '<' << CSDN->getValueAPF().convertToDouble() << '>';
506  else {
507  OS << "<APFloat(";
508  CSDN->getValueAPF().bitcastToAPInt().print(OS, false);
509  OS << ")>";
510  }
511  } else if (const GlobalAddressSDNode *GADN =
512  dyn_cast<GlobalAddressSDNode>(this)) {
513  int64_t offset = GADN->getOffset();
514  OS << '<';
515  GADN->getGlobal()->printAsOperand(OS);
516  OS << '>';
517  if (offset > 0)
518  OS << " + " << offset;
519  else
520  OS << " " << offset;
521  if (unsigned int TF = GADN->getTargetFlags())
522  OS << " [TF=" << TF << ']';
523  } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(this)) {
524  OS << "<" << FIDN->getIndex() << ">";
525  } else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(this)) {
526  OS << "<" << JTDN->getIndex() << ">";
527  if (unsigned int TF = JTDN->getTargetFlags())
528  OS << " [TF=" << TF << ']';
529  } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){
530  int offset = CP->getOffset();
531  if (CP->isMachineConstantPoolEntry())
532  OS << "<" << *CP->getMachineCPVal() << ">";
533  else
534  OS << "<" << *CP->getConstVal() << ">";
535  if (offset > 0)
536  OS << " + " << offset;
537  else
538  OS << " " << offset;
539  if (unsigned int TF = CP->getTargetFlags())
540  OS << " [TF=" << TF << ']';
541  } else if (const TargetIndexSDNode *TI = dyn_cast<TargetIndexSDNode>(this)) {
542  OS << "<" << TI->getIndex() << '+' << TI->getOffset() << ">";
543  if (unsigned TF = TI->getTargetFlags())
544  OS << " [TF=" << TF << ']';
545  } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(this)) {
546  OS << "<";
547  const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
548  if (LBB)
549  OS << LBB->getName() << " ";
550  OS << (const void*)BBDN->getBasicBlock() << ">";
551  } else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(this)) {
552  OS << ' ' << printReg(R->getReg(),
553  G ? G->getSubtarget().getRegisterInfo() : nullptr);
554  } else if (const ExternalSymbolSDNode *ES =
555  dyn_cast<ExternalSymbolSDNode>(this)) {
556  OS << "'" << ES->getSymbol() << "'";
557  if (unsigned int TF = ES->getTargetFlags())
558  OS << " [TF=" << TF << ']';
559  } else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(this)) {
560  if (M->getValue())
561  OS << "<" << M->getValue() << ">";
562  else
563  OS << "<null>";
564  } else if (const MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(this)) {
565  if (MD->getMD())
566  OS << "<" << MD->getMD() << ">";
567  else
568  OS << "<null>";
569  } else if (const VTSDNode *N = dyn_cast<VTSDNode>(this)) {
570  OS << ":" << N->getVT().getEVTString();
571  }
572  else if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(this)) {
573  OS << "<" << *LD->getMemOperand();
574 
575  bool doExt = true;
576  switch (LD->getExtensionType()) {
577  default: doExt = false; break;
578  case ISD::EXTLOAD: OS << ", anyext"; break;
579  case ISD::SEXTLOAD: OS << ", sext"; break;
580  case ISD::ZEXTLOAD: OS << ", zext"; break;
581  }
582  if (doExt)
583  OS << " from " << LD->getMemoryVT().getEVTString();
584 
585  const char *AM = getIndexedModeName(LD->getAddressingMode());
586  if (*AM)
587  OS << ", " << AM;
588 
589  OS << ">";
590  } else if (const StoreSDNode *ST = dyn_cast<StoreSDNode>(this)) {
591  OS << "<" << *ST->getMemOperand();
592 
593  if (ST->isTruncatingStore())
594  OS << ", trunc to " << ST->getMemoryVT().getEVTString();
595 
596  const char *AM = getIndexedModeName(ST->getAddressingMode());
597  if (*AM)
598  OS << ", " << AM;
599 
600  OS << ">";
601  } else if (const MemSDNode* M = dyn_cast<MemSDNode>(this)) {
602  OS << "<" << *M->getMemOperand() << ">";
603  } else if (const BlockAddressSDNode *BA =
604  dyn_cast<BlockAddressSDNode>(this)) {
605  int64_t offset = BA->getOffset();
606  OS << "<";
607  BA->getBlockAddress()->getFunction()->printAsOperand(OS, false);
608  OS << ", ";
609  BA->getBlockAddress()->getBasicBlock()->printAsOperand(OS, false);
610  OS << ">";
611  if (offset > 0)
612  OS << " + " << offset;
613  else
614  OS << " " << offset;
615  if (unsigned int TF = BA->getTargetFlags())
616  OS << " [TF=" << TF << ']';
617  } else if (const AddrSpaceCastSDNode *ASC =
618  dyn_cast<AddrSpaceCastSDNode>(this)) {
619  OS << '['
620  << ASC->getSrcAddressSpace()
621  << " -> "
622  << ASC->getDestAddressSpace()
623  << ']';
624  }
625 
626  if (VerboseDAGDumping) {
627  if (unsigned Order = getIROrder())
628  OS << " [ORD=" << Order << ']';
629 
630  if (getNodeId() != -1)
631  OS << " [ID=" << getNodeId() << ']';
632 
633  if (!G)
634  return;
635 
636  DILocation *L = getDebugLoc();
637  if (!L)
638  return;
639 
640  if (auto *Scope = L->getScope())
641  OS << Scope->getFilename();
642  else
643  OS << "<unknown>";
644  OS << ':' << L->getLine();
645  if (unsigned C = L->getColumn())
646  OS << ':' << C;
647  }
648 }
649 
650 /// Return true if this node is so simple that we should just print it inline
651 /// if it appears as an operand.
652 static bool shouldPrintInline(const SDNode &Node) {
653  if (Node.getOpcode() == ISD::EntryToken)
654  return false;
655  return Node.getNumOperands() == 0;
656 }
657 
658 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
659 static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {
660  for (const SDValue &Op : N->op_values()) {
661  if (shouldPrintInline(*Op.getNode()))
662  continue;
663  if (Op.getNode()->hasOneUse())
664  DumpNodes(Op.getNode(), indent+2, G);
665  }
666 
667  dbgs().indent(indent);
668  N->dump(G);
669 }
670 
671 LLVM_DUMP_METHOD void SelectionDAG::dump() const {
672  dbgs() << "SelectionDAG has " << AllNodes.size() << " nodes:\n";
673 
674  for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end();
675  I != E; ++I) {
676  const SDNode *N = &*I;
677  if (!N->hasOneUse() && N != getRoot().getNode() &&
678  (!shouldPrintInline(*N) || N->use_empty()))
679  DumpNodes(N, 2, this);
680  }
681 
682  if (getRoot().getNode()) DumpNodes(getRoot().getNode(), 2, this);
683  dbgs() << "\n\n";
684 }
685 #endif
686 
687 void SDNode::printr(raw_ostream &OS, const SelectionDAG *G) const {
688  OS << PrintNodeId(*this) << ": ";
689  print_types(OS, G);
690  OS << " = " << getOperationName(G);
691  print_details(OS, G);
692 }
693 
694 static bool printOperand(raw_ostream &OS, const SelectionDAG *G,
695  const SDValue Value) {
696  if (!Value.getNode()) {
697  OS << "<null>";
698  return false;
699  } else if (shouldPrintInline(*Value.getNode())) {
700  OS << Value->getOperationName(G) << ':';
701  Value->print_types(OS, G);
702  Value->print_details(OS, G);
703  return true;
704  } else {
705  OS << PrintNodeId(*Value.getNode());
706  if (unsigned RN = Value.getResNo())
707  OS << ':' << RN;
708  return false;
709  }
710 }
711 
712 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
713 using VisitedSDNodeSet = SmallPtrSet<const SDNode *, 32>;
714 
715 static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent,
716  const SelectionDAG *G, VisitedSDNodeSet &once) {
717  if (!once.insert(N).second) // If we've been here before, return now.
718  return;
719 
720  // Dump the current SDNode, but don't end the line yet.
721  OS.indent(indent);
722  N->printr(OS, G);
723 
724  // Having printed this SDNode, walk the children:
725  for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
726  if (i) OS << ",";
727  OS << " ";
728 
729  const SDValue Op = N->getOperand(i);
730  bool printedInline = printOperand(OS, G, Op);
731  if (printedInline)
732  once.insert(Op.getNode());
733  }
734 
735  OS << "\n";
736 
737  // Dump children that have grandchildren on their own line(s).
738  for (const SDValue &Op : N->op_values())
739  DumpNodesr(OS, Op.getNode(), indent+2, G, once);
740 }
741 
743  VisitedSDNodeSet once;
744  DumpNodesr(dbgs(), this, 0, nullptr, once);
745 }
746 
748  VisitedSDNodeSet once;
749  DumpNodesr(dbgs(), this, 0, G, once);
750 }
751 #endif
752 
753 static void printrWithDepthHelper(raw_ostream &OS, const SDNode *N,
754  const SelectionDAG *G, unsigned depth,
755  unsigned indent) {
756  if (depth == 0)
757  return;
758 
759  OS.indent(indent);
760 
761  N->print(OS, G);
762 
763  if (depth < 1)
764  return;
765 
766  for (const SDValue &Op : N->op_values()) {
767  // Don't follow chain operands.
768  if (Op.getValueType() == MVT::Other)
769  continue;
770  OS << '\n';
771  printrWithDepthHelper(OS, Op.getNode(), G, depth-1, indent+2);
772  }
773 }
774 
776  unsigned depth) const {
777  printrWithDepthHelper(OS, this, G, depth, 0);
778 }
779 
780 void SDNode::printrFull(raw_ostream &OS, const SelectionDAG *G) const {
781  // Don't print impossibly deep things.
782  printrWithDepth(OS, G, 10);
783 }
784 
785 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
787 void SDNode::dumprWithDepth(const SelectionDAG *G, unsigned depth) const {
788  printrWithDepth(dbgs(), G, depth);
789 }
790 
792  // Don't print impossibly deep things.
793  dumprWithDepth(G, 10);
794 }
795 #endif
796 
797 void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const {
798  printr(OS, G);
799  for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
800  if (i) OS << ", "; else OS << " ";
801  printOperand(OS, G, getOperand(i));
802  }
803 }
ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
Definition: ISDOpcodes.h:732
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
Definition: ISDOpcodes.h:546
X = FP_ROUND(Y, TRUNC) - Rounding &#39;Y&#39; from a larger floating point type down to the precision of the ...
Definition: ISDOpcodes.h:513
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:836
FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two values.
Definition: ISDOpcodes.h:570
Constrained versions of libm-equivalent floating point intrinsics.
Definition: ISDOpcodes.h:273
std::string getOperationName(const SelectionDAG *G=nullptr) const
Return the opcode of this operation for printing.
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.
Definition: ISDOpcodes.h:184
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
DELETED_NODE - This is an illegal value that is used to catch errors.
Definition: ISDOpcodes.h:42
MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to reference metadata in the IR...
Definition: ISDOpcodes.h:704
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an vector value) starting with the ...
Definition: ISDOpcodes.h:334
BR_CC - Conditional branch.
Definition: ISDOpcodes.h:618
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void dumprWithDepth(const SelectionDAG *G=nullptr, unsigned depth=100) const
printrWithDepth to dbgs().
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
Definition: Compiler.h:449
Various leaf nodes.
Definition: ISDOpcodes.h:60
VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as VEC1/VEC2.
Definition: ISDOpcodes.h:343
ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register zero-extension of the low ...
Definition: ISDOpcodes.h:495
Carry-setting nodes for multiple precision addition and subtraction.
Definition: ISDOpcodes.h:223
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain...
Definition: ISDOpcodes.h:667
void print_details(raw_ostream &OS, const SelectionDAG *G) const
raw_ostream & indent(unsigned NumSpaces)
indent - Insert &#39;NumSpaces&#39; spaces.
RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
Definition: ISDOpcodes.h:251
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
Definition: ISDOpcodes.h:131
Val, Success, OUTCHAIN = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) N.b.
Definition: ISDOpcodes.h:770
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
Constrained versions of the binary floating point operators.
Definition: ISDOpcodes.h:266
SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register sign-extension of the low ...
Definition: ISDOpcodes.h:486
[US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned integers.
Definition: ISDOpcodes.h:360
const SDNodeFlags getFlags() const
SDNode * getNode() const
get the SDNode which holds the desired result
Same for subtraction.
Definition: ISDOpcodes.h:254
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1 at the ...
Definition: ISDOpcodes.h:329
uint16_t PersistentId
Unique and persistent id per SDNode in the DAG.
The address of the GOT.
Definition: ISDOpcodes.h:66
EntryToken - This is the marker used to indicate the start of a region.
Definition: ISDOpcodes.h:45
OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) This corresponds to the fence instruction.
Definition: ISDOpcodes.h:749
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
Definition: ISDOpcodes.h:405
INT = FGETSIGN(FP) - Return the sign bit of the specified floating point value as an integer 0/1 valu...
Definition: ISDOpcodes.h:292
This SDNode is used to implement the code generator support for the llvm IR shufflevector instruction...
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...
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
Definition: ISDOpcodes.h:159
OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.longjmp intrinsic...
Definition: ISDOpcodes.h:114
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
Definition: ISDOpcodes.h:210
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations...
Definition: ISDOpcodes.h:434
CLEANUPRET - Represents a return from a cleanup block funclet.
Definition: ISDOpcodes.h:658
static Printable PrintNodeId(const SDNode &Node)
A description of a memory reference used in the backend.
PCMARKER - This corresponds to the pcmarker intrinsic.
Definition: ISDOpcodes.h:707
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Definition: Function.cpp:591
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
const HexagonInstrInfo * TII
Shift and rotation operations.
Definition: ISDOpcodes.h:380
ABS - Determine the unsigned absolute value of a signed integer value of the same bitwidth...
Definition: ISDOpcodes.h:369
BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
Definition: ISDOpcodes.h:191
CopyToReg - This node has three operands: a chain, a register number to set to this value...
Definition: ISDOpcodes.h:170
FLT_ROUNDS_ - Returns current rounding mode: -1 Undefined 0 Round to 0 1 Round to nearest 2 Round to ...
Definition: ISDOpcodes.h:521
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.
Definition: ISDOpcodes.h:681
EH_DWARF_CFA - This node represents the pointer to the DWARF Canonical Frame Address (CFA)...
Definition: ISDOpcodes.h:96
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.
Definition: ISDOpcodes.h:778
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG...
Definition: ISDOpcodes.h:73
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This file implements a class to represent arbitrary precision integral constant values and operations...
static void printrWithDepthHelper(raw_ostream &OS, const SDNode *N, const SelectionDAG *G, unsigned depth, unsigned indent)
INLINEASM - Represents an inline asm block.
Definition: ISDOpcodes.h:635
STACKSAVE - STACKSAVE has one operand, an input chain.
Definition: ISDOpcodes.h:663
FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to first (possible) on-stack ar...
Definition: ISDOpcodes.h:91
void dumprFull(const SelectionDAG *G=nullptr) const
printrFull to dbgs().
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
Definition: ISDOpcodes.h:456
OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN) The target initializes the dispatch table here...
Definition: ISDOpcodes.h:118
const TargetMachine & getTarget() const
Definition: SelectionDAG.h:391
Select with a vector condition (op #0) and two vector operands (ops #1 and #2), returning a vector re...
Definition: ISDOpcodes.h:399
Simple integer binary arithmetic operators.
Definition: ISDOpcodes.h:201
static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent, const SelectionDAG *G, VisitedSDNodeSet &once)
virtual const TargetInstrInfo * getInstrInfo() const
static const fltSemantics & IEEEdouble() LLVM_READNONE
Definition: APFloat.cpp:122
TargetConstant* - Like Constant*, but the DAG does not do any folding, simplification, or lowering of the constant.
Definition: ISDOpcodes.h:125
static const char * getIndexedModeName(ISD::MemIndexedMode AM)
READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
Definition: ISDOpcodes.h:715
ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an in-register any-extension of the low la...
Definition: ISDOpcodes.h:473
Generic reduction nodes.
Definition: ISDOpcodes.h:825
RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) This node represents a target intrinsic fun...
Definition: ISDOpcodes.h:151
void printrFull(raw_ostream &O, const SelectionDAG *G=nullptr) const
Print a SelectionDAG node and all children down to the leaves.
UNDEF - An undefined node.
Definition: ISDOpcodes.h:178
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
Definition: ISDOpcodes.h:499
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the specified, possibly variable...
Definition: ISDOpcodes.h:303
TargetInstrInfo - Interface to description of machine instruction set.
This corresponds to the llvm.lifetime.
Definition: ISDOpcodes.h:803
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) This node represents a target intrin...
Definition: ISDOpcodes.h:166
These reductions are non-strict, and have a single vector operand.
Definition: ISDOpcodes.h:827
Control flow instructions. These all have token chains.
Definition: ISDOpcodes.h:597
READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on the DAG, which implements the n...
Definition: ISDOpcodes.h:85
GC_TRANSITION_START/GC_TRANSITION_END - These operators mark the beginning and end of GC transition s...
Definition: ISDOpcodes.h:811
LOCAL_RECOVER - Represents the llvm.localrecover intrinsic.
Definition: ISDOpcodes.h:81
static cl::opt< bool > VerboseDAGDumping("dag-dump-verbose", cl::Hidden, cl::desc("Display more information when dumping selection " "DAG nodes."))
Simple binary floating point operators.
Definition: ISDOpcodes.h:260
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE...
Definition: ISDOpcodes.h:696
iterator_range< value_op_iterator > op_values() const
const SDValue & getOperand(unsigned Num) const
INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element at IDX replaced with VAL...
Definition: ISDOpcodes.h:308
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Carry-using nodes for multiple precision addition and subtraction.
Definition: ISDOpcodes.h:232
void printr(raw_ostream &OS, const SelectionDAG *G=nullptr) const
static sys::TimePoint< std::chrono::seconds > now(bool Deterministic)
This file declares a class to represent arbitrary precision floating point values and provide a varie...
INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.
Definition: ISDOpcodes.h:726
TRAP - Trapping instruction.
Definition: ISDOpcodes.h:735
TargetIndex - Like a constant pool entry, but with completely target-dependent semantics.
Definition: ISDOpcodes.h:144
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
Definition: ValueTypes.cpp:119
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
Definition: ISDOpcodes.h:57
DEBUGTRAP - Trap intended to get the attention of a debugger.
Definition: ISDOpcodes.h:738
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
Definition: ISDOpcodes.h:687
Bit counting operators with an undefined result for zero inputs.
Definition: ISDOpcodes.h:386
Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) For double-word atomic operations: ValLo...
Definition: ISDOpcodes.h:764
X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
Definition: ISDOpcodes.h:531
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...
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.
HANDLENODE node - Used as a handle for various purposes.
Definition: ISDOpcodes.h:718
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
Definition: ISDOpcodes.h:640
TargetIntrinsicInfo - Interface to description of machine instruction set.
TokenFactor - This node takes multiple tokens as input and produces a single token result...
Definition: ISDOpcodes.h:50
void dump() const
Dump this node, for debugging.
static const fltSemantics & IEEEsingle() LLVM_READNONE
Definition: APFloat.cpp:119
const TargetLowering & getTargetLoweringInfo() const
Definition: SelectionDAG.h:393
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Definition: SmallPtrSet.h:418
Returns platform specific canonical encoding of a floating point number.
Definition: ISDOpcodes.h:295
EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR identified by the (potentially...
Definition: ISDOpcodes.h:315
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but op #2 is a boolean indicating ...
Definition: ISDOpcodes.h:429
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:210
X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and rounds it to a floating point val...
Definition: ISDOpcodes.h:528
ADDRSPACECAST - This operator converts between pointers of different address spaces.
Definition: ISDOpcodes.h:550
BRCOND - Conditional branch.
Definition: ISDOpcodes.h:612
const DataFlowGraph & G
Definition: RDFGraph.cpp:211
An SDNode that represents everything that will be needed to construct a MachineInstr.
Byte Swap and Counting operators.
Definition: ISDOpcodes.h:383
FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions and truncation for half-preci...
Definition: ISDOpcodes.h:556
Represents one node in the SelectionDAG.
std::string utostr(uint64_t X, bool isNeg=false)
Definition: StringExtras.h:193
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
Select(COND, TRUEVAL, FALSEVAL).
Definition: ISDOpcodes.h:390
ZERO_EXTEND - Used for integer types, zeroing the new bits.
Definition: ISDOpcodes.h:446
ANY_EXTEND - Used for integer types. The high bits are undefined.
Definition: ISDOpcodes.h:449
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
Definition: ISDOpcodes.h:288
FMINNAN/FMAXNAN - Behave identically to FMINNUM/FMAXNUM, except that when a single input is NaN...
Definition: ISDOpcodes.h:573
CATCHRET - Represents a return from a catch block funclet.
Definition: ISDOpcodes.h:654
GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of the most recent dynamic alloca...
Definition: ISDOpcodes.h:818
BR_JT - Jumptable branch.
Definition: ISDOpcodes.h:606
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.
Definition: ISDOpcodes.h:692
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
Bitwise operators - logical and, logical or, logical xor.
Definition: ISDOpcodes.h:363
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
Definition: ISDOpcodes.h:206
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
Definition: ISDOpcodes.h:464
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
Definition: ISDOpcodes.h:582
virtual const TargetIntrinsicInfo * getIntrinsicInfo() const
If intrinsic information is available, return it. If not, return null.
#define N
const TargetSubtargetInfo & getSubtarget() const
Definition: SelectionDAG.h:392
Same for multiplication.
Definition: ISDOpcodes.h:257
FSINCOS - Compute both fsin and fcos as a single operation.
Definition: ISDOpcodes.h:576
void print_types(raw_ostream &OS, const SelectionDAG *G) const
RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) This corresponds to the eh.sjlj.setjmp intrinsic.
Definition: ISDOpcodes.h:108
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
Definition: ISDOpcodes.h:175
OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents &#39;eh_return&#39; gcc dwarf builtin...
Definition: ISDOpcodes.h:102
Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, and op #2 is a carry value...
Definition: ISDOpcodes.h:422
CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of vector type with the same length ...
Definition: ISDOpcodes.h:321
void dumpr() const
Dump (recursively) this node and its use-def subgraph.
void print(raw_ostream &OS, const SelectionDAG *G=nullptr) const
FMA - Perform a * b + c with no intermediate rounding step.
Definition: ISDOpcodes.h:278
FMIN/FMAX nodes can have flags, for NaN/NoNaN variants.
Definition: ISDOpcodes.h:832
unsigned getMachineOpcode() const
This may only be called if isMachineOpcode returns true.
PREFETCH - This corresponds to a prefetch intrinsic.
Definition: ISDOpcodes.h:744
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
FMAD - Perform a * b + c, while getting the same result as the separately rounded operations...
Definition: ISDOpcodes.h:282
SetCC operator - This evaluates to a true value iff the condition is true.
Definition: ISDOpcodes.h:413
MERGE_VALUES - This node takes multiple discrete operands and returns them all as its individual resu...
Definition: ISDOpcodes.h:198
Conversion operators.
Definition: ISDOpcodes.h:443
Simple wrapper around std::function<void(raw_ostream&)>.
Definition: Printable.h:38
OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) This corresponds to "store atomic" instruction.
Definition: ISDOpcodes.h:757
TRUNCATE - Completely drop the high bits.
Definition: ISDOpcodes.h:452
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.
Definition: ISDOpcodes.h:562
Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) This corresponds to "load atomic" instruction.
Definition: ISDOpcodes.h:753
SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a scalar value into element 0 of the...
Definition: ISDOpcodes.h:351
Carry-using nodes for multiple precision addition and subtraction.
Definition: ISDOpcodes.h:242
CARRY_FALSE - This node is used when folding other nodes, like ADDC/SUBC, which indicate the carry re...
Definition: ISDOpcodes.h:214
This file describes how to lower LLVM code to machine code.
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
Definition: ISDOpcodes.h:873
BRIND - Indirect branch.
Definition: ISDOpcodes.h:602
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
Definition: ISDOpcodes.h:356
SRCVALUE - This is a node type that holds a Value* that is used to make reference to a value in the L...
Definition: ISDOpcodes.h:700
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary...
Definition: ISDOpcodes.h:591