Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: src/IceGlobalContext.cpp

Issue 1651163002: Subzero. Enables moar complex relocation offsets. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: make format Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceInstX86Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 4bb9b7d29ddced2e57c43ef227b8beb9ef3f6c7b..df5206a6d5499d65d4b12814f970d4d9babb676c 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -44,8 +44,18 @@
namespace std {
template <> struct hash<Ice::RelocatableTuple> {
size_t operator()(const Ice::RelocatableTuple &Key) const {
+ if (!Key.EmitString.empty()) {
+ return hash<Ice::IceString>()(Key.EmitString);
+ }
+
+ assert(!Key.OffsetExpr.empty());
+ if (Key.OffsetExpr[0]->hasOffset()) {
+ return hash<Ice::IceString>()(Key.Name) +
+ hash<Ice::RelocOffsetT>()(Key.OffsetExpr[0]->getOffset());
+ }
+
return hash<Ice::IceString>()(Key.Name) +
- hash<Ice::RelocOffsetT>()(Key.Offset);
+ hash<std::size_t>()(Key.OffsetExpr.size());
}
};
} // end of namespace std
@@ -785,18 +795,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) {
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceInstX86Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698