Files
concrete/compiler/lib/Dialect/Concrete/IR/ConcreteDialect.cpp
youben11 2009ee1c94 chore: changing ref to repo after its renaming
also formatting and update the check_license script to match that
2022-01-06 12:40:10 +01:00

57 lines
1.7 KiB
C++

// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/master/LICENSE.txt
// for license information.
#include "concretelang/Dialect/Concrete/IR/ConcreteDialect.h"
#include "concretelang/Dialect/Concrete/IR/ConcreteOps.h"
#include "concretelang/Dialect/Concrete/IR/ConcreteTypes.h"
#define GET_TYPEDEF_CLASSES
#include "concretelang/Dialect/Concrete/IR/ConcreteOpsTypes.cpp.inc"
#include "concretelang/Dialect/Concrete/IR/ConcreteOpsDialect.cpp.inc"
using namespace mlir::concretelang::Concrete;
void ConcreteDialect::initialize() {
addOperations<
#define GET_OP_LIST
#include "concretelang/Dialect/Concrete/IR/ConcreteOps.cpp.inc"
>();
addTypes<
#define GET_TYPEDEF_LIST
#include "concretelang/Dialect/Concrete/IR/ConcreteOpsTypes.cpp.inc"
>();
}
::mlir::Type
ConcreteDialect::parseType(::mlir::DialectAsmParser &parser) const {
mlir::Type type;
std::string types_str[] = {
"plaintext", "plaintext_list", "foreign_plaintext_list",
"lwe_ciphertext", "lwe_key_switch_key", "lwe_bootstrap_key",
"glwe_ciphertext", "cleartext", "context",
};
for (const std::string &type_str : types_str) {
if (parser.parseOptionalKeyword(type_str).succeeded()) {
generatedTypeParser(parser, type_str, type);
return type;
}
}
parser.emitError(parser.getCurrentLocation(), "Unknown Concrete type");
return type;
}
void ConcreteDialect::printType(::mlir::Type type,
::mlir::DialectAsmPrinter &printer) const {
if (generatedTypePrinter(type, printer).failed())
// Calling default printer if failed to print Concrete type
printer.printType(type);
}