• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
17 #define LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
18 
19 #include <llvm/ADT/APFloat.h>
20 #include <llvm/ADT/APInt.h>
21 
22 namespace llvm {
23 namespace exegesis {
24 
25 // A simple object storing the value for a particular register.
26 struct RegisterValue {
zeroRegisterValue27   static RegisterValue zero(unsigned Reg) { return {Reg, APInt()}; }
28   unsigned Register;
29   APInt Value;
30 };
31 
32 enum class PredefinedValues {
33   POS_ZERO,       // Positive zero
34   NEG_ZERO,       // Negative zero
35   ONE,            // 1.0
36   TWO,            // 2.0
37   INF,            // Infinity
38   QNAN,           // Quiet NaN
39   ULP,            // One Unit in the last place
40   SMALLEST = ULP, // The minimum subnormal number
41   SMALLEST_NORM,  // The minimum normal number
42   LARGEST,        // The maximum normal number
43   ONE_PLUS_ULP,   // The value just after 1.0
44 };
45 
46 APInt bitcastFloatValue(const fltSemantics &FltSemantics,
47                         PredefinedValues Value);
48 
49 } // namespace exegesis
50 } // namespace llvm
51 
52 #endif // LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
53