Go to the documentation of this file.
14 #ifndef LLVM_ADT_DENSEMAPINFO_H
15 #define LLVM_ADT_DENSEMAPINFO_H
48 template<
typename T,
typename Enable =
void>
67 static constexpr uintptr_t Log2MaxAlign = 12;
70 uintptr_t Val =
static_cast<uintptr_t
>(-1);
72 return reinterpret_cast<T*
>(Val);
76 uintptr_t Val =
static_cast<uintptr_t
>(-2);
78 return reinterpret_cast<T*
>(Val);
82 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
83 (unsigned((uintptr_t)PtrVal) >> 9);
93 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
104 static unsigned getHashValue(
const unsigned char &Val) {
return Val * 37U; }
115 static unsigned getHashValue(
const unsigned short &Val) {
return Val * 37U; }
126 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
139 return (
unsigned)(Val * 37UL);
153 return (
unsigned)(Val * 37ULL);
157 const unsigned long long&
RHS) {
174 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
184 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
190 return (
unsigned)(Val * 37UL);
200 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
204 return (
unsigned)(Val * 37ULL);
208 const long long&
RHS) {
214 template<
typename T,
typename U>
221 return std::make_pair(FirstInfo::getEmptyKey(),
222 SecondInfo::getEmptyKey());
226 return std::make_pair(FirstInfo::getTombstoneKey(),
227 SecondInfo::getTombstoneKey());
232 SecondInfo::getHashValue(PairVal.second));
253 template <
unsigned I>
256 std::integral_constant<bool,
I + 1 ==
sizeof...(Ts)> atEnd;
259 getHashValueImpl<I + 1>(
values, atEnd));
262 template <
unsigned I>
268 std::integral_constant<bool, 0 ==
sizeof...(Ts)> atEnd;
269 return getHashValueImpl<0>(
values, atEnd);
272 template <
unsigned I>
275 std::integral_constant<bool,
I + 1 ==
sizeof...(Ts)> atEnd;
277 isEqualImpl<I + 1>(lhs, rhs, atEnd);
280 template <
unsigned I>
286 std::integral_constant<bool, 0 ==
sizeof...(Ts)> atEnd;
287 return isEqualImpl<0>(lhs, rhs, atEnd);
293 #endif // LLVM_ADT_DENSEMAPINFO_H
static unsigned short getTombstoneKey()
static short getEmptyKey()
static T * getTombstoneKey()
This is an optimization pass for GlobalISel generic memory operations.
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type)
static long long getEmptyKey()
static long getEmptyKey()
static char getEmptyKey()
static unsigned getHashValue(const unsigned long long &Val)
static Tuple getTombstoneKey()
static unsigned long getTombstoneKey()
static unsigned getHashValue(const T *PtrVal)
static unsigned getHashValue(const long &Val)
static bool isEqual(const char &LHS, const char &RHS)
static bool isEqual(const unsigned short &LHS, const unsigned short &RHS)
static bool isEqual(const unsigned long long &LHS, const unsigned long long &RHS)
static bool isEqual(const long long &LHS, const long long &RHS)
=0.0 ? 0.0 :(a > 0.0 ? 1.0 :-1.0) a
static char getTombstoneKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
static bool isEqual(const unsigned &LHS, const unsigned &RHS)
static unsigned getHashValue(const long long &Val)
static bool isEqual(const unsigned char &LHS, const unsigned char &RHS)
static unsigned getHashValue(const int &Val)
std::tuple< Ts... > Tuple
static unsigned getHashValue(const unsigned long &Val)
static unsigned short getEmptyKey()
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
static unsigned long long getEmptyKey()
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int b
static unsigned getHashValue(const unsigned short &Val)
static bool isEqualImpl(const Tuple &, const Tuple &, std::true_type)
static int getTombstoneKey()
static unsigned getHashValue(const Pair &PairVal)
static unsigned combineHashValue(unsigned a, unsigned b)
Simplistic combination of 32-bit hash values into 32-bit hash values.
static unsigned long getEmptyKey()
static long getTombstoneKey()
static unsigned getHashValue(const unsigned &Val)
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
AMD64 Optimization Manual has some nice information about optimizing integer multiplication by a constant How much of it applies to Intel s X86 implementation There are definite trade offs to xmm0 cvttss2siq rdx jb L3 subss xmm0 rax cvttss2siq rdx xorq rdx rax ret instead of xmm1 cvttss2siq rcx movaps xmm2 subss xmm2 cvttss2siq rax rdx xorq rax ucomiss xmm0 cmovb rax ret Seems like the jb branch has high likelihood of being taken It would have saved a few instructions It s not possible to reference and DH registers in an instruction requiring REX prefix divb and mulb both produce results in AH If isel emits a CopyFromReg which gets turned into a movb and that can be allocated a r8b r15b To get around isel emits a CopyFromReg from AX and then right shift it down by and truncate it It s not pretty but it works We need some register allocation magic to make the hack go which would often require a callee saved register Callees usually need to keep this value live for most of their body so it doesn t add a significant burden on them We currently implement this in however this is suboptimal because it means that it would be quite awkward to implement the optimization for callers A better implementation would be to relax the LLVM IR rules for sret arguments to allow a function with an sret argument to have a non void return type
static unsigned getHashValue(const std::tuple< Ts... > &values)
static bool isEqual(const T *LHS, const T *RHS)
static bool isEqual(const long &LHS, const long &RHS)
static unsigned getEmptyKey()
static short getTombstoneKey()
static Tuple getEmptyKey()
static bool isEqual(const Pair &LHS, const Pair &RHS)
static bool isEqual(const int &LHS, const int &RHS)
static unsigned getHashValue(const char &Val)
static unsigned char getEmptyKey()
static unsigned char getTombstoneKey()
static unsigned getHashValue(const unsigned char &Val)
static bool isEqual(const unsigned long &LHS, const unsigned long &RHS)
static unsigned getHashValueImpl(const Tuple &values, std::false_type)
static bool isEqual(const Function &Caller, const Function &Callee)
static bool isEqual(const Tuple &lhs, const Tuple &rhs)
static unsigned getHashValueImpl(const Tuple &, std::true_type)
static long long getTombstoneKey()
static unsigned getTombstoneKey()
static unsigned getHashValue(const short &Val)
static unsigned long long getTombstoneKey()
static bool isEqual(const short &LHS, const short &RHS)
static Pair getTombstoneKey()
static Pair getEmptyKey()