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