106c3fb27SDimitry Andric<!doctype html>
206c3fb27SDimitry Andric<html>
306c3fb27SDimitry Andric<!-- HTMLLogger.cpp ----------------------------------------------------
406c3fb27SDimitry Andric
506c3fb27SDimitry Andric Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
606c3fb27SDimitry Andric See https://llvm.org/LICENSE.txt for license information.
706c3fb27SDimitry Andric SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
806c3fb27SDimitry Andric
906c3fb27SDimitry Andric//===------------------------------------------------------------------------>
1006c3fb27SDimitry Andric
1106c3fb27SDimitry Andric<head>
1206c3fb27SDimitry Andric<?INJECT?>
1306c3fb27SDimitry Andric
1406c3fb27SDimitry Andric<template id="value-template">
1506c3fb27SDimitry Andric  <details class="value" open>
1606c3fb27SDimitry Andric    <summary>
1706c3fb27SDimitry Andric      <span>{{v.kind}}
1806c3fb27SDimitry Andric        <template data-if="v.value_id"><span class="address">#{{v.value_id}}</span></template>
1906c3fb27SDimitry Andric      </span>
2006c3fb27SDimitry Andric      <template data-if="v.location">
21*5f757f3fSDimitry Andric        <span class="location">{{v.type}} <span class="address">@{{v.location}}</span></span>
2206c3fb27SDimitry Andric      </template>
2306c3fb27SDimitry Andric    </summary>
2406c3fb27SDimitry Andric    <template
2506c3fb27SDimitry Andric        data-for="kv in Object.entries(v)"
2606c3fb27SDimitry Andric        data-if="['kind', 'value_id', 'type', 'location'].indexOf(kv[0]) < 0">
2706c3fb27SDimitry Andric      <div class="property"><span class="key">{{kv[0]}}</span>
2806c3fb27SDimitry Andric        <template data-if="typeof(kv[1]) != 'object'">{{kv[1]}}</template>
2906c3fb27SDimitry Andric        <template data-if="typeof(kv[1]) == 'object'" data-let="v = kv[1]">
3006c3fb27SDimitry Andric          <template data-use="value-template"></template>
3106c3fb27SDimitry Andric        </template>
3206c3fb27SDimitry Andric      </div>
3306c3fb27SDimitry Andric    </template>
3406c3fb27SDimitry Andric  </details>
3506c3fb27SDimitry Andric</template>
3606c3fb27SDimitry Andric
3706c3fb27SDimitry Andric</head>
3806c3fb27SDimitry Andric
3906c3fb27SDimitry Andric<body>
4006c3fb27SDimitry Andric
4106c3fb27SDimitry Andric<section id="timeline" data-selection="">
4206c3fb27SDimitry Andric<header>Timeline</header>
4306c3fb27SDimitry Andric<template data-for="entry in timeline">
44*5f757f3fSDimitry Andric  <div id="{{entry.block}}:{{entry.iter}}" data-bb="{{entry.block}}" class="entry">
45*5f757f3fSDimitry Andric    {{entry.block}}
46*5f757f3fSDimitry Andric    <template data-if="entry.post_visit">(post-visit)</template>
47*5f757f3fSDimitry Andric    <template data-if="!entry.post_visit">({{entry.iter}})</template>
48*5f757f3fSDimitry Andric    <template data-if="entry.converged"> &#x2192;&#x7c;<!--Rightwards arrow, vertical line--></template>
49*5f757f3fSDimitry Andric  </div>
5006c3fb27SDimitry Andric</template>
5106c3fb27SDimitry Andric</section>
5206c3fb27SDimitry Andric
5306c3fb27SDimitry Andric<section id="function" data-selection="">
5406c3fb27SDimitry Andric<header>Function</header>
5506c3fb27SDimitry Andric<div id="code"></div>
5606c3fb27SDimitry Andric<div id="cfg"></div>
5706c3fb27SDimitry Andric</section>
5806c3fb27SDimitry Andric
5906c3fb27SDimitry Andric<section id="block" data-selection="bb">
6006c3fb27SDimitry Andric<header><template>Block {{selection.bb}}</template></header>
6106c3fb27SDimitry Andric<div id="iterations">
62*5f757f3fSDimitry Andric  <template data-for="iter in cfg[selection.bb].iters">
63*5f757f3fSDimitry Andric    <a class="chooser {{selection.bb}}:{{iter.iter}}" data-iter="{{selection.bb}}:{{iter.iter}}">
64*5f757f3fSDimitry Andric      <template data-if="iter.post_visit">Post-visit</template>
65*5f757f3fSDimitry Andric      <template data-if="!iter.post_visit">{{iter.iter}}</template>
66*5f757f3fSDimitry Andric      <template data-if="iter.converged"> &#x2192;&#x7c;<!--Rightwards arrow, vertical line--></template>
67*5f757f3fSDimitry Andric    </a>
6806c3fb27SDimitry Andric  </template>
6906c3fb27SDimitry Andric</div>
7006c3fb27SDimitry Andric<table id="bb-elements">
7106c3fb27SDimitry Andric<template>
7206c3fb27SDimitry Andric  <tr id="{{selection.bb}}.0">
7306c3fb27SDimitry Andric    <td class="{{selection.bb}}">{{selection.bb}}.0</td>
7406c3fb27SDimitry Andric    <td>(initial state)</td>
7506c3fb27SDimitry Andric  </tr>
7606c3fb27SDimitry Andric</template>
7706c3fb27SDimitry Andric<template data-for="elt in cfg[selection.bb].elements">
7806c3fb27SDimitry Andric  <tr id="{{selection.bb}}.{{elt_index+1}}">
7906c3fb27SDimitry Andric    <td class="{{selection.bb}}">{{selection.bb}}.{{elt_index+1}}</td>
8006c3fb27SDimitry Andric    <td>{{elt}}</td>
8106c3fb27SDimitry Andric  </tr>
8206c3fb27SDimitry Andric</template>
8306c3fb27SDimitry Andric</table>
8406c3fb27SDimitry Andric</section>
8506c3fb27SDimitry Andric
8606c3fb27SDimitry Andric<section id="element" data-selection="iter,elt">
8706c3fb27SDimitry Andric<template data-let="state = states[selection.iter + '_' + selection.elt]">
8806c3fb27SDimitry Andric<header>
89*5f757f3fSDimitry Andric  <template data-if="state.element == 0">{{state.block}} initial state</template>
90*5f757f3fSDimitry Andric  <template data-if="state.element != 0">Element {{selection.elt}}</template>
91*5f757f3fSDimitry Andric  <template data-if="state.post_visit"> (post-visit)</template>
92*5f757f3fSDimitry Andric  <template data-if="!state.post_visit"> (iteration {{state.iter}})</template>
9306c3fb27SDimitry Andric</header>
9406c3fb27SDimitry Andric<template data-if="state.value" data-let="v = state.value">
9506c3fb27SDimitry Andric  <h2>Value</h2>
9606c3fb27SDimitry Andric  <template data-use="value-template"></template>
9706c3fb27SDimitry Andric</template>
9806c3fb27SDimitry Andric<template data-if="state.logs">
9906c3fb27SDimitry Andric  <h2>Logs</h2>
10006c3fb27SDimitry Andric  <pre>{{state.logs}}</pre>
10106c3fb27SDimitry Andric</template>
10206c3fb27SDimitry Andric<h2>Built-in lattice</h2>
10306c3fb27SDimitry Andric<pre>{{state.builtinLattice}}</pre>
10406c3fb27SDimitry Andric</template>
10506c3fb27SDimitry Andric</section>
10606c3fb27SDimitry Andric
10706c3fb27SDimitry Andric<script>
10806c3fb27SDimitry AndricaddBBColors(Object.keys(HTMLLoggerData.cfg).length);
10906c3fb27SDimitry AndricwatchSelection(HTMLLoggerData);
11006c3fb27SDimitry AndricupdateSelection({}, HTMLLoggerData);
11106c3fb27SDimitry Andric// Copy code and cfg from <template>s into the body.
11206c3fb27SDimitry Andricfor (tmpl of document.querySelectorAll('template[data-copy]'))
11306c3fb27SDimitry Andric  document.getElementById(tmpl.dataset.copy).replaceChildren(
11406c3fb27SDimitry Andric      ...tmpl.content.cloneNode(/*deep=*/true).childNodes);
11506c3fb27SDimitry Andric</script>
11606c3fb27SDimitry Andric
11706c3fb27SDimitry Andric</body>
11806c3fb27SDimitry Andric</html>
119