diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:12 +0000 |
commit | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch) | |
tree | 599ab169a01f1c86eda9adc774edaedde2f2db5b /lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp | |
parent | 1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff) |
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp | 152 |
1 files changed, 114 insertions, 38 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp index 43df2abb674b..da3049881d31 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @@ -1,9 +1,8 @@ //===- SelectionDAGDumper.cpp - Implement SelectionDAG::dump() ------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -96,6 +95,7 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::ATOMIC_LOAD_MAX: return "AtomicLoadMax"; case ISD::ATOMIC_LOAD_UMIN: return "AtomicLoadUMin"; case ISD::ATOMIC_LOAD_UMAX: return "AtomicLoadUMax"; + case ISD::ATOMIC_LOAD_FADD: return "AtomicLoadFAdd"; case ISD::ATOMIC_LOAD: return "AtomicLoad"; case ISD::ATOMIC_STORE: return "AtomicStore"; case ISD::PCMARKER: return "PCMarker"; @@ -145,6 +145,8 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { unsigned IID = cast<ConstantSDNode>(getOperand(OpNo))->getZExtValue(); if (IID < Intrinsic::num_intrinsics) return Intrinsic::getName((Intrinsic::ID)IID, None); + else if (!G) + return "Unknown intrinsic"; else if (const TargetIntrinsicInfo *TII = G->getTarget().getIntrinsicInfo()) return TII->getName(IID); llvm_unreachable("Invalid intrinsic ID"); @@ -170,7 +172,9 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::UNDEF: return "undef"; case ISD::MERGE_VALUES: return "merge_values"; case ISD::INLINEASM: return "inlineasm"; + case ISD::INLINEASM_BR: return "inlineasm_br"; case ISD::EH_LABEL: return "eh_label"; + case ISD::ANNOTATION_LABEL: return "annotation_label"; case ISD::HANDLENODE: return "handlenode"; // Unary operators @@ -297,7 +301,10 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::UADDSAT: return "uaddsat"; case ISD::SSUBSAT: return "ssubsat"; case ISD::USUBSAT: return "usubsat"; + case ISD::SMULFIX: return "smulfix"; + case ISD::SMULFIXSAT: return "smulfixsat"; + case ISD::UMULFIX: return "umulfix"; // Conversion operators. case ISD::SIGN_EXTEND: return "sign_extend"; @@ -309,9 +316,11 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::ZERO_EXTEND_VECTOR_INREG: return "zero_extend_vector_inreg"; case ISD::TRUNCATE: return "truncate"; case ISD::FP_ROUND: return "fp_round"; + case ISD::STRICT_FP_ROUND: return "strict_fp_round"; case ISD::FLT_ROUNDS_: return "flt_rounds"; case ISD::FP_ROUND_INREG: return "fp_round_inreg"; case ISD::FP_EXTEND: return "fp_extend"; + case ISD::STRICT_FP_EXTEND: return "strict_fp_extend"; case ISD::SINT_TO_FP: return "sint_to_fp"; case ISD::UINT_TO_FP: return "uint_to_fp"; @@ -321,6 +330,10 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const { case ISD::ADDRSPACECAST: return "addrspacecast"; case ISD::FP16_TO_FP: return "fp16_to_fp"; case ISD::FP_TO_FP16: return "fp_to_fp16"; + case ISD::LROUND: return "lround"; + case ISD::LLROUND: return "llround"; + case ISD::LRINT: return "lrint"; + case ISD::LLRINT: return "llrint"; // Control flow instructions case ISD::BR: return "br"; @@ -650,6 +663,36 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const { OS << ", " << AM; OS << ">"; + } else if (const MaskedLoadSDNode *MLd = dyn_cast<MaskedLoadSDNode>(this)) { + OS << "<"; + + printMemOperand(OS, *MLd->getMemOperand(), G); + + bool doExt = true; + switch (MLd->getExtensionType()) { + default: doExt = false; break; + case ISD::EXTLOAD: OS << ", anyext"; break; + case ISD::SEXTLOAD: OS << ", sext"; break; + case ISD::ZEXTLOAD: OS << ", zext"; break; + } + if (doExt) + OS << " from " << MLd->getMemoryVT().getEVTString(); + + if (MLd->isExpandingLoad()) + OS << ", expanding"; + + OS << ">"; + } else if (const MaskedStoreSDNode *MSt = dyn_cast<MaskedStoreSDNode>(this)) { + OS << "<"; + printMemOperand(OS, *MSt->getMemOperand(), G); + + if (MSt->isTruncatingStore()) + OS << ", trunc to " << MSt->getMemoryVT().getEVTString(); + + if (MSt->isCompressingStore()) + OS << ", compressing"; + + OS << ">"; } else if (const MemSDNode* M = dyn_cast<MemSDNode>(this)) { OS << "<"; printMemOperand(OS, *M->getMemOperand(), G); @@ -675,6 +718,9 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const { << " -> " << ASC->getDestAddressSpace() << ']'; + } else if (const LifetimeSDNode *LN = dyn_cast<LifetimeSDNode>(this)) { + if (LN->hasOffset()) + OS << "<" << LN->getOffset() << " to " << LN->getOffset() + LN->getSize() << ">"; } if (VerboseDAGDumping) { @@ -684,45 +730,63 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const { if (getNodeId() != -1) OS << " [ID=" << getNodeId() << ']'; if (!(isa<ConstantSDNode>(this) || (isa<ConstantFPSDNode>(this)))) - OS << "# D:" << isDivergent(); - - if (!G) - return; - - DILocation *L = getDebugLoc(); - if (!L) - return; - - if (auto *Scope = L->getScope()) - OS << Scope->getFilename(); - else - OS << "<unknown>"; - OS << ':' << L->getLine(); - if (unsigned C = L->getColumn()) - OS << ':' << C; - - for (SDDbgValue *Dbg : G->GetDbgValues(this)) { - if (Dbg->getKind() != SDDbgValue::SDNODE || Dbg->isInvalidated()) - continue; - Dbg->dump(OS); - } + OS << " # D:" << isDivergent(); + + if (G && !G->GetDbgValues(this).empty()) { + OS << " [NoOfDbgValues=" << G->GetDbgValues(this).size() << ']'; + for (SDDbgValue *Dbg : G->GetDbgValues(this)) + if (!Dbg->isInvalidated()) + Dbg->print(OS); + } else if (getHasDebugValue()) + OS << " [NoOfDbgValues>0]"; } } -LLVM_DUMP_METHOD void SDDbgValue::dump(raw_ostream &OS) const { - OS << " DbgVal"; - if (kind==SDNODE) - OS << '(' << u.s.ResNo << ')'; - OS << ":\"" << Var->getName() << '"'; +LLVM_DUMP_METHOD void SDDbgValue::print(raw_ostream &OS) const { + OS << " DbgVal(Order=" << getOrder() << ')'; + if (isInvalidated()) OS << "(Invalidated)"; + if (isEmitted()) OS << "(Emitted)"; + switch (getKind()) { + case SDNODE: + if (getSDNode()) + OS << "(SDNODE=" << PrintNodeId(*getSDNode()) << ':' << getResNo() << ')'; + else + OS << "(SDNODE)"; + break; + case CONST: + OS << "(CONST)"; + break; + case FRAMEIX: + OS << "(FRAMEIX=" << getFrameIx() << ')'; + break; + case VREG: + OS << "(VREG=" << getVReg() << ')'; + break; + } + if (isIndirect()) OS << "(Indirect)"; + OS << ":\"" << Var->getName() << '"'; #ifndef NDEBUG - if (Expr->getNumElements()) - Expr->dump(); + if (Expr->getNumElements()) + Expr->dump(); #endif } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) +LLVM_DUMP_METHOD void SDDbgValue::dump() const { + if (isInvalidated()) + return; + print(dbgs()); + dbgs() << "\n"; +} +#endif + /// Return true if this node is so simple that we should just print it inline /// if it appears as an operand. -static bool shouldPrintInline(const SDNode &Node) { +static bool shouldPrintInline(const SDNode &Node, const SelectionDAG *G) { + // Avoid lots of cluttering when inline printing nodes with associated + // DbgValues in verbose mode. + if (VerboseDAGDumping && G && !G->GetDbgValues(&Node).empty()) + return false; if (Node.getOpcode() == ISD::EntryToken) return false; return Node.getNumOperands() == 0; @@ -731,7 +795,7 @@ static bool shouldPrintInline(const SDNode &Node) { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) { for (const SDValue &Op : N->op_values()) { - if (shouldPrintInline(*Op.getNode())) + if (shouldPrintInline(*Op.getNode(), G)) continue; if (Op.getNode()->hasOneUse()) DumpNodes(Op.getNode(), indent+2, G); @@ -748,12 +812,24 @@ LLVM_DUMP_METHOD void SelectionDAG::dump() const { I != E; ++I) { const SDNode *N = &*I; if (!N->hasOneUse() && N != getRoot().getNode() && - (!shouldPrintInline(*N) || N->use_empty())) + (!shouldPrintInline(*N, this) || N->use_empty())) DumpNodes(N, 2, this); } if (getRoot().getNode()) DumpNodes(getRoot().getNode(), 2, this); - dbgs() << "\n\n"; + dbgs() << "\n"; + + if (VerboseDAGDumping) { + if (DbgBegin() != DbgEnd()) + dbgs() << "SDDbgValues:\n"; + for (auto *Dbg : make_range(DbgBegin(), DbgEnd())) + Dbg->dump(); + if (ByvalParmDbgBegin() != ByvalParmDbgEnd()) + dbgs() << "Byval SDDbgValues:\n"; + for (auto *Dbg : make_range(ByvalParmDbgBegin(), ByvalParmDbgEnd())) + Dbg->dump(); + } + dbgs() << "\n"; } #endif @@ -769,7 +845,7 @@ static bool printOperand(raw_ostream &OS, const SelectionDAG *G, if (!Value.getNode()) { OS << "<null>"; return false; - } else if (shouldPrintInline(*Value.getNode())) { + } else if (shouldPrintInline(*Value.getNode(), G)) { OS << Value->getOperationName(G) << ':'; Value->print_types(OS, G); Value->print_details(OS, G); |