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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/a09e9b77/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: extended-mdstring-syntax.patch Type: application/octet-stream Size: 5239 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/a09e9b77/attachment.obj>
Hi Dan, I am not against adding multi-line support for Metadata. I am also okay with your syntax, and I am also okay with other solutions, such as escaping of \n’s or adopting c-style concatenations of strings on multiple lines. But I think that serialization of MachineFunction should not be done in metadata. I understand the problem that you pointer out that machine instructions refer to LLVM-IR, but I don’t think that metadata is the right container for them. Nadav On Jun 26, 2013, at 3:29 PM, Dan Gohman <dan433584 at gmail.com> wrote:> 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>_______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/9f28b1d4/attachment.html>
On Wed, Jun 26, 2013 at 3:46 PM, Nadav Rotem <nrotem at apple.com> wrote:> But I think that serialization of MachineFunction should not be done in > metadata. I understand the problem that you pointer out that machine > instructions refer to LLVM-IR, but I don’t think that metadata is the right > container for them.Can you suggest an alternative solution? Can you describe why you don't think metadata is the right container? This alone isn't really helpful at moving us toward something that there has been widespread agreement LLVM needs. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130626/c9da3115/attachment.html>