[LLVMdev] RFC: Machine Level IR text-based serialization format

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Apr 29 11:40:30 PDT 2015


> On 2015-Apr-29, at 06:40, Krzysztof Parzyszek <kparzysz at codeaurora.org> wrote:
> 
> On 4/28/2015 7:13 PM, Alex L wrote:
>> 
>> 
>> 2015-04-28 16:26 GMT-07:00 Matthias Braun <matze at braunis.de
>> <mailto:matze at braunis.de>>:
>> 
>>    For that use case it is worth keeping the following things in mind:
>>    - Please try to keep the output of the various dump functions, esp.
>>    MachineInstr::dump(), MachineOperand::dump(),
>>    MachineBasicBlock::dump() as close as possible to the format you use
>>    for serializing.
>> [...]
>> 
>> Ideally the new syntax would replace the existing print/dump syntax. The
>> new syntax will lead to certain missing information when
>> this information can be inferred (e.g. the TiedTo and IsEarlyClobber
>> attributes for register operands that I mentioned earlier in this thread),
>> so maybe we could have some sort of verbose dumping option where
>> absolutely everything is dumped.
> 
> 
> I think that the new syntax is less readable than the current format of the "dump" functions, and in the long term it would be better to have something more human-friendly.  However, using YAML has the advantage that it's easier to parse it than the direct output of "dump" and so it will take less time to implement a YAML-based solution.  My concern is that you may run out of time to complete this and the file format is not the most important thing in this project.  Getting it to work, if only as a proof of concept, would be very helpful to everyone.  Coming up with a fancier grammar and implementing a parser for it could be done later on top of the initial implementation.
> 
> -Krzysztof

Until I got to this email, I was opposed to using YAML here -- I'd
prefer a custom grammar and parser -- but I find Krzysztof's point
here pretty convincing.

Starting with a (hybrid) YAML representation seems like a reasonable
way to bootstrap a machine IR.  Once it's in place and working, we
can come back and strip away the YAML parts until it's human-
friendly.  (And since YAML is machine-friendly, upgrade scripts for
testcases should be straightforward.)

BTW, we probably need some sort of LangRef document for this.  Maybe
docs/MIRLangRef.rst?



More information about the llvm-dev mailing list