|
21 | 21 | #include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
|
22 | 22 | #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
|
23 | 23 | #include "mlir/Dialect/Func/IR/FuncOps.h"
|
24 |
| -#include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
25 |
| -#include "mlir/Dialect/LLVMIR/LLVMTypes.h" |
26 | 24 | #include "mlir/Dialect/Math/IR/Math.h"
|
27 | 25 | #include "mlir/Dialect/SCF/IR/SCF.h"
|
28 | 26 | #include "mlir/IR/BuiltinDialect.h"
|
|
32 | 30 | #include "mlir/Transforms/DialectConversion.h"
|
33 | 31 | #include "mlir/Transforms/RegionUtils.h"
|
34 | 32 | #include "llvm/ADT/TypeSwitch.h"
|
35 |
| -#include "llvm/IR/DerivedTypes.h" |
36 | 33 |
|
37 | 34 | namespace circt {
|
38 | 35 | #define GEN_PASS_DEF_CONVERTMOORETOCORE
|
@@ -543,18 +540,6 @@ struct VariableOpConversion : public OpConversionPattern<VariableOp> {
|
543 | 540 | if (!resultType)
|
544 | 541 | return rewriter.notifyMatchFailure(op.getLoc(), "invalid variable type");
|
545 | 542 |
|
546 |
| - // Handle CHandle types |
547 |
| - if (isa<mlir::LLVM::LLVMPointerType>(resultType)) { |
548 |
| - // Use converted initializer if present; otherwise synthesize null ptr. |
549 |
| - Value init = adaptor.getInitial(); |
550 |
| - if (!init) |
551 |
| - init = rewriter.create<mlir::LLVM::ZeroOp>(loc, resultType); |
552 |
| - |
553 |
| - // For pointer-typed variables we produce the SSA pointer value directly. |
554 |
| - rewriter.replaceOp(op, init); |
555 |
| - return success(); |
556 |
| - } |
557 |
| - |
558 | 543 | // Determine the initial value of the signal.
|
559 | 544 | Value init = adaptor.getInitial();
|
560 | 545 | if (!init) {
|
@@ -1727,7 +1712,6 @@ static void populateLegality(ConversionTarget &target,
|
1727 | 1712 | target.addLegalDialect<mlir::BuiltinDialect>();
|
1728 | 1713 | target.addLegalDialect<mlir::math::MathDialect>();
|
1729 | 1714 | target.addLegalDialect<sim::SimDialect>();
|
1730 |
| - target.addLegalDialect<mlir::LLVM::LLVMDialect>(); |
1731 | 1715 | target.addLegalDialect<verif::VerifDialect>();
|
1732 | 1716 |
|
1733 | 1717 | target.addLegalOp<debug::ScopeOp>();
|
@@ -1814,28 +1798,10 @@ static void populateTypeConversion(TypeConverter &typeConverter) {
|
1814 | 1798 | return hw::StructType::get(type.getContext(), fields);
|
1815 | 1799 | });
|
1816 | 1800 |
|
1817 |
| - // Conversion of CHandle to LLVMPointerType |
1818 |
| - typeConverter.addConversion([&](ChandleType type) -> std::optional<Type> { |
1819 |
| - return LLVM::LLVMPointerType::get(type.getContext()); |
1820 |
| - }); |
1821 |
| - |
1822 |
| - // Explicitly mark LLVMPointerType as a legal target |
1823 |
| - typeConverter.addConversion( |
1824 |
| - [](LLVM::LLVMPointerType t) -> std::optional<Type> { return t; }); |
1825 |
| - |
1826 | 1801 | typeConverter.addConversion([&](RefType type) -> std::optional<Type> {
|
1827 |
| - if (auto innerType = typeConverter.convertType(type.getNestedType())) { |
| 1802 | + if (auto innerType = typeConverter.convertType(type.getNestedType())) |
1828 | 1803 | if (hw::isHWValueType(innerType))
|
1829 | 1804 | return hw::InOutType::get(innerType);
|
1830 |
| - // TODO: There is some abstraction missing here to correctly return a |
1831 |
| - // reference of a CHandle; return an error for now. |
1832 |
| - if (isa<mlir::LLVM::LLVMPointerType>(innerType)) { |
1833 |
| - mlir::emitError(mlir::UnknownLoc::get(type.getContext())) |
1834 |
| - << "Emission of references of LLVMPointerType is currently " |
1835 |
| - "unsupported!"; |
1836 |
| - return {}; |
1837 |
| - } |
1838 |
| - } |
1839 | 1805 | return {};
|
1840 | 1806 | });
|
1841 | 1807 |
|
|
0 commit comments