MLIR  19.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 
9 #include "mlir-c/Dialect/LLVM.h"
10 #include "mlir-c/IR.h"
11 #include "mlir-c/Support.h"
12 #include "mlir/CAPI/Registration.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 
21 using namespace mlir;
22 using namespace mlir::LLVM;
23 
25 
26 MlirType mlirLLVMPointerTypeGet(MlirContext ctx, unsigned addressSpace) {
27  return wrap(LLVMPointerType::get(unwrap(ctx), addressSpace));
28 }
29 
30 bool mlirTypeIsALLVMPointerType(MlirType type) {
31  return isa<LLVM::LLVMPointerType>(unwrap(type));
32 }
33 
34 unsigned mlirLLVMPointerTypeGetAddressSpace(MlirType pointerType) {
35  return cast<LLVM::LLVMPointerType>(unwrap(pointerType)).getAddressSpace();
36 }
37 
38 MlirType mlirLLVMVoidTypeGet(MlirContext ctx) {
39  return wrap(LLVMVoidType::get(unwrap(ctx)));
40 }
41 
42 MlirType mlirLLVMArrayTypeGet(MlirType elementType, unsigned numElements) {
43  return wrap(LLVMArrayType::get(unwrap(elementType), numElements));
44 }
45 
46 MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes,
47  MlirType const *argumentTypes, bool isVarArg) {
48  SmallVector<Type, 2> argumentStorage;
50  unwrap(resultType),
51  unwrapList(nArgumentTypes, argumentTypes, argumentStorage), isVarArg));
52 }
53 
54 bool mlirTypeIsALLVMStructType(MlirType type) {
55  return isa<LLVM::LLVMStructType>(unwrap(type));
56 }
57 
58 bool mlirLLVMStructTypeIsLiteral(MlirType type) {
59  return !cast<LLVM::LLVMStructType>(unwrap(type)).isIdentified();
60 }
61 
62 intptr_t mlirLLVMStructTypeGetNumElementTypes(MlirType type) {
63  return cast<LLVM::LLVMStructType>(unwrap(type)).getBody().size();
64 }
65 
66 MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position) {
67  return wrap(cast<LLVM::LLVMStructType>(unwrap(type)).getBody()[position]);
68 }
69 
70 bool mlirLLVMStructTypeIsPacked(MlirType type) {
71  return cast<LLVM::LLVMStructType>(unwrap(type)).isPacked();
72 }
73 
75  return wrap(cast<LLVM::LLVMStructType>(unwrap(type)).getName());
76 }
77 
78 bool mlirLLVMStructTypeIsOpaque(MlirType type) {
79  return cast<LLVM::LLVMStructType>(unwrap(type)).isOpaque();
80 }
81 
82 MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes,
83  MlirType const *fieldTypes,
84  bool isPacked) {
85  SmallVector<Type> fieldStorage;
87  unwrap(ctx), unwrapList(nFieldTypes, fieldTypes, fieldStorage),
88  isPacked));
89 }
90 
91 MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc,
92  intptr_t nFieldTypes,
93  MlirType const *fieldTypes,
94  bool isPacked) {
95  SmallVector<Type> fieldStorage;
97  [loc]() { return emitError(unwrap(loc)); }, unwrap(loc)->getContext(),
98  unwrapList(nFieldTypes, fieldTypes, fieldStorage), isPacked));
99 }
100 
101 MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name) {
102  return wrap(LLVMStructType::getOpaque(unwrap(name), unwrap(ctx)));
103 }
104 
105 MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name) {
106  return wrap(LLVMStructType::getIdentified(unwrap(ctx), unwrap(name)));
107 }
108 
109 MlirType mlirLLVMStructTypeIdentifiedNewGet(MlirContext ctx, MlirStringRef name,
110  intptr_t nFieldTypes,
111  MlirType const *fieldTypes,
112  bool isPacked) {
113  SmallVector<Type> fields;
115  unwrap(ctx), unwrap(name), unwrapList(nFieldTypes, fieldTypes, fields),
116  isPacked));
117 }
118 
120  intptr_t nFieldTypes,
121  MlirType const *fieldTypes,
122  bool isPacked) {
123  SmallVector<Type> fields;
124  return wrap(
125  cast<LLVM::LLVMStructType>(unwrap(structType))
126  .setBody(unwrapList(nFieldTypes, fieldTypes, fields), isPacked));
127 }
128 
129 MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx,
130  unsigned int opcode,
131  intptr_t nArguments,
132  uint64_t const *arguments) {
133  auto list = ArrayRef<uint64_t>(arguments, nArguments);
134  return wrap(DIExpressionElemAttr::get(unwrap(ctx), opcode, list));
135 }
136 
137 MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations,
138  MlirAttribute const *operations) {
139  SmallVector<Attribute> attrStorage;
140  attrStorage.reserve(nOperations);
141 
143  unwrap(ctx),
144  llvm::map_to_vector(
145  unwrapList(nOperations, operations, attrStorage),
146  [](Attribute a) { return cast<DIExpressionElemAttr>(a); })));
147 }
148 
149 MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx) {
150  return wrap(DINullTypeAttr::get(unwrap(ctx)));
151 }
152 
153 MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag,
154  MlirAttribute name,
155  uint64_t sizeInBits,
156  MlirLLVMTypeEncoding encoding) {
157 
158  return wrap(DIBasicTypeAttr::get(
159  unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, encoding));
160 }
161 
163  MlirContext ctx, unsigned int tag, MlirAttribute recId, MlirAttribute name,
164  MlirAttribute file, uint32_t line, MlirAttribute scope,
165  MlirAttribute baseType, int64_t flags, uint64_t sizeInBits,
166  uint64_t alignInBits, intptr_t nElements, MlirAttribute const *elements,
167  MlirAttribute dataLocation, MlirAttribute rank, MlirAttribute allocated,
168  MlirAttribute associated) {
169  SmallVector<Attribute> elementsStorage;
170  elementsStorage.reserve(nElements);
171 
173  unwrap(ctx), tag, cast<DistinctAttr>(unwrap(recId)),
174  cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(file)), line,
175  cast<DIScopeAttr>(unwrap(scope)), cast<DITypeAttr>(unwrap(baseType)),
176  DIFlags(flags), sizeInBits, alignInBits,
177  llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
178  [](Attribute a) { return cast<DINodeAttr>(a); }),
179  cast<DIExpressionAttr>(unwrap(dataLocation)),
180  cast<DIExpressionAttr>(unwrap(rank)),
181  cast<DIExpressionAttr>(unwrap(allocated)),
182  cast<DIExpressionAttr>(unwrap(associated))));
183 }
184 
186  MlirContext ctx, unsigned int tag, MlirAttribute name,
187  MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits,
188  uint64_t offsetInBits, int64_t dwarfAddressSpace, MlirAttribute extraData) {
189  std::optional<unsigned> addressSpace = std::nullopt;
190  if (dwarfAddressSpace >= 0)
191  addressSpace = (unsigned)dwarfAddressSpace;
193  unwrap(ctx), tag, cast<StringAttr>(unwrap(name)),
194  cast<DITypeAttr>(unwrap(baseType)), sizeInBits, alignInBits, offsetInBits,
195  addressSpace, cast<DINodeAttr>(unwrap(extraData))));
196 }
197 
199  MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits,
200  uint32_t alignInBits, MlirAttribute stringLength,
201  MlirAttribute stringLengthExp, MlirAttribute stringLocationExp,
202  MlirLLVMTypeEncoding encoding) {
204  unwrap(ctx), tag, cast<StringAttr>(unwrap(name)), sizeInBits, alignInBits,
205  cast<DIVariableAttr>(unwrap(stringLength)),
206  cast<DIExpressionAttr>(unwrap(stringLengthExp)),
207  cast<DIExpressionAttr>(unwrap(stringLocationExp)), encoding));
208 }
209 
210 MlirAttribute
211 mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType) {
212  return wrap(cast<DIDerivedTypeAttr>(unwrap(diDerivedType)).getBaseType());
213 }
214 
215 MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv) {
216  return wrap(CConvAttr::get(unwrap(ctx), CConv(cconv)));
217 }
218 
219 MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat) {
220  return wrap(ComdatAttr::get(unwrap(ctx), comdat::Comdat(comdat)));
221 }
222 
223 MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage) {
224  return wrap(LinkageAttr::get(unwrap(ctx), linkage::Linkage(linkage)));
225 }
226 
227 MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name,
228  MlirAttribute directory) {
229  return wrap(DIFileAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
230  cast<StringAttr>(unwrap(directory))));
231 }
232 
233 MlirAttribute
234 mlirLLVMDICompileUnitAttrGet(MlirContext ctx, MlirAttribute id,
235  unsigned int sourceLanguage, MlirAttribute file,
236  MlirAttribute producer, bool isOptimized,
237  MlirLLVMDIEmissionKind emissionKind,
238  MlirLLVMDINameTableKind nameTableKind) {
240  unwrap(ctx), cast<DistinctAttr>(unwrap(id)), sourceLanguage,
241  cast<DIFileAttr>(unwrap(file)), cast<StringAttr>(unwrap(producer)),
242  isOptimized, DIEmissionKind(emissionKind),
243  DINameTableKind(nameTableKind)));
244 }
245 
246 MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value) {
247  return wrap(DIFlagsAttr::get(unwrap(ctx), DIFlags(value)));
248 }
249 
250 MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx,
251  MlirAttribute scope,
252  MlirAttribute file,
253  unsigned int line,
254  unsigned int column) {
255  return wrap(
256  DILexicalBlockAttr::get(unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
257  cast<DIFileAttr>(unwrap(file)), line, column));
258 }
259 
260 MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx,
261  MlirAttribute scope,
262  MlirAttribute file,
263  unsigned int discriminator) {
265  unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
266  cast<DIFileAttr>(unwrap(file)), discriminator));
267 }
268 
269 MlirAttribute
270 mlirLLVMDILocalVariableAttrGet(MlirContext ctx, MlirAttribute scope,
271  MlirAttribute name, MlirAttribute diFile,
272  unsigned int line, unsigned int arg,
273  unsigned int alignInBits, MlirAttribute diType) {
275  unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
276  cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(diFile)), line,
277  arg, alignInBits, cast<DITypeAttr>(unwrap(diType))));
278 }
279 
280 MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
281  unsigned int callingConvention,
282  intptr_t nTypes,
283  MlirAttribute const *types) {
284  SmallVector<Attribute> attrStorage;
285  attrStorage.reserve(nTypes);
286 
288  unwrap(ctx), callingConvention,
289  llvm::map_to_vector(unwrapList(nTypes, types, attrStorage),
290  [](Attribute a) { return cast<DITypeAttr>(a); })));
291 }
292 
294  MlirContext ctx, MlirAttribute id, MlirAttribute compileUnit,
295  MlirAttribute scope, MlirAttribute name, MlirAttribute linkageName,
296  MlirAttribute file, unsigned int line, unsigned int scopeLine,
297  uint64_t subprogramFlags, MlirAttribute type) {
299  unwrap(ctx), cast<DistinctAttr>(unwrap(id)),
300  cast<DICompileUnitAttr>(unwrap(compileUnit)),
301  cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
302  cast<StringAttr>(unwrap(linkageName)), cast<DIFileAttr>(unwrap(file)),
303  line, scopeLine, DISubprogramFlags(subprogramFlags),
304  cast<DISubroutineTypeAttr>(unwrap(type))));
305 }
306 
307 MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram) {
308  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getScope());
309 }
310 
311 unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram) {
312  return cast<DISubprogramAttr>(unwrap(diSubprogram)).getLine();
313 }
314 
315 unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram) {
316  return cast<DISubprogramAttr>(unwrap(diSubprogram)).getScopeLine();
317 }
318 
319 MlirAttribute
320 mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram) {
321  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getCompileUnit());
322 }
323 
324 MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram) {
325  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getFile());
326 }
327 
328 MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram) {
329  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getType());
330 }
331 
332 MlirAttribute mlirLLVMDIModuleAttrGet(MlirContext ctx, MlirAttribute file,
333  MlirAttribute scope, MlirAttribute name,
334  MlirAttribute configMacros,
335  MlirAttribute includePath,
336  MlirAttribute apinotes, unsigned int line,
337  bool isDecl) {
338  return wrap(DIModuleAttr::get(
339  unwrap(ctx), cast<DIFileAttr>(unwrap(file)),
340  cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
341  cast<StringAttr>(unwrap(configMacros)),
342  cast<StringAttr>(unwrap(includePath)), cast<StringAttr>(unwrap(apinotes)),
343  line, isDecl));
344 }
345 
346 MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule) {
347  return wrap(cast<DIModuleAttr>(unwrap(diModule)).getScope());
348 }
bool mlirLLVMStructTypeIsLiteral(MlirType type)
Returns true if the type is a literal (unnamed) LLVM struct type.
Definition: LLVM.cpp:58
MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage)
Creates a LLVM Linkage attribute.
Definition: LLVM.cpp:223
MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram)
Gets the file from this DISubprogramAttr.
Definition: LLVM.cpp:324
MlirType mlirLLVMFunctionTypeGet(MlirType resultType, intptr_t nArgumentTypes, MlirType const *argumentTypes, bool isVarArg)
Creates an llvm.func type.
Definition: LLVM.cpp:46
MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule)
Gets the scope of this DIModuleAttr.
Definition: LLVM.cpp:346
intptr_t mlirLLVMStructTypeGetNumElementTypes(MlirType type)
Returns the number of fields in the struct.
Definition: LLVM.cpp:62
MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx)
Creates a LLVM DINullType attribute.
Definition: LLVM.cpp:149
MlirAttribute mlirLLVMDILocalVariableAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute name, MlirAttribute diFile, unsigned int line, unsigned int arg, unsigned int alignInBits, MlirAttribute diType)
Creates a LLVM DILocalVariableAttr attribute.
Definition: LLVM.cpp:270
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:119
MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name, MlirAttribute directory)
Creates a LLVM DIFileAttr attribute.
Definition: LLVM.cpp:227
MlirAttribute mlirLLVMDICompileUnitAttrGet(MlirContext ctx, MlirAttribute id, unsigned int sourceLanguage, MlirAttribute file, MlirAttribute producer, bool isOptimized, MlirLLVMDIEmissionKind emissionKind, MlirLLVMDINameTableKind nameTableKind)
Creates a LLVM DICompileUnit attribute.
Definition: LLVM.cpp:234
bool mlirTypeIsALLVMStructType(MlirType type)
Returns true if the type is an LLVM dialect struct type.
Definition: LLVM.cpp:54
MlirStringRef mlirLLVMStructTypeGetIdentifier(MlirType type)
Returns the identifier of the identified struct.
Definition: LLVM.cpp:74
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:198
MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram)
Gets the scope from this DISubprogramAttr.
Definition: LLVM.cpp:307
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column)
Creates a LLVM DILexicalBlock attribute.
Definition: LLVM.cpp:250
MlirAttribute mlirLLVMDIExpressionElemAttrGet(MlirContext ctx, unsigned int opcode, intptr_t nArguments, uint64_t const *arguments)
Creates a LLVM DIExpressionElem attribute.
Definition: LLVM.cpp:129
MlirAttribute mlirLLVMDIBasicTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, uint64_t sizeInBits, MlirLLVMTypeEncoding encoding)
Creates a LLVM DIBasicType attribute.
Definition: LLVM.cpp:153
MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat)
Creates a LLVM Comdat attribute.
Definition: LLVM.cpp:219
MlirAttribute mlirLLVMDISubprogramAttrGet(MlirContext ctx, MlirAttribute id, MlirAttribute compileUnit, MlirAttribute scope, MlirAttribute name, MlirAttribute linkageName, MlirAttribute file, unsigned int line, unsigned int scopeLine, uint64_t subprogramFlags, MlirAttribute type)
Creates a LLVM DISubprogramAttr attribute.
Definition: LLVM.cpp:293
MlirType mlirLLVMVoidTypeGet(MlirContext ctx)
Creates an llmv.void type.
Definition: LLVM.cpp:38
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:109
MlirType mlirLLVMStructTypeGetElementType(MlirType type, intptr_t position)
Returns the positions-th field of the struct.
Definition: LLVM.cpp:66
MlirType mlirLLVMStructTypeOpaqueGet(MlirContext ctx, MlirStringRef name)
Definition: LLVM.cpp:101
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:328
MlirAttribute mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram)
Gets the compile unit from this DISubprogram.
Definition: LLVM.cpp:320
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:332
MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv)
Creates a LLVM CConv attribute.
Definition: LLVM.cpp:215
MlirType mlirLLVMStructTypeLiteralGetChecked(MlirLocation loc, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type if possible.
Definition: LLVM.cpp:91
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int discriminator)
Creates a LLVM DILexicalBlockFile attribute.
Definition: LLVM.cpp:260
MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations, MlirAttribute const *operations)
Creates a LLVM DIExpression attribute.
Definition: LLVM.cpp:137
bool mlirLLVMStructTypeIsPacked(MlirType type)
Returns true if the struct is packed.
Definition: LLVM.cpp:70
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:246
MlirType mlirLLVMStructTypeIdentifiedGet(MlirContext ctx, MlirStringRef name)
Creates an LLVM identified struct type with no body.
Definition: LLVM.cpp:105
MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx, unsigned int callingConvention, intptr_t nTypes, MlirAttribute const *types)
Creates a LLVM DISubroutineTypeAttr attribute.
Definition: LLVM.cpp:280
MlirAttribute mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType)
Gets the base type from a LLVM DIDerivedType attribute.
Definition: LLVM.cpp:211
bool mlirLLVMStructTypeIsOpaque(MlirType type)
Returns true is the struct is explicitly opaque (will not have a body) or uninitialized (will eventua...
Definition: LLVM.cpp:78
MlirAttribute mlirLLVMDICompositeTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute recId, 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:162
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:311
MlirType mlirLLVMPointerTypeGet(MlirContext ctx, unsigned addressSpace)
Creates an llvm.ptr type.
Definition: LLVM.cpp:26
unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram)
Gets the scope line from this DISubprogram.
Definition: LLVM.cpp:315
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:185
MlirType mlirLLVMStructTypeLiteralGet(MlirContext ctx, intptr_t nFieldTypes, MlirType const *fieldTypes, bool isPacked)
Creates an LLVM literal (unnamed) struct type.
Definition: LLVM.cpp:82
#define MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Name, Namespace, ClassName)
Definition: Registration.h:36
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
Definition: Wrap.h:40
Attributes are known-constant values of operations.
Definition: Attributes.h:25
static LLVMStructType getLiteralChecked(function_ref< InFlightDiagnostic()> emitError, MLIRContext *context, ArrayRef< Type > types, bool isPacked=false)
Definition: LLVMTypes.cpp:459
static LLVMStructType getLiteral(MLIRContext *context, ArrayRef< Type > types, bool isPacked=false)
Gets or creates a literal struct with the given body in the provided context.
Definition: LLVMTypes.cpp:453
static LLVMStructType getNewIdentified(MLIRContext *context, StringRef name, ArrayRef< Type > elements, bool isPacked=false)
Gets a new identified struct with the given body.
Definition: LLVMTypes.cpp:436
static LLVMStructType getIdentified(MLIRContext *context, StringRef name)
Gets or creates an identified struct with the given name in the provided context.
Definition: LLVMTypes.cpp:425
static LLVMStructType getOpaque(StringRef name, MLIRContext *context)
Gets or creates an intentionally-opaque identified struct.
Definition: LLVMTypes.cpp:465
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
Definition: Diagnostics.h:19
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
Definition: Diagnostics.h:24
MlirLLVMDINameTableKind
Definition: LLVM.h:280
MlirLLVMLinkage
Definition: LLVM.h:177
MlirLLVMComdat
Definition: LLVM.h:164
MlirLLVMCConv
Definition: LLVM.h:109
MlirLLVMDIEmissionKind
Definition: LLVM.h:272
MlirLLVMTypeEncoding
Definition: LLVM.h:208
Include the generated interface declarations.
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.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
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