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