This patch enables the MarkDeclareTarget for CIR by adding the pass to the lowerings and attaching the declare target interface to the cir::FuncOp. The MarkDeclareTarget is also generalized to work on the FunctionOpInterface instead of func::Op since it needs to be able to handle cir::FuncOp as well. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
981 B
C++
27 lines
981 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Registration for OpenMP extensions as applied to CIR dialect.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "clang/CIR/Dialect/OpenMP/RegisterOpenMPExtensions.h"
|
|
#include "mlir/Dialect/OpenMP/OpenMPInterfaces.h"
|
|
#include "clang/CIR/Dialect/IR/CIRDialect.h"
|
|
|
|
namespace cir::omp {
|
|
|
|
void registerOpenMPExtensions(mlir::DialectRegistry ®istry) {
|
|
registry.addExtension(+[](mlir::MLIRContext *ctx, cir::CIRDialect *dialect) {
|
|
cir::FuncOp::attachInterface<
|
|
mlir::omp::DeclareTargetDefaultModel<cir::FuncOp>>(*ctx);
|
|
});
|
|
}
|
|
|
|
} // namespace cir::omp
|