rocm.bindings.llvm.c.cyremarks

rocm.bindings.llvm.c.cyremarks#

2026-09-24

9 min read time

Applies to Linux and Windows

Advanced Micro Devices, Inc.

Cython declarations for the C-level interface. Use cimport rocm.bindings.llvm.c.cyremarks from your Cython code to access these declarations directly.

See also

The high-level Python API is documented at rocm.bindings.llvm.c.remarks.

# MIT License
#
# Copyright (c) 2021-2026 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


# This file has been autogenerated, do not modify.

from libc.stdint cimport *
ctypedef bint _Bool # bool is not a reserved keyword in C, _Bool is
from rocm.bindings.llvm.c.cytypes cimport *
from rocm.bindings.llvm.c.cyvisibility cimport *
cdef extern from "llvm-c/Remarks.h":

    cdef enum LLVMRemarkType:
        LLVMRemarkTypeUnknown
        LLVMRemarkTypePassed
        LLVMRemarkTypeMissed
        LLVMRemarkTypeAnalysis
        LLVMRemarkTypeAnalysisFPCommute
        LLVMRemarkTypeAnalysisAliasing
        LLVMRemarkTypeFailure

    cdef struct LLVMRemarkOpaqueString:
        pass

    ctypedef LLVMRemarkOpaqueString * LLVMRemarkStringRef

# 
# Returns the buffer holding the string.
# 
# \since REMARKS_API_VERSION=0
cdef const char * LLVMRemarkStringGetData(LLVMRemarkStringRef String)


# 
# Returns the size of the string.
# 
# \since REMARKS_API_VERSION=0
cdef uint32_t LLVMRemarkStringGetLen(LLVMRemarkStringRef String)


cdef extern from "llvm-c/Remarks.h":

    cdef struct LLVMRemarkOpaqueDebugLoc:
        pass

    ctypedef LLVMRemarkOpaqueDebugLoc * LLVMRemarkDebugLocRef

# 
# Return the path to the source file for a debug location.
# 
# \since REMARKS_API_VERSION=0
cdef LLVMRemarkStringRef LLVMRemarkDebugLocGetSourceFilePath(LLVMRemarkDebugLocRef DL)


# 
# Return the line in the source file for a debug location.
# 
# \since REMARKS_API_VERSION=0
cdef uint32_t LLVMRemarkDebugLocGetSourceLine(LLVMRemarkDebugLocRef DL)


# 
# Return the column in the source file for a debug location.
# 
# \since REMARKS_API_VERSION=0
cdef uint32_t LLVMRemarkDebugLocGetSourceColumn(LLVMRemarkDebugLocRef DL)


cdef extern from "llvm-c/Remarks.h":

    cdef struct LLVMRemarkOpaqueArg:
        pass

    ctypedef LLVMRemarkOpaqueArg * LLVMRemarkArgRef

# 
# 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
cdef LLVMRemarkStringRef LLVMRemarkArgGetKey(LLVMRemarkArgRef Arg)


# 
# Returns the value of an argument. This is a string that can contain newlines.
# 
# \since REMARKS_API_VERSION=0
cdef LLVMRemarkStringRef LLVMRemarkArgGetValue(LLVMRemarkArgRef Arg)


# 
# 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
cdef LLVMRemarkDebugLocRef LLVMRemarkArgGetDebugLoc(LLVMRemarkArgRef Arg)


cdef extern from "llvm-c/Remarks.h":

    cdef struct LLVMRemarkOpaqueEntry:
        pass

    ctypedef LLVMRemarkOpaqueEntry * LLVMRemarkEntryRef

# 
# Free the resources used by the remark entry.
# 
# \since REMARKS_API_VERSION=0
cdef void LLVMRemarkEntryDispose(LLVMRemarkEntryRef Remark)


# 
# 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
cdef LLVMRemarkType LLVMRemarkEntryGetType(LLVMRemarkEntryRef Remark)


# 
# Get the name of the pass that emitted this remark.
# 
# \since REMARKS_API_VERSION=0
cdef LLVMRemarkStringRef LLVMRemarkEntryGetPassName(LLVMRemarkEntryRef Remark)


# 
# Get an identifier of the remark.
# 
# \since REMARKS_API_VERSION=0
cdef LLVMRemarkStringRef LLVMRemarkEntryGetRemarkName(LLVMRemarkEntryRef Remark)


# 
# Get the name of the function being processed when the remark was emitted.
# 
# \since REMARKS_API_VERSION=0
cdef 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
cdef 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
cdef uint64_t LLVMRemarkEntryGetHotness(LLVMRemarkEntryRef Remark)


# 
# The number of arguments the remark holds.
# 
# \since REMARKS_API_VERSION=0
cdef 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`.
# 
# The lifetime of the returned value is bound to the lifetime of \p Remark.
# 
# \since REMARKS_API_VERSION=0
cdef 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.
# 
# The lifetime of the returned value is bound to the lifetime of \p Remark.
# 
# \since REMARKS_API_VERSION=0
cdef LLVMRemarkArgRef LLVMRemarkEntryGetNextArg(LLVMRemarkArgRef It,LLVMRemarkEntryRef Remark)


cdef extern from "llvm-c/Remarks.h":

    cdef struct LLVMRemarkOpaqueParser:
        pass

    ctypedef LLVMRemarkOpaqueParser * LLVMRemarkParserRef

# 
# 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=0
cdef 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
cdef 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
# LLVMRemarkEntryDispose().
# 
# All the entries in the returned value that are of LLVMRemarkStringRef type
# will become invalidated once a call to LLVMRemarkParserDispose is made.
# 
# 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:
# 
# 1) LLVMRemarkParserHasError() will return `1`.
# 
# 2) LLVMRemarkParserGetErrorMessage() will return a descriptive error
#    message.
# 
# An error may occur if:
# 
# 1) An argument is invalid.
# 
# 2) There is a parsing error. This can occur on things like malformed YAML.
# 
# 3) There is a Remark semantic error. This can occur on well-formed files with
#    missing or extra fields.
# 
# Here is a quick example of the usage:
# 
# ```
# LLVMRemarkParserRef Parser = LLVMRemarkParserCreateYAML(Buf, Size);
# LLVMRemarkEntryRef Remark = NULL;
# while ((Remark = LLVMRemarkParserGetNext(Parser))) {
#    // use Remark
#    LLVMRemarkEntryDispose(Remark); // Release memory.
# }
# bool HasError = LLVMRemarkParserHasError(Parser);
# LLVMRemarkParserDispose(Parser);
# ```
# 
# \since REMARKS_API_VERSION=0
cdef LLVMRemarkEntryRef LLVMRemarkParserGetNext(LLVMRemarkParserRef Parser)


# 
# Returns `1` if the parser encountered an error while parsing the buffer.
# 
# \since REMARKS_API_VERSION=0
cdef int LLVMRemarkParserHasError(LLVMRemarkParserRef Parser)


# 
# Returns a null-terminated string containing an error message.
# 
# In case of no error, the result is `NULL`.
# 
# The memory of the string is bound to the lifetime of \p Parser. If
# LLVMRemarkParserDispose() is called, the memory of the string will be
# released.
# 
# \since REMARKS_API_VERSION=0
cdef const char * LLVMRemarkParserGetErrorMessage(LLVMRemarkParserRef Parser)


# 
# Releases all the resources used by \p Parser.
# 
# \since REMARKS_API_VERSION=0
cdef void LLVMRemarkParserDispose(LLVMRemarkParserRef Parser)


# 
# Returns the version of the remarks library.
# 
# \since REMARKS_API_VERSION=0
cdef uint32_t LLVMRemarkVersion()


cdef bint __remarks_has_symbol(const char* name) noexcept nogil