diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2019-09-09 17:43:50 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2019-09-09 17:43:50 +0000 |
commit | a85d9ef11ae3dd5c840b1087555b04bedc304113 (patch) | |
tree | cd1358b8a50bde1f206b87a4a288c90acea293b9 /llvm/include/llvm-c/Remarks.h | |
parent | 56e4ea2bff9eb2f43b20a68951e6263ad3c9022f (diff) | |
download | bcm5719-llvm-a85d9ef11ae3dd5c840b1087555b04bedc304113.tar.gz bcm5719-llvm-a85d9ef11ae3dd5c840b1087555b04bedc304113.zip |
[Remarks] Add parser for bitstream remarks
The bitstream remark serializer landed in r367372.
This adds a bitstream remark parser that parser bitstream remark files
to llvm::remarks::Remark objects through the RemarkParser interface.
A few interesting things to point out:
* There are parsing helpers to parse the different types of blocks
* The main parsing helper allows us to parse remark metadata and open an
external file containing the encoded remarks
* This adds a dependency from the Remarks library to the BitstreamReader
library
* The testing strategy is to create a remark entry through YAML, parse
it, serialize it to bitstream, parse that back and compare the objects.
* There are close to no tests for malformed bitstream remarks, due to
the lack of textual format for the bitstream format.
* This adds a new C API for parsing bitstream remarks:
LLVMRemarkParserCreateBitstream.
* This bumps the REMARKS_API_VERSION to 1.
Differential Revision: https://reviews.llvm.org/D67134
llvm-svn: 371429
Diffstat (limited to 'llvm/include/llvm-c/Remarks.h')
-rw-r--r-- | llvm/include/llvm-c/Remarks.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/include/llvm-c/Remarks.h b/llvm/include/llvm-c/Remarks.h index 88eb5120c57..5444aebddd6 100644 --- a/llvm/include/llvm-c/Remarks.h +++ b/llvm/include/llvm-c/Remarks.h @@ -30,7 +30,8 @@ extern "C" { * @{ */ -#define REMARKS_API_VERSION 0 +// 0 -> 1: Bitstream remarks support. +#define REMARKS_API_VERSION 1 /** * The type of the emitted remark. @@ -241,6 +242,20 @@ extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf, uint64_t Size); /** + * Creates a remark parser that can be used to parse the buffer located in \p + * Buf of size \p Size bytes. + * + * \p Buf cannot be `NULL`. + * + * This function should be paired with LLVMRemarkParserDispose() to avoid + * leaking resources. + * + * \since REMARKS_API_VERSION=1 + */ +extern LLVMRemarkParserRef LLVMRemarkParserCreateBitstream(const void *Buf, + uint64_t Size); + +/** * Returns the next remark in the file. * * The value pointed to by the return value needs to be disposed using a call to |