Chromium Code Reviews| Index: src/IceGlobalContext.cpp |
| diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp |
| index 4bb9b7d29ddced2e57c43ef227b8beb9ef3f6c7b..99703379e76f14c9026dc1bf14162fab886999cf 100644 |
| --- a/src/IceGlobalContext.cpp |
| +++ b/src/IceGlobalContext.cpp |
| @@ -44,8 +44,15 @@ |
| namespace std { |
| template <> struct hash<Ice::RelocatableTuple> { |
| size_t operator()(const Ice::RelocatableTuple &Key) const { |
| - return hash<Ice::IceString>()(Key.Name) + |
| - hash<Ice::RelocOffsetT>()(Key.Offset); |
| + if (!Key.EmitString.empty()) { |
| + return hash<Ice::IceString>()(Key.EmitString); |
| + } |
| + if (Key.OffsetExpr[0]->hasOffset()) { |
|
Jim Stichnoth
2016/02/02 20:57:49
Please assert(!Key.OffsetExpr.empty())
otherwise i
John
2016/02/03 15:50:41
Done.
|
| + return hash<Ice::IceString>()(Key.Name) + |
| + hash<Ice::RelocOffsetT>()(Key.OffsetExpr[0]->getOffset()); |
| + } |
| + return hash<Ice::IceString>()(Key.Name); |
| + hash<std::size_t>()(Key.OffsetExpr.size()); |
|
Jim Stichnoth
2016/02/02 20:57:49
remove this
John
2016/02/03 15:50:41
I meant to add it to the return value.
|
| } |
| }; |
| } // end of namespace std |
| @@ -785,18 +792,28 @@ Constant *GlobalContext::getConstantDouble(double ConstantDouble) { |
| return getConstPool()->Doubles.getOrAdd(this, ConstantDouble); |
| } |
| -Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, |
| +Constant *GlobalContext::getConstantSym(const RelocOffsetArray &Offset, |
| const IceString &Name, |
| + const IceString &EmitString, |
| bool SuppressMangling) { |
| return getConstPool()->Relocatables.getOrAdd( |
| - this, RelocatableTuple(Offset, Name, SuppressMangling)); |
| + this, RelocatableTuple(Offset, Name, EmitString, SuppressMangling)); |
| +} |
| + |
| +Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, |
| + const IceString &Name, |
| + bool SuppressMangling) { |
| + constexpr char EmptyEmitString[] = ""; |
| + return getConstantSym({RelocOffset::create(this, Offset)}, Name, |
| + EmptyEmitString, SuppressMangling); |
| } |
| Constant *GlobalContext::getConstantExternSym(const IceString &Name) { |
| constexpr RelocOffsetT Offset = 0; |
| constexpr bool SuppressMangling = true; |
| return getConstPool()->ExternRelocatables.getOrAdd( |
| - this, RelocatableTuple(Offset, Name, SuppressMangling)); |
| + this, RelocatableTuple({RelocOffset::create(this, Offset)}, Name, |
| + SuppressMangling)); |
| } |
| Constant *GlobalContext::getConstantUndef(Type Ty) { |