Add a utility for converting between different types of remarks
authorJessica Paquette <jpaquette@apple.com>
Sat, 10 Sep 2022 02:58:02 +0000 (19:58 -0700)
committerJessica Paquette <jpaquette@apple.com>
Mon, 12 Sep 2022 22:04:19 +0000 (15:04 -0700)
commit7d80b94ca3ab4563c964ebbf3662c0d3033dc91a
treed3d3d6139b14a357f14a2019d495b7c353196bcf
parentd90f7cb559e32c2cbf1f9839d7e8e0cc0be189ba
Add a utility for converting between different types of remarks

This adds llvm-remarkutil. This is intended to be a general tool for doing stuff
with/to remark files.

This patch gives it the following powers:

* `bitstream2yaml` - To convert bitstream remarks to YAML
* `yaml2bitstream` - To convert YAML remarks to bitstream remarks

These are both implemented as subcommands, like

`llvm-remarkutil bitstream2yaml <input_file> -o -`

I ran into an issue where I had some bitstream remarks coming from CI, and I
wanted to be able to do stuff with them (e.g. visualize them). But then I
noticed we didn't have any tooling for doing that, so I decided to write this
thing.

Being able to output YAML as a start seemed like a good idea, since it
would allow people to reuse any tooling they may have written based around YAML
remarks.

Hopefully it can grow into a more featureful remark utility. :)

Currently there are is an outstanding performance issue (see the TODO) with
the bitstream2yaml case. I decided that I'd keep the tool small to start with
and have the yaml2bitstream and bitstream2yaml cases be symmetric.

Also I moved the remarks documentation to its own header because it seems
a little out of place with "basic commands" and "developer tools"; it's
really kind of its own thing.

Differential Revision: https://reviews.llvm.org/D133646
17 files changed:
llvm/docs/CommandGuide/LLVMRemarkUtil.rst [new file with mode: 0644]
llvm/docs/CommandGuide/index.rst
llvm/test/CMakeLists.txt
llvm/test/lit.cfg.py
llvm/test/tools/llvm-remarkutil/Inputs/broken-remark [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/Inputs/broken-remark.bitstream [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/Inputs/empty-file [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/Inputs/two-remarks.bitstream [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/Inputs/two-remarks.yaml [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/broken-bitstream-remark.test [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/broken-yaml-remark.test [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/convert.test [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/empty-file.test [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/file-does-not-exist.test [new file with mode: 0644]
llvm/test/tools/llvm-remarkutil/missing-subcommand.test [new file with mode: 0644]
llvm/tools/llvm-remarkutil/CMakeLists.txt [new file with mode: 0644]
llvm/tools/llvm-remarkutil/RemarkUtil.cpp [new file with mode: 0644]