<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-06-23 12:43 GMT-07:00 Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2015-Jun-22, at 11:38, Alex Lorenz <<a href="mailto:arphaman@gmail.com">arphaman@gmail.com</a>> wrote:<br>
><br>
> Hi dexonsmith, bob.wilson, bogner,<br>
><br>
> This patch is based on a previous serialization patch that serializes null register operands (<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10580&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tsBlmNXSQqE668_1bo9f3jnpLCHXWTEMzAB-7TY3tiA&s=gNjDngL7cU2Uc2Oto8vU-OENf7aNhnN4HQG1e0tevCk&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D10580</a>).<br>
><br>
> This patch serializes machine basic block operands.<br>
> The following syntax is used for basic block operands:<br>
><br>
> %bb.<name><br>
> %bb.<index><br>
><br>
> The name is printed when the machine basic block has a name, i.e. when its basic block has a name. Otherwise, a number is printed, which is just an index into a list of machine basic blocks for that function.<br>
> Example:<br>
><br>
> JG_1 %bb.if.cond<br>
> JG_1 %bb.2<br>
<br>
</span>This is ambiguous in general. IIUC, it's legal for two different<br>
`MachineBasicBlock`s to point at the same `BasicBlock` (see, e.g.,<br>
`BranchFolder::SplitMBBAt()`), so the name isn't a sufficient identifier.<br>
<br>
I'm not such a big fan of your numbered identifiers either, since they're<br>
going to be hard to read, the numbering isn't explicit in the source, and<br>
the numbering is fragile (removing a basic block in the middle changes<br>
all the numbers following).<br>
<br>
Here's a different straw man proposal (I don't love it, so I hope you can<br>
refine it to something better).<br>
<br>
First, change the `name:` field to include an ID number. Suppose you<br>
have two BBs, %then and %else. %then has two MBBs. You'd get something<br>
like the following:<br>
<br>
- name: 0.then<br>
- name: 0.else<br>
- name: 1.then<br>
<br>
The syntax is `<num> ['.' <bb-name>]`. (Maybe the `<num>` should be<br>
specified in a separate field?)<br>
<br>
Second, change the references to use both these numbers and the names.<br>
Maybe, for these:<br>
<br>
%bb.0.then<br>
%bb.0.else<br>
%bb.1.then<br>
<br>
Unnamed basic blocks fall out naturally as:<br>
<br>
%bb.0 ; reference to the first unnamed basic block<br>
%bb.1 ; reference to the second unnamed basic block<br>
<br>
These aren't alternate names, these are the only names. And the `0` and<br>
`1` are somehow defined explicitly in MIR.<br>
<br>
Thoughts? Other ideas?\<br></blockquote><div><br></div><div><br></div><div>Thanks, yeah this makes sense.</div><div>I decided to add a required number field to the MBB YAML mapping, so now the numbers are explicitly defined in MIR. The references adopt the syntax proposed by you.</div><div><br></div><div>Alex</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
><br>
> REPOSITORY<br>
> rL LLVM<br>
><br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10608&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tsBlmNXSQqE668_1bo9f3jnpLCHXWTEMzAB-7TY3tiA&s=Eo-XwqLFosMY3nqjWxzBuVeF4lgtsMjWFOJ-qQiSQRg&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D10608</a><br>
><br>
> Files:<br>
> lib/CodeGen/MIRParser/MILexer.cpp<br>
> lib/CodeGen/MIRParser/MILexer.h<br>
> lib/CodeGen/MIRParser/MIParser.cpp<br>
> lib/CodeGen/MIRParser/MIParser.h<br>
> lib/CodeGen/MIRParser/MIRParser.cpp<br>
> lib/CodeGen/MIRPrinter.cpp<br>
> test/CodeGen/MIR/X86/large-index-number-error.mir<br>
> test/CodeGen/MIR/X86/machine-basic-block-operands.mir<br>
> test/CodeGen/MIR/X86/unknown-machine-basic-block.mir<br>
> test/CodeGen/MIR/X86/unknown-named-machine-basic-block.mir<br>
><br>
> EMAIL PREFERENCES<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tsBlmNXSQqE668_1bo9f3jnpLCHXWTEMzAB-7TY3tiA&s=i7Y3J5QZyFXRow0aMY5j-3fxa8KL7nivafb-cKZiywk&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</span>> <D10608.28137.patch><br>
<br>
</blockquote></div><br></div></div>