Update type parser (#376)

This commit is contained in:
Tian Jin 2019-11-19 19:45:03 -05:00 committed by Tian Jin
parent 0c36057404
commit 6c7ff180f9
1 changed files with 18 additions and 23 deletions

View File

@ -10,6 +10,7 @@
#include "mlir/IR/Builders.h" #include "mlir/IR/Builders.h"
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/OpDefinition.h" #include "mlir/IR/OpDefinition.h"
#include "mlir/IR/StandardTypes.h" #include "mlir/IR/StandardTypes.h"
@ -21,29 +22,23 @@ class KrnlOpsDialect : public Dialect {
KrnlOpsDialect(MLIRContext* context); KrnlOpsDialect(MLIRContext* context);
static StringRef getDialectNamespace() { return "krnl"; } static StringRef getDialectNamespace() { return "krnl"; }
// /// Parse a type registered to this dialect. Overriding this method is /// Parse a type registered to this dialect.
// /// required for dialects that have custom types. Type parseType(DialectAsmParser& parser) const override {
// /// Technically this is only needed to be able to round-trip to textual IR. if (succeeded(parser.parseOptionalKeyword("loop")))
// mlir::Type parseType( return LoopType::get(parser.getBuilder().getContext());
// llvm::StringRef tyData, mlir::Location loc) const override {
// MLIRContext* context = getContext(); parser.emitError(parser.getCurrentLocation(), "Unknown type");
// }
// if (tyData.consume_front("loop"))
// return LoopType::get(context); /// Print a type registered to this dialect.
// else void printType(Type type, DialectAsmPrinter& os) const override {
// return (emitError(loc, "Unexpected type: " + tyData), Type()); switch (type.getKind()) {
// } case KrnlTypes::Loop:
// os << "loop";
// /// Print a type registered to this dialect. Overriding this method is return;
// /// only required for dialects that have custom types. }
// /// Technically this is only needed to be able to round-trip to textual IR. }
// void printType(mlir::Type type, llvm::raw_ostream& os) const override { >>>>>>> 011cc1b... Update type parser (#376)
// switch (type.getKind()) {
// case KrnlTypes::Loop:
// os << "loop";
// return;
// }
// }
}; };
#define GET_OP_CLASSES #define GET_OP_CLASSES