1 | |
2 | //===-- Allocatable.cpp -- Allocatable statements lowering ----------------===// |
3 | // |
4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
5 | // See https://llvm.org/LICENSE.txt for license information. |
6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | // |
10 | // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/ |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #include "flang/Optimizer/Builder/Runtime/CUDA/Descriptor.h" |
15 | #include "flang/Optimizer/Builder/FIRBuilder.h" |
16 | #include "flang/Optimizer/Builder/Runtime/RTBuilder.h" |
17 | #include "flang/Runtime/CUDA/descriptor.h" |
18 | |
19 | using namespace Fortran::runtime::cuda; |
20 | |
21 | void fir::runtime::cuda::genSyncGlobalDescriptor(fir::FirOpBuilder &builder, |
22 | mlir::Location loc, |
23 | mlir::Value hostPtr) { |
24 | mlir::func::FuncOp callee = |
25 | fir::runtime::getRuntimeFunc<mkRTKey(CUFSyncGlobalDescriptor)>(loc, |
26 | builder); |
27 | auto fTy = callee.getFunctionType(); |
28 | mlir::Value sourceFile = fir::factory::locationToFilename(builder, loc); |
29 | mlir::Value sourceLine = |
30 | fir::factory::locationToLineNo(builder, loc, fTy.getInput(2)); |
31 | llvm::SmallVector<mlir::Value> args{fir::runtime::createArguments( |
32 | builder, loc, fTy, hostPtr, sourceFile, sourceLine)}; |
33 | builder.create<fir::CallOp>(loc, callee, args); |
34 | } |
35 | |