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, bool isMonomorphic);
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);
47
48mlir::Value genDsecnds(fir::FirOpBuilder &builder, mlir::Location loc,
49 mlir::Value refTime);
50
51void genEtime(fir::FirOpBuilder &builder, mlir::Location loc,
52 mlir::Value values, mlir::Value time);
53
54void genFree(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value ptr);
55
56mlir::Value genFseek(fir::FirOpBuilder &builder, mlir::Location loc,
57 mlir::Value unit, mlir::Value offset, mlir::Value whence);
58mlir::Value genFtell(fir::FirOpBuilder &builder, mlir::Location loc,
59 mlir::Value unit);
60
61mlir::Value genGetUID(fir::FirOpBuilder &, mlir::Location);
62mlir::Value genGetGID(fir::FirOpBuilder &, mlir::Location);
63
64mlir::Value genMalloc(fir::FirOpBuilder &builder, mlir::Location loc,
65 mlir::Value size);
66
67void genRandomInit(fir::FirOpBuilder &, mlir::Location, mlir::Value repeatable,
68 mlir::Value imageDistinct);
69void genRandomNumber(fir::FirOpBuilder &, mlir::Location, mlir::Value harvest);
70void genRandomSeed(fir::FirOpBuilder &, mlir::Location, mlir::Value size,
71 mlir::Value put, mlir::Value get);
72
74void genRename(fir::FirOpBuilder &builder, mlir::Location loc,
75 mlir::Value path1, mlir::Value path2, mlir::Value status);
76
77mlir::Value genSecnds(fir::FirOpBuilder &builder, mlir::Location loc,
78 mlir::Value refTime);
79
81mlir::Value genTime(fir::FirOpBuilder &builder, mlir::Location loc);
82
84void genTransfer(fir::FirOpBuilder &builder, mlir::Location loc,
85 mlir::Value resultBox, mlir::Value sourceBox,
86 mlir::Value moldBox);
87
89void genTransferSize(fir::FirOpBuilder &builder, mlir::Location loc,
90 mlir::Value resultBox, mlir::Value sourceBox,
91 mlir::Value moldBox, mlir::Value size);
92
95void genSystemClock(fir::FirOpBuilder &, mlir::Location, mlir::Value count,
96 mlir::Value rate, mlir::Value max);
97
98// generate signal runtime call
99// CALL SIGNAL(NUMBER, HANDLER [, STATUS])
100// status can be {} or a value. It may also be dynamically absent
101void genSignal(fir::FirOpBuilder &builder, mlir::Location loc,
102 mlir::Value number, mlir::Value handler, mlir::Value status);
103
105void genSleep(fir::FirOpBuilder &builder, mlir::Location loc,
106 mlir::Value seconds);
107
109mlir::Value genChdir(fir::FirOpBuilder &builder, mlir::Location loc,
110 mlir::Value name);
111
112} // namespace runtime
113} // namespace fir
114
115#endif // FORTRAN_LOWER_RUNTIME_H
Definition BoxValue.h:77
Definition FIRBuilder.h:55
Definition AbstractConverter.h:34
Definition AbstractConverter.h:29