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  SmallVector<Attribute> elementsStorage;
168  elementsStorage.reserve(nElements);
169 
171  unwrap(ctx), tag, cast<DistinctAttr>(unwrap(recId)),
172  cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(file)), line,
173  cast<DIScopeAttr>(unwrap(scope)), cast<DITypeAttr>(unwrap(baseType)),
174  DIFlags(flags), sizeInBits, alignInBits,
175  llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
176  [](Attribute a) { return cast<DINodeAttr>(a); })));
177 }
178 
179 MlirAttribute
180 mlirLLVMDIDerivedTypeAttrGet(MlirContext ctx, unsigned int tag,
181  MlirAttribute name, MlirAttribute baseType,
182  uint64_t sizeInBits, uint32_t alignInBits,
183  uint64_t offsetInBits, MlirAttribute extraData) {
185  unwrap(ctx), tag, cast<StringAttr>(unwrap(name)),
186  cast<DITypeAttr>(unwrap(baseType)), sizeInBits, alignInBits, offsetInBits,
187  cast<DINodeAttr>(unwrap(extraData))));
188 }
189 
190 MlirAttribute
191 mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType) {
192  return wrap(cast<DIDerivedTypeAttr>(unwrap(diDerivedType)).getBaseType());
193 }
194 
195 MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv) {
196  return wrap(CConvAttr::get(unwrap(ctx), CConv(cconv)));
197 }
198 
199 MlirAttribute mlirLLVMComdatAttrGet(MlirContext ctx, MlirLLVMComdat comdat) {
200  return wrap(ComdatAttr::get(unwrap(ctx), comdat::Comdat(comdat)));
201 }
202 
203 MlirAttribute mlirLLVMLinkageAttrGet(MlirContext ctx, MlirLLVMLinkage linkage) {
204  return wrap(LinkageAttr::get(unwrap(ctx), linkage::Linkage(linkage)));
205 }
206 
207 MlirAttribute mlirLLVMDIFileAttrGet(MlirContext ctx, MlirAttribute name,
208  MlirAttribute directory) {
209  return wrap(DIFileAttr::get(unwrap(ctx), cast<StringAttr>(unwrap(name)),
210  cast<StringAttr>(unwrap(directory))));
211 }
212 
213 MlirAttribute
214 mlirLLVMDICompileUnitAttrGet(MlirContext ctx, MlirAttribute id,
215  unsigned int sourceLanguage, MlirAttribute file,
216  MlirAttribute producer, bool isOptimized,
217  MlirLLVMDIEmissionKind emissionKind,
218  MlirLLVMDINameTableKind nameTableKind) {
220  unwrap(ctx), cast<DistinctAttr>(unwrap(id)), sourceLanguage,
221  cast<DIFileAttr>(unwrap(file)), cast<StringAttr>(unwrap(producer)),
222  isOptimized, DIEmissionKind(emissionKind),
223  DINameTableKind(nameTableKind)));
224 }
225 
226 MlirAttribute mlirLLVMDIFlagsAttrGet(MlirContext ctx, uint64_t value) {
227  return wrap(DIFlagsAttr::get(unwrap(ctx), DIFlags(value)));
228 }
229 
230 MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx,
231  MlirAttribute scope,
232  MlirAttribute file,
233  unsigned int line,
234  unsigned int column) {
235  return wrap(
236  DILexicalBlockAttr::get(unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
237  cast<DIFileAttr>(unwrap(file)), line, column));
238 }
239 
240 MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx,
241  MlirAttribute scope,
242  MlirAttribute file,
243  unsigned int discriminator) {
245  unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
246  cast<DIFileAttr>(unwrap(file)), discriminator));
247 }
248 
249 MlirAttribute
250 mlirLLVMDILocalVariableAttrGet(MlirContext ctx, MlirAttribute scope,
251  MlirAttribute name, MlirAttribute diFile,
252  unsigned int line, unsigned int arg,
253  unsigned int alignInBits, MlirAttribute diType) {
255  unwrap(ctx), cast<DIScopeAttr>(unwrap(scope)),
256  cast<StringAttr>(unwrap(name)), cast<DIFileAttr>(unwrap(diFile)), line,
257  arg, alignInBits, cast<DITypeAttr>(unwrap(diType))));
258 }
259 
260 MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
261  unsigned int callingConvention,
262  intptr_t nTypes,
263  MlirAttribute const *types) {
264  SmallVector<Attribute> attrStorage;
265  attrStorage.reserve(nTypes);
266 
268  unwrap(ctx), callingConvention,
269  llvm::map_to_vector(unwrapList(nTypes, types, attrStorage),
270  [](Attribute a) { return cast<DITypeAttr>(a); })));
271 }
272 
274  MlirContext ctx, MlirAttribute id, MlirAttribute compileUnit,
275  MlirAttribute scope, MlirAttribute name, MlirAttribute linkageName,
276  MlirAttribute file, unsigned int line, unsigned int scopeLine,
277  uint64_t subprogramFlags, MlirAttribute type) {
279  unwrap(ctx), cast<DistinctAttr>(unwrap(id)),
280  cast<DICompileUnitAttr>(unwrap(compileUnit)),
281  cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
282  cast<StringAttr>(unwrap(linkageName)), cast<DIFileAttr>(unwrap(file)),
283  line, scopeLine, DISubprogramFlags(subprogramFlags),
284  cast<DISubroutineTypeAttr>(unwrap(type))));
285 }
286 
287 MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram) {
288  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getScope());
289 }
290 
291 unsigned int mlirLLVMDISubprogramAttrGetLine(MlirAttribute diSubprogram) {
292  return cast<DISubprogramAttr>(unwrap(diSubprogram)).getLine();
293 }
294 
295 unsigned int mlirLLVMDISubprogramAttrGetScopeLine(MlirAttribute diSubprogram) {
296  return cast<DISubprogramAttr>(unwrap(diSubprogram)).getScopeLine();
297 }
298 
299 MlirAttribute
300 mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram) {
301  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getCompileUnit());
302 }
303 
304 MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram) {
305  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getFile());
306 }
307 
308 MlirAttribute mlirLLVMDISubprogramAttrGetType(MlirAttribute diSubprogram) {
309  return wrap(cast<DISubprogramAttr>(unwrap(diSubprogram)).getType());
310 }
311 
312 MlirAttribute mlirLLVMDIModuleAttrGet(MlirContext ctx, MlirAttribute file,
313  MlirAttribute scope, MlirAttribute name,
314  MlirAttribute configMacros,
315  MlirAttribute includePath,
316  MlirAttribute apinotes, unsigned int line,
317  bool isDecl) {
318  return wrap(DIModuleAttr::get(
319  unwrap(ctx), cast<DIFileAttr>(unwrap(file)),
320  cast<DIScopeAttr>(unwrap(scope)), cast<StringAttr>(unwrap(name)),
321  cast<StringAttr>(unwrap(configMacros)),
322  cast<StringAttr>(unwrap(includePath)), cast<StringAttr>(unwrap(apinotes)),
323  line, isDecl));
324 }
325 
326 MlirAttribute mlirLLVMDIModuleAttrGetScope(MlirAttribute diModule) {
327  return wrap(cast<DIModuleAttr>(unwrap(diModule)).getScope());
328 }
MlirAttribute mlirLLVMDIDerivedTypeAttrGet(MlirContext ctx, unsigned int tag, MlirAttribute name, MlirAttribute baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, MlirAttribute extraData)
Creates a LLVM DIDerivedType attribute.
Definition: LLVM.cpp:180
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:203
MlirAttribute mlirLLVMDISubprogramAttrGetFile(MlirAttribute diSubprogram)
Gets the file from this DISubprogramAttr.
Definition: LLVM.cpp:304
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:326
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:250
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:207
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:214
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 mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram)
Gets the scope from this DISubprogramAttr.
Definition: LLVM.cpp:287
MlirAttribute mlirLLVMDILexicalBlockAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int line, unsigned int column)
Creates a LLVM DILexicalBlock attribute.
Definition: LLVM.cpp:230
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:199
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:273
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:308
MlirAttribute mlirLLVMDISubprogramAttrGetCompileUnit(MlirAttribute diSubprogram)
Gets the compile unit from this DISubprogram.
Definition: LLVM.cpp:300
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:312
MlirAttribute mlirLLVMCConvAttrGet(MlirContext ctx, MlirLLVMCConv cconv)
Creates a LLVM CConv attribute.
Definition: LLVM.cpp:195
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 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)
Creates a LLVM DICompositeType attribute.
Definition: LLVM.cpp:162
MlirAttribute mlirLLVMDILexicalBlockFileAttrGet(MlirContext ctx, MlirAttribute scope, MlirAttribute file, unsigned int discriminator)
Creates a LLVM DILexicalBlockFile attribute.
Definition: LLVM.cpp:240
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:226
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:260
MlirAttribute mlirLLVMDIDerivedTypeAttrGetBaseType(MlirAttribute diDerivedType)
Gets the base type from a LLVM DIDerivedType attribute.
Definition: LLVM.cpp:191
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
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:291
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:295
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:267
MlirLLVMLinkage
Definition: LLVM.h:177
MlirLLVMComdat
Definition: LLVM.h:164
MlirLLVMCConv
Definition: LLVM.h:109
MlirLLVMDIEmissionKind
Definition: LLVM.h:259
MlirLLVMTypeEncoding
Definition: LLVM.h:208
Include the generated interface declarations.
Definition: CallGraph.h:229
Include the generated interface declarations.
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