mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Revert "LLVMContext: Store APInt/APFloat directly into the ConstantInt/FP DenseMaps."
Somehow made DenseMap probe on forever on 32 bit machines. This reverts commit r223478. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223546 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -46,26 +46,55 @@ class Type;
|
||||
class Value;
|
||||
|
||||
struct DenseMapAPIntKeyInfo {
|
||||
static inline APInt getEmptyKey() { return APInt(nullptr, 0); }
|
||||
static inline APInt getTombstoneKey() {
|
||||
return APInt(reinterpret_cast<uint64_t *>(sizeof(uint64_t)), 0);
|
||||
}
|
||||
static unsigned getHashValue(const APInt &Key) {
|
||||
struct KeyTy {
|
||||
APInt val;
|
||||
Type* type;
|
||||
KeyTy(const APInt& V, Type* Ty) : val(V), type(Ty) {}
|
||||
bool operator==(const KeyTy& that) const {
|
||||
return type == that.type && this->val == that.val;
|
||||
}
|
||||
bool operator!=(const KeyTy& that) const {
|
||||
return !this->operator==(that);
|
||||
}
|
||||
friend hash_code hash_value(const KeyTy &Key) {
|
||||
return hash_combine(Key.type, Key.val);
|
||||
}
|
||||
};
|
||||
static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), nullptr); }
|
||||
static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), nullptr); }
|
||||
static unsigned getHashValue(const KeyTy &Key) {
|
||||
return static_cast<unsigned>(hash_value(Key));
|
||||
}
|
||||
static bool isEqual(const APInt &LHS, const APInt &RHS) {
|
||||
return LHS.getBitWidth() == RHS.getBitWidth() && LHS == RHS;
|
||||
static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
struct DenseMapAPFloatKeyInfo {
|
||||
static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus, 1); }
|
||||
static inline APFloat getTombstoneKey() { return APFloat(APFloat::Bogus, 2); }
|
||||
static unsigned getHashValue(const APFloat &Key) {
|
||||
struct KeyTy {
|
||||
APFloat val;
|
||||
KeyTy(const APFloat& V) : val(V){}
|
||||
bool operator==(const KeyTy& that) const {
|
||||
return this->val.bitwiseIsEqual(that.val);
|
||||
}
|
||||
bool operator!=(const KeyTy& that) const {
|
||||
return !this->operator==(that);
|
||||
}
|
||||
friend hash_code hash_value(const KeyTy &Key) {
|
||||
return hash_combine(Key.val);
|
||||
}
|
||||
};
|
||||
static inline KeyTy getEmptyKey() {
|
||||
return KeyTy(APFloat(APFloat::Bogus,1));
|
||||
}
|
||||
static inline KeyTy getTombstoneKey() {
|
||||
return KeyTy(APFloat(APFloat::Bogus,2));
|
||||
}
|
||||
static unsigned getHashValue(const KeyTy &Key) {
|
||||
return static_cast<unsigned>(hash_value(Key));
|
||||
}
|
||||
static bool isEqual(const APFloat &LHS, const APFloat &RHS) {
|
||||
return LHS.bitwiseIsEqual(RHS);
|
||||
static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -248,10 +277,12 @@ public:
|
||||
LLVMContext::YieldCallbackTy YieldCallback;
|
||||
void *YieldOpaqueHandle;
|
||||
|
||||
typedef DenseMap<APInt, ConstantInt *, DenseMapAPIntKeyInfo> IntMapTy;
|
||||
typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt *,
|
||||
DenseMapAPIntKeyInfo> IntMapTy;
|
||||
IntMapTy IntConstants;
|
||||
|
||||
typedef DenseMap<APFloat, ConstantFP *, DenseMapAPFloatKeyInfo> FPMapTy;
|
||||
|
||||
typedef DenseMap<DenseMapAPFloatKeyInfo::KeyTy, ConstantFP*,
|
||||
DenseMapAPFloatKeyInfo> FPMapTy;
|
||||
FPMapTy FPConstants;
|
||||
|
||||
FoldingSet<AttributeImpl> AttrsSet;
|
||||
|
Reference in New Issue
Block a user