[llvm-dev] is a MachineBasicBlock a kind of superblock?

Chris Sears via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 11 11:41:05 PDT 2020


MachineBasicBlock allows for multiple terminators. Unconditional branches
and returns are marked as terminators; the MIPS backend also marks
conditional branches as terminators. The MachineBasicBlock then has a
helper function getFirstTerminator which iterates from the first terminator
to the end of the MBB.

So it seems to me that an MBB is a kind of superblock, single entrance and
multiple side exits. There are also 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 to be as big as possible.

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.

Anyways, am I getting this right? If so, is there any way to control the
creation of these superblocks, that is, which basic blocks from the CFG go
into a given MBB?

I'm still in the MC layer, so I really don't know where in the MI layer
this sort of 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.)

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.

thanks,

Chris

BTW, this is at the MI-MC interface. The IR BasicBlock is a completely
different issue.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200711/44c1b258/attachment.html>


More information about the llvm-dev mailing list