<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi, Chris,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As I think about it, no, MBBs are not superblocks. The important part here is that semantically, while we may need multiple instructions at the end of the block in order to encode the branches to the various successors, we don't have other code in between these
 various terminators. There's an ordering: PHIs, then other things, then terminators. Regarding tail duplication, etc. the thing to realize is that, past a certain point in the pipeline, the blocks' layout order is significant and blocks have implicit fallthrough
 branches. We still maintain separate blocks, however.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
 -Hal</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hal Finkel<br>
Lead, Compiler Technology and Programming Languages<br>
Leadership Computing Facility<br>
Argonne National Laboratory</div>
</span></font></div>
</div>
</div>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Chris Sears via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Sent:</b> Saturday, July 11, 2020 1:41 PM<br>
<b>To:</b> llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> [llvm-dev] is a MachineBasicBlock a kind of superblock?</font>
<div> </div>
</div>
<div>
<div dir="ltr">MachineBasicBlock allows for multiple terminators. Unconditional branches and returns are marked as terminators<span class="x_gmail_default" style="font-size:small">; t</span>he MIPS backend also marks conditional branches as terminators. The
 MachineBasicBlock <span class="x_gmail_default" style="font-size:small">then </span>
has a helper function getFirstTerminator which iterates from the first terminator to the end of the MBB.<br>
<br>
So it seems to me that an MBB is a kind of superblock, single entrance and multiple side exits.
<span class="x_gmail_default" style="font-size:small">There are also</span> TailDuplication and BranchFolding passes. While these two are technically not part of the superblock definition, they are usually part of a superblock implementation because you want
 a superblock <span class="x_gmail_default" style="font-size:small">to be </span>
as<span class="x_gmail_default" style="font-size:small"> big as</span> possible.
<div><br>
</div>
<div>
<div class="x_gmail_default" style="font-size:small">Of course, you could make a big superblock in the CFG and then tile it down into basic MBBs. But the only reason that I can think of for that would be codegen simplicity and with GlobalISel, I would think
 that would no longer be the case.</div>
<br>
A<span class="x_gmail_default" style="font-size:small">nyways, a</span>m I getting this right? If so, is there any way to control the creation of th<span class="x_gmail_default" style="font-size:small">ese</span> superblock<span class="x_gmail_default" style="font-size:small">s</span>,
 that is, which basic blocks from the CFG go into a given MBB?<br>
<br>
I'm still in the MC layer, so I really don't know where in the MI layer this <span class="x_gmail_default" style="font-size:small">
sort of </span>tiling of the CFG is done. (In a full blown superblock formation that tiling would be a profile driven decision for finding the hot trace.)<br>
<br>
It's always good to just look at things. So I want to just display some MBBs for some code for some backend at preEmit and just look at what they look like. Any suggestions for that will be appreciated.<br>
<br>
thanks,<br>
<br>
Chris<br>
<br>
BTW, this is at the MI-MC interface. The IR BasicBlock is <span class="x_gmail_default" style="font-size:small">
a </span>completely different<span class="x_gmail_default" style="font-size:small"> issue.</span></div>
</div>
</div>
</div>
</body>
</html>