MLIR
19.0.0git
|
#include "mlir-c/Dialect/LLVM.h"
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/CAPI/Wrap.h"
#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "llvm-c/Core.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallVectorExtras.h"
Go to the source code of this file.
Functions | |
MlirType | mlirLLVMPointerTypeGet (MlirContext ctx, unsigned addressSpace) |
Creates an llvm.ptr type. More... | |
MlirType | mlirLLVMVoidTypeGet (MlirContext ctx) |
Creates an llmv.void type. More... | |
MlirType | mlirLLVMArrayTypeGet (MlirType elementType, unsigned numElements) |
Creates an llvm.array type. More... | |
MlirType | mlirLLVMFunctionTypeGet (MlirType resultType, intptr_t nArgumentTypes, MlirType const *argumentTypes, bool isVarArg) |
Creates an llvm.func type. More... | |
bool | mlirTypeIsALLVMStructType (MlirType type) |
Returns true if the type is an LLVM dialect struct type. More... | |
bool | mlirLLVMStructTypeIsLiteral (MlirType type) |
Returns true if the type is a literal (unnamed) LLVM struct type. More... | |
intptr_t | mlirLLVMStructTypeGetNumElementTypes (MlirType type) |
Returns the number of fields in the struct. More... | |
MlirType | mlirLLVMStructTypeGetElementType (MlirType type, intptr_t position) |
Returns the positions -th field of the struct. More... | |
bool | mlirLLVMStructTypeIsPacked (MlirType type) |
Returns true if the struct is packed. More... | |
MlirStringRef | mlirLLVMStructTypeGetIdentifier (MlirType type) |
Returns the identifier of the identified struct. More... | |
bool | mlirLLVMStructTypeIsOpaque (MlirType type) |
Returns true is the struct is explicitly opaque (will not have a body) or uninitialized (will eventually have a body). More... | |
MlirType | mlirLLVMStructTypeLiteralGet (MlirContext ctx, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked) |
Creates an LLVM literal (unnamed) struct type. More... | |
MlirType | mlirLLVMStructTypeLiteralGetChecked (MlirLocation loc, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked) |
Creates an LLVM literal (unnamed) struct type if possible. More... | |
MlirType | mlirLLVMStructTypeOpaqueGet (MlirContext ctx, MlirStringRef name) |
MlirType | mlirLLVMStructTypeIdentifiedGet (MlirContext ctx, MlirStringRef name) |
Creates an LLVM identified struct type with no body. More... | |
MlirType | mlirLLVMStructTypeIdentifiedNewGet (MlirContext ctx, MlirStringRef name, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked) |
Creates an LLVM identified struct type with no body and a name starting with the given prefix. More... | |
MlirLogicalResult | mlirLLVMStructTypeSetBody (MlirType structType, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked) |
Sets the body of the identified struct if it hasn't been set yet. More... | |
MlirAttribute | mlirLLVMDIExpressionElemAttrGet (MlirContext ctx, unsigned int opcode, intptr_t nArguments, uint64_t const *arguments) |
Creates a LLVM DIExpressionElem attribute. More... | |
MlirAttribute | mlirLLVMDIExpressionAttrGet (MlirContext ctx, intptr_t nOperations, MlirAttribute const *operations) |
Creates a LLVM DIExpression attribute. More... | |
MlirAttribute | mlirLLVMDINullTypeAttrGet (MlirContext ctx) |
Creates a LLVM DINullType attribute. More... | |
MlirAttribute | mlirLLVMDIBasicTypeAttrGet (MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, MlirLLVMTypeEncoding encoding) |
Creates a LLVM DIBasicType attribute. More... | |
MlirAttribute | mlirLLVMDICompositeTypeAttrGet (MlirContext ctx, unsigned int tag, MlirAttribute recId, MlirAttribute name, MlirAttribute file, uint32_t line, MlirAttribute scope, MlirAttribute baseType, int64_t flags, uint64_t sizeInBits, uint64_t alignInBits, intptr_t nElements, MlirAttribute const *elements) |
Creates a LLVM DICompositeType attribute. More... | |
MlirAttribute | mlirLLVMDIDerivedTypeAttrGet (MlirContext ctx, unsigned int tag, MlirAttribute name, MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, MlirAttribute extraData) |
Creates a LLVM DIDerivedType attribute. More... | |
MlirAttribute | mlirLLVMDIDerivedTypeAttrGetBaseType (MlirAttribute diDerivedType) |
Gets the base type from a LLVM DIDerivedType attribute. More... | |
MlirAttribute | mlirLLVMCConvAttrGet (MlirContext ctx, MlirLLVMCConv cconv) |
Creates a LLVM CConv attribute. More... | |
MlirAttribute | mlirLLVMComdatAttrGet (MlirContext ctx, MlirLLVMComdat comdat) |
Creates a LLVM Comdat attribute. More... | |
MlirAttribute | mlirLLVMLinkageAttrGet (MlirContext ctx, MlirLLVMLinkage linkage) |
Creates a LLVM Linkage attribute. More... | |
MlirAttribute | mlirLLVMDIFileAttrGet (MlirContext ctx, MlirAttribute name, MlirAttribute directory) |
Creates a LLVM DIFileAttr attribute. More... | |
MlirAttribute | mlirLLVMDICompileUnitAttrGet (MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer, bool isOptimized, MlirLLVMDIEmissionKind emissionKind) |
Creates a LLVM DICompileUnit attribute. More... | |
MlirAttribute | mlirLLVMDIFlagsAttrGet (MlirContext ctx, uint64_t value) |
Creates a LLVM DIFlags attribute. More... | |
MlirAttribute | mlirLLVMDILexicalBlockAttrGet (MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column) |
Creates a LLVM DILexicalBlock attribute. More... | |
MlirAttribute | mlirLLVMDILexicalBlockFileAttrGet (MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int discriminator) |
Creates a LLVM DILexicalBlockFile attribute. More... | |
MlirAttribute | mlirLLVMDILocalVariableAttrGet (MlirContext ctx, MlirAttribute scope, MlirAttribute name, MlirAttribute diFile, unsigned int line, unsigned int arg, unsigned int alignInBits, MlirAttribute diType) |
Creates a LLVM DILocalVariableAttr attribute. More... | |
MlirAttribute | mlirLLVMDISubroutineTypeAttrGet (MlirContext ctx, unsigned int callingConvention, intptr_t nTypes, MlirAttribute const *types) |
Creates a LLVM DISubroutineTypeAttr attribute. More... | |
MlirAttribute | mlirLLVMDISubprogramAttrGet (MlirContext ctx, MlirAttribute id, MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name, MlirAttribute linkageName, MlirAttribute file, unsigned int line, unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type) |
Creates a LLVM DISubprogramAttr attribute. More... | |
MlirAttribute | mlirLLVMDISubprogramAttrGetScope (MlirAttribute diSubprogram) |
Gets the scope from this DISubprogramAttr. More... | |
unsigned int | mlirLLVMDISubprogramAttrGetLine (MlirAttribute diSubprogram) |
Gets the line from this DISubprogramAttr. More... | |
unsigned int | mlirLLVMDISubprogramAttrGetScopeLine (MlirAttribute diSubprogram) |
Gets the scope line from this DISubprogram. More... | |
MlirAttribute | mlirLLVMDISubprogramAttrGetCompileUnit (MlirAttribute diSubprogram) |
Gets the compile unit from this DISubprogram. More... | |
MlirAttribute | mlirLLVMDISubprogramAttrGetFile (MlirAttribute diSubprogram) |
Gets the file from this DISubprogramAttr. More... | |
MlirAttribute | mlirLLVMDISubprogramAttrGetType (MlirAttribute diSubprogram) |
Gets the type from this DISubprogramAttr. More... | |
MlirAttribute | mlirLLVMDIModuleAttrGet (MlirContext ctx, MlirAttribute file, MlirAttribute scope, MlirAttribute name, MlirAttribute configMacros, MlirAttribute includePath, MlirAttribute apinotes, unsigned int line, bool isDecl) |
Creates a LLVM DIModuleAttr attribute. More... | |
MlirAttribute | mlirLLVMDIModuleAttrGetScope (MlirAttribute diModule) |
Gets the scope of this DIModuleAttr. More... | |
MlirType mlirLLVMArrayTypeGet | ( | MlirType | elementType, |
unsigned | numElements | ||
) |
Creates an llvm.array type.
Definition at line 34 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMCConvAttrGet | ( | MlirContext | ctx, |
MlirLLVMCConv | cconv | ||
) |
Creates a LLVM CConv attribute.
Definition at line 187 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMComdatAttrGet | ( | MlirContext | ctx, |
MlirLLVMComdat | comdat | ||
) |
Creates a LLVM Comdat attribute.
Definition at line 191 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDIBasicTypeAttrGet | ( | MlirContext | ctx, |
unsigned int | tag, | ||
MlirAttribute | name, | ||
uint64_t | sizeInBits, | ||
MlirLLVMTypeEncoding | encoding | ||
) |
Creates a LLVM DIBasicType attribute.
Definition at line 145 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDICompileUnitAttrGet | ( | MlirContext | ctx, |
MlirAttribute | id, | ||
unsigned int | sourceLanguage, | ||
MlirAttribute | file, | ||
MlirAttribute | producer, | ||
bool | isOptimized, | ||
MlirLLVMDIEmissionKind | emissionKind | ||
) |
Creates a LLVM DICompileUnit attribute.
Definition at line 206 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDICompositeTypeAttrGet | ( | MlirContext | ctx, |
unsigned int | tag, | ||
MlirAttribute | recId, | ||
MlirAttribute | name, | ||
MlirAttribute | file, | ||
uint32_t | line, | ||
MlirAttribute | scope, | ||
MlirAttribute | baseType, | ||
int64_t | flags, | ||
uint64_t | sizeInBits, | ||
uint64_t | alignInBits, | ||
intptr_t | nElements, | ||
MlirAttribute const * | elements | ||
) |
Creates a LLVM DICompositeType attribute.
Definition at line 154 of file LLVM.cpp.
References mlir::Attribute::cast(), mlir::get(), unwrap(), unwrapList(), and wrap().
MlirAttribute mlirLLVMDIDerivedTypeAttrGet | ( | MlirContext | ctx, |
unsigned int | tag, | ||
MlirAttribute | name, | ||
MlirAttribute | baseType, | ||
uint64_t | sizeInBits, | ||
uint32_t | alignInBits, | ||
uint64_t | offsetInBits, | ||
MlirAttribute | extraData | ||
) |
Creates a LLVM DIDerivedType attribute.
Definition at line 172 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDIDerivedTypeAttrGetBaseType | ( | MlirAttribute | diDerivedType | ) |
MlirAttribute mlirLLVMDIExpressionAttrGet | ( | MlirContext | ctx, |
intptr_t | nOperations, | ||
MlirAttribute const * | operations | ||
) |
Creates a LLVM DIExpression attribute.
Definition at line 129 of file LLVM.cpp.
References mlir::Attribute::cast(), mlir::get(), unwrap(), unwrapList(), and wrap().
MlirAttribute mlirLLVMDIExpressionElemAttrGet | ( | MlirContext | ctx, |
unsigned int | opcode, | ||
intptr_t | nArguments, | ||
uint64_t const * | arguments | ||
) |
Creates a LLVM DIExpressionElem attribute.
Definition at line 121 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDIFileAttrGet | ( | MlirContext | ctx, |
MlirAttribute | name, | ||
MlirAttribute | directory | ||
) |
Creates a LLVM DIFileAttr attribute.
Definition at line 199 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDIFlagsAttrGet | ( | MlirContext | ctx, |
uint64_t | value | ||
) |
Creates a LLVM DIFlags attribute.
Definition at line 216 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDILexicalBlockAttrGet | ( | MlirContext | ctx, |
MlirAttribute | scope, | ||
MlirAttribute | file, | ||
unsigned int | line, | ||
unsigned int | column | ||
) |
Creates a LLVM DILexicalBlock attribute.
Definition at line 220 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet | ( | MlirContext | ctx, |
MlirAttribute | scope, | ||
MlirAttribute | file, | ||
unsigned int | discriminator | ||
) |
Creates a LLVM DILexicalBlockFile attribute.
Definition at line 230 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDILocalVariableAttrGet | ( | MlirContext | ctx, |
MlirAttribute | scope, | ||
MlirAttribute | name, | ||
MlirAttribute | diFile, | ||
unsigned int | line, | ||
unsigned int | arg, | ||
unsigned int | alignInBits, | ||
MlirAttribute | diType | ||
) |
Creates a LLVM DILocalVariableAttr attribute.
Definition at line 240 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDIModuleAttrGet | ( | MlirContext | ctx, |
MlirAttribute | file, | ||
MlirAttribute | scope, | ||
MlirAttribute | name, | ||
MlirAttribute | configMacros, | ||
MlirAttribute | includePath, | ||
MlirAttribute | apinotes, | ||
unsigned int | line, | ||
bool | isDecl | ||
) |
Creates a LLVM DIModuleAttr attribute.
Definition at line 302 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDIModuleAttrGetScope | ( | MlirAttribute | diModule | ) |
MlirAttribute mlirLLVMDINullTypeAttrGet | ( | MlirContext | ctx | ) |
Creates a LLVM DINullType attribute.
Definition at line 141 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDISubprogramAttrGet | ( | MlirContext | ctx, |
MlirAttribute | id, | ||
MlirAttribute | compileUnit, | ||
MlirAttribute | scope, | ||
MlirAttribute | name, | ||
MlirAttribute | linkageName, | ||
MlirAttribute | file, | ||
unsigned int | line, | ||
unsigned int | scopeLine, | ||
uint64_t | subprogramFlags, | ||
MlirAttribute | type | ||
) |
Creates a LLVM DISubprogramAttr attribute.
Definition at line 263 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirAttribute mlirLLVMDISubprogramAttrGetCompileUnit | ( | MlirAttribute | diSubprogram | ) |
MlirAttribute mlirLLVMDISubprogramAttrGetFile | ( | MlirAttribute | diSubprogram | ) |
unsigned int mlirLLVMDISubprogramAttrGetLine | ( | MlirAttribute | diSubprogram | ) |
MlirAttribute mlirLLVMDISubprogramAttrGetScope | ( | MlirAttribute | diSubprogram | ) |
unsigned int mlirLLVMDISubprogramAttrGetScopeLine | ( | MlirAttribute | diSubprogram | ) |
MlirAttribute mlirLLVMDISubprogramAttrGetType | ( | MlirAttribute | diSubprogram | ) |
MlirAttribute mlirLLVMDISubroutineTypeAttrGet | ( | MlirContext | ctx, |
unsigned int | callingConvention, | ||
intptr_t | nTypes, | ||
MlirAttribute const * | types | ||
) |
Creates a LLVM DISubroutineTypeAttr attribute.
Definition at line 250 of file LLVM.cpp.
References mlir::Attribute::cast(), mlir::get(), unwrap(), unwrapList(), and wrap().
MlirType mlirLLVMFunctionTypeGet | ( | MlirType | resultType, |
intptr_t | nArgumentTypes, | ||
MlirType const * | argumentTypes, | ||
bool | isVarArg | ||
) |
Creates an llvm.func type.
Definition at line 38 of file LLVM.cpp.
References mlir::get(), unwrap(), unwrapList(), and wrap().
MlirAttribute mlirLLVMLinkageAttrGet | ( | MlirContext | ctx, |
MlirLLVMLinkage | linkage | ||
) |
Creates a LLVM Linkage attribute.
Definition at line 195 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirType mlirLLVMPointerTypeGet | ( | MlirContext | ctx, |
unsigned | addressSpace | ||
) |
Creates an llvm.ptr type.
Definition at line 26 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
MlirType mlirLLVMStructTypeGetElementType | ( | MlirType | type, |
intptr_t | position | ||
) |
Returns the positions
-th field of the struct.
Asserts if the struct is opaque, not yet initialized or if the position is out of range.
Definition at line 58 of file LLVM.cpp.
References unwrap(), and wrap().
Referenced by populateDialectLLVMSubmodule().
MlirStringRef mlirLLVMStructTypeGetIdentifier | ( | MlirType | type | ) |
Returns the identifier of the identified struct.
Asserts that the struct is identified, i.e., not literal.
Definition at line 66 of file LLVM.cpp.
References unwrap(), and wrap().
Referenced by populateDialectLLVMSubmodule().
intptr_t mlirLLVMStructTypeGetNumElementTypes | ( | MlirType | type | ) |
Returns the number of fields in the struct.
Asserts if the struct is opaque or not yet initialized.
Definition at line 54 of file LLVM.cpp.
References unwrap().
Referenced by populateDialectLLVMSubmodule().
MlirType mlirLLVMStructTypeIdentifiedGet | ( | MlirContext | ctx, |
MlirStringRef | name | ||
) |
Creates an LLVM identified struct type with no body.
If a struct type with this name already exists in the context, returns that type. Use mlirLLVMStructTypeIdentifiedNewGet to create a fresh struct type, potentially renaming it. The body should be set separatelty by calling mlirLLVMStructTypeSetBody, if it isn't set already.
Definition at line 97 of file LLVM.cpp.
References mlir::LLVM::LLVMStructType::getIdentified(), unwrap(), and wrap().
Referenced by populateDialectLLVMSubmodule().
MlirType mlirLLVMStructTypeIdentifiedNewGet | ( | MlirContext | ctx, |
MlirStringRef | name, | ||
intptr_t | nFieldTypes, | ||
MlirType const * | fieldTypes, | ||
bool | isPacked | ||
) |
Creates an LLVM identified struct type with no body and a name starting with the given prefix.
If a struct with the exact name as the given prefix already exists, appends an unspecified suffix to the name so that the name is unique in context.
Definition at line 101 of file LLVM.cpp.
References mlir::LLVM::LLVMStructType::getNewIdentified(), unwrap(), unwrapList(), and wrap().
Referenced by populateDialectLLVMSubmodule().
bool mlirLLVMStructTypeIsLiteral | ( | MlirType | type | ) |
Returns true
if the type is a literal (unnamed) LLVM struct type.
Definition at line 50 of file LLVM.cpp.
References unwrap().
Referenced by populateDialectLLVMSubmodule().
bool mlirLLVMStructTypeIsOpaque | ( | MlirType | type | ) |
Returns true
is the struct is explicitly opaque (will not have a body) or uninitialized (will eventually have a body).
Definition at line 70 of file LLVM.cpp.
References unwrap().
Referenced by populateDialectLLVMSubmodule().
bool mlirLLVMStructTypeIsPacked | ( | MlirType | type | ) |
Returns true
if the struct is packed.
Definition at line 62 of file LLVM.cpp.
References unwrap().
Referenced by populateDialectLLVMSubmodule().
MlirType mlirLLVMStructTypeLiteralGet | ( | MlirContext | ctx, |
intptr_t | nFieldTypes, | ||
MlirType const * | fieldTypes, | ||
bool | isPacked | ||
) |
Creates an LLVM literal (unnamed) struct type.
This may assert if the fields have types not compatible with the LLVM dialect. For a graceful failure, use the checked version.
Definition at line 74 of file LLVM.cpp.
References mlir::LLVM::LLVMStructType::getLiteral(), unwrap(), unwrapList(), and wrap().
MlirType mlirLLVMStructTypeLiteralGetChecked | ( | MlirLocation | loc, |
intptr_t | nFieldTypes, | ||
MlirType const * | fieldTypes, | ||
bool | isPacked | ||
) |
Creates an LLVM literal (unnamed) struct type if possible.
Emits a diagnostic at the given location and returns null otherwise.
Definition at line 83 of file LLVM.cpp.
References mlir::emitError(), mlir::LLVM::LLVMStructType::getLiteralChecked(), unwrap(), unwrapList(), and wrap().
Referenced by populateDialectLLVMSubmodule().
MlirType mlirLLVMStructTypeOpaqueGet | ( | MlirContext | ctx, |
MlirStringRef | name | ||
) |
Definition at line 93 of file LLVM.cpp.
References mlir::LLVM::LLVMStructType::getOpaque(), unwrap(), and wrap().
Referenced by populateDialectLLVMSubmodule().
MlirLogicalResult mlirLLVMStructTypeSetBody | ( | MlirType | structType, |
intptr_t | nFieldTypes, | ||
MlirType const * | fieldTypes, | ||
bool | isPacked | ||
) |
Sets the body of the identified struct if it hasn't been set yet.
Returns whether the operation was successful.
Definition at line 111 of file LLVM.cpp.
References unwrap(), unwrapList(), and wrap().
Referenced by populateDialectLLVMSubmodule().
MlirType mlirLLVMVoidTypeGet | ( | MlirContext | ctx | ) |
Creates an llmv.void type.
Definition at line 30 of file LLVM.cpp.
References mlir::get(), unwrap(), and wrap().
bool mlirTypeIsALLVMStructType | ( | MlirType | type | ) |
Returns true
if the type is an LLVM dialect struct type.
Definition at line 46 of file LLVM.cpp.
References unwrap().
Referenced by populateDialectLLVMSubmodule().