MLIR 23.0.0git
LLVM.cpp
Go to the documentation of this file.
1//===- LLVM.cpp - C Interface for LLVM dialect ----------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "mlir-c/IR.h"
11#include "mlir-c/Support.h"
13#include "mlir/CAPI/Wrap.h"
17#include "llvm-c/Core.h"
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/ADT/SmallVectorExtras.h"
20
21using namespace mlir;
22using namespace mlir::LLVM;
23
25
26MlirType mlirLLVMPointerTypeGet(MlirContext ctx, unsigned addressSpace) {
27 return wrap(LLVMPointerType::get(unwrap(ctx), addressSpace));
28}
29
31 return wrap(LLVM::LLVMPointerType::name);
32}
33
35 return wrap(LLVM::LLVMPointerType::getTypeID());
36}
37
38bool mlirTypeIsALLVMPointerType(MlirType type) {
39 return isa<LLVM::LLVMPointerType>(unwrap(type));
40}
41
42unsigned mlirLLVMPointerTypeGetAddressSpace(MlirType pointerType) {
43 return cast<LLVM::LLVMPointerType>(unwrap(pointerType)).getAddressSpace();
44}
45
46MlirType mlirLLVMVoidTypeGet(MlirContext ctx) {
47 return wrap(LLVMVoidType::get(unwrap(ctx)));
48}
49
50MlirStringRef mlirLLVMVoidTypeGetName(void) { return wrap(LLVMVoidType::name); }
51
52MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements) {
53 return wrap(LLVMArrayType::get(unwrap(elementType), numElements));
54}
55
57 return wrap(LLVMArrayType::name);
58}
59
60MlirType mlirLLVMArrayTypeGetElementType(MlirType type) {
61 return wrap(cast<LLVM::LLVMArrayType>(unwrap(type)).getElementType());
62}
63
64MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,
65 MlirType const *argumentTypes, bool isVarArg) {
66 SmallVector<Type, 2> argumentStorage;
67 return wrap(LLVMFunctionType::get(
68 unwrap(resultType),
69 unwrapList(nArgumentTypes, argumentTypes, argumentStorage), isVarArg));
70}
71
73 return wrap(LLVMFunctionType::name);
74}
75
77 return llvm::cast<LLVM::LLVMFunctionType>(unwrap(type)).getNumParams();
78}
79
80MlirType mlirLLVMFunctionTypeGetInput(MlirType type, intptr_t pos) {
81 assert(pos >= 0 && "pos in array must be positive");
82 return wrap(llvm::cast<LLVM::LLVMFunctionType>(unwrap(type))
83 .getParamType(static_cast<unsigned>(pos)));
84}
85
86MlirType mlirLLVMFunctionTypeGetReturnType(MlirType type) {
87 return wrap(llvm::cast<LLVM::LLVMFunctionType>(unwrap(type)).getReturnType());
88}
89
90bool mlirTypeIsALLVMStructType(MlirType type) {
91 return isa<LLVM::LLVMStructType>(unwrap(type));
92}
93
95 return wrap(LLVM::LLVMStructType::getTypeID());
96}
97
99 return wrap(LLVM::LLVMStructType::name);
100}
101
102bool mlirLLVMStructTypeIsLiteral(MlirType type) {
103 return !cast<LLVM::LLVMStructType>(unwrap(type)).isIdentified();
104}
105
107 return cast<LLVM::LLVMStructType>(unwrap(type)).getBody().size();
108}
109
110MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position) {
111 return wrap(cast<LLVM::LLVMStructType>(unwrap(type)).getBody()[position]);
112}
113
114bool mlirLLVMStructTypeIsPacked(MlirType type) {
115 return cast<LLVM::LLVMStructType>(unwrap(type)).isPacked();
116}
117
119 return wrap(cast<LLVM::LLVMStructType>(unwrap(type)).getName());
120}
121
122bool mlirLLVMStructTypeIsOpaque(MlirType type) {
123 return cast<LLVM::LLVMStructType>(unwrap(type)).isOpaque();
124}
125
126MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes,
127 MlirType const *fieldTypes,
128 bool isPacked) {
129 SmallVector<Type> fieldStorage;
130 return wrap(LLVMStructType::getLiteral(
131 unwrap(ctx), unwrapList(nFieldTypes, fieldTypes, fieldStorage),
132 isPacked));
133}
134
135MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc,
136 intptr_t nFieldTypes,
137 MlirType const *fieldTypes,
138 bool isPacked) {
139 SmallVector<Type> fieldStorage;
140 return wrap(LLVMStructType::getLiteralChecked(
141 [loc]() { return emitError(unwrap(loc)); }, unwrap(loc)->getContext(),
142 unwrapList(nFieldTypes, fieldTypes, fieldStorage), isPacked));
143}
144
145MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name) {
146 return wrap(LLVMStructType::getOpaque(unwrap(name), unwrap(ctx)));
147}
148
149MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name) {
150 return wrap(LLVMStructType::getIdentified(unwrap(ctx), unwrap(name)));
151}
152
154 intptr_t nFieldTypes,
155 MlirType const *fieldTypes,
156 bool isPacked) {
157 SmallVector<Type> fields;
158 return wrap(LLVMStructType::getNewIdentified(
159 unwrap(ctx), unwrap(name), unwrapList(nFieldTypes, fieldTypes, fields),
160 isPacked));
161}
162
164 intptr_t nFieldTypes,
165 MlirType const *fieldTypes,
166 bool isPacked) {
167 SmallVector<Type> fields;
168 return wrap(
169 cast<LLVM::LLVMStructType>(unwrap(structType))
170 .setBody(unwrapList(nFieldTypes, fieldTypes, fields), isPacked));
171}
172
173MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx,
174 unsigned int opcode,
175 intptr_t nArguments,
176 uint64_t const *arguments) {
177 auto list = ArrayRef<uint64_t>(arguments, nArguments);
178 return wrap(DIExpressionElemAttr::get(unwrap(ctx), opcode, list));
179}
180
182 return wrap(DIExpressionElemAttr::name);
183}
184
185MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations,
186 MlirAttribute const *operations) {
187 SmallVector<Attribute> attrStorage;
188 attrStorage.reserve(nOperations);
189
190 return wrap(DIExpressionAttr::get(
191 unwrap(ctx),
192 llvm::map_to_vector(unwrapList(nOperations, operations, attrStorage),
193 llvm::CastTo<DIExpressionElemAttr>)));
194}
195
197 return wrap(DIExpressionAttr::name);
198}
199
200MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx) {
201 return wrap(DINullTypeAttr::get(unwrap(ctx)));
202}
203
205 return wrap(DINullTypeAttr::name);
206}
207
208MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag,
209 MlirAttribute name,
210 uint64_t sizeInBits,
211 MlirLLVMTypeEncoding encoding) {
212
213 return wrap(DIBasicTypeAttr::get(
214 unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, encoding));
215}
216
218 return wrap(DIBasicTypeAttr::name);
219}
220
221MlirAttribute mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId) {
222 return wrap(
223 DICompositeTypeAttr::getRecSelf(cast<DistinctAttr>(unwrap(recId))));
224}
225
227 MlirContext ctx, MlirAttribute recId, bool isRecSelf, unsigned int tag,
228 MlirAttribute name, MlirAttribute file, uint32_t line, MlirAttribute scope,
229 MlirAttribute baseType, int64_t flags, uint64_t sizeInBits,
230 uint64_t alignInBits, intptr_t nElements, MlirAttribute const *elements,
231 MlirAttribute dataLocation, MlirAttribute rank, MlirAttribute allocated,
232 MlirAttribute associated) {
233 SmallVector<Attribute> elementsStorage;
234 elementsStorage.reserve(nElements);
235
236 return wrap(DICompositeTypeAttr::get(
237 unwrap(ctx), cast<DistinctAttr>(unwrap(recId)), isRecSelf, tag,
238 cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(file)), line,
239 cast<DIScopeAttr>(unwrap(scope)), cast<DITypeAttr>(unwrap(baseType)),
240 DIFlags(flags), sizeInBits, alignInBits,
241 cast<DIExpressionAttr>(unwrap(dataLocation)),
242 cast<DIExpressionAttr>(unwrap(rank)),
243 cast<DIExpressionAttr>(unwrap(allocated)),
244 cast<DIExpressionAttr>(unwrap(associated)),
245 llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
246 llvm::CastTo<DINodeAttr>)));
247}
248
250 return wrap(DICompositeTypeAttr::name);
251}
252
253MlirAttribute
254mlirLLVMDIDerivedTypeAttrGet(MlirContext ctx, unsigned int tag,
255 MlirAttribute name, MlirAttribute baseType,
256 uint64_t sizeInBits, uint32_t alignInBits,
257 uint64_t offsetInBits, int64_t dwarfAddressSpace,
258 int64_t flags, MlirAttribute extraData) {
259 std::optional<unsigned> addressSpace = std::nullopt;
260 if (dwarfAddressSpace >= 0)
261 addressSpace = (unsigned)dwarfAddressSpace;
262 return wrap(DIDerivedTypeAttr::get(
263 unwrap(ctx), tag, cast<StringAttr>(unwrap(name)),
264 cast<DITypeAttr>(unwrap(baseType)), sizeInBits, alignInBits, offsetInBits,
265 addressSpace, DIFlags(flags), cast<DINodeAttr>(unwrap(extraData))));
266}
267
269 return wrap(DIDerivedTypeAttr::name);
270}
271
273 MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
274 uint32_t alignInBits, MlirAttribute stringLength,
275 MlirAttribute stringLengthExp, MlirAttribute stringLocationExp,
276 MlirLLVMTypeEncoding encoding) {
277 return wrap(DIStringTypeAttr::get(
278 unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, alignInBits,
279 cast<DIVariableAttr>(unwrap(stringLength)),
280 cast<DIExpressionAttr>(unwrap(stringLengthExp)),
281 cast<DIExpressionAttr>(unwrap(stringLocationExp)), encoding));
282}
283
285 return wrap(DIStringTypeAttr::name);
286}
287
288MlirAttribute
289mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType) {
290 return wrap(cast<DIDerivedTypeAttr>(unwrap(diDerivedType)).getBaseType());
291}
292
293MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv) {
294 return wrap(CConvAttr::get(unwrap(ctx), CConv(cconv)));
295}
296
297MlirStringRef mlirLLVMCConvAttrGetName(void) { return wrap(CConvAttr::name); }
298
299MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat) {
300 return wrap(ComdatAttr::get(unwrap(ctx), comdat::Comdat(comdat)));
301}
302
303MlirStringRef mlirLLVMComdatAttrGetName(void) { return wrap(ComdatAttr::name); }
304
305MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage) {
306 return wrap(LinkageAttr::get(unwrap(ctx), linkage::Linkage(linkage)));
307}
308
310 return wrap(LinkageAttr::name);
311}
312
313MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name,
314 MlirAttribute directory) {
315 return wrap(DIFileAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
316 cast<StringAttr>(unwrap(directory))));
317}
318
319MlirStringRef mlirLLVMDIFileAttrGetName(void) { return wrap(DIFileAttr::name); }
320
322 MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage,
323 MlirAttribute file, MlirAttribute producer, bool isOptimized,
324 MlirLLVMDIEmissionKind emissionKind, MlirLLVMDINameTableKind nameTableKind,
325 MlirAttribute splitDebugFilename) {
326 return wrap(DICompileUnitAttr::get(
327 unwrap(ctx), cast<DistinctAttr>(unwrap(id)), sourceLanguage,
328 cast<DIFileAttr>(unwrap(file)), cast<StringAttr>(unwrap(producer)),
329 isOptimized, DIEmissionKind(emissionKind), DINameTableKind(nameTableKind),
330 cast<StringAttr>(unwrap(splitDebugFilename))));
331}
332
334 return wrap(DICompileUnitAttr::name);
335}
336
337MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value) {
338 return wrap(DIFlagsAttr::get(unwrap(ctx), DIFlags(value)));
339}
340
342 return wrap(DIFlagsAttr::name);
343}
344
345MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx,
346 MlirAttribute scope,
347 MlirAttribute file,
348 unsigned int line,
349 unsigned int column) {
350 return wrap(
351 DILexicalBlockAttr::get(unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
352 cast<DIFileAttr>(unwrap(file)), line, column));
353}
354
356 return wrap(DILexicalBlockAttr::name);
357}
358
359MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx,
360 MlirAttribute scope,
361 MlirAttribute file,
362 unsigned int discriminator) {
363 return wrap(DILexicalBlockFileAttr::get(
364 unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
365 cast<DIFileAttr>(unwrap(file)), discriminator));
366}
367
369 return wrap(DILexicalBlockFileAttr::name);
370}
371
373 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
374 MlirAttribute diFile, unsigned int line, unsigned int arg,
375 unsigned int alignInBits, MlirAttribute diType, int64_t flags) {
376 return wrap(DILocalVariableAttr::get(
377 unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
378 cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(diFile)), line,
379 arg, alignInBits, cast<DITypeAttr>(unwrap(diType)), DIFlags(flags)));
380}
381
383 return wrap(DILocalVariableAttr::name);
384}
385
386MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
387 unsigned int callingConvention,
388 intptr_t nTypes,
389 MlirAttribute const *types) {
390 SmallVector<Attribute> attrStorage;
391 attrStorage.reserve(nTypes);
392
393 return wrap(DISubroutineTypeAttr::get(
394 unwrap(ctx), callingConvention,
395 llvm::map_to_vector(unwrapList(nTypes, types, attrStorage),
396 llvm::CastTo<DITypeAttr>)));
397}
398
400 return wrap(DISubroutineTypeAttr::name);
401}
402
403MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId) {
404 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(unwrap(recId))));
405}
406
408 MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id,
409 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
410 MlirAttribute linkageName, MlirAttribute file, unsigned int line,
411 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
412 intptr_t nRetainedNodes, MlirAttribute const *retainedNodes,
413 intptr_t nAnnotations, MlirAttribute const *annotations) {
414 SmallVector<Attribute> nodesStorage;
415 nodesStorage.reserve(nRetainedNodes);
416
417 SmallVector<Attribute> annotationsStorage;
418 annotationsStorage.reserve(nAnnotations);
419
420 return wrap(DISubprogramAttr::get(
421 unwrap(ctx), cast<DistinctAttr>(unwrap(recId)), isRecSelf,
422 cast<DistinctAttr>(unwrap(id)),
423 cast<DICompileUnitAttr>(unwrap(compileUnit)),
424 cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
425 cast<StringAttr>(unwrap(linkageName)), cast<DIFileAttr>(unwrap(file)),
426 line, scopeLine, DISubprogramFlags(subprogramFlags),
427 cast<DISubroutineTypeAttr>(unwrap(type)),
428 llvm::map_to_vector(
429 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
430 llvm::CastTo<DINodeAttr>),
431 llvm::map_to_vector(
432 unwrapList(nAnnotations, annotations, annotationsStorage),
433 llvm::CastTo<DINodeAttr>)));
434}
435
437 return wrap(DISubprogramAttr::name);
438}
439
440MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram) {
441 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getScope());
442}
443
444unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram) {
445 return cast<DISubprogramAttr>(unwrap(diSubprogram)).getLine();
446}
447
448unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram) {
449 return cast<DISubprogramAttr>(unwrap(diSubprogram)).getScopeLine();
450}
451
452MlirAttribute
453mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram) {
454 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getCompileUnit());
455}
456
457MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram) {
458 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getFile());
459}
460
461MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram) {
462 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getType());
463}
464
465MlirAttribute mlirLLVMDIModuleAttrGet(MlirContext ctx, MlirAttribute file,
466 MlirAttribute scope, MlirAttribute name,
467 MlirAttribute configMacros,
468 MlirAttribute includePath,
469 MlirAttribute apinotes, unsigned int line,
470 bool isDecl) {
471 return wrap(DIModuleAttr::get(
472 unwrap(ctx), cast<DIFileAttr>(unwrap(file)),
473 cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
474 cast<StringAttr>(unwrap(configMacros)),
475 cast<StringAttr>(unwrap(includePath)), cast<StringAttr>(unwrap(apinotes)),
476 line, isDecl));
477}
478
480 return wrap(DIModuleAttr::name);
481}
482
483MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule) {
484 return wrap(cast<DIModuleAttr>(unwrap(diModule)).getScope());
485}
486
488 MlirContext ctx, unsigned int tag, MlirAttribute scope,
489 MlirAttribute entity, MlirAttribute file, unsigned int line,
490 MlirAttribute name, intptr_t nElements, MlirAttribute const *elements) {
491 SmallVector<Attribute> elementsStorage;
492 elementsStorage.reserve(nElements);
493 return wrap(DIImportedEntityAttr::get(
494 unwrap(ctx), tag, cast<DIScopeAttr>(unwrap(scope)),
495 cast<DINodeAttr>(unwrap(entity)), cast<DIFileAttr>(unwrap(file)), line,
496 cast<StringAttr>(unwrap(name)),
497 llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
498 llvm::CastTo<DINodeAttr>)));
499}
500
502 return wrap(DIImportedEntityAttr::name);
503}
504
505MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name,
506 MlirAttribute value) {
507 return wrap(DIAnnotationAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
508 cast<StringAttr>(unwrap(value))));
509}
510
512 return wrap(DIAnnotationAttr::name);
513}
static Type getElementType(Type type)
Determine the element type of type.
MlirStringRef mlirLLVMDIFlagsAttrGetName(void)
Definition LLVM.cpp:341
MlirStringRef mlirLLVMDIModuleAttrGetName(void)
Definition LLVM.cpp:479
MlirStringRef mlirLLVMDIAnnotationAttrGetName(void)
Definition LLVM.cpp:511
bool mlirLLVMStructTypeIsLiteral(MlirType type)
Returns true if the type is a literal (unnamed) LLVM struct type.
Definition LLVM.cpp:102
MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage)
Creates a LLVM Linkage attribute.
Definition LLVM.cpp:305
MlirStringRef mlirLLVMDIImportedEntityAttrGetName(void)
Definition LLVM.cpp:501
MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram)
Gets the file from this DISubprogramAttr.
Definition LLVM.cpp:457
MlirStringRef mlirLLVMDICompileUnitAttrGetName(void)
Definition LLVM.cpp:333
MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes, MlirType const *argumentTypes, bool isVarArg)
Creates an llvm.func type.
Definition LLVM.cpp:64
MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule)
Gets the scope of this DIModuleAttr.
Definition LLVM.cpp:483
MlirStringRef mlirLLVMDISubroutineTypeAttrGetName(void)
Definition LLVM.cpp:399
MlirType mlirLLVMFunctionTypeGetInput(MlirType type, intptr_t pos)
Returns the pos-th input type.
Definition LLVM.cpp:80
MlirStringRef mlirLLVMCConvAttrGetName(void)
Definition LLVM.cpp:297
MlirStringRef mlirLLVMDILexicalBlockAttrGetName(void)
Definition LLVM.cpp:355
MlirStringRef mlirLLVMDIStringTypeAttrGetName(void)
Definition LLVM.cpp:284
intptr_t mlirLLVMStructTypeGetNumElementTypes(MlirType type)
Returns the number of fields in the struct.
Definition LLVM.cpp:106
MlirStringRef mlirLLVMStructTypeGetName(void)
Definition LLVM.cpp:98
intptr_t mlirLLVMFunctionTypeGetNumInputs(MlirType type)
Returns the number of input types.
Definition LLVM.cpp:76
MlirStringRef mlirLLVMDILexicalBlockFileAttrGetName(void)
Definition LLVM.cpp:368
MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx)
Creates a LLVM DINullType attribute.
Definition LLVM.cpp:200
MlirStringRef mlirLLVMPointerTypeGetName(void)
Definition LLVM.cpp:30
MlirStringRef mlirLLVMDIFileAttrGetName(void)
Definition LLVM.cpp:319
MlirType mlirLLVMArrayTypeGetElementType(MlirType type)
Returns the element type of the llvm.array type.
Definition LLVM.cpp:60
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.
Definition LLVM.cpp:163
MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute directory)
Creates a LLVM DIFileAttr attribute.
Definition LLVM.cpp:313
MlirTypeID mlirLLVMPointerTypeGetTypeID()
Definition LLVM.cpp:34
bool mlirTypeIsALLVMStructType(MlirType type)
Returns true if the type is an LLVM dialect struct type.
Definition LLVM.cpp:90
MlirStringRef mlirLLVMStructTypeGetIdentifier(MlirType type)
Returns the identifier of the identified struct.
Definition LLVM.cpp:118
MlirAttribute mlirLLVMDIStringTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, uint32_t alignInBits, MlirAttribute stringLength, MlirAttribute stringLengthExp, MlirAttribute stringLocationExp, MlirLLVMTypeEncoding encoding)
Definition LLVM.cpp:272
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.
Definition LLVM.cpp:226
MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram)
Gets the scope from this DISubprogramAttr.
Definition LLVM.cpp:440
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column)
Creates a LLVM DILexicalBlock attribute.
Definition LLVM.cpp:345
MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx, unsigned int opcode, intptr_t nArguments, uint64_t const *arguments)
Creates a LLVM DIExpressionElem attribute.
Definition LLVM.cpp:173
MlirAttribute mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DICompositeType attribute.
Definition LLVM.cpp:221
MlirStringRef mlirLLVMArrayTypeGetName(void)
Definition LLVM.cpp:56
MlirTypeID mlirLLVMStructTypeGetTypeID()
Definition LLVM.cpp:94
MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, MlirLLVMTypeEncoding encoding)
Creates a LLVM DIBasicType attribute.
Definition LLVM.cpp:208
MlirType mlirLLVMFunctionTypeGetReturnType(MlirType type)
Returns the return type of the function type.
Definition LLVM.cpp:86
MlirStringRef mlirLLVMDINullTypeAttrGetName(void)
Definition LLVM.cpp:204
MlirStringRef mlirLLVMDIDerivedTypeAttrGetName(void)
Definition LLVM.cpp:268
MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat)
Creates a LLVM Comdat attribute.
Definition LLVM.cpp:299
MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DISubprogramAttr attribute.
Definition LLVM.cpp:403
MlirType mlirLLVMVoidTypeGet(MlirContext ctx)
Creates an llmv.void type.
Definition LLVM.cpp:46
MlirStringRef mlirLLVMDIBasicTypeAttrGetName(void)
Definition LLVM.cpp:217
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.
Definition LLVM.cpp:487
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.
Definition LLVM.cpp:153
MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position)
Returns the positions-th field of the struct.
Definition LLVM.cpp:110
MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name)
Definition LLVM.cpp:145
MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements)
Creates an llvm.array type.
Definition LLVM.cpp:52
MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram)
Gets the type from this DISubprogramAttr.
Definition LLVM.cpp:461
MlirAttribute mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram)
Gets the compile unit from this DISubprogram.
Definition LLVM.cpp:453
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.
Definition LLVM.cpp:465
MlirStringRef mlirLLVMDICompositeTypeAttrGetName(void)
Definition LLVM.cpp:249
MlirStringRef mlirLLVMDIExpressionAttrGetName(void)
Definition LLVM.cpp:196
MlirStringRef mlirLLVMComdatAttrGetName(void)
Definition LLVM.cpp:303
MlirStringRef mlirLLVMDILocalVariableAttrGetName(void)
Definition LLVM.cpp:382
MlirStringRef mlirLLVMDISubprogramAttrGetName(void)
Definition LLVM.cpp:436
MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv)
Creates a LLVM CConv attribute.
Definition LLVM.cpp:293
MlirStringRef mlirLLVMLinkageAttrGetName(void)
Definition LLVM.cpp:309
MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute value)
Creates a LLVM DIAnnotation attribute.
Definition LLVM.cpp:505
MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type if possible.
Definition LLVM.cpp:135
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int discriminator)
Creates a LLVM DILexicalBlockFile attribute.
Definition LLVM.cpp:359
MlirAttribute mlirLLVMDICompileUnitAttrGet(MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer, bool isOptimized, MlirLLVMDIEmissionKind emissionKind, MlirLLVMDINameTableKind nameTableKind, MlirAttribute splitDebugFilename)
Creates a LLVM DICompileUnit attribute.
Definition LLVM.cpp:321
MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations, MlirAttribute const *operations)
Creates a LLVM DIExpression attribute.
Definition LLVM.cpp:185
bool mlirLLVMStructTypeIsPacked(MlirType type)
Returns true if the struct is packed.
Definition LLVM.cpp:114
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.
Definition LLVM.cpp:407
unsigned mlirLLVMPointerTypeGetAddressSpace(MlirType pointerType)
Returns address space of llvm.ptr.
Definition LLVM.cpp:42
MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value)
Creates a LLVM DIFlags attribute.
Definition LLVM.cpp:337
MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name)
Creates an LLVM identified struct type with no body.
Definition LLVM.cpp:149
MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx, unsigned int callingConvention, intptr_t nTypes, MlirAttribute const *types)
Creates a LLVM DISubroutineTypeAttr attribute.
Definition LLVM.cpp:386
MlirAttribute mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType)
Gets the base type from a LLVM DIDerivedType attribute.
Definition LLVM.cpp:289
bool mlirLLVMStructTypeIsOpaque(MlirType type)
Returns true is the struct is explicitly opaque (will not have a body) or uninitialized (will eventua...
Definition LLVM.cpp:122
bool mlirTypeIsALLVMPointerType(MlirType type)
Returns true if the type is an LLVM dialect pointer type.
Definition LLVM.cpp:38
unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram)
Gets the line from this DISubprogramAttr.
Definition LLVM.cpp:444
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.
Definition LLVM.cpp:372
MlirStringRef mlirLLVMVoidTypeGetName(void)
Definition LLVM.cpp:50
unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram)
Gets the scope line from this DISubprogram.
Definition LLVM.cpp:448
MlirAttribute mlirLLVMDIDerivedTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, int64_t dwarfAddressSpace, int64_t flags, MlirAttribute extraData)
Creates a LLVM DIDerivedType attribute.
Definition LLVM.cpp:254
MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type.
Definition LLVM.cpp:126
MlirStringRef mlirLLVMDIExpressionElemAttrGetName(void)
Definition LLVM.cpp:181
MlirStringRef mlirLLVMFunctionTypeGetName(void)
Definition LLVM.cpp:72
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
Definition Wrap.h:40
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition Diagnostics.h:24
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
Definition Diagnostics.h:19
MlirLLVMDINameTableKind
Definition LLVM.h:334
MLIR_CAPI_EXPORTED MlirType mlirLLVMPointerTypeGet(MlirContext ctx, unsigned addressSpace)
Creates an llvm.ptr type.
Definition LLVM.cpp:26
MlirLLVMLinkage
Definition LLVM.h:208
MlirLLVMComdat
Definition LLVM.h:193
MlirLLVMCConv
Definition LLVM.h:136
MlirLLVMDIEmissionKind
Definition LLVM.h:326
MlirLLVMTypeEncoding
Definition LLVM.h:247
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
Definition Utils.cpp:305
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
A logical result value, essentially a boolean with named states.
Definition Support.h:118
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:75