Migrate the translation of the OpenMP dialect operations to LLVM IR to the new dialect-based mechanism. Depends On D96503 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D96504
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
//===- mlir-cpu-runner.cpp - MLIR CPU Execution Driver---------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Main entry point to a command line utility that executes an MLIR file on the
|
|
// CPU by translating MLIR to LLVM IR before JIT-compiling and executing the
|
|
// latter.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
|
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
|
|
#include "mlir/ExecutionEngine/JitRunner.h"
|
|
#include "mlir/ExecutionEngine/OptUtils.h"
|
|
#include "mlir/IR/Dialect.h"
|
|
#include "mlir/Target/LLVMIR.h"
|
|
#include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h"
|
|
|
|
#include "llvm/Support/InitLLVM.h"
|
|
#include "llvm/Support/TargetSelect.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
llvm::InitLLVM y(argc, argv);
|
|
llvm::InitializeNativeTarget();
|
|
llvm::InitializeNativeTargetAsmPrinter();
|
|
llvm::InitializeNativeTargetAsmParser();
|
|
mlir::initializeLLVMPasses();
|
|
|
|
mlir::DialectRegistry registry;
|
|
registry.insert<mlir::LLVM::LLVMDialect, mlir::omp::OpenMPDialect>();
|
|
mlir::registerLLVMDialectTranslation(registry);
|
|
registry.addDialectInterface<mlir::omp::OpenMPDialect,
|
|
mlir::OpenMPDialectLLVMIRTranslationInterface>();
|
|
|
|
return mlir::JitRunnerMain(argc, argv, registry);
|
|
}
|