From 09ad814e9593a61e61c01f0be17af2e9ebe11b0e Mon Sep 17 00:00:00 2001 From: youben11 Date: Thu, 16 Sep 2021 08:40:01 +0100 Subject: [PATCH] fix: use ref to PatternRewriter in NativeCodeCall --- .../zamalang/Conversion/HLFHEToMidLFHE/Patterns.h | 6 +++--- .../Conversion/MidLFHEToLowLFHE/Patterns.h | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h b/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h index a838c0ec3..2a4230e20 100644 --- a/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h +++ b/compiler/include/zamalang/Conversion/HLFHEToMidLFHE/Patterns.h @@ -19,7 +19,7 @@ convertTypeEncryptedIntegerToGLWE(mlir::MLIRContext *context, return GLWECipherTextType::get(context, -1, -1, -1, eint.getWidth()); } -mlir::Value createZeroGLWEOpFromHLFHE(mlir::PatternRewriter rewriter, +mlir::Value createZeroGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::OpResult result) { mlir::SmallVector args{}; @@ -34,7 +34,7 @@ mlir::Value createZeroGLWEOpFromHLFHE(mlir::PatternRewriter rewriter, } template -mlir::Value createGLWEOpFromHLFHE(mlir::PatternRewriter rewriter, +mlir::Value createGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result) { mlir::SmallVector args{arg0, arg1}; @@ -48,7 +48,7 @@ mlir::Value createGLWEOpFromHLFHE(mlir::PatternRewriter rewriter, } mlir::Value -createApplyLookupTableGLWEOpFromHLFHE(mlir::PatternRewriter rewriter, +createApplyLookupTableGLWEOpFromHLFHE(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result) { mlir::SmallVector args{arg0, arg1}; diff --git a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h b/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h index 3a65456c7..4e9455020 100644 --- a/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h +++ b/compiler/include/zamalang/Conversion/MidLFHEToLowLFHE/Patterns.h @@ -78,7 +78,7 @@ CleartextType convertCleartextTypeFromType(mlir::MLIRContext *context, return nullptr; } -mlir::Value createZeroLWEOpFromMidLFHE(mlir::PatternRewriter rewriter, +mlir::Value createZeroLWEOpFromMidLFHE(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::OpResult result) { mlir::SmallVector args{}; @@ -92,7 +92,7 @@ mlir::Value createZeroLWEOpFromMidLFHE(mlir::PatternRewriter rewriter, } template -mlir::Value createLowLFHEOpFromMidLFHE(mlir::PatternRewriter rewriter, +mlir::Value createLowLFHEOpFromMidLFHE(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result) { @@ -106,7 +106,7 @@ mlir::Value createLowLFHEOpFromMidLFHE(mlir::PatternRewriter rewriter, } mlir::Value createAddPlainLweCiphertextWithGlwe( - mlir::PatternRewriter rewriter, mlir::Location loc, mlir::Value arg0, + mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result, mlir::Type encryptedType) { PlaintextType encoded_type = convertPlaintextTypeFromType(rewriter.getContext(), encryptedType); @@ -125,7 +125,7 @@ mlir::Value createAddPlainLweCiphertextWithGlwe( return op.getODSResults(0).front(); } -mlir::Value createAddPlainLweCiphertext(mlir::PatternRewriter rewriter, +mlir::Value createAddPlainLweCiphertext(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result) { @@ -134,7 +134,7 @@ mlir::Value createAddPlainLweCiphertext(mlir::PatternRewriter rewriter, glwe); } -mlir::Value createSubIntLweCiphertext(mlir::PatternRewriter rewriter, +mlir::Value createSubIntLweCiphertext(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result) { auto arg1_type = arg1.getType(); @@ -147,7 +147,7 @@ mlir::Value createSubIntLweCiphertext(mlir::PatternRewriter rewriter, result, arg1_type); } -mlir::Value createMulClearLweCiphertext(mlir::PatternRewriter rewriter, +mlir::Value createMulClearLweCiphertext(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value arg0, mlir::Value arg1, mlir::OpResult result) { @@ -210,7 +210,7 @@ mlir::Value createMulClearLweCiphertext(mlir::PatternRewriter rewriter, // } : (!LowLFHE.lwe_ciphertext<600, 4>, !LowLFHE.glwe_ciphertext) // ->!LowLFHE.lwe_ciphertext<2048, 4> // ``` -mlir::Value createPBS(mlir::PatternRewriter rewriter, mlir::Location loc, +mlir::Value createPBS(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Value ct, mlir::Value table, mlir::IntegerAttr k, mlir::IntegerAttr polynomialSize, mlir::IntegerAttr levelKS, mlir::IntegerAttr baseLogKS,