1 //===- RequestCWrappers.cpp - Annotate funcs with wrap attributes ---------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h" 10 #include "PassDetail.h" 11 #include "mlir/Dialect/Func/IR/FuncOps.h" 12 #include "mlir/Dialect/LLVMIR/LLVMDialect.h" 13 14 using namespace mlir; 15 16 namespace { 17 class RequestCWrappersPass 18 : public LLVMRequestCWrappersBase<RequestCWrappersPass> { 19 public: 20 void runOnOperation() override { 21 getOperation()->setAttr(LLVM::LLVMDialect::getEmitCWrapperAttrName(), 22 UnitAttr::get(&getContext())); 23 } 24 }; 25 } // namespace 26 27 std::unique_ptr<Pass> mlir::LLVM::createRequestCWrappersPass() { 28 return std::make_unique<RequestCWrappersPass>(); 29 } 30