Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unique names for pass type converters #483

Merged
merged 1 commit into from Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Conversion/CGGIToTfheRust/CGGIToTfheRust.cpp
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
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