MLIR  19.0.0git
ModuleImport.h
Go to the documentation of this file.
1 //===- ModuleImport.h - LLVM to MLIR conversion -----------------*- C++ -*-===//
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 // This file implements the import of an LLVM IR module into an LLVM dialect
10 // module.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_TARGET_LLVMIR_MODULEIMPORT_H
15 #define MLIR_TARGET_LLVMIR_MODULEIMPORT_H
16 
18 #include "mlir/IR/BuiltinOps.h"
22 
23 namespace llvm {
24 class BasicBlock;
25 class CallBase;
26 class DbgVariableIntrinsic;
27 class Function;
28 class Instruction;
29 class Value;
30 } // namespace llvm
31 
32 namespace mlir {
33 namespace LLVM {
34 
35 namespace detail {
36 class DataLayoutImporter;
37 class DebugImporter;
38 class LoopAnnotationImporter;
39 } // namespace detail
40 
41 /// Module import implementation class that provides methods to import globals
42 /// and functions from an LLVM module into an MLIR module. It holds mappings
43 /// between the original and translated globals, basic blocks, and values used
44 /// during the translation. Additionally, it keeps track of the current constant
45 /// insertion point since LLVM immediate values translate to MLIR operations
46 /// that are introduced at the beginning of the region.
47 class ModuleImport {
48 public:
49  ModuleImport(ModuleOp mlirModule, std::unique_ptr<llvm::Module> llvmModule,
50  bool emitExpensiveWarnings);
51 
52  /// Calls the LLVMImportInterface initialization that queries the registered
53  /// dialect interfaces for the supported LLVM IR intrinsics and metadata kinds
54  /// and builds the dispatch tables. Returns failure if multiple dialect
55  /// interfaces translate the same LLVM IR intrinsic.
57 
58  /// Converts all functions of the LLVM module to MLIR functions.
60 
61  /// Converts all comdat selectors of the LLVM module to MLIR comdat
62  /// operations.
64 
65  /// Converts all global variables of the LLVM module to MLIR global variables.
67 
68  /// Converts the data layout of the LLVM module to an MLIR data layout
69  /// specification.
71 
72  /// Stores the mapping between an LLVM value and its MLIR counterpart.
73  void mapValue(llvm::Value *llvm, Value mlir) { mapValue(llvm) = mlir; }
74 
75  /// Provides write-once access to store the MLIR value corresponding to the
76  /// given LLVM value.
77  Value &mapValue(llvm::Value *value) {
78  Value &mlir = valueMapping[value];
79  assert(mlir == nullptr &&
80  "attempting to map a value that is already mapped");
81  return mlir;
82  }
83 
84  /// Returns the MLIR value mapped to the given LLVM value.
85  Value lookupValue(llvm::Value *value) { return valueMapping.lookup(value); }
86 
87  /// Stores a mapping between an LLVM instruction and the imported MLIR
88  /// operation if the operation returns no result. Asserts if the operation
89  /// returns a result and should be added to valueMapping instead.
90  void mapNoResultOp(llvm::Instruction *llvm, Operation *mlir) {
92  }
93 
94  /// Provides write-once access to store the MLIR operation corresponding to
95  /// the given LLVM instruction if the operation returns no result. Asserts if
96  /// the operation returns a result and should be added to valueMapping
97  /// instead.
98  Operation *&mapNoResultOp(llvm::Instruction *inst) {
99  Operation *&mlir = noResultOpMapping[inst];
100  assert(inst->getType()->isVoidTy() &&
101  "attempting to map an operation that returns a result");
102  assert(mlir == nullptr &&
103  "attempting to map an operation that is already mapped");
104  return mlir;
105  }
106 
107  /// Returns the MLIR operation mapped to the given LLVM instruction. Queries
108  /// valueMapping and noResultOpMapping to support operations with and without
109  /// result.
110  Operation *lookupOperation(llvm::Instruction *inst) {
111  if (Value value = lookupValue(inst))
112  return value.getDefiningOp();
113  return noResultOpMapping.lookup(inst);
114  }
115 
116  /// Stores the mapping between an LLVM block and its MLIR counterpart.
117  void mapBlock(llvm::BasicBlock *llvm, Block *mlir) {
118  auto result = blockMapping.try_emplace(llvm, mlir);
119  (void)result;
120  assert(result.second && "attempting to map a block that is already mapped");
121  }
122 
123  /// Returns the MLIR block mapped to the given LLVM block.
124  Block *lookupBlock(llvm::BasicBlock *block) const {
125  return blockMapping.lookup(block);
126  }
127 
128  /// Converts an LLVM value to an MLIR value, or returns failure if the
129  /// conversion fails. Uses the `convertConstant` method to translate constant
130  /// LLVM values.
131  FailureOr<Value> convertValue(llvm::Value *value);
132 
133  /// Converts an LLVM metadata value to an MLIR value, or returns failure if
134  /// the conversion fails. Uses the `convertConstant` method to translate
135  /// constant LLVM values.
136  FailureOr<Value> convertMetadataValue(llvm::Value *value);
137 
138  /// Converts a range of LLVM values to a range of MLIR values using the
139  /// `convertValue` method, or returns failure if the conversion fails.
141 
142  /// Converts `value` to an integer attribute. Asserts if the matching fails.
143  IntegerAttr matchIntegerAttr(llvm::Value *value);
144 
145  /// Converts `value` to a float attribute. Asserts if the matching fails.
146  FloatAttr matchFloatAttr(llvm::Value *value);
147 
148  /// Converts `value` to a local variable attribute. Asserts if the matching
149  /// fails.
150  DILocalVariableAttr matchLocalVariableAttr(llvm::Value *value);
151 
152  /// Converts `value` to a label attribute. Asserts if the matching fails.
153  DILabelAttr matchLabelAttr(llvm::Value *value);
154 
155  /// Converts `value` to a FP exception behavior attribute. Asserts if the
156  /// matching fails.
157  FPExceptionBehaviorAttr matchFPExceptionBehaviorAttr(llvm::Value *value);
158 
159  /// Converts `value` to a rounding mode attribute. Asserts if the matching
160  /// fails.
161  RoundingModeAttr matchRoundingModeAttr(llvm::Value *value);
162 
163  /// Converts `value` to an array of alias scopes or returns failure if the
164  /// conversion fails.
166  matchAliasScopeAttrs(llvm::Value *value);
167 
168  /// Translates the debug location.
169  Location translateLoc(llvm::DILocation *loc);
170 
171  /// Converts the type from LLVM to MLIR LLVM dialect.
172  Type convertType(llvm::Type *type) {
173  return typeTranslator.translateType(type);
174  }
175 
176  /// Imports `func` into the current module.
177  LogicalResult processFunction(llvm::Function *func);
178 
179  /// Converts function attributes of LLVM Function `func` into LLVM dialect
180  /// attributes of LLVMFuncOp `funcOp`.
181  void processFunctionAttributes(llvm::Function *func, LLVMFuncOp funcOp);
182 
183  /// Sets the integer overflow flags (nsw/nuw) attribute for the imported
184  /// operation `op` given the original instruction `inst`. Asserts if the
185  /// operation does not implement the integer overflow flag interface.
186  void setIntegerOverflowFlagsAttr(llvm::Instruction *inst,
187  Operation *op) const;
188 
189  /// Sets the fastmath flags attribute for the imported operation `op` given
190  /// the original instruction `inst`. Asserts if the operation does not
191  /// implement the fastmath interface.
192  void setFastmathFlagsAttr(llvm::Instruction *inst, Operation *op) const;
193 
194  /// Converts !llvm.linker.options metadata to the llvm.linker.options
195  /// LLVM dialect operation.
197 
198  /// Converts all LLVM metadata nodes that translate to attributes such as
199  /// alias analysis or access group metadata, and builds a map from the
200  /// metadata nodes to the converted attributes.
201  /// Returns success if all conversions succeed and failure otherwise.
203 
204  /// Returns the MLIR attribute mapped to the given LLVM TBAA
205  /// metadata `node`.
206  Attribute lookupTBAAAttr(const llvm::MDNode *node) const {
207  return tbaaMapping.lookup(node);
208  }
209 
210  /// Returns the access group attributes that map to the access group nodes
211  /// starting from the access group metadata `node`. Returns failure, if any of
212  /// the attributes cannot be found.
214  lookupAccessGroupAttrs(const llvm::MDNode *node) const;
215 
216  /// Returns the loop annotation attribute that corresponds to the given LLVM
217  /// loop metadata `node`.
218  LoopAnnotationAttr translateLoopAnnotationAttr(const llvm::MDNode *node,
219  Location loc) const;
220 
221  /// Returns the alias scope attributes that map to the alias scope nodes
222  /// starting from the metadata `node`. Returns failure, if any of the
223  /// attributes cannot be found.
225  lookupAliasScopeAttrs(const llvm::MDNode *node) const;
226 
227  /// Adds a debug intrinsics to the list of intrinsics that should be converted
228  /// after the function conversion has finished.
229  void addDebugIntrinsic(llvm::CallInst *intrinsic);
230 
231  /// Converts the LLVM values for an intrinsic to mixed MLIR values and
232  /// attributes for LLVM_IntrOpBase. Attributes correspond to LLVM immargs. The
233  /// list `immArgPositions` contains the positions of immargs on the LLVM
234  /// intrinsic, and `immArgAttrNames` list (of the same length) contains the
235  /// corresponding MLIR attribute names.
238  ArrayRef<unsigned> immArgPositions,
239  ArrayRef<StringLiteral> immArgAttrNames,
240  SmallVectorImpl<Value> &valuesOut,
242 
243 private:
244  /// Clears the accumulated state before processing a new region.
245  void clearRegionState() {
246  valueMapping.clear();
247  noResultOpMapping.clear();
248  blockMapping.clear();
249  debugIntrinsics.clear();
250  }
251  /// Sets the constant insertion point to the start of the given block.
252  void setConstantInsertionPointToStart(Block *block) {
253  constantInsertionBlock = block;
254  constantInsertionOp = nullptr;
255  }
256 
257  /// Converts an LLVM global variable into an MLIR LLVM dialect global
258  /// operation if a conversion exists. Otherwise, returns failure.
259  LogicalResult convertGlobal(llvm::GlobalVariable *globalVar);
260  /// Imports the magic globals "global_ctors" and "global_dtors".
261  LogicalResult convertGlobalCtorsAndDtors(llvm::GlobalVariable *globalVar);
262  /// Returns personality of `func` as a FlatSymbolRefAttr.
263  FlatSymbolRefAttr getPersonalityAsAttr(llvm::Function *func);
264  /// Imports `bb` into `block`, which must be initially empty.
265  LogicalResult processBasicBlock(llvm::BasicBlock *bb, Block *block);
266  /// Converts all debug intrinsics in `debugIntrinsics`. Assumes that the
267  /// function containing the intrinsics has been fully converted to MLIR.
268  LogicalResult processDebugIntrinsics();
269  /// Converts a single debug intrinsic.
270  LogicalResult processDebugIntrinsic(llvm::DbgVariableIntrinsic *dbgIntr,
271  DominanceInfo &domInfo);
272  /// Converts an LLVM intrinsic to an MLIR LLVM dialect operation if an MLIR
273  /// counterpart exists. Otherwise, returns failure.
274  LogicalResult convertIntrinsic(llvm::CallInst *inst);
275  /// Converts an LLVM instruction to an MLIR LLVM dialect operation if an MLIR
276  /// counterpart exists. Otherwise, returns failure.
277  LogicalResult convertInstruction(llvm::Instruction *inst);
278  /// Converts the metadata attached to the original instruction `inst` if
279  /// a dialect interfaces supports the specific kind of metadata and attaches
280  /// the resulting dialect attributes to the converted operation `op`. Emits a
281  /// warning if the conversion of a supported metadata kind fails.
282  void setNonDebugMetadataAttrs(llvm::Instruction *inst, Operation *op);
283  /// Imports `inst` and populates valueMapping[inst] with the result of the
284  /// imported operation or noResultOpMapping[inst] with the imported operation
285  /// if it has no result.
286  LogicalResult processInstruction(llvm::Instruction *inst);
287  /// Converts the `branch` arguments in the order of the phi's found in
288  /// `target` and appends them to the `blockArguments` to attach to the
289  /// generated branch operation. The `blockArguments` thus have the same order
290  /// as the phi's in `target`.
291  LogicalResult convertBranchArgs(llvm::Instruction *branch,
292  llvm::BasicBlock *target,
293  SmallVectorImpl<Value> &blockArguments);
294  /// Appends the converted result type and operands of `callInst` to the
295  /// `types` and `operands` arrays. For indirect calls, the method additionally
296  /// inserts the called function at the beginning of the `operands` array.
297  LogicalResult convertCallTypeAndOperands(llvm::CallBase *callInst,
298  SmallVectorImpl<Type> &types,
299  SmallVectorImpl<Value> &operands);
300  /// Converts the parameter attributes attached to `func` and adds them to the
301  /// `funcOp`.
302  void convertParameterAttributes(llvm::Function *func, LLVMFuncOp funcOp,
303  OpBuilder &builder);
304  /// Converts the AttributeSet of one parameter in LLVM IR to a corresponding
305  /// DictionaryAttr for the LLVM dialect.
306  DictionaryAttr convertParameterAttribute(llvm::AttributeSet llvmParamAttrs,
307  OpBuilder &builder);
308  /// Returns the builtin type equivalent to the given LLVM dialect type or
309  /// nullptr if there is no equivalent. The returned type can be used to create
310  /// an attribute for a GlobalOp or a ConstantOp.
311  Type getBuiltinTypeForAttr(Type type);
312  /// Returns `constant` as an attribute to attach to a GlobalOp or ConstantOp
313  /// or nullptr if the constant is not convertible. It supports scalar integer
314  /// and float constants as well as shaped types thereof including strings.
315  Attribute getConstantAsAttr(llvm::Constant *constant);
316  /// Returns the topologically sorted set of transitive dependencies needed to
317  /// convert the given constant.
318  SetVector<llvm::Constant *> getConstantsToConvert(llvm::Constant *constant);
319  /// Converts an LLVM constant to an MLIR value, or returns failure if the
320  /// conversion fails. The MLIR value may be produced by a ConstantOp,
321  /// AddressOfOp, NullOp, or a side-effect free operation (for ConstantExprs or
322  /// ConstantGEPs).
323  FailureOr<Value> convertConstant(llvm::Constant *constant);
324  /// Converts an LLVM constant and its transitive constant dependencies to MLIR
325  /// operations by converting them in topological order using the
326  /// `convertConstant` method, or returns failure if the conversion of any of
327  /// them fails. All operations are inserted at the start of the current
328  /// function entry block.
329  FailureOr<Value> convertConstantExpr(llvm::Constant *constant);
330  /// Returns a global comdat operation that serves as a container for LLVM
331  /// comdat selectors. Creates the global comdat operation on the first
332  /// invocation.
333  ComdatOp getGlobalComdatOp();
334  /// Performs conversion of LLVM TBAA metadata starting from
335  /// `node`. On exit from this function all nodes reachable
336  /// from `node` are converted, and tbaaMapping map is updated
337  /// (unless all dependencies have been converted by a previous
338  /// invocation of this function).
339  LogicalResult processTBAAMetadata(const llvm::MDNode *node);
340  /// Converts all LLVM access groups starting from `node` to MLIR access group
341  /// operations and stores a mapping from every nested access group node to the
342  /// translated attribute. Returns success if all conversions succeed and
343  /// failure otherwise.
344  LogicalResult processAccessGroupMetadata(const llvm::MDNode *node);
345  /// Converts all LLVM alias scopes and domains starting from `node` to MLIR
346  /// alias scope and domain attributes and stores a mapping from every nested
347  /// alias scope or alias domain node to the translated attribute. Returns
348  /// success if all conversions succeed and failure otherwise.
349  LogicalResult processAliasScopeMetadata(const llvm::MDNode *node);
350  /// Converts the given LLVM comdat struct to an MLIR comdat selector operation
351  /// and stores a mapping from the struct to the symbol pointing to the
352  /// translated operation.
353  void processComdat(const llvm::Comdat *comdat);
354 
355  /// Builder pointing at where the next instruction should be generated.
356  OpBuilder builder;
357  /// Block to insert the next constant into.
358  Block *constantInsertionBlock = nullptr;
359  /// Operation to insert the next constant after.
360  Operation *constantInsertionOp = nullptr;
361  /// Operation to insert the next global after.
362  Operation *globalInsertionOp = nullptr;
363  /// Operation to insert comdat selector operations into.
364  ComdatOp globalComdatOp = nullptr;
365  /// The current context.
366  MLIRContext *context;
367  /// The MLIR module being created.
368  ModuleOp mlirModule;
369  /// The LLVM module being imported.
370  std::unique_ptr<llvm::Module> llvmModule;
371 
372  /// A dialect interface collection used for dispatching the import to specific
373  /// dialects.
374  LLVMImportInterface iface;
375 
376  /// Function-local mapping between original and imported block.
377  DenseMap<llvm::BasicBlock *, Block *> blockMapping;
378  /// Function-local mapping between original and imported values.
379  DenseMap<llvm::Value *, Value> valueMapping;
380  /// Function-local mapping between original instructions and imported
381  /// operations for all operations that return no result. All operations that
382  /// return a result have a valueMapping entry instead.
383  DenseMap<llvm::Instruction *, Operation *> noResultOpMapping;
384  /// Function-local list of debug intrinsics that need to be imported after the
385  /// function conversion has finished.
386  SetVector<llvm::Instruction *> debugIntrinsics;
387  /// Mapping between LLVM alias scope and domain metadata nodes and
388  /// attributes in the LLVM dialect corresponding to these nodes.
389  DenseMap<const llvm::MDNode *, Attribute> aliasScopeMapping;
390  /// Mapping between LLVM TBAA metadata nodes and LLVM dialect TBAA attributes
391  /// corresponding to these nodes.
392  DenseMap<const llvm::MDNode *, Attribute> tbaaMapping;
393  /// Mapping between LLVM comdat structs and symbol references to LLVM dialect
394  /// comdat selector operations corresponding to these structs.
395  DenseMap<const llvm::Comdat *, SymbolRefAttr> comdatMapping;
396  /// The stateful type translator (contains named structs).
397  LLVM::TypeFromLLVMIRTranslator typeTranslator;
398  /// Stateful debug information importer.
399  std::unique_ptr<detail::DebugImporter> debugImporter;
400  /// Loop annotation importer.
401  std::unique_ptr<detail::LoopAnnotationImporter> loopAnnotationImporter;
402 
403  /// An option to control if expensive but uncritical diagnostics should be
404  /// emitted. Avoids generating warnings for unhandled debug intrinsics and
405  /// metadata that otherwise dominate the translation time for large inputs.
406  bool emitExpensiveWarnings;
407 };
408 
409 } // namespace LLVM
410 } // namespace mlir
411 
412 #endif // MLIR_TARGET_LLVMIR_MODULEIMPORT_H
Attributes are known-constant values of operations.
Definition: Attributes.h:25
Block represents an ordered list of Operations.
Definition: Block.h:30
This class provides support for representing a failure result, or a valid value of type T.
Definition: LogicalResult.h:78
LogicalResult initializeImport()
Queries all registered dialect interfaces for the supported LLVM IR intrinsic and metadata kinds and ...
Module import implementation class that provides methods to import globals and functions from an LLVM...
Definition: ModuleImport.h:47
Location translateLoc(llvm::DILocation *loc)
Translates the debug location.
LogicalResult convertComdats()
Converts all comdat selectors of the LLVM module to MLIR comdat operations.
LogicalResult convertFunctions()
Converts all functions of the LLVM module to MLIR functions.
FailureOr< SmallVector< Value > > convertValues(ArrayRef< llvm::Value * > values)
Converts a range of LLVM values to a range of MLIR values using the convertValue method,...
Attribute lookupTBAAAttr(const llvm::MDNode *node) const
Returns the MLIR attribute mapped to the given LLVM TBAA metadata node.
Definition: ModuleImport.h:206
ModuleImport(ModuleOp mlirModule, std::unique_ptr< llvm::Module > llvmModule, bool emitExpensiveWarnings)
DILocalVariableAttr matchLocalVariableAttr(llvm::Value *value)
Converts value to a local variable attribute.
LogicalResult convertLinkerOptionsMetadata()
Converts !llvm.linker.options metadata to the llvm.linker.options LLVM dialect operation.
void mapBlock(llvm::BasicBlock *llvm, Block *mlir)
Stores the mapping between an LLVM block and its MLIR counterpart.
Definition: ModuleImport.h:117
void processFunctionAttributes(llvm::Function *func, LLVMFuncOp funcOp)
Converts function attributes of LLVM Function func into LLVM dialect attributes of LLVMFuncOp funcOp.
LogicalResult convertMetadata()
Converts all LLVM metadata nodes that translate to attributes such as alias analysis or access group ...
LogicalResult convertIntrinsicArguments(ArrayRef< llvm::Value * > values, ArrayRef< unsigned > immArgPositions, ArrayRef< StringLiteral > immArgAttrNames, SmallVectorImpl< Value > &valuesOut, SmallVectorImpl< NamedAttribute > &attrsOut)
Converts the LLVM values for an intrinsic to mixed MLIR values and attributes for LLVM_IntrOpBase.
Value & mapValue(llvm::Value *value)
Provides write-once access to store the MLIR value corresponding to the given LLVM value.
Definition: ModuleImport.h:77
FailureOr< Value > convertValue(llvm::Value *value)
Converts an LLVM value to an MLIR value, or returns failure if the conversion fails.
LogicalResult initializeImportInterface()
Calls the LLVMImportInterface initialization that queries the registered dialect interfaces for the s...
Definition: ModuleImport.h:56
void addDebugIntrinsic(llvm::CallInst *intrinsic)
Adds a debug intrinsics to the list of intrinsics that should be converted after the function convers...
Block * lookupBlock(llvm::BasicBlock *block) const
Returns the MLIR block mapped to the given LLVM block.
Definition: ModuleImport.h:124
FailureOr< Value > convertMetadataValue(llvm::Value *value)
Converts an LLVM metadata value to an MLIR value, or returns failure if the conversion fails.
FailureOr< SmallVector< AliasScopeAttr > > lookupAliasScopeAttrs(const llvm::MDNode *node) const
Returns the alias scope attributes that map to the alias scope nodes starting from the metadata node.
void mapNoResultOp(llvm::Instruction *llvm, Operation *mlir)
Stores a mapping between an LLVM instruction and the imported MLIR operation if the operation returns...
Definition: ModuleImport.h:90
Type convertType(llvm::Type *type)
Converts the type from LLVM to MLIR LLVM dialect.
Definition: ModuleImport.h:172
Operation * lookupOperation(llvm::Instruction *inst)
Returns the MLIR operation mapped to the given LLVM instruction.
Definition: ModuleImport.h:110
DILabelAttr matchLabelAttr(llvm::Value *value)
Converts value to a label attribute. Asserts if the matching fails.
FloatAttr matchFloatAttr(llvm::Value *value)
Converts value to a float attribute. Asserts if the matching fails.
LoopAnnotationAttr translateLoopAnnotationAttr(const llvm::MDNode *node, Location loc) const
Returns the loop annotation attribute that corresponds to the given LLVM loop metadata node.
void setFastmathFlagsAttr(llvm::Instruction *inst, Operation *op) const
Sets the fastmath flags attribute for the imported operation op given the original instruction inst.
FailureOr< SmallVector< AliasScopeAttr > > matchAliasScopeAttrs(llvm::Value *value)
Converts value to an array of alias scopes or returns failure if the conversion fails.
Value lookupValue(llvm::Value *value)
Returns the MLIR value mapped to the given LLVM value.
Definition: ModuleImport.h:85
LogicalResult processFunction(llvm::Function *func)
Imports func into the current module.
void setIntegerOverflowFlagsAttr(llvm::Instruction *inst, Operation *op) const
Sets the integer overflow flags (nsw/nuw) attribute for the imported operation op given the original ...
RoundingModeAttr matchRoundingModeAttr(llvm::Value *value)
Converts value to a rounding mode attribute.
Operation *& mapNoResultOp(llvm::Instruction *inst)
Provides write-once access to store the MLIR operation corresponding to the given LLVM instruction if...
Definition: ModuleImport.h:98
void mapValue(llvm::Value *llvm, Value mlir)
Stores the mapping between an LLVM value and its MLIR counterpart.
Definition: ModuleImport.h:73
FailureOr< SmallVector< AccessGroupAttr > > lookupAccessGroupAttrs(const llvm::MDNode *node) const
Returns the access group attributes that map to the access group nodes starting from the access group...
LogicalResult convertGlobals()
Converts all global variables of the LLVM module to MLIR global variables.
FPExceptionBehaviorAttr matchFPExceptionBehaviorAttr(llvm::Value *value)
Converts value to a FP exception behavior attribute.
LogicalResult convertDataLayout()
Converts the data layout of the LLVM module to an MLIR data layout specification.
IntegerAttr matchIntegerAttr(llvm::Value *value)
Converts value to an integer attribute. Asserts if the matching fails.
Type translateType(llvm::Type *type)
Translates the given LLVM IR type to the MLIR LLVM dialect.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition: Location.h:63
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition: Types.h:74
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Definition: Value.h:96
Include the generated interface declarations.
Definition: CallGraph.h:229
Include the generated interface declarations.
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26