FPEnv.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- FPEnv.h ---- FP Environment ------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. /// @file
  15. /// This file contains the declarations of entities that describe floating
  16. /// point environment and related functions.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_IR_FLOATINGPOINT_H
  20. #define LLVM_IR_FLOATINGPOINT_H
  21. #include "llvm/ADT/FloatingPointMode.h"
  22. #include "llvm/ADT/Optional.h"
  23. namespace llvm {
  24. class StringRef;
  25. namespace fp {
  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. /// Returns a valid RoundingMode enumerator when given a string
  38. /// that is valid as input in constrained intrinsic rounding mode
  39. /// metadata.
  40. Optional<RoundingMode> StrToRoundingMode(StringRef);
  41. /// For any RoundingMode enumerator, returns a string valid as input in
  42. /// constrained intrinsic rounding mode metadata.
  43. Optional<StringRef> RoundingModeToStr(RoundingMode);
  44. /// Returns a valid ExceptionBehavior enumerator when given a string
  45. /// valid as input in constrained intrinsic exception behavior metadata.
  46. Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef);
  47. /// For any ExceptionBehavior enumerator, returns a string valid as
  48. /// input in constrained intrinsic exception behavior metadata.
  49. Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior);
  50. }
  51. #endif
  52. #ifdef __GNUC__
  53. #pragma GCC diagnostic pop
  54. #endif