1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Reformat.

llvm-svn: 223580
This commit is contained in:
NAKAMURA Takumi 2014-12-06 05:57:06 +00:00
parent ef2e57c33a
commit 842b214603
2 changed files with 21 additions and 29 deletions

View File

@ -554,7 +554,6 @@ Constant *ConstantInt::getFalse(Type *Ty) {
ConstantInt::getFalse(Ty->getContext()));
}
// Get a ConstantInt from an APInt. Note that the value stored in the DenseMap
// as the key, is a DenseMapAPIntKeyInfo::KeyTy which has provided the
// operator== and operator!= to ensure that the DenseMap doesn't attempt to
@ -566,7 +565,8 @@ ConstantInt *ConstantInt::get(LLVMContext &Context, const APInt &V) {
// get an existing value or the insertion position
LLVMContextImpl *pImpl = Context.pImpl;
ConstantInt *&Slot = pImpl->IntConstants[DenseMapAPIntKeyInfo::KeyTy(V, ITy)];
if (!Slot) Slot = new ConstantInt(ITy, V);
if (!Slot)
Slot = new ConstantInt(ITy, V);
return Slot;
}

View File

@ -48,54 +48,46 @@ class Value;
struct DenseMapAPIntKeyInfo {
struct KeyTy {
APInt val;
Type* type;
KeyTy(const APInt& V, Type* Ty) : val(V), type(Ty) {}
bool operator==(const KeyTy& that) const {
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);
}
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 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 KeyTy &LHS, const KeyTy &RHS) {
return LHS == RHS;
}
static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) { return LHS == RHS; }
};
struct DenseMapAPFloatKeyInfo {
struct KeyTy {
APFloat val;
KeyTy(const APFloat& V) : val(V){}
bool operator==(const KeyTy& that) const {
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);
}
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));
return KeyTy(APFloat(APFloat::Bogus, 1));
}
static inline KeyTy getTombstoneKey() {
return KeyTy(APFloat(APFloat::Bogus,2));
return KeyTy(APFloat(APFloat::Bogus, 2));
}
static unsigned getHashValue(const KeyTy &Key) {
return static_cast<unsigned>(hash_value(Key));
}
static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) {
return LHS == RHS;
}
static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) { return LHS == RHS; }
};
struct AnonStructTypeKeyInfo {
@ -281,8 +273,8 @@ public:
DenseMapAPIntKeyInfo> IntMapTy;
IntMapTy IntConstants;
typedef DenseMap<DenseMapAPFloatKeyInfo::KeyTy, ConstantFP*,
DenseMapAPFloatKeyInfo> FPMapTy;
typedef DenseMap<DenseMapAPFloatKeyInfo::KeyTy, ConstantFP *,
DenseMapAPFloatKeyInfo> FPMapTy;
FPMapTy FPConstants;
FoldingSet<AttributeImpl> AttrsSet;