54 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10///11/// Defines a Target independent value for a Register. This is useful to explore12/// the influence of the instruction input values on its execution time.13///14//===----------------------------------------------------------------------===//15 16#ifndef LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H17#define LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H18 19#include <llvm/ADT/APFloat.h>20#include <llvm/ADT/APInt.h>21#include <llvm/MC/MCRegister.h>22 23namespace llvm {24namespace exegesis {25 26// A simple object storing the value for a particular register.27struct RegisterValue {28 static RegisterValue zero(MCRegister Reg) { return {Reg, APInt()}; }29 MCRegister Register;30 APInt Value;31};32 33enum class PredefinedValues {34 POS_ZERO, // Positive zero35 NEG_ZERO, // Negative zero36 ONE, // 1.037 TWO, // 2.038 INF, // Infinity39 QNAN, // Quiet NaN40 ULP, // One Unit in the last place41 SMALLEST = ULP, // The minimum subnormal number42 SMALLEST_NORM, // The minimum normal number43 LARGEST, // The maximum normal number44 ONE_PLUS_ULP, // The value just after 1.045};46 47APInt bitcastFloatValue(const fltSemantics &FltSemantics,48 PredefinedValues Value);49 50} // namespace exegesis51} // namespace llvm52 53#endif // LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H54