//===- MIROps.cpp - Implement the Moore MIR operations --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implement the Moore MIR ops.
//
//===----------------------------------------------------------------------===//

#include "circt/Dialect/Moore/MIROps.h"
#include "mlir/IR/Builders.h"

using namespace circt;
using namespace circt::moore;

//===----------------------------------------------------------------------===//
// Custom LValue parser and printer
//===----------------------------------------------------------------------===//

static ParseResult parseLValueType(OpAsmParser &p, Type &lValueType) {
  Type type;
  if (p.parseType(type))
    return p.emitError(p.getCurrentLocation(), "expected type");
  lValueType = LValueType::get(type);
  return success();
}

static void printLValueType(OpAsmPrinter &p, Operation *, Type lValueType) {
  p.printType(lValueType.cast<LValueType>().getNestedType());
}

//===----------------------------------------------------------------------===//
// TableGen generated logic.
//===----------------------------------------------------------------------===//

// Provide the autogenerated implementation guts for the Op classes.
#define GET_OP_CLASSES
#include "circt/Dialect/Moore/Moore.cpp.inc"
#include "circt/Dialect/Moore/MooreEnums.cpp.inc"
#include "circt/Dialect/Moore/MooreStructs.cpp.inc"
