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 return wrap(DICompileUnitAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
350 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
351 unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer,
354 MlirAttribute splitDebugFilename,
intptr_t nImportedEntities,
355 MlirAttribute
const *importedEntities) {
357 importsStorage.reserve(nImportedEntities);
358 return wrap(DICompileUnitAttr::get(
359 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
360 cast<DistinctAttr>(
unwrap(
id)), sourceLanguage,
361 cast<DIFileAttr>(
unwrap(file)), cast<StringAttr>(
unwrap(producer)),
362 isOptimized, DIEmissionKind(emissionKind), isDebugInfoForProfiling,
363 DINameTableKind(nameTableKind),
364 cast<StringAttr>(
unwrap(splitDebugFilename)),
366 unwrapList(nImportedEntities, importedEntities, importsStorage),
367 llvm::CastTo<DINodeAttr>)));
371 return wrap(DICompileUnitAttr::name);
375 return wrap(DIFlagsAttr::get(
unwrap(ctx), DIFlags(value)));
379 return wrap(DIFlagsAttr::name);
386 unsigned int column) {
388 DILexicalBlockAttr::get(
unwrap(ctx), cast<DIScopeAttr>(
unwrap(scope)),
389 cast<DIFileAttr>(
unwrap(file)), line, column));
393 return wrap(DILexicalBlockAttr::name);
399 unsigned int discriminator) {
400 return wrap(DILexicalBlockFileAttr::get(
402 cast<DIFileAttr>(
unwrap(file)), discriminator));
406 return wrap(DILexicalBlockFileAttr::name);
410 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
411 MlirAttribute diFile,
unsigned int line,
unsigned int arg,
412 unsigned int alignInBits, MlirAttribute diType,
int64_t flags) {
413 return wrap(DILocalVariableAttr::get(
415 cast<StringAttr>(
unwrap(name)), cast<DIFileAttr>(
unwrap(diFile)), line,
416 arg, alignInBits, cast<DITypeAttr>(
unwrap(diType)), DIFlags(flags)));
420 return wrap(DILocalVariableAttr::name);
424 unsigned int callingConvention,
426 MlirAttribute
const *types) {
428 attrStorage.reserve(nTypes);
430 return wrap(DISubroutineTypeAttr::get(
431 unwrap(ctx), callingConvention,
432 llvm::map_to_vector(
unwrapList(nTypes, types, attrStorage),
433 llvm::CastTo<DITypeAttr>)));
437 return wrap(DISubroutineTypeAttr::name);
441 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(
unwrap(recId))));
445 MlirContext ctx, MlirAttribute recId,
bool isRecSelf, MlirAttribute
id,
446 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
447 MlirAttribute linkageName, MlirAttribute file,
unsigned int line,
448 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
449 intptr_t nRetainedNodes, MlirAttribute
const *retainedNodes,
450 intptr_t nAnnotations, MlirAttribute
const *annotations) {
452 nodesStorage.reserve(nRetainedNodes);
455 annotationsStorage.reserve(nAnnotations);
457 return wrap(DISubprogramAttr::get(
458 unwrap(ctx), cast<DistinctAttr>(
unwrap(recId)), isRecSelf,
459 cast<DistinctAttr>(
unwrap(
id)),
460 cast<DICompileUnitAttr>(
unwrap(compileUnit)),
461 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
462 cast<StringAttr>(
unwrap(linkageName)), cast<DIFileAttr>(
unwrap(file)),
463 line, scopeLine, DISubprogramFlags(subprogramFlags),
464 cast<DISubroutineTypeAttr>(
unwrap(type)),
466 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
467 llvm::CastTo<DINodeAttr>),
469 unwrapList(nAnnotations, annotations, annotationsStorage),
470 llvm::CastTo<DINodeAttr>)));
474 return wrap(DISubprogramAttr::name);
478 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScope());
482 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getLine();
486 return cast<DISubprogramAttr>(
unwrap(diSubprogram)).getScopeLine();
491 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getCompileUnit());
495 return wrap(cast<DISubprogramAttr>(
unwrap(diSubprogram)).getFile());
503 MlirAttribute scope, MlirAttribute name,
504 MlirAttribute configMacros,
505 MlirAttribute includePath,
506 MlirAttribute apinotes,
unsigned int line,
508 return wrap(DIModuleAttr::get(
510 cast<DIScopeAttr>(
unwrap(scope)), cast<StringAttr>(
unwrap(name)),
511 cast<StringAttr>(
unwrap(configMacros)),
512 cast<StringAttr>(
unwrap(includePath)), cast<StringAttr>(
unwrap(apinotes)),
517 return wrap(DIModuleAttr::name);
521 return wrap(cast<DIModuleAttr>(
unwrap(diModule)).getScope());
525 MlirContext ctx,
unsigned int tag, MlirAttribute scope,
526 MlirAttribute entity, MlirAttribute file,
unsigned int line,
527 MlirAttribute name,
intptr_t nElements, MlirAttribute
const *elements) {
529 elementsStorage.reserve(nElements);
530 return wrap(DIImportedEntityAttr::get(
532 cast<DINodeAttr>(
unwrap(entity)), cast<DIFileAttr>(
unwrap(file)), line,
533 cast<StringAttr>(
unwrap(name)),
534 llvm::map_to_vector(
unwrapList(nElements, elements, elementsStorage),
535 llvm::CastTo<DINodeAttr>)));
539 return wrap(DIImportedEntityAttr::name);
543 MlirAttribute value) {
544 return wrap(DIAnnotationAttr::get(
unwrap(ctx), cast<StringAttr>(
unwrap(name)),
545 cast<StringAttr>(
unwrap(value))));
549 return wrap(DIAnnotationAttr::name);
562 return isa<MDStringAttr>(
unwrap(attr));
566 return wrap(MDStringAttr::getTypeID());
570 return wrap(cast<MDStringAttr>(
unwrap(attr)).getValue().getValue());
574 MlirAttribute valueAttr) {
579 return isa<MDConstantAttr>(
unwrap(attr));
583 return wrap(MDConstantAttr::getTypeID());
592 MDFuncAttr::get(
unwrap(ctx), cast<FlatSymbolRefAttr>(
unwrap(name))));
596 return isa<MDFuncAttr>(
unwrap(attr));
600 return wrap(MDFuncAttr::getTypeID());
608 MlirAttribute
const *operands) {
610 attrStorage.reserve(nOperands);
612 unwrapList(nOperands, operands, attrStorage)));
616 return isa<MDNodeAttr>(
unwrap(attr));
620 return wrap(MDNodeAttr::getTypeID());
624 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.
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 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.
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.