CIRCT  19.0.0git
HWToLLVM.h
Go to the documentation of this file.
1 //===- HWToLLVM.h - HW to LLVM pass entry point -----------------*- 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 header file defines prototypes that expose the HWToLLVM pass
10 // constructors.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef CIRCT_CONVERSION_HWTOLLVM_HWTOLLVM_H
15 #define CIRCT_CONVERSION_HWTOLLVM_HWTOLLVM_H
16 
18 #include "circt/Support/LLVM.h"
19 #include <memory>
20 
21 namespace mlir {
22 class LLVMTypeConverter;
23 namespace LLVM {
24 class GlobalOp;
25 } // namespace LLVM
26 } // namespace mlir
27 
28 namespace circt {
29 
30 #define GEN_PASS_DECL_CONVERTHWTOLLVM
31 #include "circt/Conversion/Passes.h.inc"
32 
33 class Namespace;
34 
36  /// Convert an index into a HW ArrayType or StructType to LLVM Endianess.
37  static uint32_t convertToLLVMEndianess(Type type, uint32_t index);
38 
39  /// Get the index of a specific StructType field in the LLVM lowering of the
40  /// StructType
41  static uint32_t llvmIndexOfStructField(hw::StructType type,
42  StringRef fieldName);
43 };
44 
45 /// Get the HW to LLVM type conversions.
46 void populateHWToLLVMTypeConversions(mlir::LLVMTypeConverter &converter);
47 
48 /// Get the HW to LLVM conversion patterns.
50  mlir::LLVMTypeConverter &converter, RewritePatternSet &patterns,
51  Namespace &globals,
52  DenseMap<std::pair<Type, ArrayAttr>, mlir::LLVM::GlobalOp>
53  &constAggregateGlobalsMap);
54 
55 /// Create an HW to LLVM conversion pass.
56 std::unique_ptr<OperationPass<ModuleOp>> createConvertHWToLLVMPass();
57 
58 } // namespace circt
59 
60 #endif // CIRCT_CONVERSION_HWTOLLVM_HWTOLLVM_H
A namespace that is used to store existing names and generate new names in some scope within the IR.
Definition: Namespace.h:30
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
void populateHWToLLVMConversionPatterns(mlir::LLVMTypeConverter &converter, RewritePatternSet &patterns, Namespace &globals, DenseMap< std::pair< Type, ArrayAttr >, mlir::LLVM::GlobalOp > &constAggregateGlobalsMap)
Get the HW to LLVM conversion patterns.
std::unique_ptr< OperationPass< ModuleOp > > createConvertHWToLLVMPass()
Create an HW to LLVM conversion pass.
Definition: HWToLLVM.cpp:691
void populateHWToLLVMTypeConversions(mlir::LLVMTypeConverter &converter)
Get the HW to LLVM type conversions.
static uint32_t convertToLLVMEndianess(Type type, uint32_t index)
Convert an index into a HW ArrayType or StructType to LLVM Endianess.
Definition: HWToLLVM.cpp:37
static uint32_t llvmIndexOfStructField(hw::StructType type, StringRef fieldName)
Get the index of a specific StructType field in the LLVM lowering of the StructType.
Definition: HWToLLVM.cpp:49