llvm_sys/
remarks.rs

1//! Remark diagnostics library.
2use crate::prelude::LLVMBool;
3
4#[repr(C)]
5pub enum LLVMRemarkType {
6    LLVMRemarkTypeUnknown,
7    LLVMRemarkTypePassed,
8    LLVMRemarkTypeMissed,
9    LLVMRemarkTypeAnalysis,
10    LLVMRemarkTypeAnalysisFPCommute,
11    LLVMRemarkTypeAnalysisAliasing,
12    LLVMRemarkTypeFailure,
13}
14
15pub enum LLVMRemarkOpaqueString {}
16
17/// String containing a buffer and a length. The buffer is not guaranteed to be zero-terminated.
18pub type LLVMRemarkStringRef = *mut LLVMRemarkOpaqueString;
19
20extern "C" {
21    /// Returns the buffer holding the string.
22    pub fn LLVMRemarkStringGetData(String: LLVMRemarkStringRef) -> *const ::libc::c_char;
23
24    /// Returns the size of the string.
25    pub fn LLVMRemarkStringGetLen(String: LLVMRemarkStringRef) -> u32;
26}
27
28pub enum LLVMRemarkOpaqueDebugLoc {}
29
30/// DebugLoc containing File, Line and Column.
31pub type LLVMRemarkDebugLocRef = *mut LLVMRemarkOpaqueDebugLoc;
32
33extern "C" {
34    /// Return the path to the source file for a debug location.
35    pub fn LLVMRemarkDebugLocGetSourceFilePath(DL: LLVMRemarkDebugLocRef) -> LLVMRemarkStringRef;
36
37    /// Return the line in the source file for a debug location.
38    pub fn LLVMRemarkDebugLocGetSourceLine(DL: LLVMRemarkDebugLocRef) -> u32;
39
40    /// Return the column in the source file for a debug location.
41    pub fn LLVMRemarkDebugLocGetSourceColumn(DL: LLVMRemarkDebugLocRef) -> u32;
42}
43
44pub enum LLVMRemarkOpaqueArg {}
45
46/// Element of the "Args" list. The key might give more information about what
47/// the semantics of the value are, e.g. "Callee" will tell you that the value
48/// is a symbol that names a function.
49pub type LLVMRemarkArgRef = *mut LLVMRemarkOpaqueArg;
50
51extern "C" {
52    /// Returns the key of an argument. The key defines what the value is, and the
53    /// same key can appear multiple times in the list of arguments.
54    pub fn LLVMRemarkArgGetKey(Arg: LLVMRemarkArgRef) -> LLVMRemarkStringRef;
55
56    /// Returns the value of an argument. This is a string that can contain newlines.
57    pub fn LLVMRemarkArgGetValue(Arg: LLVMRemarkArgRef) -> LLVMRemarkStringRef;
58
59    /// Returns the debug location that is attached to the value of this argument.
60    pub fn LLVMRemarkArgGetDebugLoc(Arg: LLVMRemarkArgRef) -> LLVMRemarkDebugLocRef;
61}
62
63pub enum LLVMRemarkOpaqueEntry {}
64/// A remark emitted by the compiler.
65pub type LLVMRemarkEntryRef = *mut LLVMRemarkOpaqueEntry;
66
67extern "C" {
68    /// Free the resources used by the remark entry.
69    pub fn LLVMRemarkEntryDispose(Remark: LLVMRemarkEntryRef);
70
71    /// The type of the remark. For example, it can allow users to only keep the
72    /// missed optimizations from the compiler.
73    pub fn LLVMRemarkEntryGetType(Remark: LLVMRemarkEntryRef) -> LLVMRemarkType;
74
75    /// Get the name of the pass that emitted this remark.
76    pub fn LLVMRemarkEntryGetPassName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
77
78    /// Get an identifier of the remark.
79    pub fn LLVMRemarkEntryGetRemarkName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
80
81    /// Get the name of the function being processed when the remark was emitted.
82    pub fn LLVMRemarkEntryGetFunctionName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
83
84    /// Returns the debug location that is attached to this remark.
85    pub fn LLVMRemarkEntryGetDebugLoc(Remark: LLVMRemarkEntryRef) -> LLVMRemarkDebugLocRef;
86
87    /// Return the hotness of the remark.
88    pub fn LLVMRemarkEntryGetHotness(Remark: LLVMRemarkEntryRef) -> u64;
89
90    /// The number of arguments the remark holds.
91    pub fn LLVMRemarkEntryGetNumArgs(Remark: LLVMRemarkEntryRef) -> u32;
92
93    /// Get a new iterator to iterate over a remark's argument.
94    pub fn LLVMRemarkEntryGetFirstArg(Remark: LLVMRemarkEntryRef) -> LLVMRemarkArgRef;
95
96    /// Get the next argument in Remark from the position of It.
97    pub fn LLVMRemarkEntryGetNextArg(
98        It: LLVMRemarkArgRef,
99        Remark: LLVMRemarkEntryRef,
100    ) -> LLVMRemarkArgRef;
101}
102
103pub enum LLVMRemarkOpaqueParser {}
104pub type LLVMRemarkParserRef = *mut LLVMRemarkOpaqueParser;
105
106extern "C" {
107    /// Creates a remark parser that can be used to parse the buffer located in
108    /// Buf of size Size bytes.
109    pub fn LLVMRemarkParserCreateYAML(Buf: *const ::libc::c_void, Size: u64)
110        -> LLVMRemarkParserRef;
111
112    pub fn LLVMRemarkParserCreateBitstream(
113        Buf: *const ::libc::c_void,
114        Size: u64,
115    ) -> LLVMRemarkParserRef;
116
117    /// Returns the next remark in the file.
118    pub fn LLVMRemarkParserGetNext(Parser: LLVMRemarkParserRef) -> LLVMRemarkEntryRef;
119
120    /// Returns `1` if the parser encountered an error while parsing the buffer.
121    pub fn LLVMRemarkParserHasError(Parser: LLVMRemarkParserRef) -> LLVMBool;
122
123    /// Returns a null-terminated string containing an error message.
124    pub fn LLVMRemarkParserGetErrorMessage(Parser: LLVMRemarkParserRef) -> *const ::libc::c_char;
125
126    pub fn LLVMRemarkParserDispose(Parser: LLVMRemarkParserRef);
127}
128
129pub const REMARKS_API_VERSION: u32 = 1;
130
131extern "C" {
132    /// Returns the version of the remarks library.
133    pub fn LLVMRemarkVersion() -> u32;
134}