xref: /llvm-project/flang/lib/Optimizer/Builder/Runtime/Pointer.cpp (revision f8843efbb2190db85c696001ffd6211a2c20ac37)
1 //===-- Pointer.cpp -- generate pointer runtime API calls------------------===//
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 "flang/Optimizer/Builder/Runtime/Pointer.h"
10 #include "flang/Optimizer/Builder/FIRBuilder.h"
11 #include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
12 #include "flang/Runtime/pointer.h"
13 
14 using namespace Fortran::runtime;
15 
genPointerAssociateScalar(fir::FirOpBuilder & builder,mlir::Location loc,mlir::Value desc,mlir::Value target)16 void fir::runtime::genPointerAssociateScalar(fir::FirOpBuilder &builder,
17                                              mlir::Location loc,
18                                              mlir::Value desc,
19                                              mlir::Value target) {
20   mlir::func::FuncOp func{
21       fir::runtime::getRuntimeFunc<mkRTKey(PointerAssociateScalar)>(loc,
22                                                                     builder)};
23   mlir::FunctionType fTy{func.getFunctionType()};
24   llvm::SmallVector<mlir::Value> args{
25       fir::runtime::createArguments(builder, loc, fTy, desc, target)};
26   builder.create<fir::CallOp>(loc, func, args);
27 }
28