#include #include #include #include #include ">

LLVM: include/llvm/Support/ScaledNumber.h File Reference (original) (raw)

#include "[llvm/Support/Compiler.h](Compiler%5F8h%5Fsource.html)"
#include "[llvm/Support/MathExtras.h](MathExtras%5F8h%5Fsource.html)"
#include <algorithm>
#include <cstdint>
#include <limits>
#include <string>
#include <tuple>
#include <utility>

Go to the source code of this file.

Namespaces
namespace llvm
This is an optimization pass for GlobalISel generic memory operations.
namespace llvm::ScaledNumbers
Functions
template
int llvm::ScaledNumbers::getWidth ()
Get the width of a number.
template
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
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.
LLVM_ABI 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
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.
LLVM_ABI 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.
LLVM_ABI 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
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
std::pair< int32_t, int > llvm::ScaledNumbers::getLgImpl (DigitsT Digits, int16_t Scale)
Implementation of getLg() and friends.
template
int32_t llvm::ScaledNumbers::getLg (DigitsT Digits, int16_t Scale)
Get the lg (rounded) of a scaled number.
template
int32_t llvm::ScaledNumbers::getLgFloor (DigitsT Digits, int16_t Scale)
Get the lg floor of a scaled number.
template
int32_t llvm::ScaledNumbers::getLgCeiling (DigitsT Digits, int16_t Scale)
Get the lg ceiling of a scaled number.
LLVM_ABI int llvm::ScaledNumbers::compareImpl (uint64_t L, uint64_t R, int ScaleDiff)
Implementation for comparing scaled numbers.
template
int llvm::ScaledNumbers::compare (DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)
Compare two scaled numbers.
template
int16_t llvm::ScaledNumbers::matchScales (DigitsT &LDigits, int16_t &LScale, DigitsT &RDigits, int16_t &RScale)
Match scales of two numbers.
template
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
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
ScaledNumber< DigitsT > llvm::operator<< (const ScaledNumber< DigitsT > &L, int16_t Shift)
template
ScaledNumber< DigitsT > llvm::operator>> (const ScaledNumber< DigitsT > &L, int16_t Shift)
template
raw_ostream & llvm::operator<< (raw_ostream &OS, const ScaledNumber< DigitsT > &X)

SCALED_NUMBER_BOP

#define SCALED_NUMBER_BOP ( op,
base )

Value:

template \

ScaledNumber operator op(const ScaledNumber &L, \

const ScaledNumber &R) { \

return ScaledNumber(L) base R; \

}

Definition at line 721 of file ScaledNumber.h.

SCALED_NUMBER_COMPARE_TO

#define SCALED_NUMBER_COMPARE_TO ( op )

Value:

SCALED_NUMBER_COMPARE_TO_TYPE(op, int64_t, int64_t) \

SCALED_NUMBER_COMPARE_TO_TYPE(op, int32_t, int64_t)

#define SCALED_NUMBER_COMPARE_TO_TYPE(op, T1, T2)

Definition at line 759 of file ScaledNumber.h.

SCALED_NUMBER_COMPARE_TO_TYPE

#define SCALED_NUMBER_COMPARE_TO_TYPE ( op,
T1,
T2 )

Value:

template \

bool operator op(const ScaledNumber &L, T1 R) { \

return L.compareTo(T2(R)) op 0; \

} \

template \

bool operator op(T1 L, const ScaledNumber &R) { \

return 0 op R.compareTo(T2(L)); \

}

Definition at line 750 of file ScaledNumber.h.