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, MlirAttribute identifier,
257 MlirAttribute discriminator) {
259 elementsStorage.reserve(nElements);
261 return wrap(DICompositeTypeAttr::get(
262 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf, tag,
263 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(file)), line,
264 cast<DIScopeAttr>(
unwrap(scope)), cast<DITypeAttr>(
unwrap(baseType)),
265 DIFlags(flags), sizeInBits, alignInBits,
266 cast<DIExpressionAttr>(
unwrap(dataLocation)),
267 cast<DIExpressionAttr>(
unwrap(rank)),
268 cast<DIExpressionAttr>(
unwrap(allocated)),
269 cast<DIExpressionAttr>(
unwrap(associated)),
270 cast<StringAttr>(
unwrap(identifier)),
271 cast<DIDerivedTypeAttr>(
unwrap(discriminator)),
272 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
273 llvm::CastTo<DINodeAttr>)));
277 return wrap(DICompositeTypeAttr::name);
281 MlirContext ctx,
unsigned int tag, MlirAttribute name, MlirAttribute file,
282 uint32_t line, MlirAttribute scope, MlirAttribute baseType,
283 uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits,
284 int64_t dwarfAddressSpace,
int64_t flags, MlirAttribute extraData) {
285 std::optional<unsigned> addressSpace = std::nullopt;
286 if (dwarfAddressSpace >= 0)
287 addressSpace = (
unsigned)dwarfAddressSpace;
288 return wrap(DIDerivedTypeAttr::get(
290 cast<DIFileAttr>(
unwrap(file)), line, cast<DIScopeAttr>(
unwrap(scope)),
291 cast<DITypeAttr>(
unwrap(baseType)), sizeInBits, alignInBits, offsetInBits,
292 addressSpace, DIFlags(flags),
unwrap(extraData)));
296 return wrap(DIDerivedTypeAttr::name);
300 MlirContext ctx,
unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
301 uint32_t alignInBits, MlirAttribute stringLength,
302 MlirAttribute stringLengthExp, MlirAttribute stringLocationExp,
304 return wrap(DIStringTypeAttr::get(
305 unwrap(ctx), tag, cast<StringAttr>(
unwrap(name)), sizeInBits, alignInBits,
306 cast<DIVariableAttr>(
unwrap(stringLength)),
307 cast<DIExpressionAttr>(
unwrap(stringLengthExp)),
308 cast<DIExpressionAttr>(
unwrap(stringLocationExp)), encoding,
309 cast<DITypeAttr>(
unwrap(charType))));
313 return wrap(DIStringTypeAttr::name);
318 return wrap(cast<DIDerivedTypeAttr>(
unwrap(diDerivedType)).getBaseType());
322 return wrap(CConvAttr::get(
unwrap(ctx), CConv(cconv)));
328 return wrap(ComdatAttr::get(
unwrap(ctx), comdat::Comdat(comdat)));
334 return wrap(LinkageAttr::get(
unwrap(ctx), linkage::Linkage(linkage)));
338 return wrap(LinkageAttr::name);
342 MlirAttribute directory) {
344 cast<StringAttr>(
unwrap(directory))));
350 return wrap(DICompileUnitAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
354 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
355 unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer,
358 MlirAttribute splitDebugFilename,
intptr_t nImportedEntities,
359 MlirAttribute
const *importedEntities) {
361 ctx, recId, isRecSelf,
id, sourceLanguage,
362 0, file, producer, isOptimized, emissionKind,
363 isDebugInfoForProfiling, nameTableKind, splitDebugFilename,
364 nImportedEntities, importedEntities);
368 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
369 unsigned int sourceLanguage,
unsigned int sourceLanguageDialect,
370 MlirAttribute file, MlirAttribute producer,
bool isOptimized,
373 intptr_t nImportedEntities, MlirAttribute
const *importedEntities) {
375 importsStorage.reserve(nImportedEntities);
376 auto sourceLanguageAttr = DISourceLanguageNameAttr::get(
377 unwrap(ctx), sourceLanguage, 0, std::nullopt,
378 sourceLanguageDialect);
379 return wrap(DICompileUnitAttr::get(
380 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
381 cast<DistinctAttr>(
unwrap(
id)), sourceLanguageAttr,
382 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
383 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
384 DINameTableKind(nameTableKind),
385 cast<StringAttr>(
unwrap(splitDebugFilename)),
387 unwrapList(nImportedEntities, importedEntities, importsStorage),
388 llvm::CastTo<DINodeAttr>)));
392 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
393 unsigned int sourceLanguageName, uint32_t sourceLanguageVersion,
394 unsigned int sourceLanguageDialect, MlirAttribute file,
395 MlirAttribute producer,
bool isOptimized,
398 intptr_t nImportedEntities, MlirAttribute
const *importedEntities) {
400 importsStorage.reserve(nImportedEntities);
401 auto sourceLanguageAttr = DISourceLanguageNameAttr::get(
402 unwrap(ctx), 0, sourceLanguageName,
403 std::optional<uint32_t>(sourceLanguageVersion), sourceLanguageDialect);
404 return wrap(DICompileUnitAttr::get(
405 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
406 cast<DistinctAttr>(
unwrap(
id)), sourceLanguageAttr,
407 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
408 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
409 DINameTableKind(nameTableKind),
410 cast<StringAttr>(
unwrap(splitDebugFilename)),
412 unwrapList(nImportedEntities, importedEntities, importsStorage),
413 llvm::CastTo<DINodeAttr>)));
417 return wrap(DICompileUnitAttr::name);
421 return wrap(DIFlagsAttr::get(
unwrap(ctx), DIFlags(value)));
425 return wrap(DIFlagsAttr::name);
432 unsigned int column) {
434 DILexicalBlockAttr::get(
unwrap(ctx), cast<DIScopeAttr>(
unwrap(scope)),
435 cast<DIFileAttr>(
unwrap(file)), line, column));
439 return wrap(DILexicalBlockAttr::name);
445 unsigned int discriminator) {
446 return wrap(DILexicalBlockFileAttr::get(
448 cast<DIFileAttr>(
unwrap(file)), discriminator));
452 return wrap(DILexicalBlockFileAttr::name);
456 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
457 MlirAttribute diFile,
unsigned int line,
unsigned int arg,
458 unsigned int alignInBits, MlirAttribute diType,
int64_t flags) {
459 return wrap(DILocalVariableAttr::get(
461 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(diFile)), line,
462 arg, alignInBits, cast<DITypeAttr>(
unwrap(diType)), DIFlags(flags)));
466 return wrap(DILocalVariableAttr::name);
470 unsigned int callingConvention,
472 MlirAttribute
const *types) {
474 attrStorage.reserve(nTypes);
476 return wrap(DISubroutineTypeAttr::get(
477 unwrap(ctx), callingConvention,
478 llvm::map_to_vector(
unwrapList(nTypes, types, attrStorage),
479 llvm::CastTo<DITypeAttr>)));
483 return wrap(DISubroutineTypeAttr::name);
487 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
491 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
492 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
493 MlirAttribute linkageName, MlirAttribute file,
unsigned int line,
494 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
495 intptr_t nRetainedNodes, MlirAttribute
const *retainedNodes,
496 intptr_t nAnnotations, MlirAttribute
const *annotations) {
498 nodesStorage.reserve(nRetainedNodes);
501 annotationsStorage.reserve(nAnnotations);
503 return wrap(DISubprogramAttr::get(
504 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
505 cast<DistinctAttr>(
unwrap(
id)),
506 cast<DICompileUnitAttr>(
unwrap(compileUnit)),
507 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
508 cast<StringAttr>(
unwrap(linkageName)), cast<DIFileAttr>(
unwrap(file)),
509 line, scopeLine, DISubprogramFlags(subprogramFlags),
510 cast<DISubroutineTypeAttr>(
unwrap(type)),
512 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
513 llvm::CastTo<Attribute>),
515 unwrapList(nAnnotations, annotations, annotationsStorage),
516 llvm::CastTo<DINodeAttr>)));
520 return wrap(DISubprogramAttr::name);
524 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScope());
528 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getLine();
532 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScopeLine();
537 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getCompileUnit());
541 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getFile());
549 MlirAttribute scope, MlirAttribute name,
550 MlirAttribute configMacros,
551 MlirAttribute includePath,
552 MlirAttribute apinotes,
unsigned int line,
554 return wrap(DIModuleAttr::get(
556 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
557 cast<StringAttr>(
unwrap(configMacros)),
558 cast<StringAttr>(
unwrap(includePath)), cast<StringAttr>(
unwrap(apinotes)),
563 return wrap(DIModuleAttr::name);
567 return wrap(cast<DIModuleAttr>(
unwrap(diModule)).getScope());
571 MlirContext ctx,
unsigned int tag, MlirAttribute scope,
572 MlirAttribute entity, MlirAttribute file,
unsigned int line,
573 MlirAttribute name,
intptr_t nElements, MlirAttribute
const *elements) {
575 elementsStorage.reserve(nElements);
576 return wrap(DIImportedEntityAttr::get(
578 cast<DINodeAttr>(
unwrap(entity)), cast<DIFileAttr>(
unwrap(file)), line,
579 cast<StringAttr>(
unwrap(name)),
580 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
581 llvm::CastTo<DINodeAttr>)));
585 return wrap(DIImportedEntityAttr::name);
589 MlirAttribute value) {
590 return wrap(DIAnnotationAttr::get(
unwrap(ctx), cast<StringAttr>(
unwrap(name)),
591 cast<StringAttr>(
unwrap(value))));
595 return wrap(DIAnnotationAttr::name);
608 return isa<MDStringAttr>(
unwrap(attr));
612 return wrap(MDStringAttr::getTypeID());
616 return wrap(cast<MDStringAttr>(
unwrap(attr)).getValue().getValue());
620 MlirAttribute valueAttr) {
625 return isa<MDConstantAttr>(
unwrap(attr));
629 return wrap(MDConstantAttr::getTypeID());
637 MlirAttribute name) {
638 return wrap(MDGlobalValueAttr::get(
unwrap(ctx),
639 cast<FlatSymbolRefAttr>(
unwrap(name))));
643 return isa<MDGlobalValueAttr>(
unwrap(attr));
647 return wrap(MDGlobalValueAttr::getTypeID());
655 MlirAttribute
const *operands) {
657 attrStorage.reserve(nOperands);
659 unwrapList(nOperands, operands, attrStorage)));
663 return isa<MDNodeAttr>(
unwrap(attr));
667 return wrap(MDNodeAttr::getTypeID());
671 return cast<MDNodeAttr>(
unwrap(attr)).getOperands().size();
MlirStringRef mlirLLVMDIFlagsAttrGetName(void)
intptr_t mlirLLVMMDNodeAttrGetNumOperands(MlirAttribute attr)
Returns the number of operands in an LLVM MDNodeAttr.
MlirStringRef mlirLLVMDIModuleAttrGetName(void)
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, MlirAttribute identifier, MlirAttribute discriminator)
Creates a LLVM DICompositeType attribute.
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.
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.
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.
MlirAttribute mlirLLVMDICompileUnitAttrGet(MlirContext ctx, MlirAttribute recId, bool isRecSelf, 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.
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 mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram)
Gets the scope from this DISubprogramAttr.
MlirAttribute mlirLLVMMDGlobalValueAttrGetName(MlirAttribute attr)
Returns the symbol name of an LLVM MDGlobalValueAttr.
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column)
Creates a LLVM DILexicalBlock attribute.
bool mlirLLVMAttrIsAMDGlobalValueAttr(MlirAttribute attr)
Returns true if the attribute is an LLVM MDGlobalValueAttr.
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.
MlirAttribute mlirLLVMDICompileUnitAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DICompileUnitAttr attribute.
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.
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.
MlirAttribute mlirLLVMDICompileUnitAttrGetWithSourceLanguageName(MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id, unsigned int sourceLanguageName, uint32_t sourceLanguageVersion, unsigned int sourceLanguageDialect, MlirAttribute file, MlirAttribute producer, bool isOptimized, MlirLLVMDIEmissionKind emissionKind, bool isDebugInfoForProfiling, MlirLLVMDINameTableKind nameTableKind, MlirAttribute splitDebugFilename, intptr_t nImportedEntities, MlirAttribute const *importedEntities)
Creates an LLVM DICompileUnit attribute with a DWARF v6 source language name, version,...
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.
MlirTypeID mlirLLVMMDGlobalValueAttrGetTypeID(void)
Returns the TypeID of MDGlobalValueAttr.
MlirAttribute mlirLLVMDICompileUnitAttrGetWithSourceLanguageDialect(MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id, unsigned int sourceLanguage, unsigned int sourceLanguageDialect, 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 with a source language dialect.
MlirAttribute mlirLLVMDIStringTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, uint32_t alignInBits, MlirAttribute stringLength, MlirAttribute stringLengthExp, MlirAttribute stringLocationExp, MlirLLVMTypeEncoding encoding, MlirAttribute charType)
MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type.
MlirStringRef mlirLLVMDIExpressionElemAttrGetName(void)
MlirAttribute mlirLLVMMDGlobalValueAttrGet(MlirContext ctx, MlirAttribute name)
Creates an LLVM MDGlobalValueAttr referencing a symbol-backed global value.
MlirStringRef mlirLLVMFunctionTypeGetName(void)
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
static Type getElementType(Type type, ArrayRef< int32_t > indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
Walks the given type hierarchy with the given indices, potentially down to component granularity,...
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.