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

Unified Diff: src/PNaClTranslator.cpp

Issue 899483002: Subzero: Track protos + globals w/out initializers as undef too (not just helper funcs) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase Created 5 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/IceELFObjectWriter.cpp ('k') | tests_lit/llvm2ice_tests/elf_container.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 249875fe42a6f6c4b692a2075c990b3cb203cadc..4d8357879281c78eae49809c717a3ebcdf94450c 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -284,10 +284,15 @@ public:
// TODO(kschimpf) Don't get addresses of intrinsic function declarations.
Ice::GlobalDeclaration *Decl = nullptr;
unsigned FcnIDSize = FunctionDeclarationList.size();
+ bool IsUndefined = false;
if (ID < FcnIDSize) {
Decl = FunctionDeclarationList[ID];
+ const auto Func = llvm::cast<Ice::FunctionDeclaration>(Decl);
+ IsUndefined = Func->isProto();
} else if ((ID - FcnIDSize) < VariableDeclarations.size()) {
Decl = VariableDeclarations[ID - FcnIDSize];
+ const auto Var = llvm::cast<Ice::VariableDeclaration>(Decl);
+ IsUndefined = !Var->hasInitializer();
}
std::string Name;
bool SuppressMangling;
@@ -303,9 +308,13 @@ public:
Name = "??";
SuppressMangling = false;
}
- const Ice::RelocOffsetT Offset = 0;
- C = getTranslator().getContext()->getConstantSym(Offset, Name,
- SuppressMangling);
+ if (IsUndefined)
+ C = getTranslator().getContext()->getConstantExternSym(Name);
+ else {
+ const Ice::RelocOffsetT Offset = 0;
+ C = getTranslator().getContext()->getConstantSym(Offset, Name,
+ SuppressMangling);
+ }
ValueIDConstants[ID] = C;
return C;
}
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | tests_lit/llvm2ice_tests/elf_container.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698