FLANG
Intrinsics.h
1// Builder/Runtime/Intrinsics.h Fortran runtime codegen interface -*- C++ -*-//
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// Builder routines for constructing the FIR dialect of MLIR. As FIR is a
10// dialect of MLIR, it makes extensive use of MLIR interfaces and MLIR's coding
11// style (https://mlir.llvm.org/getting_started/DeveloperGuide/) is used in this
12// module.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef FORTRAN_LOWER_RUNTIME_H
17#define FORTRAN_LOWER_RUNTIME_H
18
19#include <optional>
20
21namespace mlir {
22class Location;
23class Type;
24class Value;
25} // namespace mlir
26
27namespace fir {
28class CharBoxValue;
29class FirOpBuilder;
30
31namespace runtime {
32
33mlir::Value genAssociated(fir::FirOpBuilder &, mlir::Location,
34 mlir::Value pointer, mlir::Value target);
35
36void genPointerAssociate(fir::FirOpBuilder &, mlir::Location,
37 mlir::Value pointer, mlir::Value target);
38void genPointerAssociateRemapping(fir::FirOpBuilder &, mlir::Location,
39 mlir::Value pointer, mlir::Value target,
40 mlir::Value bounds);
41
42mlir::Value genCpuTime(fir::FirOpBuilder &, mlir::Location);
43void genDateAndTime(fir::FirOpBuilder &, mlir::Location,
44 std::optional<fir::CharBoxValue> date,
45 std::optional<fir::CharBoxValue> time,
46 std::optional<fir::CharBoxValue> zone, mlir::Value values);
47void genEtime(fir::FirOpBuilder &builder, mlir::Location loc,
48 mlir::Value values, mlir::Value time);
49
50void genFree(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value ptr);
51
52mlir::Value genGetUID(fir::FirOpBuilder &, mlir::Location);
53mlir::Value genGetGID(fir::FirOpBuilder &, mlir::Location);
54
55mlir::Value genMalloc(fir::FirOpBuilder &builder, mlir::Location loc,
56 mlir::Value size);
57
58void genRandomInit(fir::FirOpBuilder &, mlir::Location, mlir::Value repeatable,
59 mlir::Value imageDistinct);
60void genRandomNumber(fir::FirOpBuilder &, mlir::Location, mlir::Value harvest);
61void genRandomSeed(fir::FirOpBuilder &, mlir::Location, mlir::Value size,
62 mlir::Value put, mlir::Value get);
63
65void genRename(fir::FirOpBuilder &builder, mlir::Location loc,
66 mlir::Value path1, mlir::Value path2, mlir::Value status);
67
69void genTransfer(fir::FirOpBuilder &builder, mlir::Location loc,
70 mlir::Value resultBox, mlir::Value sourceBox,
71 mlir::Value moldBox);
72
74void genTransferSize(fir::FirOpBuilder &builder, mlir::Location loc,
75 mlir::Value resultBox, mlir::Value sourceBox,
76 mlir::Value moldBox, mlir::Value size);
77
80void genSystemClock(fir::FirOpBuilder &, mlir::Location, mlir::Value count,
81 mlir::Value rate, mlir::Value max);
82
83// generate signal runtime call
84// CALL SIGNAL(NUMBER, HANDLER [, STATUS])
85// status can be {} or a value. It may also be dynamically absent
86void genSignal(fir::FirOpBuilder &builder, mlir::Location loc,
87 mlir::Value number, mlir::Value handler, mlir::Value status);
88
90void genSleep(fir::FirOpBuilder &builder, mlir::Location loc,
91 mlir::Value seconds);
92
93} // namespace runtime
94} // namespace fir
95
96#endif // FORTRAN_LOWER_RUNTIME_H
Definition: FIRBuilder.h:55
Definition: AbstractConverter.h:31
@ Value
Lower argument to a value. Mainly intended for scalar arguments.
Definition: AbstractConverter.h:27