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 importsStorage.reserve(nImportedEntities);
361 return wrap(DICompileUnitAttr::get(
362 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
363 cast<DistinctAttr>(
unwrap(
id)), sourceLanguage,
364 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
365 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
366 DINameTableKind(nameTableKind),
367 cast<StringAttr>(
unwrap(splitDebugFilename)),
369 unwrapList(nImportedEntities, importedEntities, importsStorage),
370 llvm::CastTo<DINodeAttr>)));
374 return wrap(DICompileUnitAttr::name);
378 return wrap(DIFlagsAttr::get(
unwrap(ctx), DIFlags(value)));
382 return wrap(DIFlagsAttr::name);
389 unsigned int column) {
391 DILexicalBlockAttr::get(
unwrap(ctx), cast<DIScopeAttr>(
unwrap(scope)),
392 cast<DIFileAttr>(
unwrap(file)), line, column));
396 return wrap(DILexicalBlockAttr::name);
402 unsigned int discriminator) {
403 return wrap(DILexicalBlockFileAttr::get(
405 cast<DIFileAttr>(
unwrap(file)), discriminator));
409 return wrap(DILexicalBlockFileAttr::name);
413 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
414 MlirAttribute diFile,
unsigned int line,
unsigned int arg,
415 unsigned int alignInBits, MlirAttribute diType,
int64_t flags) {
416 return wrap(DILocalVariableAttr::get(
418 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(diFile)), line,
419 arg, alignInBits, cast<DITypeAttr>(
unwrap(diType)), DIFlags(flags)));
423 return wrap(DILocalVariableAttr::name);
427 unsigned int callingConvention,
429 MlirAttribute
const *types) {
431 attrStorage.reserve(nTypes);
433 return wrap(DISubroutineTypeAttr::get(
434 unwrap(ctx), callingConvention,
435 llvm::map_to_vector(
unwrapList(nTypes, types, attrStorage),
436 llvm::CastTo<DITypeAttr>)));
440 return wrap(DISubroutineTypeAttr::name);
444 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
448 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
449 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
450 MlirAttribute linkageName, MlirAttribute file,
unsigned int line,
451 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
452 intptr_t nRetainedNodes, MlirAttribute
const *retainedNodes,
453 intptr_t nAnnotations, MlirAttribute
const *annotations) {
455 nodesStorage.reserve(nRetainedNodes);
458 annotationsStorage.reserve(nAnnotations);
460 return wrap(DISubprogramAttr::get(
461 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
462 cast<DistinctAttr>(
unwrap(
id)),
463 cast<DICompileUnitAttr>(
unwrap(compileUnit)),
464 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
465 cast<StringAttr>(
unwrap(linkageName)), cast<DIFileAttr>(
unwrap(file)),
466 line, scopeLine, DISubprogramFlags(subprogramFlags),
467 cast<DISubroutineTypeAttr>(
unwrap(type)),
469 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
470 llvm::CastTo<DINodeAttr>),
472 unwrapList(nAnnotations, annotations, annotationsStorage),
473 llvm::CastTo<DINodeAttr>)));
477 return wrap(DISubprogramAttr::name);
481 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScope());
485 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getLine();
489 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScopeLine();
494 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getCompileUnit());
498 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getFile());
506 MlirAttribute scope, MlirAttribute name,
507 MlirAttribute configMacros,
508 MlirAttribute includePath,
509 MlirAttribute apinotes,
unsigned int line,
511 return wrap(DIModuleAttr::get(
513 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
514 cast<StringAttr>(
unwrap(configMacros)),
515 cast<StringAttr>(
unwrap(includePath)), cast<StringAttr>(
unwrap(apinotes)),
520 return wrap(DIModuleAttr::name);
524 return wrap(cast<DIModuleAttr>(
unwrap(diModule)).getScope());
528 MlirContext ctx,
unsigned int tag, MlirAttribute scope,
529 MlirAttribute entity, MlirAttribute file,
unsigned int line,
530 MlirAttribute name,
intptr_t nElements, MlirAttribute
const *elements) {
532 elementsStorage.reserve(nElements);
533 return wrap(DIImportedEntityAttr::get(
535 cast<DINodeAttr>(
unwrap(entity)), cast<DIFileAttr>(
unwrap(file)), line,
536 cast<StringAttr>(
unwrap(name)),
537 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
538 llvm::CastTo<DINodeAttr>)));
542 return wrap(DIImportedEntityAttr::name);
546 MlirAttribute value) {
547 return wrap(DIAnnotationAttr::get(
unwrap(ctx), cast<StringAttr>(
unwrap(name)),
548 cast<StringAttr>(
unwrap(value))));
552 return wrap(DIAnnotationAttr::name);
565 return isa<MDStringAttr>(
unwrap(attr));
569 return wrap(MDStringAttr::getTypeID());
573 return wrap(cast<MDStringAttr>(
unwrap(attr)).getValue().getValue());
577 MlirAttribute valueAttr) {
582 return isa<MDConstantAttr>(
unwrap(attr));
586 return wrap(MDConstantAttr::getTypeID());
595 MDFuncAttr::get(
unwrap(ctx), cast<FlatSymbolRefAttr>(
unwrap(name))));
599 return isa<MDFuncAttr>(
unwrap(attr));
603 return wrap(MDFuncAttr::getTypeID());
611 MlirAttribute
const *operands) {
613 attrStorage.reserve(nOperands);
615 unwrapList(nOperands, operands, attrStorage)));
619 return isa<MDNodeAttr>(
unwrap(attr));
623 return wrap(MDNodeAttr::getTypeID());
627 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.
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.
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 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.
MlirAttribute mlirLLVMDICompileUnitAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DICompileUnitAttr 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.
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.