17#include "llvm-c/Core.h"
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/ADT/SmallVectorExtras.h"
27 return wrap(LLVMPointerType::get(
unwrap(ctx), addressSpace));
31 return wrap(LLVM::LLVMPointerType::name);
35 return wrap(LLVM::LLVMPointerType::getTypeID());
39 return isa<LLVM::LLVMPointerType>(
unwrap(type));
43 return cast<LLVM::LLVMPointerType>(
unwrap(pointerType)).getAddressSpace();
53 return isa<LLVM::LLVMArrayType>(
unwrap(type));
57 return wrap(LLVM::LLVMArrayType::getTypeID());
61 return wrap(LLVMArrayType::get(
unwrap(elementType), numElements));
65 return wrap(LLVMArrayType::name);
73 return cast<LLVM::LLVMArrayType>(
unwrap(type)).getNumElements();
77 MlirType
const *argumentTypes,
bool isVarArg) {
79 return wrap(LLVMFunctionType::get(
81 unwrapList(nArgumentTypes, argumentTypes, argumentStorage), isVarArg));
85 return wrap(LLVMFunctionType::name);
89 return isa<LLVM::LLVMFunctionType>(
unwrap(type));
93 return wrap(LLVM::LLVMFunctionType::getTypeID());
97 return llvm::cast<LLVM::LLVMFunctionType>(
unwrap(type)).getNumParams();
101 assert(pos >= 0 &&
"pos in array must be positive");
102 return wrap(llvm::cast<LLVM::LLVMFunctionType>(
unwrap(type))
103 .getParamType(
static_cast<unsigned>(pos)));
107 return wrap(llvm::cast<LLVM::LLVMFunctionType>(
unwrap(type)).getReturnType());
111 return llvm::cast<LLVM::LLVMFunctionType>(
unwrap(type)).isVarArg();
115 return isa<LLVM::LLVMStructType>(
unwrap(type));
119 return wrap(LLVM::LLVMStructType::getTypeID());
123 return wrap(LLVM::LLVMStructType::name);
127 return !cast<LLVM::LLVMStructType>(
unwrap(type)).isIdentified();
131 return cast<LLVM::LLVMStructType>(
unwrap(type)).getBody().size();
135 return wrap(cast<LLVM::LLVMStructType>(
unwrap(type)).getBody()[position]);
139 return cast<LLVM::LLVMStructType>(
unwrap(type)).isPacked();
143 return wrap(cast<LLVM::LLVMStructType>(
unwrap(type)).getName());
147 return cast<LLVM::LLVMStructType>(
unwrap(type)).isOpaque();
151 MlirType
const *fieldTypes,
154 return wrap(LLVMStructType::getLiteral(
161 MlirType
const *fieldTypes,
164 return wrap(LLVMStructType::getLiteralChecked(
166 unwrapList(nFieldTypes, fieldTypes, fieldStorage), isPacked));
179 MlirType
const *fieldTypes,
182 return wrap(LLVMStructType::getNewIdentified(
189 MlirType
const *fieldTypes,
193 cast<LLVM::LLVMStructType>(
unwrap(structType))
194 .setBody(
unwrapList(nFieldTypes, fieldTypes, fields), isPacked));
200 uint64_t
const *arguments) {
202 return wrap(DIExpressionElemAttr::get(
unwrap(ctx), opcode, list));
206 return wrap(DIExpressionElemAttr::name);
210 MlirAttribute
const *operations) {
212 attrStorage.reserve(nOperations);
214 return wrap(DIExpressionAttr::get(
216 llvm::map_to_vector(
unwrapList(nOperations, operations, attrStorage),
217 llvm::CastTo<DIExpressionElemAttr>)));
221 return wrap(DIExpressionAttr::name);
225 return wrap(DINullTypeAttr::get(
unwrap(ctx)));
229 return wrap(DINullTypeAttr::name);
237 return wrap(DIBasicTypeAttr::get(
238 unwrap(ctx), tag, cast<StringAttr>(
unwrap(name)), sizeInBits, encoding));
242 return wrap(DIBasicTypeAttr::name);
247 DICompositeTypeAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
251 MlirContext ctx, MlirAttribute recId,
bool isRecSelf,
unsigned int tag,
252 MlirAttribute name, MlirAttribute file, uint32_t line, MlirAttribute scope,
253 MlirAttribute baseType,
int64_t flags, uint64_t sizeInBits,
254 uint64_t alignInBits,
intptr_t nElements, MlirAttribute
const *elements,
255 MlirAttribute dataLocation, MlirAttribute rank, MlirAttribute allocated,
256 MlirAttribute associated) {
258 elementsStorage.reserve(nElements);
260 return wrap(DICompositeTypeAttr::get(
261 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf, tag,
262 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(file)), line,
263 cast<DIScopeAttr>(
unwrap(scope)), cast<DITypeAttr>(
unwrap(baseType)),
264 DIFlags(flags), sizeInBits, alignInBits,
265 cast<DIExpressionAttr>(
unwrap(dataLocation)),
266 cast<DIExpressionAttr>(
unwrap(rank)),
267 cast<DIExpressionAttr>(
unwrap(allocated)),
268 cast<DIExpressionAttr>(
unwrap(associated)),
269 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
270 llvm::CastTo<DINodeAttr>)));
274 return wrap(DICompositeTypeAttr::name);
278 MlirContext ctx,
unsigned int tag, MlirAttribute name, MlirAttribute file,
279 uint32_t line, MlirAttribute scope, MlirAttribute baseType,
280 uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits,
281 int64_t dwarfAddressSpace,
int64_t flags, MlirAttribute extraData) {
282 std::optional<unsigned> addressSpace = std::nullopt;
283 if (dwarfAddressSpace >= 0)
284 addressSpace = (
unsigned)dwarfAddressSpace;
285 return wrap(DIDerivedTypeAttr::get(
287 cast<DIFileAttr>(
unwrap(file)), line, cast<DIScopeAttr>(
unwrap(scope)),
288 cast<DITypeAttr>(
unwrap(baseType)), sizeInBits, alignInBits, offsetInBits,
289 addressSpace, DIFlags(flags), cast<DINodeAttr>(
unwrap(extraData))));
293 return wrap(DIDerivedTypeAttr::name);
297 MlirContext ctx,
unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
298 uint32_t alignInBits, MlirAttribute stringLength,
299 MlirAttribute stringLengthExp, MlirAttribute stringLocationExp,
301 return wrap(DIStringTypeAttr::get(
302 unwrap(ctx), tag, cast<StringAttr>(
unwrap(name)), sizeInBits, alignInBits,
303 cast<DIVariableAttr>(
unwrap(stringLength)),
304 cast<DIExpressionAttr>(
unwrap(stringLengthExp)),
305 cast<DIExpressionAttr>(
unwrap(stringLocationExp)), encoding));
309 return wrap(DIStringTypeAttr::name);
314 return wrap(cast<DIDerivedTypeAttr>(
unwrap(diDerivedType)).getBaseType());
318 return wrap(CConvAttr::get(
unwrap(ctx), CConv(cconv)));
324 return wrap(ComdatAttr::get(
unwrap(ctx), comdat::Comdat(comdat)));
330 return wrap(LinkageAttr::get(
unwrap(ctx), linkage::Linkage(linkage)));
334 return wrap(LinkageAttr::name);
338 MlirAttribute directory) {
340 cast<StringAttr>(
unwrap(directory))));
346 MlirContext ctx, MlirAttribute
id,
unsigned int sourceLanguage,
347 MlirAttribute file, MlirAttribute producer,
bool isOptimized,
350 intptr_t nImportedEntities, MlirAttribute
const *importedEntities) {
352 importsStorage.reserve(nImportedEntities);
353 return wrap(DICompileUnitAttr::get(
354 unwrap(ctx), cast<DistinctAttr>(
unwrap(
id)), sourceLanguage,
355 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
356 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
357 DINameTableKind(nameTableKind),
358 cast<StringAttr>(
unwrap(splitDebugFilename)),
360 unwrapList(nImportedEntities, importedEntities, importsStorage),
361 llvm::CastTo<DINodeAttr>)));
365 return wrap(DICompileUnitAttr::name);
369 return wrap(DIFlagsAttr::get(
unwrap(ctx), DIFlags(value)));
373 return wrap(DIFlagsAttr::name);
380 unsigned int column) {
382 DILexicalBlockAttr::get(
unwrap(ctx), cast<DIScopeAttr>(
unwrap(scope)),
383 cast<DIFileAttr>(
unwrap(file)), line, column));
387 return wrap(DILexicalBlockAttr::name);
393 unsigned int discriminator) {
394 return wrap(DILexicalBlockFileAttr::get(
396 cast<DIFileAttr>(
unwrap(file)), discriminator));
400 return wrap(DILexicalBlockFileAttr::name);
404 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
405 MlirAttribute diFile,
unsigned int line,
unsigned int arg,
406 unsigned int alignInBits, MlirAttribute diType,
int64_t flags) {
407 return wrap(DILocalVariableAttr::get(
409 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(diFile)), line,
410 arg, alignInBits, cast<DITypeAttr>(
unwrap(diType)), DIFlags(flags)));
414 return wrap(DILocalVariableAttr::name);
418 unsigned int callingConvention,
420 MlirAttribute
const *types) {
422 attrStorage.reserve(nTypes);
424 return wrap(DISubroutineTypeAttr::get(
425 unwrap(ctx), callingConvention,
426 llvm::map_to_vector(
unwrapList(nTypes, types, attrStorage),
427 llvm::CastTo<DITypeAttr>)));
431 return wrap(DISubroutineTypeAttr::name);
435 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
439 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
440 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
441 MlirAttribute linkageName, MlirAttribute file,
unsigned int line,
442 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
443 intptr_t nRetainedNodes, MlirAttribute
const *retainedNodes,
444 intptr_t nAnnotations, MlirAttribute
const *annotations) {
446 nodesStorage.reserve(nRetainedNodes);
449 annotationsStorage.reserve(nAnnotations);
451 return wrap(DISubprogramAttr::get(
452 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
453 cast<DistinctAttr>(
unwrap(
id)),
454 cast<DICompileUnitAttr>(
unwrap(compileUnit)),
455 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
456 cast<StringAttr>(
unwrap(linkageName)), cast<DIFileAttr>(
unwrap(file)),
457 line, scopeLine, DISubprogramFlags(subprogramFlags),
458 cast<DISubroutineTypeAttr>(
unwrap(type)),
460 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
461 llvm::CastTo<DINodeAttr>),
463 unwrapList(nAnnotations, annotations, annotationsStorage),
464 llvm::CastTo<DINodeAttr>)));
468 return wrap(DISubprogramAttr::name);
472 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScope());
476 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getLine();
480 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScopeLine();
485 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getCompileUnit());
489 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getFile());
497 MlirAttribute scope, MlirAttribute name,
498 MlirAttribute configMacros,
499 MlirAttribute includePath,
500 MlirAttribute apinotes,
unsigned int line,
502 return wrap(DIModuleAttr::get(
504 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
505 cast<StringAttr>(
unwrap(configMacros)),
506 cast<StringAttr>(
unwrap(includePath)), cast<StringAttr>(
unwrap(apinotes)),
511 return wrap(DIModuleAttr::name);
515 return wrap(cast<DIModuleAttr>(
unwrap(diModule)).getScope());
519 MlirContext ctx,
unsigned int tag, MlirAttribute scope,
520 MlirAttribute entity, MlirAttribute file,
unsigned int line,
521 MlirAttribute name,
intptr_t nElements, MlirAttribute
const *elements) {
523 elementsStorage.reserve(nElements);
524 return wrap(DIImportedEntityAttr::get(
526 cast<DINodeAttr>(
unwrap(entity)), cast<DIFileAttr>(
unwrap(file)), line,
527 cast<StringAttr>(
unwrap(name)),
528 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
529 llvm::CastTo<DINodeAttr>)));
533 return wrap(DIImportedEntityAttr::name);
537 MlirAttribute value) {
538 return wrap(DIAnnotationAttr::get(
unwrap(ctx), cast<StringAttr>(
unwrap(name)),
539 cast<StringAttr>(
unwrap(value))));
543 return wrap(DIAnnotationAttr::name);
556 return isa<MDStringAttr>(
unwrap(attr));
560 return wrap(MDStringAttr::getTypeID());
564 return wrap(cast<MDStringAttr>(
unwrap(attr)).getValue().getValue());
568 MlirAttribute valueAttr) {
573 return isa<MDConstantAttr>(
unwrap(attr));
577 return wrap(MDConstantAttr::getTypeID());
586 MDFuncAttr::get(
unwrap(ctx), cast<FlatSymbolRefAttr>(
unwrap(name))));
590 return isa<MDFuncAttr>(
unwrap(attr));
594 return wrap(MDFuncAttr::getTypeID());
602 MlirAttribute
const *operands) {
604 attrStorage.reserve(nOperands);
606 unwrapList(nOperands, operands, attrStorage)));
610 return isa<MDNodeAttr>(
unwrap(attr));
614 return wrap(MDNodeAttr::getTypeID());
618 return cast<MDNodeAttr>(
unwrap(attr)).getOperands().size();
static Type getElementType(Type type)
Determine the element type of type.
MlirStringRef mlirLLVMDIFlagsAttrGetName(void)
intptr_t mlirLLVMMDNodeAttrGetNumOperands(MlirAttribute attr)
Returns the number of operands in an LLVM MDNodeAttr.
MlirStringRef mlirLLVMDIModuleAttrGetName(void)
MlirStringRef mlirLLVMDIAnnotationAttrGetName(void)
bool mlirLLVMStructTypeIsLiteral(MlirType type)
Returns true if the type is a literal (unnamed) LLVM struct type.
MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage)
Creates a LLVM Linkage attribute.
MlirAttribute mlirLLVMMDFuncAttrGetName(MlirAttribute attr)
Returns the symbol name of an LLVM MDFuncAttr.
MlirStringRef mlirLLVMDIImportedEntityAttrGetName(void)
MlirTypeID mlirLLVMMDConstantAttrGetTypeID(void)
Returns the TypeID of MDConstantAttr.
MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram)
Gets the file from this DISubprogramAttr.
bool mlirLLVMAttrIsAMDConstantAttr(MlirAttribute attr)
Returns true if the attribute is an LLVM MDConstantAttr.
MlirStringRef mlirLLVMDICompileUnitAttrGetName(void)
MlirStringRef mlirLLVMMDStringAttrGetValue(MlirAttribute attr)
Returns the string value of an LLVM MDStringAttr.
MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes, MlirType const *argumentTypes, bool isVarArg)
Creates an llvm.func type.
MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule)
Gets the scope of this DIModuleAttr.
bool mlirTypeIsALLVMArrayType(MlirType type)
Returns true if the type is an LLVM dialect array type.
MlirStringRef mlirLLVMDISubroutineTypeAttrGetName(void)
MlirAttribute mlirLLVMMDStringAttrGet(MlirContext ctx, MlirStringRef value)
Creates an LLVM MDStringAttr.
MlirType mlirLLVMFunctionTypeGetInput(MlirType type, intptr_t pos)
Returns the pos-th input type.
MlirTypeID mlirLLVMMDFuncAttrGetTypeID(void)
Returns the TypeID of MDFuncAttr.
MlirStringRef mlirLLVMCConvAttrGetName(void)
MlirStringRef mlirLLVMDILexicalBlockAttrGetName(void)
bool mlirTypeIsALLVMFunctionType(MlirType type)
Returns true if the type is an LLVM dialect function type.
MlirStringRef mlirLLVMDIStringTypeAttrGetName(void)
intptr_t mlirLLVMStructTypeGetNumElementTypes(MlirType type)
Returns the number of fields in the struct.
bool mlirLLVMAttrIsAMDNodeAttr(MlirAttribute attr)
Returns true if the attribute is an LLVM MDNodeAttr.
MlirTypeID mlirLLVMMDStringAttrGetTypeID(void)
Returns the TypeID of MDStringAttr.
MlirStringRef mlirLLVMStructTypeGetName(void)
intptr_t mlirLLVMFunctionTypeGetNumInputs(MlirType type)
Returns the number of input types.
MlirStringRef mlirLLVMDILexicalBlockFileAttrGetName(void)
MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx)
Creates a LLVM DINullType attribute.
MlirStringRef mlirLLVMPointerTypeGetName(void)
unsigned mlirLLVMArrayTypeGetNumElements(MlirType type)
Returns the number of elements in the llvm.array type.
MlirTypeID mlirLLVMArrayTypeGetTypeID()
MlirStringRef mlirLLVMDIFileAttrGetName(void)
MlirType mlirLLVMArrayTypeGetElementType(MlirType type)
Returns the element type of the llvm.array type.
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.
MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute directory)
Creates a LLVM DIFileAttr attribute.
MlirTypeID mlirLLVMPointerTypeGetTypeID()
bool mlirTypeIsALLVMStructType(MlirType type)
Returns true if the type is an LLVM dialect struct type.
MlirStringRef mlirLLVMStructTypeGetIdentifier(MlirType type)
Returns the identifier of the identified struct.
MlirAttribute mlirLLVMDIStringTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, uint32_t alignInBits, MlirAttribute stringLength, MlirAttribute stringLengthExp, MlirAttribute stringLocationExp, MlirLLVMTypeEncoding encoding)
MlirAttribute mlirLLVMDICompositeTypeAttrGet(MlirContext ctx, MlirAttribute recId, bool isRecSelf, unsigned int tag, 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, MlirAttribute dataLocation, MlirAttribute rank, MlirAttribute allocated, MlirAttribute associated)
Creates a LLVM DICompositeType attribute.
MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram)
Gets the scope from this DISubprogramAttr.
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column)
Creates a LLVM DILexicalBlock attribute.
MlirAttribute mlirLLVMMDNodeAttrGet(MlirContext ctx, intptr_t nOperands, MlirAttribute const *operands)
Creates an LLVM MDNodeAttr.
MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx, unsigned int opcode, intptr_t nArguments, uint64_t const *arguments)
Creates a LLVM DIExpressionElem attribute.
bool mlirLLVMAttrIsAMDFuncAttr(MlirAttribute attr)
Returns true if the attribute is an LLVM MDFuncAttr.
MlirAttribute mlirLLVMMDFuncAttrGet(MlirContext ctx, MlirAttribute name)
Creates an LLVM MDFuncAttr referencing a function symbol.
MlirAttribute mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DICompositeType attribute.
MlirStringRef mlirLLVMArrayTypeGetName(void)
MlirTypeID mlirLLVMStructTypeGetTypeID()
MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, MlirLLVMTypeEncoding encoding)
Creates a LLVM DIBasicType attribute.
MlirType mlirLLVMFunctionTypeGetReturnType(MlirType type)
Returns the return type of the function type.
MlirAttribute mlirLLVMDIDerivedTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, MlirAttribute file, uint32_t line, MlirAttribute scope, MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, int64_t dwarfAddressSpace, int64_t flags, MlirAttribute extraData)
Creates a LLVM DIDerivedType attribute.
MlirStringRef mlirLLVMDINullTypeAttrGetName(void)
MlirStringRef mlirLLVMDIDerivedTypeAttrGetName(void)
MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat)
Creates a LLVM Comdat attribute.
MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DISubprogramAttr attribute.
MlirType mlirLLVMVoidTypeGet(MlirContext ctx)
Creates an llmv.void type.
MlirStringRef mlirLLVMDIBasicTypeAttrGetName(void)
MlirAttribute mlirLLVMDIImportedEntityAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute scope, MlirAttribute entity, MlirAttribute file, unsigned int line, MlirAttribute name, intptr_t nElements, MlirAttribute const *elements)
Creates a LLVM DIImportedEntityAttr attribute.
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.
MlirAttribute mlirLLVMMDConstantAttrGet(MlirContext ctx, MlirAttribute valueAttr)
Creates an LLVM MDConstantAttr wrapping an attribute.
MlirAttribute mlirLLVMDICompileUnitAttrGet(MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer, bool isOptimized, MlirLLVMDIEmissionKind emissionKind, bool isDebugInfoForProfiling, MlirLLVMDINameTableKind nameTableKind, MlirAttribute splitDebugFilename, intptr_t nImportedEntities, MlirAttribute const *importedEntities)
Creates a LLVM DICompileUnit attribute.
MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position)
Returns the positions-th field of the struct.
MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name)
MlirAttribute mlirLLVMMDNodeAttrGetOperand(MlirAttribute attr, intptr_t index)
Returns the operand at the given index of an LLVM MDNodeAttr.
MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements)
Creates an llvm.array type.
MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram)
Gets the type from this DISubprogramAttr.
MlirTypeID mlirLLVMMDNodeAttrGetTypeID(void)
Returns the TypeID of MDNodeAttr.
bool mlirLLVMFunctionTypeIsVarArg(MlirType type)
Returns true if the function type is variadic.
MlirAttribute mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram)
Gets the compile unit from this DISubprogram.
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.
MlirStringRef mlirLLVMDICompositeTypeAttrGetName(void)
bool mlirLLVMAttrIsAMDStringAttr(MlirAttribute attr)
Returns true if the attribute is an LLVM MDStringAttr.
MlirStringRef mlirLLVMDIExpressionAttrGetName(void)
MlirStringRef mlirLLVMComdatAttrGetName(void)
MlirStringRef mlirLLVMDILocalVariableAttrGetName(void)
MlirStringRef mlirLLVMDISubprogramAttrGetName(void)
MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv)
Creates a LLVM CConv attribute.
MlirStringRef mlirLLVMLinkageAttrGetName(void)
MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute value)
Creates a LLVM DIAnnotation attribute.
MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type if possible.
MlirAttribute mlirLLVMMDConstantAttrGetValue(MlirAttribute attr)
Returns the attribute value of an LLVM MDConstantAttr.
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int discriminator)
Creates a LLVM DILexicalBlockFile attribute.
MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations, MlirAttribute const *operations)
Creates a LLVM DIExpression attribute.
bool mlirLLVMStructTypeIsPacked(MlirType type)
Returns true if the struct is packed.
MlirAttribute mlirLLVMDISubprogramAttrGet(MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id, MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name, MlirAttribute linkageName, MlirAttribute file, unsigned int line, unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type, intptr_t nRetainedNodes, MlirAttribute const *retainedNodes, intptr_t nAnnotations, MlirAttribute const *annotations)
Creates a LLVM DISubprogramAttr attribute.
unsigned mlirLLVMPointerTypeGetAddressSpace(MlirType pointerType)
Returns address space of llvm.ptr.
MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value)
Creates a LLVM DIFlags attribute.
MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name)
Creates an LLVM identified struct type with no body.
MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx, unsigned int callingConvention, intptr_t nTypes, MlirAttribute const *types)
Creates a LLVM DISubroutineTypeAttr attribute.
MlirAttribute mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType)
Gets the base type from a LLVM DIDerivedType attribute.
bool mlirLLVMStructTypeIsOpaque(MlirType type)
Returns true is the struct is explicitly opaque (will not have a body) or uninitialized (will eventua...
bool mlirTypeIsALLVMPointerType(MlirType type)
Returns true if the type is an LLVM dialect pointer type.
MlirTypeID mlirLLVMFunctionTypeGetTypeID(void)
Returns the TypeID of an LLVM function type.
unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram)
Gets the line from this DISubprogramAttr.
MlirAttribute mlirLLVMDILocalVariableAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute name, MlirAttribute diFile, unsigned int line, unsigned int arg, unsigned int alignInBits, MlirAttribute diType, int64_t flags)
Creates a LLVM DILocalVariableAttr attribute.
MlirStringRef mlirLLVMVoidTypeGetName(void)
unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram)
Gets the scope line from this DISubprogram.
MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type.
MlirStringRef mlirLLVMDIExpressionElemAttrGetName(void)
MlirStringRef mlirLLVMFunctionTypeGetName(void)
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
Attributes are known-constant values of operations.
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
MLIR_CAPI_EXPORTED MlirType mlirLLVMPointerTypeGet(MlirContext ctx, unsigned addressSpace)
Creates an llvm.ptr type.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
A logical result value, essentially a boolean with named states.
A pointer to a sized fragment of a string, not necessarily null-terminated.