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