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