2020-09-29 09:36:00 +08:00
|
|
|
//===- Registration.cpp - C Interface for MLIR Registration ---------------===//
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "npcomp-c/Registration.h"
|
|
|
|
|
|
|
|
#include "mlir/CAPI/IR.h"
|
2020-12-30 05:22:18 +08:00
|
|
|
#include "mlir/Conversion/Passes.h"
|
|
|
|
#include "mlir/Transforms/Passes.h"
|
2020-09-29 09:36:00 +08:00
|
|
|
#include "npcomp/InitAll.h"
|
|
|
|
|
|
|
|
void npcompRegisterAllDialects(MlirContext context) {
|
2021-02-23 04:08:17 +08:00
|
|
|
mlir::DialectRegistry registry;
|
|
|
|
mlir::NPCOMP::registerAllDialects(registry);
|
|
|
|
unwrap(context)->appendDialectRegistry(registry);
|
2020-09-29 09:36:00 +08:00
|
|
|
// TODO: Don't eagerly load once D88162 is in and clients can do this.
|
2021-02-23 04:08:17 +08:00
|
|
|
unwrap(context)->loadAllAvailableDialects();
|
2020-09-29 09:36:00 +08:00
|
|
|
}
|
2020-12-30 05:22:18 +08:00
|
|
|
|
|
|
|
void npcompRegisterAllPasses() {
|
|
|
|
::mlir::NPCOMP::registerAllPasses();
|
|
|
|
|
|
|
|
// Upstream passes we depend on.
|
|
|
|
::mlir::registerCanonicalizerPass();
|
|
|
|
::mlir::registerSCFToStandardPass();
|
|
|
|
}
|