RegisterValue.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //===-- RegisterValue.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. /// \file
  10. ///
  11. /// Defines a Target independent value for a Register. This is useful to explore
  12. /// the influence of the instruction input values on its execution time.
  13. ///
  14. //===----------------------------------------------------------------------===//
  15. #ifndef LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
  16. #define LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
  17. #include <llvm/ADT/APFloat.h>
  18. #include <llvm/ADT/APInt.h>
  19. namespace llvm {
  20. namespace exegesis {
  21. // A simple object storing the value for a particular register.
  22. struct RegisterValue {
  23. static RegisterValue zero(unsigned Reg) { return {Reg, APInt()}; }
  24. unsigned Register;
  25. APInt Value;
  26. };
  27. enum class PredefinedValues {
  28. POS_ZERO, // Positive zero
  29. NEG_ZERO, // Negative zero
  30. ONE, // 1.0
  31. TWO, // 2.0
  32. INF, // Infinity
  33. QNAN, // Quiet NaN
  34. ULP, // One Unit in the last place
  35. SMALLEST = ULP, // The minimum subnormal number
  36. SMALLEST_NORM, // The minimum normal number
  37. LARGEST, // The maximum normal number
  38. ONE_PLUS_ULP, // The value just after 1.0
  39. };
  40. APInt bitcastFloatValue(const fltSemantics &FltSemantics,
  41. PredefinedValues Value);
  42. } // namespace exegesis
  43. } // namespace llvm
  44. #endif // LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H