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 class Namespace;
30 
32  /// Convert an index into a HW ArrayType or StructType to LLVM Endianess.
33  static uint32_t convertToLLVMEndianess(Type type, uint32_t index);
34 
35  /// Get the index of a specific StructType field in the LLVM lowering of the
36  /// StructType
37  static uint32_t llvmIndexOfStructField(hw::StructType type,
38  StringRef fieldName);
39 };
40 
41 /// Get the HW to LLVM type conversions.
42 void populateHWToLLVMTypeConversions(mlir::LLVMTypeConverter &converter);
43 
44 /// Get the HW to LLVM conversion patterns.
46  mlir::LLVMTypeConverter &converter, RewritePatternSet &patterns,
47  Namespace &globals,
48  DenseMap<std::pair<Type, ArrayAttr>, mlir::LLVM::GlobalOp>
49  &constAggregateGlobalsMap);
50 
51 /// Create an HW to LLVM conversion pass.
52 std::unique_ptr<OperationPass<ModuleOp>> createConvertHWToLLVMPass();
53 
54 } // namespace circt
55 
56 #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:29
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:689
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:33
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:45