summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm-c
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-03-19 18:21:43 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-03-19 18:21:43 +0000
commit064774f753a093f484b524eb5b3847da48dcad8d (patch)
tree6465a9303f05be43b19400c589a63b98c0e2045f /llvm/include/llvm-c
parent9ef60a2539b268f40052f61149aab6c2442732aa (diff)
downloadbcm5719-llvm-064774f753a093f484b524eb5b3847da48dcad8d.tar.gz
bcm5719-llvm-064774f753a093f484b524eb5b3847da48dcad8d.zip
Revert "[Remarks] Add a new Remark / RemarkParser abstraction"
This reverts commit 51dc6a8c84cd6a58562e320e1828a0158dbbf750. Breaks http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/20034/steps/build%20stage%201/logs/stdio. llvm-svn: 356492
Diffstat (limited to 'llvm/include/llvm-c')
-rw-r--r--llvm/include/llvm-c/Remarks.h223
1 files changed, 55 insertions, 168 deletions
diff --git a/llvm/include/llvm-c/Remarks.h b/llvm/include/llvm-c/Remarks.h
index e57ca3cd8f5..901acac76d9 100644
--- a/llvm/include/llvm-c/Remarks.h
+++ b/llvm/include/llvm-c/Remarks.h
@@ -34,201 +34,86 @@ extern "C" {
#define REMARKS_API_VERSION 0
/**
- * The type of the emitted remark.
- */
-enum LLVMRemarkType {
- LLVMRemarkTypeUnknown,
- LLVMRemarkTypePassed,
- LLVMRemarkTypeMissed,
- LLVMRemarkTypeAnalysis,
- LLVMRemarkTypeAnalysisFPCommute,
- LLVMRemarkTypeAnalysisAliasing,
- LLVMRemarkTypeFailure
-};
-
-/**
* String containing a buffer and a length. The buffer is not guaranteed to be
* zero-terminated.
*
* \since REMARKS_API_VERSION=0
*/
-typedef struct LLVMRemarkOpaqueString *LLVMRemarkStringRef;
-
-/**
- * Returns the buffer holding the string.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern const char *LLVMRemarkStringGetData(LLVMRemarkStringRef String);
-
-/**
- * Returns the size of the string.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern uint32_t LLVMRemarkStringGetLen(LLVMRemarkStringRef String);
+typedef struct {
+ const char *Str;
+ uint32_t Len;
+} LLVMRemarkStringRef;
/**
* DebugLoc containing File, Line and Column.
*
* \since REMARKS_API_VERSION=0
*/
-typedef struct LLVMRemarkOpaqueDebugLoc *LLVMRemarkDebugLocRef;
-
-/**
- * Return the path to the source file for a debug location.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkStringRef
-LLVMRemarkDebugLocGetSourceFilePath(LLVMRemarkDebugLocRef DL);
-
-/**
- * Return the line in the source file for a debug location.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern uint32_t LLVMRemarkDebugLocGetSourceLine(LLVMRemarkDebugLocRef DL);
-
-/**
- * Return the column in the source file for a debug location.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern uint32_t LLVMRemarkDebugLocGetSourceColumn(LLVMRemarkDebugLocRef DL);
+typedef struct {
+ // File:
+ LLVMRemarkStringRef SourceFile;
+ // Line:
+ uint32_t SourceLineNumber;
+ // Column:
+ uint32_t SourceColumnNumber;
+} LLVMRemarkDebugLoc;
/**
* Element of the "Args" list. The key might give more information about what
- * the semantics of the value are, e.g. "Callee" will tell you that the value
+ * are the semantics of the value, e.g. "Callee" will tell you that the value
* is a symbol that names a function.
*
* \since REMARKS_API_VERSION=0
*/
-typedef struct LLVMRemarkOpaqueArg *LLVMRemarkArgRef;
+typedef struct {
+ // e.g. "Callee"
+ LLVMRemarkStringRef Key;
+ // e.g. "malloc"
+ LLVMRemarkStringRef Value;
-/**
- * Returns the key of an argument. The key defines what the value is, and the
- * same key can appear multiple times in the list of arguments.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkStringRef LLVMRemarkArgGetKey(LLVMRemarkArgRef Arg);
+ // "DebugLoc": Optional
+ LLVMRemarkDebugLoc DebugLoc;
+} LLVMRemarkArg;
/**
- * Returns the value of an argument. This is a string that can contain newlines.
+ * One remark entry.
*
* \since REMARKS_API_VERSION=0
*/
-extern LLVMRemarkStringRef LLVMRemarkArgGetValue(LLVMRemarkArgRef Arg);
+typedef struct {
+ // e.g. !Missed, !Passed
+ LLVMRemarkStringRef RemarkType;
+ // "Pass": Required
+ LLVMRemarkStringRef PassName;
+ // "Name": Required
+ LLVMRemarkStringRef RemarkName;
+ // "Function": Required
+ LLVMRemarkStringRef FunctionName;
-/**
- * Returns the debug location that is attached to the value of this argument.
- *
- * If there is no debug location, the return value will be `NULL`.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkDebugLocRef LLVMRemarkArgGetDebugLoc(LLVMRemarkArgRef Arg);
-
-/**
- * A remark emitted by the compiler.
- *
- * \since REMARKS_API_VERSION=0
- */
-typedef struct LLVMRemarkOpaqueEntry *LLVMRemarkEntryRef;
-
-/**
- * The type of the remark. For example, it can allow users to only keep the
- * missed optimizations from the compiler.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern enum LLVMRemarkType LLVMRemarkEntryGetType(LLVMRemarkEntryRef Remark);
-
-/**
- * Get the name of the pass that emitted this remark.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkStringRef
-LLVMRemarkEntryGetPassName(LLVMRemarkEntryRef Remark);
-
-/**
- * Get an identifier of the remark.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkStringRef
-LLVMRemarkEntryGetRemarkName(LLVMRemarkEntryRef Remark);
-
-/**
- * Get the name of the function being processsed when the remark was emitted.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkStringRef
-LLVMRemarkEntryGetFunctionName(LLVMRemarkEntryRef Remark);
-
-/**
- * Returns the debug location that is attached to this remark.
- *
- * If there is no debug location, the return value will be `NULL`.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkDebugLocRef
-LLVMRemarkEntryGetDebugLoc(LLVMRemarkEntryRef Remark);
-
-/**
- * Return the hotness of the remark.
- *
- * A hotness of `0` means this value is not set.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern uint64_t LLVMRemarkEntryGetHotness(LLVMRemarkEntryRef Remark);
-
-/**
- * The number of arguments the remark holds.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern uint32_t LLVMRemarkEntryGetNumArgs(LLVMRemarkEntryRef Remark);
-
-/**
- * Get a new iterator to iterate over a remark's argument.
- *
- * If there are no arguments in \p Remark, the return value will be `NULL`.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkArgRef LLVMRemarkEntryGetFirstArg(LLVMRemarkEntryRef Remark);
-
-/**
- * Get the next argument in \p Remark from the position of \p It.
- *
- * Returns `NULL` if there are no more arguments available.
- *
- * \since REMARKS_API_VERSION=0
- */
-extern LLVMRemarkArgRef LLVMRemarkEntryGetNextArg(LLVMRemarkArgRef It,
- LLVMRemarkEntryRef Remark);
+ // "DebugLoc": Optional
+ LLVMRemarkDebugLoc DebugLoc;
+ // "Hotness": Optional
+ uint32_t Hotness;
+ // "Args": Optional. It is an array of `num_args` elements.
+ uint32_t NumArgs;
+ LLVMRemarkArg *Args;
+} LLVMRemarkEntry;
typedef struct LLVMRemarkOpaqueParser *LLVMRemarkParserRef;
/**
- * Creates a remark parser that can be used to parse the buffer located in \p
- * Buf of size \p Size bytes.
+ * Creates a remark parser that can be used to read and parse the buffer located
+ * in \p Buf of size \p Size.
*
- * \p Buf cannot be `NULL`.
+ * \p Buf cannot be NULL.
*
* This function should be paired with LLVMRemarkParserDispose() to avoid
* leaking resources.
*
* \since REMARKS_API_VERSION=0
*/
-extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf,
- uint64_t Size);
+extern LLVMRemarkParserRef LLVMRemarkParserCreate(const void *Buf,
+ uint64_t Size);
/**
* Returns the next remark in the file.
@@ -236,9 +121,9 @@ extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf,
* The value pointed to by the return value is invalidated by the next call to
* LLVMRemarkParserGetNext().
*
- * If the parser reaches the end of the buffer, the return value will be `NULL`.
+ * If the parser reaches the end of the buffer, the return value will be NULL.
*
- * In the case of an error, the return value will be `NULL`, and:
+ * In the case of an error, the return value will be NULL, and:
*
* 1) LLVMRemarkParserHasError() will return `1`.
*
@@ -249,16 +134,18 @@ extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf,
*
* 1) An argument is invalid.
*
- * 2) There is a parsing error. This can occur on things like malformed YAML.
+ * 2) There is a YAML parsing error. This type of error aborts parsing
+ * immediately and returns `1`. It can occur on malformed YAML.
*
- * 3) There is a Remark semantic error. This can occur on well-formed files with
- * missing or extra fields.
+ * 3) Remark parsing error. If this type of error occurs, the parser won't call
+ * the handler and will continue to the next one. It can occur on malformed
+ * remarks, like missing or extra fields in the file.
*
* Here is a quick example of the usage:
*
* ```
- * LLVMRemarkParserRef Parser = LLVMRemarkParserCreateYAML(Buf, Size);
- * LLVMRemarkEntryRef Remark = NULL;
+ * LLVMRemarkParserRef Parser = LLVMRemarkParserCreate(Buf, Size);
+ * LLVMRemarkEntry *Remark = NULL;
* while ((Remark == LLVMRemarkParserGetNext(Parser))) {
* // use Remark
* }
@@ -268,7 +155,7 @@ extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf,
*
* \since REMARKS_API_VERSION=0
*/
-extern LLVMRemarkEntryRef LLVMRemarkParserGetNext(LLVMRemarkParserRef Parser);
+extern LLVMRemarkEntry *LLVMRemarkParserGetNext(LLVMRemarkParserRef Parser);
/**
* Returns `1` if the parser encountered an error while parsing the buffer.
@@ -298,7 +185,7 @@ extern const char *LLVMRemarkParserGetErrorMessage(LLVMRemarkParserRef Parser);
extern void LLVMRemarkParserDispose(LLVMRemarkParserRef Parser);
/**
- * Returns the version of the remarks library.
+ * Returns the version of the remarks dylib.
*
* \since REMARKS_API_VERSION=0
*/
OpenPOWER on IntegriCloud