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

Unified Diff: src/IceTranslator.cpp

Issue 874353006: Write out global initializers and data rel directly to ELF file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: misc stuff 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
Index: src/IceTranslator.cpp
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp
index c0331a8718df28fe05546d2812995340e76db6ca..351b13ca9e5fc02eb37a121543e687aeb75da81f 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -103,21 +103,35 @@ void Translator::emitConstants() {
}
void Translator::lowerGlobals(
- const VariableDeclarationListType &VariableDeclarations) {
+ const VariableDeclarationList &VariableDeclarations) {
+ TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx);
std::unique_ptr<TargetGlobalInitLowering> GlobalLowering(
TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
bool DisableTranslation = Ctx->getFlags().DisableTranslation;
const bool DumpGlobalVariables =
ALLOW_DUMP && Ctx->isVerbose() && Ctx->getFlags().VerboseFocusOn.empty();
- OstreamLocker L(Ctx);
- Ostream &Stream = Ctx->getStrDump();
- const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly;
- for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
- if (DumpGlobalVariables)
- Global->dump(getContext(), Stream);
- if (!DisableTranslation &&
- matchSymbolName(Global->getName(), TranslateOnly))
- GlobalLowering->lower(*Global);
+ if (Ctx->getFlags().UseELFWriter) {
+ // Dump all globals if requested, but don't interleave w/ emission.
+ if (DumpGlobalVariables) {
+ OstreamLocker L(Ctx);
+ Ostream &Stream = Ctx->getStrDump();
+ for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
+ Global->dump(getContext(), Stream);
+ }
+ }
+ GlobalLowering->lowerGlobalsELF(VariableDeclarations);
+ } else {
+ const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly;
+ OstreamLocker L(Ctx);
+ Ostream &Stream = Ctx->getStrDump();
+ for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
+ // Interleave dump output w/ emit output.
+ if (DumpGlobalVariables)
+ Global->dump(getContext(), Stream);
+ if (!DisableTranslation &&
+ matchSymbolName(Global->getName(), TranslateOnly))
+ GlobalLowering->lower(*Global);
+ }
}
GlobalLowering.reset();
}

Powered by Google App Engine
This is Rietveld 408576698