LLVM API Documentation
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cstdint>
#include <limits>
#include <string>
#include <tuple>
#include <utility>
Go to the source code of this file.
Classes | |
class | llvm::ScaledNumberBase |
class | llvm::ScaledNumber< DigitsT > |
Simple representation of a scaled number. More... | |
struct | llvm::isPodLike< ScaledNumber< T > > |
Namespaces | |
namespace | llvm |
List of target independent CodeGen pass IDs. | |
namespace | llvm::ScaledNumbers |
Defines | |
#define | SCALED_NUMBER_BOP(op, base) |
#define | SCALED_NUMBER_COMPARE_TO_TYPE(op, T1, T2) |
#define | SCALED_NUMBER_COMPARE_TO(op) |
Functions | |
template<class DigitsT > | |
int | llvm::ScaledNumbers::getWidth () |
Get the width of a number. | |
template<class DigitsT > | |
std::pair< DigitsT, int16_t > | llvm::ScaledNumbers::getRounded (DigitsT Digits, int16_t Scale, bool ShouldRound) |
Conditionally round up a scaled number. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::getRounded32 (uint32_t Digits, int16_t Scale, bool ShouldRound) |
Convenience helper for 32-bit rounding. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::getRounded64 (uint64_t Digits, int16_t Scale, bool ShouldRound) |
Convenience helper for 64-bit rounding. | |
template<class DigitsT > | |
std::pair< DigitsT, int16_t > | llvm::ScaledNumbers::getAdjusted (uint64_t Digits, int16_t Scale=0) |
Adjust a 64-bit scaled number down to the appropriate width. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::getAdjusted32 (uint64_t Digits, int16_t Scale=0) |
Convenience helper for adjusting to 32 bits. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::getAdjusted64 (uint64_t Digits, int16_t Scale=0) |
Convenience helper for adjusting to 64 bits. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::multiply64 (uint64_t LHS, uint64_t RHS) |
Multiply two 64-bit integers to create a 64-bit scaled number. | |
template<class DigitsT > | |
std::pair< DigitsT, int16_t > | llvm::ScaledNumbers::getProduct (DigitsT LHS, DigitsT RHS) |
Multiply two 32-bit integers to create a 32-bit scaled number. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::getProduct32 (uint32_t LHS, uint32_t RHS) |
Convenience helper for 32-bit product. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::getProduct64 (uint64_t LHS, uint64_t RHS) |
Convenience helper for 64-bit product. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::divide64 (uint64_t Dividend, uint64_t Divisor) |
Divide two 64-bit integers to create a 64-bit scaled number. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::divide32 (uint32_t Dividend, uint32_t Divisor) |
Divide two 32-bit integers to create a 32-bit scaled number. | |
template<class DigitsT > | |
std::pair< DigitsT, int16_t > | llvm::ScaledNumbers::getQuotient (DigitsT Dividend, DigitsT Divisor) |
Divide two 32-bit numbers to create a 32-bit scaled number. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::getQuotient32 (uint32_t Dividend, uint32_t Divisor) |
Convenience helper for 32-bit quotient. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::getQuotient64 (uint64_t Dividend, uint64_t Divisor) |
Convenience helper for 64-bit quotient. | |
template<class DigitsT > | |
std::pair< int32_t, int > | llvm::ScaledNumbers::getLgImpl (DigitsT Digits, int16_t Scale) |
Implementation of getLg() and friends. | |
template<class DigitsT > | |
int32_t | llvm::ScaledNumbers::getLg (DigitsT Digits, int16_t Scale) |
Get the lg (rounded) of a scaled number. | |
template<class DigitsT > | |
int32_t | llvm::ScaledNumbers::getLgFloor (DigitsT Digits, int16_t Scale) |
Get the lg floor of a scaled number. | |
template<class DigitsT > | |
int32_t | llvm::ScaledNumbers::getLgCeiling (DigitsT Digits, int16_t Scale) |
Get the lg ceiling of a scaled number. | |
int | llvm::ScaledNumbers::compareImpl (uint64_t L, uint64_t R, int ScaleDiff) |
Implementation for comparing scaled numbers. | |
template<class DigitsT > | |
int | llvm::ScaledNumbers::compare (DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale) |
Compare two scaled numbers. | |
template<class DigitsT > | |
int16_t | llvm::ScaledNumbers::matchScales (DigitsT &LDigits, int16_t &LScale, DigitsT &RDigits, int16_t &RScale) |
Match scales of two numbers. | |
template<class DigitsT > | |
std::pair< DigitsT, int16_t > | llvm::ScaledNumbers::getSum (DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale) |
Get the sum of two scaled numbers. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::getSum32 (uint32_t LDigits, int16_t LScale, uint32_t RDigits, int16_t RScale) |
Convenience helper for 32-bit sum. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::getSum64 (uint64_t LDigits, int16_t LScale, uint64_t RDigits, int16_t RScale) |
Convenience helper for 64-bit sum. | |
template<class DigitsT > | |
std::pair< DigitsT, int16_t > | llvm::ScaledNumbers::getDifference (DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale) |
Get the difference of two scaled numbers. | |
std::pair< uint32_t, int16_t > | llvm::ScaledNumbers::getDifference32 (uint32_t LDigits, int16_t LScale, uint32_t RDigits, int16_t RScale) |
Convenience helper for 32-bit difference. | |
std::pair< uint64_t, int16_t > | llvm::ScaledNumbers::getDifference64 (uint64_t LDigits, int16_t LScale, uint64_t RDigits, int16_t RScale) |
Convenience helper for 64-bit difference. | |
template<class DigitsT > | |
raw_ostream & | llvm::operator<< (raw_ostream &OS, const ScaledNumber< DigitsT > &X) |
Variables | |
const int32_t | llvm::ScaledNumbers::MaxScale = 16383 |
Maximum scale; same as APFloat for easy debug printing. | |
const int32_t | llvm::ScaledNumbers::MinScale = -16382 |
Maximum scale; same as APFloat for easy debug printing. |
#define SCALED_NUMBER_BOP | ( | op, | |
base | |||
) |
template <class DigitsT> \ ScaledNumber<DigitsT> operator op(const ScaledNumber<DigitsT> &L, \ const ScaledNumber<DigitsT> &R) { \ return ScaledNumber<DigitsT>(L) base R; \ }
Definition at line 726 of file ScaledNumber.h.
#define SCALED_NUMBER_COMPARE_TO | ( | op | ) |
SCALED_NUMBER_COMPARE_TO_TYPE(op, uint64_t, uint64_t) \ SCALED_NUMBER_COMPARE_TO_TYPE(op, uint32_t, uint64_t) \ SCALED_NUMBER_COMPARE_TO_TYPE(op, int64_t, int64_t) \ SCALED_NUMBER_COMPARE_TO_TYPE(op, int32_t, int64_t)
Definition at line 754 of file ScaledNumber.h.
#define SCALED_NUMBER_COMPARE_TO_TYPE | ( | op, | |
T1, | |||
T2 | |||
) |
template <class DigitsT> \ bool operator op(const ScaledNumber<DigitsT> &L, T1 R) { \ return L.compareTo(T2(R)) op 0; \ } \ template <class DigitsT> \ bool operator op(T1 L, const ScaledNumber<DigitsT> &R) { \ return 0 op R.compareTo(T2(L)); \ }
Definition at line 745 of file ScaledNumber.h.