Lines Matching +full:block +full:- +full:diagram

1 //===-- HTMLLogger.cpp ----------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
14 // so each output file is self-contained.
40 // bb: B2 (basic block 0 is selected)
42 // iter: B2:1 (iteration 1 of the basic block is selected)
43 // hover: B3 (hovering over basic block 3)
47 // (id or data-foo) that define what they should select.
51 // - sections <section data-selection="bb"> get shown
52 // - templates under such sections get re-rendered
53 // - elements with class/id "B2" get class "bb-select"
55 //===----------------------------------------------------------------------===//
115 JOS.attribute("formula", llvm::to_string(B->formula())); in dump()
116 JOS.attribute("truth", Env.proves(B->formula()) ? "true" in dump()
117 : Env.proves(Env.arena().makeNot(B->formula())) in dump()
128 if (!L.getType()->isRecordType()) in dump()
133 for (const auto &Child : RLoc->children()) in dump()
134 JOS.attributeObject("f:" + Child.first->getNameAsString(), [&] { in dump()
140 for (const auto &SyntheticField : RLoc->synthetic_fields()) in dump()
153 const CFGBlock *Block; member
166 // Timeline of iterations of CFG block visitation.
168 // Indexes in `Iters` of the iterations for each block.
170 // For a given block ID, did the block converge (on the last iteration)?
174 // The number of elements we have visited within the current CFG block.
182 this->ACFG = &ACFG; in beginAnalysis()
191 *OS << ND->getNameAsString() << " at "; in beginAnalysis()
213 JOS.attribute("block", blockID(E.Block->getBlockID())); in endAnalysis()
248 static std::string blockID(unsigned Block) { in blockID() argument
249 return llvm::formatv("B{0}", Block); in blockID()
251 static std::string eltID(unsigned Block, unsigned Element) { in eltID() argument
252 return llvm::formatv("B{0}.{1}", Block, Element); in eltID()
254 static std::string iterID(unsigned Block, unsigned Iter) { in iterID() argument
255 return llvm::formatv("B{0}:{1}", Block, Iter); in iterID()
257 static std::string elementIterID(unsigned Block, unsigned Iter, in elementIterID() argument
259 return llvm::formatv("B{0}:{1}_B{0}.{2}", Block, Iter, Element); in elementIterID()
264 // - values associated with the current Stmt
265 // - values associated with its children
266 // - meaningful names for values
267 // - which boolean values are implied true/false by the flow condition
269 unsigned Block = Iters.back().Block->getBlockID(); in recordState() local
272 JOS.attributeObject(elementIterID(Block, Iter, ElementIndex), [&] { in recordState()
273 JOS.attribute("block", blockID(Block)); in recordState()
278 // If this state immediately follows an Expr, show its built-in model. in recordState()
281 Iters.back().Block->Elements[ElementIndex - 1].getAs<CFGStmt>(); in recordState()
282 if (const Expr *E = S ? llvm::dyn_cast<Expr>(S->getStmt()) : nullptr) { in recordState()
283 if (E->isPRValue()) { in recordState()
284 if (!E->getType()->isRecordType()) in recordState()
309 BlockConverged[Iters.back().Block->getBlockID()] = true; in blockConverged()
318 // Write the CFG block details.
349 const auto &AST = ACFG->getDecl().getASTContext(); in writeCode()
353 // Pretty-printing from the AST would probably be nicer (no macros or in writeCode()
357 CharSourceRange::getTokenRange(ACFG->getDecl().getSourceRange()), in writeCode()
368 enum : unsigned { Missing = static_cast<unsigned>(-1) }; in writeCode()
370 // The basic block this is part of. in writeCode()
388 if (this->BB != Missing && BB != this->BB && BBPriority <= RangeLen) in writeCode()
390 if (BB != this->BB) { in writeCode()
391 this->BB = BB; in writeCode()
397 if (this->Elt == Missing || EltPriority > RangeLen) in writeCode()
398 this->Elt = Elt; in writeCode()
414 OS << " data-elt='" << eltID(BB, Elt) << "'"; in writeCode()
416 OS << " data-bb='" << blockID(BB) << "'"; in writeCode()
423 for (const auto *Block : ACFG->getCFG()) { in writeCode() local
425 for (const auto& Elt : *Block) { in writeCode()
429 CharSourceRange::getTokenRange(S->getStmt()->getSourceRange()), in writeCode()
438 unsigned Off = EltRange.getBegin().getRawEncoding() - in writeCode()
440 unsigned Len = EltRange.getEnd().getRawEncoding() - in writeCode()
443 State[Off + I].assign(Block->getBlockID(), EltIndex, Len); in writeCode()
451 *OS << "<template data-copy='code'>\n"; in writeCode()
458 *OS << "<code class='line' data-line='" << Line++ << "'>"; in writeCode()
462 bool NeedOpen = I == 0 || !(State[I] == State[I-1]); in writeCode()
470 *OS << "</code>\n<code class='line' data-line='" << Line++ << "'>"; in writeCode()
479 // Write the CFG diagram, a graph of basic blocks.
483 *OS << "<template data-copy='cfg'>\n"; in writeCFG()
484 if (auto SVG = renderSVG(buildCFGDot(ACFG->getCFG()))) in writeCFG()
498 node[class=bb, shape=square, fontname="sans-serif", tooltip=" "] in buildCFGDot()
510 for (const auto *Block : CFG) { in buildCFGDot() local
511 for (const auto &Succ : Block->succs()) { in buildCFGDot()
513 GraphS << " " << blockID(Block->getBlockID()) << " -> " in buildCFGDot()
514 << blockID(Succ.getReachableBlock()->getBlockID()) << "\n"; in buildCFGDot()
522 // Nothing interesting here, just subprocess/temp-file plumbing.
555 DotPath, {"dot", "-Tsvg"}, /*Env=*/std::nullopt, Redirects, in renderSVG()
569 llvm::StringRef Result = Buf.get()->getBuffer(); in renderSVG()