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));
312 return wrap(DIStringTypeAttr::name);
317 return wrap(cast<DIDerivedTypeAttr>(
unwrap(diDerivedType)).getBaseType());
321 return wrap(CConvAttr::get(
unwrap(ctx), CConv(cconv)));
327 return wrap(ComdatAttr::get(
unwrap(ctx), comdat::Comdat(comdat)));
333 return wrap(LinkageAttr::get(
unwrap(ctx), linkage::Linkage(linkage)));
337 return wrap(LinkageAttr::name);
341 MlirAttribute directory) {
343 cast<StringAttr>(
unwrap(directory))));
349 return wrap(DICompileUnitAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
353 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
354 unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer,
357 MlirAttribute splitDebugFilename,
intptr_t nImportedEntities,
358 MlirAttribute
const *importedEntities) {
360 ctx, recId, isRecSelf,
id, sourceLanguage,
361 0, file, producer, isOptimized, emissionKind,
362 isDebugInfoForProfiling, nameTableKind, splitDebugFilename,
363 nImportedEntities, importedEntities);
367 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
368 unsigned int sourceLanguage,
unsigned int sourceLanguageDialect,
369 MlirAttribute file, MlirAttribute producer,
bool isOptimized,
372 intptr_t nImportedEntities, MlirAttribute
const *importedEntities) {
374 importsStorage.reserve(nImportedEntities);
375 auto sourceLanguageAttr = DISourceLanguageNameAttr::get(
376 unwrap(ctx), sourceLanguage, 0, std::nullopt,
377 sourceLanguageDialect);
378 return wrap(DICompileUnitAttr::get(
379 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
380 cast<DistinctAttr>(
unwrap(
id)), sourceLanguageAttr,
381 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
382 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
383 DINameTableKind(nameTableKind),
384 cast<StringAttr>(
unwrap(splitDebugFilename)),
386 unwrapList(nImportedEntities, importedEntities, importsStorage),
387 llvm::CastTo<DINodeAttr>)));
391 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
392 unsigned int sourceLanguageName, uint32_t sourceLanguageVersion,
393 unsigned int sourceLanguageDialect, MlirAttribute file,
394 MlirAttribute producer,
bool isOptimized,
397 intptr_t nImportedEntities, MlirAttribute
const *importedEntities) {
399 importsStorage.reserve(nImportedEntities);
400 auto sourceLanguageAttr = DISourceLanguageNameAttr::get(
401 unwrap(ctx), 0, sourceLanguageName,
402 std::optional<uint32_t>(sourceLanguageVersion), sourceLanguageDialect);
403 return wrap(DICompileUnitAttr::get(
404 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
405 cast<DistinctAttr>(
unwrap(
id)), sourceLanguageAttr,
406 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
407 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
408 DINameTableKind(nameTableKind),
409 cast<StringAttr>(
unwrap(splitDebugFilename)),
411 unwrapList(nImportedEntities, importedEntities, importsStorage),
412 llvm::CastTo<DINodeAttr>)));
416 return wrap(DICompileUnitAttr::name);
420 return wrap(DIFlagsAttr::get(
unwrap(ctx), DIFlags(value)));
424 return wrap(DIFlagsAttr::name);
431 unsigned int column) {
433 DILexicalBlockAttr::get(
unwrap(ctx), cast<DIScopeAttr>(
unwrap(scope)),
434 cast<DIFileAttr>(
unwrap(file)), line, column));
438 return wrap(DILexicalBlockAttr::name);
444 unsigned int discriminator) {
445 return wrap(DILexicalBlockFileAttr::get(
447 cast<DIFileAttr>(
unwrap(file)), discriminator));
451 return wrap(DILexicalBlockFileAttr::name);
455 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
456 MlirAttribute diFile,
unsigned int line,
unsigned int arg,
457 unsigned int alignInBits, MlirAttribute diType,
int64_t flags) {
458 return wrap(DILocalVariableAttr::get(
460 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(diFile)), line,
461 arg, alignInBits, cast<DITypeAttr>(
unwrap(diType)), DIFlags(flags)));
465 return wrap(DILocalVariableAttr::name);
469 unsigned int callingConvention,
471 MlirAttribute
const *types) {
473 attrStorage.reserve(nTypes);
475 return wrap(DISubroutineTypeAttr::get(
476 unwrap(ctx), callingConvention,
477 llvm::map_to_vector(
unwrapList(nTypes, types, attrStorage),
478 llvm::CastTo<DITypeAttr>)));
482 return wrap(DISubroutineTypeAttr::name);
486 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
490 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
491 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
492 MlirAttribute linkageName, MlirAttribute file,
unsigned int line,
493 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
494 intptr_t nRetainedNodes, MlirAttribute
const *retainedNodes,
495 intptr_t nAnnotations, MlirAttribute
const *annotations) {
497 nodesStorage.reserve(nRetainedNodes);
500 annotationsStorage.reserve(nAnnotations);
502 return wrap(DISubprogramAttr::get(
503 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
504 cast<DistinctAttr>(
unwrap(
id)),
505 cast<DICompileUnitAttr>(
unwrap(compileUnit)),
506 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
507 cast<StringAttr>(
unwrap(linkageName)), cast<DIFileAttr>(
unwrap(file)),
508 line, scopeLine, DISubprogramFlags(subprogramFlags),
509 cast<DISubroutineTypeAttr>(
unwrap(type)),
511 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
512 llvm::CastTo<Attribute>),
514 unwrapList(nAnnotations, annotations, annotationsStorage),
515 llvm::CastTo<DINodeAttr>)));
519 return wrap(DISubprogramAttr::name);
523 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScope());
527 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getLine();
531 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScopeLine();
536 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getCompileUnit());
540 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getFile());
548 MlirAttribute scope, MlirAttribute name,
549 MlirAttribute configMacros,
550 MlirAttribute includePath,
551 MlirAttribute apinotes,
unsigned int line,
553 return wrap(DIModuleAttr::get(
555 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
556 cast<StringAttr>(
unwrap(configMacros)),
557 cast<StringAttr>(
unwrap(includePath)), cast<StringAttr>(
unwrap(apinotes)),
562 return wrap(DIModuleAttr::name);
566 return wrap(cast<DIModuleAttr>(
unwrap(diModule)).getScope());
570 MlirContext ctx,
unsigned int tag, MlirAttribute scope,
571 MlirAttribute entity, MlirAttribute file,
unsigned int line,
572 MlirAttribute name,
intptr_t nElements, MlirAttribute
const *elements) {
574 elementsStorage.reserve(nElements);
575 return wrap(DIImportedEntityAttr::get(
577 cast<DINodeAttr>(
unwrap(entity)), cast<DIFileAttr>(
unwrap(file)), line,
578 cast<StringAttr>(
unwrap(name)),
579 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
580 llvm::CastTo<DINodeAttr>)));
584 return wrap(DIImportedEntityAttr::name);
588 MlirAttribute value) {
589 return wrap(DIAnnotationAttr::get(
unwrap(ctx), cast<StringAttr>(
unwrap(name)),
590 cast<StringAttr>(
unwrap(value))));
594 return wrap(DIAnnotationAttr::name);
607 return isa<MDStringAttr>(
unwrap(attr));
611 return wrap(MDStringAttr::getTypeID());
615 return wrap(cast<MDStringAttr>(
unwrap(attr)).getValue().getValue());
619 MlirAttribute valueAttr) {
624 return isa<MDConstantAttr>(
unwrap(attr));
628 return wrap(MDConstantAttr::getTypeID());
636 MlirAttribute name) {
637 return wrap(MDGlobalValueAttr::get(
unwrap(ctx),
638 cast<FlatSymbolRefAttr>(
unwrap(name))));
642 return isa<MDGlobalValueAttr>(
unwrap(attr));
646 return wrap(MDGlobalValueAttr::getTypeID());
654 MlirAttribute
const *operands) {
656 attrStorage.reserve(nOperands);
658 unwrapList(nOperands, operands, attrStorage)));
662 return isa<MDNodeAttr>(
unwrap(attr));
666 return wrap(MDNodeAttr::getTypeID());
670 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)
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 mlirLLVMDIStringTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, uint32_t alignInBits, MlirAttribute stringLength, MlirAttribute stringLengthExp, MlirAttribute stringLocationExp, MlirLLVMTypeEncoding encoding)
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.
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 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.