FLANG
Fortran-consts.h
1//===-- include/flang/Common/Fortran-consts.h -------------------*- 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#ifndef FORTRAN_COMMON_FORTRAN_CONSTS_H_
10#define FORTRAN_COMMON_FORTRAN_CONSTS_H_
11
12#include "api-attrs.h"
13#include "enum-class.h"
14#include <cstdint>
15
16namespace Fortran::common {
17
18// Fortran has five kinds of standard intrinsic data types, the Unsigned
19// extension, and derived types.
20ENUM_CLASS(
21 TypeCategory, Integer, Unsigned, Real, Complex, Character, Logical, Derived)
22ENUM_CLASS(VectorElementCategory, Integer, Unsigned, Real)
23
24ENUM_CLASS(IoStmtKind, None, Backspace, Close, Endfile, Flush, Inquire, Open,
25 Print, Read, Rewind, Wait, Write)
26
27// Defined I/O variants
28ENUM_CLASS(
29 DefinedIo, ReadFormatted, ReadUnformatted, WriteFormatted, WriteUnformatted)
30
31RT_OFFLOAD_VAR_GROUP_BEGIN
32// Fortran arrays may have up to 15 dimensions (See Fortran 2018 section 5.4.6).
33static constexpr int maxRank{15};
34RT_OFFLOAD_VAR_GROUP_END
35
36// Floating-point rounding modes; these are packed into a byte to save
37// room in the runtime's format processing context structure. These
38// enumerators are defined with the corresponding values returned from
39// llvm.get.rounding.
40enum class RoundingMode : std::uint8_t {
41 ToZero, // ROUND=ZERO, RZ - truncation
42 TiesToEven, // ROUND=NEAREST, RN - default IEEE rounding
43 Up, // ROUND=UP, RU
44 Down, // ROUND=DOWN, RD
45 TiesAwayFromZero, // ROUND=COMPATIBLE, RC - ties round away from zero
46};
47
48} // namespace Fortran::common
49#endif /* FORTRAN_COMMON_FORTRAN_CONSTS_H_ */
Definition bit-population-count.h:20