FLANG
exceptions.h
1//===-- include/flang/Runtime/exceptions.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// Map Fortran ieee_arithmetic module exceptions to fenv.h exceptions.
10
11#ifndef FORTRAN_RUNTIME_EXCEPTIONS_H_
12#define FORTRAN_RUNTIME_EXCEPTIONS_H_
13
14#include "flang/Runtime/entry-names.h"
15#include <cinttypes>
16#include <cstddef>
17
18namespace Fortran::runtime {
19
20class Descriptor;
21
22extern "C" {
23
24// Map a set of IEEE_FLAG_TYPE exception values to a libm fenv.h excepts value.
25// This mapping is done at runtime to support cross compilation.
26std::uint32_t RTNAME(MapException)(std::uint32_t excepts);
27
28// Check if the processor has the ability to control whether to halt
29// or continue exeuction when a given exception is raised.
30bool RTNAME(SupportHalting)(uint32_t except);
31
32// Get and set the ieee underflow mode if supported; otherwise nops.
33bool RTNAME(GetUnderflowMode)(void);
34void RTNAME(SetUnderflowMode)(bool flag);
35
36// Get the byte size of ieee_modes_type and ieee_status_type data.
37std::size_t RTNAME(GetModesTypeSize)(void);
38std::size_t RTNAME(GetStatusTypeSize)(void);
39
40} // extern "C"
41} // namespace Fortran::runtime
42#endif // FORTRAN_RUNTIME_EXCEPTIONS_H_