rocm.bindings.llvm.c.cytargetmachine#
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.cytargetmachine from your Cython code to access
these declarations directly.
See also
The high-level Python API is documented at rocm.bindings.llvm.c.targetmachine.
# 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.cytarget cimport *
from rocm.bindings.llvm.c.cytypes cimport *
from rocm.bindings.llvm.c.cyvisibility cimport *
cdef extern from "llvm-c/TargetMachine.h":
cdef struct LLVMOpaqueTargetMachineOptions:
pass
ctypedef LLVMOpaqueTargetMachineOptions * LLVMTargetMachineOptionsRef
cdef struct LLVMOpaqueTargetMachine:
pass
ctypedef LLVMOpaqueTargetMachine * LLVMTargetMachineRef
cdef struct LLVMTarget:
pass
ctypedef LLVMTarget * LLVMTargetRef
ctypedef enum LLVMCodeGenOptLevel:
LLVMCodeGenLevelNone
LLVMCodeGenLevelLess
LLVMCodeGenLevelDefault
LLVMCodeGenLevelAggressive
ctypedef enum LLVMRelocMode:
LLVMRelocDefault
LLVMRelocStatic
LLVMRelocPIC
LLVMRelocDynamicNoPic
LLVMRelocROPI
LLVMRelocRWPI
LLVMRelocROPI_RWPI
ctypedef enum LLVMCodeModel:
LLVMCodeModelDefault
LLVMCodeModelJITDefault
LLVMCodeModelTiny
LLVMCodeModelSmall
LLVMCodeModelKernel
LLVMCodeModelMedium
LLVMCodeModelLarge
ctypedef enum LLVMCodeGenFileType:
LLVMAssemblyFile
LLVMObjectFile
ctypedef enum LLVMGlobalISelAbortMode:
LLVMGlobalISelAbortEnable
LLVMGlobalISelAbortDisable
LLVMGlobalISelAbortDisableWithDiag
# Returns the first llvm::Target in the registered targets list.
cdef LLVMTargetRef LLVMGetFirstTarget() except? NULL nogil
# Returns the next llvm::Target given a previous one (or null if there's none)
cdef LLVMTargetRef LLVMGetNextTarget(LLVMTargetRef T) except? NULL nogil
# Finds the target corresponding to the given name and stores it in \p T.
# Returns 0 on success.
cdef LLVMTargetRef LLVMGetTargetFromName(const char * Name) except? NULL nogil
# Finds the target corresponding to the given triple and stores it in \p T.
# Returns 0 on success. Optionally returns any error in ErrorMessage.
# Use LLVMDisposeMessage to dispose the message.
cdef int LLVMGetTargetFromTriple(const char * Triple,LLVMTargetRef * T,char ** ErrorMessage) except? -1 nogil
# Returns the name of a target. See llvm::Target::getName
cdef const char * LLVMGetTargetName(LLVMTargetRef T) except? NULL nogil
# Returns the description of a target. See llvm::Target::getDescription
cdef const char * LLVMGetTargetDescription(LLVMTargetRef T) except? NULL nogil
# Returns if the target has a JIT
cdef int LLVMTargetHasJIT(LLVMTargetRef T) except? -1 nogil
# Returns if the target has a TargetMachine associated
cdef int LLVMTargetHasTargetMachine(LLVMTargetRef T) except? -1 nogil
# Returns if the target as an ASM backend (required for emitting output)
cdef int LLVMTargetHasAsmBackend(LLVMTargetRef T) except? -1 nogil
#
# Create a new set of options for an llvm::TargetMachine.
#
# The returned option structure must be released with
# LLVMDisposeTargetMachineOptions() after the call to
# LLVMCreateTargetMachineWithOptions().
cdef LLVMTargetMachineOptionsRef LLVMCreateTargetMachineOptions() except? NULL nogil
#
# Dispose of an LLVMTargetMachineOptionsRef instance.
cdef void LLVMDisposeTargetMachineOptions(LLVMTargetMachineOptionsRef Options) noexcept nogil
cdef void LLVMTargetMachineOptionsSetCPU(LLVMTargetMachineOptionsRef Options,const char * CPU) noexcept nogil
#
# Set the list of features for the target machine.
#
# \param Features a comma-separated list of features.
cdef void LLVMTargetMachineOptionsSetFeatures(LLVMTargetMachineOptionsRef Options,const char * Features) noexcept nogil
cdef void LLVMTargetMachineOptionsSetABI(LLVMTargetMachineOptionsRef Options,const char * ABI) noexcept nogil
cdef void LLVMTargetMachineOptionsSetCodeGenOptLevel(LLVMTargetMachineOptionsRef Options,LLVMCodeGenOptLevel Level) noexcept nogil
cdef void LLVMTargetMachineOptionsSetRelocMode(LLVMTargetMachineOptionsRef Options,LLVMRelocMode Reloc) noexcept nogil
cdef void LLVMTargetMachineOptionsSetCodeModel(LLVMTargetMachineOptionsRef Options,LLVMCodeModel CodeModel) noexcept nogil
#
# Create a new llvm::TargetMachine.
#
# \param T the target to create a machine for.
# \param Triple a triple describing the target machine.
# \param Options additional configuration (see
# LLVMCreateTargetMachineOptions()).
cdef LLVMTargetMachineRef LLVMCreateTargetMachineWithOptions(LLVMTargetRef T,const char * Triple,LLVMTargetMachineOptionsRef Options) except? NULL nogil
# Creates a new llvm::TargetMachine. See llvm::Target::createTargetMachine
cdef LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T,const char * Triple,const char * CPU,const char * Features,LLVMCodeGenOptLevel Level,LLVMRelocMode Reloc,LLVMCodeModel CodeModel) except? NULL nogil
# Dispose the LLVMTargetMachineRef instance generated by
# LLVMCreateTargetMachine.
cdef void LLVMDisposeTargetMachine(LLVMTargetMachineRef T) noexcept nogil
# Returns the Target used in a TargetMachine
cdef LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T) except? NULL nogil
# Returns the triple used creating this target machine. See
# llvm::TargetMachine::getTriple. The result needs to be disposed with
# LLVMDisposeMessage.
cdef char * LLVMGetTargetMachineTriple(LLVMTargetMachineRef T) except? NULL nogil
# Returns the cpu used creating this target machine. See
# llvm::TargetMachine::getCPU. The result needs to be disposed with
# LLVMDisposeMessage.
cdef char * LLVMGetTargetMachineCPU(LLVMTargetMachineRef T) except? NULL nogil
# Returns the feature string used creating this target machine. See
# llvm::TargetMachine::getFeatureString. The result needs to be disposed with
# LLVMDisposeMessage.
cdef char * LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T) except? NULL nogil
# Create a DataLayout based on the targetMachine.
cdef LLVMTargetDataRef LLVMCreateTargetDataLayout(LLVMTargetMachineRef T) except? NULL nogil
# Set the target machine's ASM verbosity.
cdef void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,int VerboseAsm) noexcept nogil
# Enable fast-path instruction selection.
cdef void LLVMSetTargetMachineFastISel(LLVMTargetMachineRef T,int Enable) noexcept nogil
# Enable global instruction selection.
cdef void LLVMSetTargetMachineGlobalISel(LLVMTargetMachineRef T,int Enable) noexcept nogil
# Set abort behaviour when global instruction selection fails to lower/select
# an instruction.
cdef void LLVMSetTargetMachineGlobalISelAbort(LLVMTargetMachineRef T,LLVMGlobalISelAbortMode Mode) noexcept nogil
# Enable the MachineOutliner pass.
cdef void LLVMSetTargetMachineMachineOutliner(LLVMTargetMachineRef T,int Enable) noexcept nogil
# Emits an asm or object file for the given module to the filename. This
# wraps several c++ only classes (among them a file stream). Returns any
# error in ErrorMessage. Use LLVMDisposeMessage to dispose the message.
cdef int LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T,LLVMModuleRef M,const char * Filename,LLVMCodeGenFileType codegen,char ** ErrorMessage) except? -1 nogil
# Compile the LLVM IR stored in \p M and store the result in \p OutMemBuf.
cdef int LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T,LLVMModuleRef M,LLVMCodeGenFileType codegen,char ** ErrorMessage,LLVMMemoryBufferRef * OutMemBuf) except? -1 nogil
# Get a triple for the host machine as a string. The result needs to be
# disposed with LLVMDisposeMessage.
cdef char * LLVMGetDefaultTargetTriple() except? NULL nogil
# Normalize a target triple. The result needs to be disposed with
# LLVMDisposeMessage.
cdef char * LLVMNormalizeTargetTriple(const char * triple) except? NULL nogil
# Get the host CPU as a string. The result needs to be disposed with
# LLVMDisposeMessage.
cdef char * LLVMGetHostCPUName() except? NULL nogil
# Get the host CPU's features as a string. The result needs to be disposed
# with LLVMDisposeMessage.
cdef char * LLVMGetHostCPUFeatures() except? NULL nogil
# Adds the target-specific analysis passes to the pass manager.
cdef void LLVMAddAnalysisPasses(LLVMTargetMachineRef T,LLVMPassManagerRef PM) noexcept nogil
cdef bint __targetmachine_has_symbol(const char* name) noexcept nogil