Skip to content

Commit

Permalink
add unique names for pass type converters
Browse files Browse the repository at this point in the history
Fixes #482
  • Loading branch information
j2kun committed Mar 5, 2024
1 parent 1939b79 commit 3578947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/Conversion/CGGIToTfheRust/CGGIToTfheRust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ int widthFromEncodingAttr(Attribute encoding) {
});
}

class PassTypeConverter : public TypeConverter {
class CGGIToTfheRustTypeConverter : public TypeConverter {
public:
PassTypeConverter(MLIRContext *ctx) {
CGGIToTfheRustTypeConverter(MLIRContext *ctx) {
addConversion([](Type type) { return type; });
addConversion([ctx](lwe::LWECiphertextType type) -> Type {
int width = widthFromEncodingAttr(type.getEncoding());
Expand Down Expand Up @@ -402,7 +402,7 @@ class CGGIToTfheRust : public impl::CGGIToTfheRustBase<CGGIToTfheRust> {
MLIRContext *context = &getContext();
auto *op = getOperation();

PassTypeConverter typeConverter(context);
CGGIToTfheRustTypeConverter typeConverter(context);
RewritePatternSet patterns(context);
ConversionTarget target(*context);
addStructuralConversionPatterns(typeConverter, patterns, target);
Expand Down
6 changes: 3 additions & 3 deletions templates/Conversion/lib/ConversionPass.cpp.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ namespace mlir::heir {
#include "include/Conversion/{{ pass_name }}/{{ pass_name }}.h.inc"

// Remove this class if no type conversions are necessary
class PassTypeConverter : public TypeConverter {
class {{ pass_name }}TypeConverter : public TypeConverter {
public:
PassTypeConverter(MLIRContext *ctx) {
{{ pass_name }}TypeConverter(MLIRContext *ctx) {
addConversion([](Type type) { return type; });
// FIXME: implement, replace FooType with the type that needs
// to be converted or remove this class
Expand Down Expand Up @@ -42,7 +42,7 @@ struct {{ pass_name }} : public impl::{{ pass_name }}Base<{{ pass_name }}> {
void runOnOperation() override {
MLIRContext *context = &getContext();
auto *module = getOperation();
PassTypeConverter typeConverter(context);
{{ pass_name }}TypeConverter typeConverter(context);

RewritePatternSet patterns(context);
ConversionTarget target(*context);
Expand Down

0 comments on commit 3578947

Please sign in to comment.