LLVM API Documentation

Namespaces | Defines | Enumerations | Functions | Variables
MathExtras.h File Reference
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SwapByteOrder.h"
#include <cassert>
#include <cstring>
#include <type_traits>
Include dependency graph for MathExtras.h:

Go to the source code of this file.

Namespaces

namespace  llvm
 

List of target independent CodeGen pass IDs.


Defines

#define R2(n)   n, n + 2 * 64, n + 1 * 64, n + 3 * 64
#define R4(n)   R2(n), R2(n + 2 * 16), R2(n + 1 * 16), R2(n + 3 * 16)
#define R6(n)   R4(n), R4(n + 2 * 4), R4(n + 1 * 4), R4(n + 3 * 4)

Enumerations

enum  llvm::ZeroBehavior { llvm::ZB_Undefined, llvm::ZB_Max, llvm::ZB_Width }
 The behavior an operation has on an input of 0. More...

Functions

template<typename T >
std::enable_if
< std::numeric_limits< T >
::is_integer
&&!std::numeric_limits< T >
::is_signed, std::size_t >
::type 
llvm::countTrailingZeros (T Val, ZeroBehavior ZB=ZB_Width)
 Count number of 0's from the least significant bit to the most stopping at the first 1.
template<typename T >
std::enable_if
< std::numeric_limits< T >
::is_integer
&&!std::numeric_limits< T >
::is_signed, std::size_t >
::type 
llvm::countLeadingZeros (T Val, ZeroBehavior ZB=ZB_Width)
 Count number of 0's from the most significant bit to the least stopping at the first 1.
template<typename T >
std::enable_if
< std::numeric_limits< T >
::is_integer
&&!std::numeric_limits< T >
::is_signed, T >::type 
llvm::findFirstSet (T Val, ZeroBehavior ZB=ZB_Max)
 Get the index of the first set bit starting from the least significant bit.
template<typename T >
std::enable_if
< std::numeric_limits< T >
::is_integer
&&!std::numeric_limits< T >
::is_signed, T >::type 
llvm::findLastSet (T Val, ZeroBehavior ZB=ZB_Max)
 Get the index of the last set bit starting from the least significant bit.
template<typename T >
T llvm::reverseBits (T Val)
 Reverse the bits in Val.
uint32_t llvm::Hi_32 (uint64_t Value)
 Hi_32 - This function returns the high 32 bits of a 64 bit value.
uint32_t llvm::Lo_32 (uint64_t Value)
 Lo_32 - This function returns the low 32 bits of a 64 bit value.
uint64_t llvm::Make_64 (uint32_t High, uint32_t Low)
template<unsigned N>
bool llvm::isInt (int64_t x)
 isInt - Checks if an integer fits into the given bit width.
template<>
bool llvm::isInt< 8 > (int64_t x)
template<>
bool llvm::isInt< 16 > (int64_t x)
template<>
bool llvm::isInt< 32 > (int64_t x)
template<unsigned N, unsigned S>
bool llvm::isShiftedInt (int64_t x)
template<unsigned N>
bool llvm::isUInt (uint64_t x)
 isUInt - Checks if an unsigned integer fits into the given bit width.
template<>
bool llvm::isUInt< 8 > (uint64_t x)
template<>
bool llvm::isUInt< 16 > (uint64_t x)
template<>
bool llvm::isUInt< 32 > (uint64_t x)
template<unsigned N, unsigned S>
bool llvm::isShiftedUInt (uint64_t x)
bool llvm::isUIntN (unsigned N, uint64_t x)
bool llvm::isIntN (unsigned N, int64_t x)
bool llvm::isMask_32 (uint32_t Value)
bool llvm::isMask_64 (uint64_t Value)
bool llvm::isShiftedMask_32 (uint32_t Value)
bool llvm::isShiftedMask_64 (uint64_t Value)
bool llvm::isPowerOf2_32 (uint32_t Value)
bool llvm::isPowerOf2_64 (uint64_t Value)
uint16_t llvm::ByteSwap_16 (uint16_t Value)
uint32_t llvm::ByteSwap_32 (uint32_t Value)
uint64_t llvm::ByteSwap_64 (uint64_t Value)
unsigned llvm::CountLeadingOnes_32 (uint32_t Value)
unsigned llvm::CountLeadingOnes_64 (uint64_t Value)
unsigned llvm::CountTrailingOnes_32 (uint32_t Value)
unsigned llvm::CountTrailingOnes_64 (uint64_t Value)
unsigned llvm::CountPopulation_32 (uint32_t Value)
unsigned llvm::CountPopulation_64 (uint64_t Value)
unsigned llvm::Log2_32 (uint32_t Value)
unsigned llvm::Log2_64 (uint64_t Value)
unsigned llvm::Log2_32_Ceil (uint32_t Value)
unsigned llvm::Log2_64_Ceil (uint64_t Value)
uint64_t llvm::GreatestCommonDivisor64 (uint64_t A, uint64_t B)
double llvm::BitsToDouble (uint64_t Bits)
float llvm::BitsToFloat (uint32_t Bits)
uint64_t llvm::DoubleToBits (double Double)
uint32_t llvm::FloatToBits (float Float)
int llvm::IsNAN (float f)
 Platform-independent wrappers for the C99 isnan() function.
int llvm::IsNAN (double d)
int llvm::IsInf (float f)
 Platform-independent wrappers for the C99 isinf() function.
int llvm::IsInf (double d)
uint64_t llvm::MinAlign (uint64_t A, uint64_t B)
char * llvm::alignPtr (char *Ptr, size_t Alignment)
 Aligns Ptr to Alignment bytes, rounding up.
uint64_t llvm::NextPowerOf2 (uint64_t A)
uint64_t llvm::PowerOf2Floor (uint64_t A)
uint64_t llvm::RoundUpToAlignment (uint64_t Value, uint64_t Align)
uint64_t llvm::OffsetToAlignment (uint64_t Value, uint64_t Align)
int64_t llvm::abs64 (int64_t x)
template<unsigned B>
int32_t llvm::SignExtend32 (uint32_t x)
int32_t llvm::SignExtend32 (uint32_t X, unsigned B)
 Sign extend number in the bottom B bits of X to a 32-bit int. Requires 0 < B <= 32.
template<unsigned B>
int64_t llvm::SignExtend64 (uint64_t x)
int64_t llvm::SignExtend64 (uint64_t X, unsigned B)
 Sign extend number in the bottom B bits of X to a 64-bit int. Requires 0 < B <= 64.

Variables

static const unsigned char llvm::BitReverseTable256 [256]
 Macro compressed bit reversal table for 256 bits.
const float llvm::huge_valf = HUGE_VALF

Define Documentation

#define R2 (   n)    n, n + 2 * 64, n + 1 * 64, n + 3 * 64
#define R4 (   n)    R2(n), R2(n + 2 * 16), R2(n + 1 * 16), R2(n + 3 * 16)
#define R6 (   n)    R4(n), R4(n + 2 * 4), R4(n + 1 * 4), R4(n + 3 * 4)