MLIR 22.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::getTypeID());
32}
33
34bool mlirTypeIsALLVMPointerType(MlirType type) {
35 return isa<LLVM::LLVMPointerType>(unwrap(type));
36}
37
38unsigned mlirLLVMPointerTypeGetAddressSpace(MlirType pointerType) {
39 return cast<LLVM::LLVMPointerType>(unwrap(pointerType)).getAddressSpace();
40}
41
42MlirType mlirLLVMVoidTypeGet(MlirContext ctx) {
43 return wrap(LLVMVoidType::get(unwrap(ctx)));
44}
45
46MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements) {
47 return wrap(LLVMArrayType::get(unwrap(elementType), numElements));
48}
49
50MlirType mlirLLVMArrayTypeGetElementType(MlirType type) {
51 return wrap(cast<LLVM::LLVMArrayType>(unwrap(type)).getElementType());
52}
53
54MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,
55 MlirType const *argumentTypes, bool isVarArg) {
56 SmallVector<Type, 2> argumentStorage;
57 return wrap(LLVMFunctionType::get(
58 unwrap(resultType),
59 unwrapList(nArgumentTypes, argumentTypes, argumentStorage), isVarArg));
60}
61
62intptr_t mlirLLVMFunctionTypeGetNumInputs(MlirType type) {
63 return llvm::cast<LLVM::LLVMFunctionType>(unwrap(type)).getNumParams();
64}
65
66MlirType mlirLLVMFunctionTypeGetInput(MlirType type, intptr_t pos) {
67 assert(pos >= 0 && "pos in array must be positive");
68 return wrap(llvm::cast<LLVM::LLVMFunctionType>(unwrap(type))
69 .getParamType(static_cast<unsigned>(pos)));
70}
71
72MlirType mlirLLVMFunctionTypeGetReturnType(MlirType type) {
73 return wrap(llvm::cast<LLVM::LLVMFunctionType>(unwrap(type)).getReturnType());
74}
75
76bool mlirTypeIsALLVMStructType(MlirType type) {
77 return isa<LLVM::LLVMStructType>(unwrap(type));
78}
79
81 return wrap(LLVM::LLVMStructType::getTypeID());
82}
83
84bool mlirLLVMStructTypeIsLiteral(MlirType type) {
85 return !cast<LLVM::LLVMStructType>(unwrap(type)).isIdentified();
86}
87
88intptr_t mlirLLVMStructTypeGetNumElementTypes(MlirType type) {
89 return cast<LLVM::LLVMStructType>(unwrap(type)).getBody().size();
90}
91
92MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position) {
93 return wrap(cast<LLVM::LLVMStructType>(unwrap(type)).getBody()[position]);
94}
95
96bool mlirLLVMStructTypeIsPacked(MlirType type) {
97 return cast<LLVM::LLVMStructType>(unwrap(type)).isPacked();
98}
99
101 return wrap(cast<LLVM::LLVMStructType>(unwrap(type)).getName());
102}
103
104bool mlirLLVMStructTypeIsOpaque(MlirType type) {
105 return cast<LLVM::LLVMStructType>(unwrap(type)).isOpaque();
106}
107
108MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes,
109 MlirType const *fieldTypes,
110 bool isPacked) {
111 SmallVector<Type> fieldStorage;
112 return wrap(LLVMStructType::getLiteral(
113 unwrap(ctx), unwrapList(nFieldTypes, fieldTypes, fieldStorage),
114 isPacked));
115}
116
117MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc,
118 intptr_t nFieldTypes,
119 MlirType const *fieldTypes,
120 bool isPacked) {
121 SmallVector<Type> fieldStorage;
122 return wrap(LLVMStructType::getLiteralChecked(
123 [loc]() { return emitError(unwrap(loc)); }, unwrap(loc)->getContext(),
124 unwrapList(nFieldTypes, fieldTypes, fieldStorage), isPacked));
125}
126
127MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name) {
128 return wrap(LLVMStructType::getOpaque(unwrap(name), unwrap(ctx)));
129}
130
131MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name) {
132 return wrap(LLVMStructType::getIdentified(unwrap(ctx), unwrap(name)));
133}
134
136 intptr_t nFieldTypes,
137 MlirType const *fieldTypes,
138 bool isPacked) {
139 SmallVector<Type> fields;
140 return wrap(LLVMStructType::getNewIdentified(
141 unwrap(ctx), unwrap(name), unwrapList(nFieldTypes, fieldTypes, fields),
142 isPacked));
143}
144
146 intptr_t nFieldTypes,
147 MlirType const *fieldTypes,
148 bool isPacked) {
149 SmallVector<Type> fields;
150 return wrap(
151 cast<LLVM::LLVMStructType>(unwrap(structType))
152 .setBody(unwrapList(nFieldTypes, fieldTypes, fields), isPacked));
153}
154
155MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx,
156 unsigned int opcode,
157 intptr_t nArguments,
158 uint64_t const *arguments) {
159 auto list = ArrayRef<uint64_t>(arguments, nArguments);
160 return wrap(DIExpressionElemAttr::get(unwrap(ctx), opcode, list));
161}
162
163MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations,
164 MlirAttribute const *operations) {
165 SmallVector<Attribute> attrStorage;
166 attrStorage.reserve(nOperations);
167
168 return wrap(DIExpressionAttr::get(
169 unwrap(ctx),
170 llvm::map_to_vector(unwrapList(nOperations, operations, attrStorage),
171 llvm::CastTo<DIExpressionElemAttr>)));
172}
173
174MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx) {
175 return wrap(DINullTypeAttr::get(unwrap(ctx)));
176}
177
178MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag,
179 MlirAttribute name,
180 uint64_t sizeInBits,
181 MlirLLVMTypeEncoding encoding) {
182
183 return wrap(DIBasicTypeAttr::get(
184 unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, encoding));
185}
186
187MlirAttribute mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId) {
188 return wrap(
189 DICompositeTypeAttr::getRecSelf(cast<DistinctAttr>(unwrap(recId))));
190}
191
193 MlirContext ctx, MlirAttribute recId, bool isRecSelf, unsigned int tag,
194 MlirAttribute name, MlirAttribute file, uint32_t line, MlirAttribute scope,
195 MlirAttribute baseType, int64_t flags, uint64_t sizeInBits,
196 uint64_t alignInBits, intptr_t nElements, MlirAttribute const *elements,
197 MlirAttribute dataLocation, MlirAttribute rank, MlirAttribute allocated,
198 MlirAttribute associated) {
199 SmallVector<Attribute> elementsStorage;
200 elementsStorage.reserve(nElements);
201
202 return wrap(DICompositeTypeAttr::get(
203 unwrap(ctx), cast<DistinctAttr>(unwrap(recId)), isRecSelf, tag,
204 cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(file)), line,
205 cast<DIScopeAttr>(unwrap(scope)), cast<DITypeAttr>(unwrap(baseType)),
206 DIFlags(flags), sizeInBits, alignInBits,
207 cast<DIExpressionAttr>(unwrap(dataLocation)),
208 cast<DIExpressionAttr>(unwrap(rank)),
209 cast<DIExpressionAttr>(unwrap(allocated)),
210 cast<DIExpressionAttr>(unwrap(associated)),
211 llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
212 llvm::CastTo<DINodeAttr>)));
213}
214
216 MlirContext ctx, unsigned int tag, MlirAttribute name,
217 MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits,
218 uint64_t offsetInBits, int64_t dwarfAddressSpace, MlirAttribute extraData) {
219 std::optional<unsigned> addressSpace = std::nullopt;
220 if (dwarfAddressSpace >= 0)
221 addressSpace = (unsigned)dwarfAddressSpace;
222 return wrap(DIDerivedTypeAttr::get(
223 unwrap(ctx), tag, cast<StringAttr>(unwrap(name)),
224 cast<DITypeAttr>(unwrap(baseType)), sizeInBits, alignInBits, offsetInBits,
225 addressSpace, cast<DINodeAttr>(unwrap(extraData))));
226}
227
229 MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
230 uint32_t alignInBits, MlirAttribute stringLength,
231 MlirAttribute stringLengthExp, MlirAttribute stringLocationExp,
232 MlirLLVMTypeEncoding encoding) {
233 return wrap(DIStringTypeAttr::get(
234 unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, alignInBits,
235 cast<DIVariableAttr>(unwrap(stringLength)),
236 cast<DIExpressionAttr>(unwrap(stringLengthExp)),
237 cast<DIExpressionAttr>(unwrap(stringLocationExp)), encoding));
238}
239
240MlirAttribute
241mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType) {
242 return wrap(cast<DIDerivedTypeAttr>(unwrap(diDerivedType)).getBaseType());
243}
244
245MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv) {
246 return wrap(CConvAttr::get(unwrap(ctx), CConv(cconv)));
247}
248
249MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat) {
250 return wrap(ComdatAttr::get(unwrap(ctx), comdat::Comdat(comdat)));
251}
252
253MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage) {
254 return wrap(LinkageAttr::get(unwrap(ctx), linkage::Linkage(linkage)));
255}
256
257MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name,
258 MlirAttribute directory) {
259 return wrap(DIFileAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
260 cast<StringAttr>(unwrap(directory))));
261}
262
264 MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage,
265 MlirAttribute file, MlirAttribute producer, bool isOptimized,
266 MlirLLVMDIEmissionKind emissionKind, MlirLLVMDINameTableKind nameTableKind,
267 MlirAttribute splitDebugFilename) {
268 return wrap(DICompileUnitAttr::get(
269 unwrap(ctx), cast<DistinctAttr>(unwrap(id)), sourceLanguage,
270 cast<DIFileAttr>(unwrap(file)), cast<StringAttr>(unwrap(producer)),
271 isOptimized, DIEmissionKind(emissionKind), DINameTableKind(nameTableKind),
272 cast<StringAttr>(unwrap(splitDebugFilename))));
273}
274
275MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value) {
276 return wrap(DIFlagsAttr::get(unwrap(ctx), DIFlags(value)));
277}
278
279MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx,
280 MlirAttribute scope,
281 MlirAttribute file,
282 unsigned int line,
283 unsigned int column) {
284 return wrap(
285 DILexicalBlockAttr::get(unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
286 cast<DIFileAttr>(unwrap(file)), line, column));
287}
288
289MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx,
290 MlirAttribute scope,
291 MlirAttribute file,
292 unsigned int discriminator) {
293 return wrap(DILexicalBlockFileAttr::get(
294 unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
295 cast<DIFileAttr>(unwrap(file)), discriminator));
296}
297
299 MlirContext ctx, MlirAttribute scope, MlirAttribute name,
300 MlirAttribute diFile, unsigned int line, unsigned int arg,
301 unsigned int alignInBits, MlirAttribute diType, int64_t flags) {
302 return wrap(DILocalVariableAttr::get(
303 unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
304 cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(diFile)), line,
305 arg, alignInBits, cast<DITypeAttr>(unwrap(diType)), DIFlags(flags)));
306}
307
308MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
309 unsigned int callingConvention,
310 intptr_t nTypes,
311 MlirAttribute const *types) {
312 SmallVector<Attribute> attrStorage;
313 attrStorage.reserve(nTypes);
314
315 return wrap(DISubroutineTypeAttr::get(
316 unwrap(ctx), callingConvention,
317 llvm::map_to_vector(unwrapList(nTypes, types, attrStorage),
318 llvm::CastTo<DITypeAttr>)));
319}
320
321MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId) {
322 return wrap(DISubprogramAttr::getRecSelf(cast<DistinctAttr>(unwrap(recId))));
323}
324
326 MlirContext ctx, MlirAttribute recId, bool isRecSelf, MlirAttribute id,
327 MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name,
328 MlirAttribute linkageName, MlirAttribute file, unsigned int line,
329 unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type,
330 intptr_t nRetainedNodes, MlirAttribute const *retainedNodes,
331 intptr_t nAnnotations, MlirAttribute const *annotations) {
332 SmallVector<Attribute> nodesStorage;
333 nodesStorage.reserve(nRetainedNodes);
334
335 SmallVector<Attribute> annotationsStorage;
336 annotationsStorage.reserve(nAnnotations);
337
338 return wrap(DISubprogramAttr::get(
339 unwrap(ctx), cast<DistinctAttr>(unwrap(recId)), isRecSelf,
340 cast<DistinctAttr>(unwrap(id)),
341 cast<DICompileUnitAttr>(unwrap(compileUnit)),
342 cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
343 cast<StringAttr>(unwrap(linkageName)), cast<DIFileAttr>(unwrap(file)),
344 line, scopeLine, DISubprogramFlags(subprogramFlags),
345 cast<DISubroutineTypeAttr>(unwrap(type)),
346 llvm::map_to_vector(
347 unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
348 llvm::CastTo<DINodeAttr>),
349 llvm::map_to_vector(
350 unwrapList(nAnnotations, annotations, annotationsStorage),
351 llvm::CastTo<DINodeAttr>)));
352}
353
354MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram) {
355 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getScope());
356}
357
358unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram) {
359 return cast<DISubprogramAttr>(unwrap(diSubprogram)).getLine();
360}
361
362unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram) {
363 return cast<DISubprogramAttr>(unwrap(diSubprogram)).getScopeLine();
364}
365
366MlirAttribute
367mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram) {
368 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getCompileUnit());
369}
370
371MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram) {
372 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getFile());
373}
374
375MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram) {
376 return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getType());
377}
378
379MlirAttribute mlirLLVMDIModuleAttrGet(MlirContext ctx, MlirAttribute file,
380 MlirAttribute scope, MlirAttribute name,
381 MlirAttribute configMacros,
382 MlirAttribute includePath,
383 MlirAttribute apinotes, unsigned int line,
384 bool isDecl) {
385 return wrap(DIModuleAttr::get(
386 unwrap(ctx), cast<DIFileAttr>(unwrap(file)),
387 cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
388 cast<StringAttr>(unwrap(configMacros)),
389 cast<StringAttr>(unwrap(includePath)), cast<StringAttr>(unwrap(apinotes)),
390 line, isDecl));
391}
392
393MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule) {
394 return wrap(cast<DIModuleAttr>(unwrap(diModule)).getScope());
395}
396
398 MlirContext ctx, unsigned int tag, MlirAttribute scope,
399 MlirAttribute entity, MlirAttribute file, unsigned int line,
400 MlirAttribute name, intptr_t nElements, MlirAttribute const *elements) {
401 SmallVector<Attribute> elementsStorage;
402 elementsStorage.reserve(nElements);
403 return wrap(DIImportedEntityAttr::get(
404 unwrap(ctx), tag, cast<DIScopeAttr>(unwrap(scope)),
405 cast<DINodeAttr>(unwrap(entity)), cast<DIFileAttr>(unwrap(file)), line,
406 cast<StringAttr>(unwrap(name)),
407 llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
408 llvm::CastTo<DINodeAttr>)));
409}
410
411MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name,
412 MlirAttribute value) {
413 return wrap(DIAnnotationAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
414 cast<StringAttr>(unwrap(value))));
415}
static Type getElementType(Type type)
Determine the element type of type.
bool mlirLLVMStructTypeIsLiteral(MlirType type)
Returns true if the type is a literal (unnamed) LLVM struct type.
Definition LLVM.cpp:84
MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage)
Creates a LLVM Linkage attribute.
Definition LLVM.cpp:253
MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram)
Gets the file from this DISubprogramAttr.
Definition LLVM.cpp:371
MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes, MlirType const *argumentTypes, bool isVarArg)
Creates an llvm.func type.
Definition LLVM.cpp:54
MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule)
Gets the scope of this DIModuleAttr.
Definition LLVM.cpp:393
MlirType mlirLLVMFunctionTypeGetInput(MlirType type, intptr_t pos)
Returns the pos-th input type.
Definition LLVM.cpp:66
intptr_t mlirLLVMStructTypeGetNumElementTypes(MlirType type)
Returns the number of fields in the struct.
Definition LLVM.cpp:88
intptr_t mlirLLVMFunctionTypeGetNumInputs(MlirType type)
Returns the number of input types.
Definition LLVM.cpp:62
MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx)
Creates a LLVM DINullType attribute.
Definition LLVM.cpp:174
MlirType mlirLLVMArrayTypeGetElementType(MlirType type)
Returns the element type of the llvm.array type.
Definition LLVM.cpp:50
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:145
MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute directory)
Creates a LLVM DIFileAttr attribute.
Definition LLVM.cpp:257
MlirTypeID mlirLLVMPointerTypeGetTypeID()
Definition LLVM.cpp:30
bool mlirTypeIsALLVMStructType(MlirType type)
Returns true if the type is an LLVM dialect struct type.
Definition LLVM.cpp:76
MlirStringRef mlirLLVMStructTypeGetIdentifier(MlirType type)
Returns the identifier of the identified struct.
Definition LLVM.cpp:100
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:228
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:192
MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram)
Gets the scope from this DISubprogramAttr.
Definition LLVM.cpp:354
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column)
Creates a LLVM DILexicalBlock attribute.
Definition LLVM.cpp:279
MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx, unsigned int opcode, intptr_t nArguments, uint64_t const *arguments)
Creates a LLVM DIExpressionElem attribute.
Definition LLVM.cpp:155
MlirAttribute mlirLLVMDICompositeTypeAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DICompositeType attribute.
Definition LLVM.cpp:187
MlirTypeID mlirLLVMStructTypeGetTypeID()
Definition LLVM.cpp:80
MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, MlirLLVMTypeEncoding encoding)
Creates a LLVM DIBasicType attribute.
Definition LLVM.cpp:178
MlirType mlirLLVMFunctionTypeGetReturnType(MlirType type)
Returns the return type of the function type.
Definition LLVM.cpp:72
MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat)
Creates a LLVM Comdat attribute.
Definition LLVM.cpp:249
MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId)
Creates a self-referencing LLVM DISubprogramAttr attribute.
Definition LLVM.cpp:321
MlirType mlirLLVMVoidTypeGet(MlirContext ctx)
Creates an llmv.void type.
Definition LLVM.cpp:42
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:397
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:135
MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position)
Returns the positions-th field of the struct.
Definition LLVM.cpp:92
MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name)
Definition LLVM.cpp:127
MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements)
Creates an llvm.array type.
Definition LLVM.cpp:46
MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram)
Gets the type from this DISubprogramAttr.
Definition LLVM.cpp:375
MlirAttribute mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram)
Gets the compile unit from this DISubprogram.
Definition LLVM.cpp:367
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:379
MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv)
Creates a LLVM CConv attribute.
Definition LLVM.cpp:245
MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute value)
Creates a LLVM DIAnnotation attribute.
Definition LLVM.cpp:411
MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type if possible.
Definition LLVM.cpp:117
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int discriminator)
Creates a LLVM DILexicalBlockFile attribute.
Definition LLVM.cpp:289
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:263
MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations, MlirAttribute const *operations)
Creates a LLVM DIExpression attribute.
Definition LLVM.cpp:163
bool mlirLLVMStructTypeIsPacked(MlirType type)
Returns true if the struct is packed.
Definition LLVM.cpp:96
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:325
unsigned mlirLLVMPointerTypeGetAddressSpace(MlirType pointerType)
Returns address space of llvm.ptr.
Definition LLVM.cpp:38
MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value)
Creates a LLVM DIFlags attribute.
Definition LLVM.cpp:275
MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name)
Creates an LLVM identified struct type with no body.
Definition LLVM.cpp:131
MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx, unsigned int callingConvention, intptr_t nTypes, MlirAttribute const *types)
Creates a LLVM DISubroutineTypeAttr attribute.
Definition LLVM.cpp:308
MlirAttribute mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType)
Gets the base type from a LLVM DIDerivedType attribute.
Definition LLVM.cpp:241
bool mlirLLVMStructTypeIsOpaque(MlirType type)
Returns true is the struct is explicitly opaque (will not have a body) or uninitialized (will eventua...
Definition LLVM.cpp:104
bool mlirTypeIsALLVMPointerType(MlirType type)
Returns true if the type is an LLVM dialect pointer type.
Definition LLVM.cpp:34
unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram)
Gets the line from this DISubprogramAttr.
Definition LLVM.cpp:358
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:298
unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram)
Gets the scope line from this DISubprogram.
Definition LLVM.cpp:362
MlirAttribute mlirLLVMDIDerivedTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, int64_t dwarfAddressSpace, MlirAttribute extraData)
Creates a LLVM DIDerivedType attribute.
Definition LLVM.cpp:215
MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type.
Definition LLVM.cpp:108
#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:301
MLIR_CAPI_EXPORTED MlirType mlirLLVMPointerTypeGet(MlirContext ctx, unsigned addressSpace)
Creates an llvm.ptr type.
Definition LLVM.cpp:26
MlirLLVMLinkage
Definition LLVM.h:194
MlirLLVMComdat
Definition LLVM.h:181
MlirLLVMCConv
Definition LLVM.h:126
MlirLLVMDIEmissionKind
Definition LLVM.h:293
MlirLLVMTypeEncoding
Definition LLVM.h:225
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:304
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:116
A pointer to a sized fragment of a string, not necessarily null-terminated.
Definition Support.h:73