Skip to content

Commit 41ffa0b

Browse files
committed
Revert unsquashed commits
Revert "Remove getDependentDialects" This reverts commit 22db386. Revert "Mark ref<!llvm.ptr> issue as TODO" This reverts commit 2598ae8. Revert "Raise error instead of dropping reference" This reverts commit 4bca6de. Revert "Remove unneeded conversion" This reverts commit 91dc526. Revert "[ImportVerilog][MooreToCore] Implement CHandle import and lowering" This reverts commit c1f69c6.
1 parent 22db386 commit 41ffa0b

File tree

9 files changed

+2
-64
lines changed

9 files changed

+2
-64
lines changed

include/circt/Conversion/Passes.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ def ConvertMooreToCore : Pass<"convert-moore-to-core", "mlir::ModuleOp"> {
494494
"mlir::cf::ControlFlowDialect",
495495
"mlir::scf::SCFDialect",
496496
"mlir::math::MathDialect",
497-
"mlir::LLVM::LLVMDialect",
498497
"sim::SimDialect",
499498
"verif::VerifDialect",
500499
];

lib/Conversion/ImportVerilog/Types.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ struct TypeVisitor {
162162
return moore::StringType::get(context.getContext());
163163
}
164164

165-
Type visit(const slang::ast::CHandleType &type) {
166-
return moore::ChandleType::get(context.getContext());
167-
}
168-
169165
/// Emit an error for all other types.
170166
template <typename T>
171167
Type visit(T &&node) {

lib/Conversion/MooreToCore/MooreToCore.cpp

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
2222
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
2323
#include "mlir/Dialect/Func/IR/FuncOps.h"
24-
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
25-
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
2624
#include "mlir/Dialect/Math/IR/Math.h"
2725
#include "mlir/Dialect/SCF/IR/SCF.h"
2826
#include "mlir/IR/BuiltinDialect.h"
@@ -32,7 +30,6 @@
3230
#include "mlir/Transforms/DialectConversion.h"
3331
#include "mlir/Transforms/RegionUtils.h"
3432
#include "llvm/ADT/TypeSwitch.h"
35-
#include "llvm/IR/DerivedTypes.h"
3633

3734
namespace circt {
3835
#define GEN_PASS_DEF_CONVERTMOORETOCORE
@@ -543,18 +540,6 @@ struct VariableOpConversion : public OpConversionPattern<VariableOp> {
543540
if (!resultType)
544541
return rewriter.notifyMatchFailure(op.getLoc(), "invalid variable type");
545542

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-
558543
// Determine the initial value of the signal.
559544
Value init = adaptor.getInitial();
560545
if (!init) {
@@ -1727,7 +1712,6 @@ static void populateLegality(ConversionTarget &target,
17271712
target.addLegalDialect<mlir::BuiltinDialect>();
17281713
target.addLegalDialect<mlir::math::MathDialect>();
17291714
target.addLegalDialect<sim::SimDialect>();
1730-
target.addLegalDialect<mlir::LLVM::LLVMDialect>();
17311715
target.addLegalDialect<verif::VerifDialect>();
17321716

17331717
target.addLegalOp<debug::ScopeOp>();
@@ -1814,28 +1798,10 @@ static void populateTypeConversion(TypeConverter &typeConverter) {
18141798
return hw::StructType::get(type.getContext(), fields);
18151799
});
18161800

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-
18261801
typeConverter.addConversion([&](RefType type) -> std::optional<Type> {
1827-
if (auto innerType = typeConverter.convertType(type.getNestedType())) {
1802+
if (auto innerType = typeConverter.convertType(type.getNestedType()))
18281803
if (hw::isHWValueType(innerType))
18291804
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-
}
18391805
return {};
18401806
});
18411807

test/Conversion/ImportVerilog/types.sv

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,3 @@ module String;
153153
// CHECK-NEXT: %s = moore.variable : <string>
154154
string s;
155155
endmodule
156-
157-
// CHECK-LABEL: moore.module @CHandle
158-
module CHandle;
159-
// CHECK: %test = moore.variable : <chandle>
160-
chandle test;
161-
endmodule
162-
163-
// CHECK-LABEL: func.func private @takesCHandle(%arg0: !moore.chandle) {
164-
function automatic void takesCHandle(chandle test);
165-
endfunction

test/Conversion/MooreToCore/basic.mlir

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,3 @@ func.func @SeverityToPrint() {
12791279
return
12801280
}
12811281

1282-
// CHECK-LABEL: func.func @CHandle(%arg0: !llvm.ptr)
1283-
func.func @CHandle(%arg0: !moore.chandle) {
1284-
return
1285-
}

tools/circt-opt/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ target_link_libraries(circt-opt
3838
MLIRFuncInlinerExtension
3939
MLIRVectorDialect
4040
MLIRIndexDialect
41-
MLIRLLVMIRTransforms
4241
)
4342

4443
export_executable_symbols_for_plugins(circt-opt)

tools/circt-opt/circt-opt.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "mlir/Dialect/Func/IR/FuncOps.h"
2525
#include "mlir/Dialect/Index/IR/IndexDialect.h"
2626
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
27-
#include "mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
2827
#include "mlir/Dialect/Math/IR/Math.h"
2928
#include "mlir/Dialect/MemRef/IR/MemRef.h"
3029
#include "mlir/Dialect/SCF/IR/SCF.h"
@@ -65,7 +64,6 @@ int main(int argc, char **argv) {
6564
circt::registerAllPasses();
6665

6766
mlir::func::registerInlinerExtension(registry);
68-
mlir::LLVM::registerInlinerInterface(registry);
6967

7068
// Register the standard passes we want.
7169
mlir::registerCSEPass();

tools/circt-verilog/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ set(libs
2222
MLIRSCFDialect
2323
MLIRSCFDialect
2424
MLIRSupport
25-
MLIRLLVMIRTransforms
2625
)
2726

2827
add_circt_tool(circt-verilog circt-verilog.cpp DEPENDS ${libs})

tools/circt-verilog/circt-verilog.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
3333
#include "mlir/Dialect/Func/Extensions/InlinerExtension.h"
3434
#include "mlir/Dialect/Func/IR/FuncOps.h"
35-
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
36-
#include "mlir/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.h"
3735
#include "mlir/Dialect/SCF/IR/SCF.h"
3836
#include "mlir/IR/AsmState.h"
3937
#include "mlir/IR/BuiltinOps.h"
@@ -613,15 +611,12 @@ int main(int argc, char **argv) {
613611
moore::MooreDialect,
614612
scf::SCFDialect,
615613
seq::SeqDialect,
616-
verif::VerifDialect,
617-
mlir::LLVM::LLVMDialect
614+
verif::VerifDialect
618615
>();
619616
// clang-format on
620617

621618
// Perform the actual work and use "exit" to avoid slow context teardown.
622619
mlir::func::registerInlinerExtension(registry);
623-
mlir::LLVM::registerInlinerInterface(registry);
624-
625620
MLIRContext context(registry);
626621
exit(failed(execute(&context)));
627622
}

0 commit comments

Comments
 (0)