Hello,
I propose a new syntax for metadata strings (MDStrings) which would allow string data to be spread over multiple lines:
!0 = metadata !{metadata !“”"
hello
world
“”"}
The special three-quote sequence marks the beginning and end of a multi-line string.
This syntax could have a variety of uses, but of particular interest is that it could be used as a basis for serializing MachineFunctions. MachineFunctions are not an entirely self-contained IR; they contain references to LLVM IR. As such, a serialization of a MachineFunction needs to have an LLVM Module to refer to. By encoding MachineFunctions in metadata, they can easily accompany an LLVM Module. By being multi-line, the data could be made to be reasonably human-readable and human-editable.
Attached is a simple proof-of-concept patch which implements parsing and printing for this new MDString syntax.
Comments welcome!
Dan
extended-mdstring-syntax.patch (5.12 KB)