LLVM  10.0.0
FPEnv.h
Go to the documentation of this file.
1 //===- FPEnv.h ---- FP Environment ------------------------------*- 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 /// @file
10 /// This file contains the declarations of entities that describe floating
11 /// point environment and related functions.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_IR_FLOATINGPOINT_H
16 #define LLVM_IR_FLOATINGPOINT_H
17 
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/ADT/StringRef.h"
20 #include <stdint.h>
21 
22 namespace llvm {
23 
24 namespace fp {
25 
26 /// Rounding mode used for floating point operations.
27 ///
28 /// Each of these values correspond to some metadata argument value of a
29 /// constrained floating point intrinsic. See the LLVM Language Reference Manual
30 /// for details.
31 enum RoundingMode : uint8_t {
32  rmDynamic, ///< This corresponds to "fpround.dynamic".
33  rmToNearest, ///< This corresponds to "fpround.tonearest".
34  rmDownward, ///< This corresponds to "fpround.downward".
35  rmUpward, ///< This corresponds to "fpround.upward".
36  rmTowardZero ///< This corresponds to "fpround.tozero".
37 };
38 
39 /// Exception behavior used for floating point operations.
40 ///
41 /// Each of these values correspond to some metadata argument value of a
42 /// constrained floating point intrinsic. See the LLVM Language Reference Manual
43 /// for details.
44 enum ExceptionBehavior : uint8_t {
45  ebIgnore, ///< This corresponds to "fpexcept.ignore".
46  ebMayTrap, ///< This corresponds to "fpexcept.maytrap".
47  ebStrict ///< This corresponds to "fpexcept.strict".
48 };
49 
50 }
51 
52 /// Returns a valid RoundingMode enumerator when given a string
53 /// that is valid as input in constrained intrinsic rounding mode
54 /// metadata.
56 
57 /// For any RoundingMode enumerator, returns a string valid as input in
58 /// constrained intrinsic rounding mode metadata.
60 
61 /// Returns a valid ExceptionBehavior enumerator when given a string
62 /// valid as input in constrained intrinsic exception behavior metadata.
64 
65 /// For any ExceptionBehavior enumerator, returns a string valid as
66 /// input in constrained intrinsic exception behavior metadata.
68 
69 }
70 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
This corresponds to "fpround.tonearest".
Definition: FPEnv.h:33
ExceptionBehavior
Exception behavior used for floating point operations.
Definition: FPEnv.h:44
RoundingMode
Rounding mode used for floating point operations.
Definition: FPEnv.h:31
Optional< fp::RoundingMode > StrToRoundingMode(StringRef)
Returns a valid RoundingMode enumerator when given a string that is valid as input in constrained int...
Definition: FPEnv.cpp:20
This corresponds to "fpexcept.maytrap".
Definition: FPEnv.h:46
Optional< fp::ExceptionBehavior > StrToExceptionBehavior(StringRef)
Returns a valid ExceptionBehavior enumerator when given a string valid as input in constrained intrin...
Definition: FPEnv.cpp:54
Optional< StringRef > ExceptionBehaviorToStr(fp::ExceptionBehavior)
For any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic except...
Definition: FPEnv.cpp:62
This corresponds to "fpround.dynamic".
Definition: FPEnv.h:32
This corresponds to "fpexcept.ignore".
Definition: FPEnv.h:45
This corresponds to "fpround.tozero".
Definition: FPEnv.h:36
Optional< StringRef > RoundingModeToStr(fp::RoundingMode)
For any RoundingMode enumerator, returns a string valid as input in constrained intrinsic rounding mo...
Definition: FPEnv.cpp:32
This corresponds to "fpexcept.strict".
Definition: FPEnv.h:47
This corresponds to "fpround.downward".
Definition: FPEnv.h:34
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
This corresponds to "fpround.upward".
Definition: FPEnv.h:35