LLVM  14.0.0git
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_FPENV_H
16 #define LLVM_IR_FPENV_H
17 
19 #include "llvm/ADT/Optional.h"
20 
21 namespace llvm {
22 class StringRef;
23 
24 namespace fp {
25 
26 /// Exception behavior 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 ExceptionBehavior : uint8_t {
32  ebIgnore, ///< This corresponds to "fpexcept.ignore".
33  ebMayTrap, ///< This corresponds to "fpexcept.maytrap".
34  ebStrict ///< This corresponds to "fpexcept.strict".
35 };
36 
37 }
38 
39 /// Returns a valid RoundingMode enumerator when given a string
40 /// that is valid as input in constrained intrinsic rounding mode
41 /// metadata.
42 Optional<RoundingMode> StrToRoundingMode(StringRef);
43 
44 /// For any RoundingMode enumerator, returns a string valid as input in
45 /// constrained intrinsic rounding mode metadata.
46 Optional<StringRef> RoundingModeToStr(RoundingMode);
47 
48 /// Returns a valid ExceptionBehavior enumerator when given a string
49 /// valid as input in constrained intrinsic exception behavior metadata.
50 Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef);
51 
52 /// For any ExceptionBehavior enumerator, returns a string valid as
53 /// input in constrained intrinsic exception behavior metadata.
55 
56 /// Returns true if the exception handling behavior and rounding mode
57 /// match what is used in the default floating point environment.
60 }
61 }
62 #endif
FloatingPointMode.h
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
Optional.h
llvm::fp::ebMayTrap
@ ebMayTrap
This corresponds to "fpexcept.maytrap".
Definition: FPEnv.h:33
llvm::RoundingMode
RoundingMode
Rounding mode.
Definition: FloatingPointMode.h:34
llvm::StrToExceptionBehavior
Optional< fp::ExceptionBehavior > StrToExceptionBehavior(StringRef)
Returns a valid ExceptionBehavior enumerator when given a string valid as input in constrained intrin...
Definition: FPEnv.cpp:60
llvm::AArch64::RM
@ RM
Definition: AArch64ISelLowering.h:472
llvm::isDefaultFPEnvironment
bool isDefaultFPEnvironment(fp::ExceptionBehavior EB, RoundingMode RM)
Returns true if the exception handling behavior and rounding mode match what is used in the default f...
Definition: FPEnv.h:58
llvm::RoundingModeToStr
Optional< StringRef > RoundingModeToStr(RoundingMode)
For any RoundingMode enumerator, returns a string valid as input in constrained intrinsic rounding mo...
Definition: FPEnv.cpp:33
llvm::fp::ebIgnore
@ ebIgnore
This corresponds to "fpexcept.ignore".
Definition: FPEnv.h:32
llvm::fp::ExceptionBehavior
ExceptionBehavior
Exception behavior used for floating point operations.
Definition: FPEnv.h:31
llvm::fp::ebStrict
@ ebStrict
This corresponds to "fpexcept.strict".
Definition: FPEnv.h:34
llvm::RoundingMode::NearestTiesToEven
@ NearestTiesToEven
roundTiesToEven.
llvm::StrToRoundingMode
Optional< RoundingMode > StrToRoundingMode(StringRef)
Returns a valid RoundingMode enumerator when given a string that is valid as input in constrained int...
Definition: FPEnv.cpp:20
llvm::ExceptionBehaviorToStr
Optional< StringRef > ExceptionBehaviorToStr(fp::ExceptionBehavior)
For any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic except...
Definition: FPEnv.cpp:68