| Index: src/IceTranslator.cpp
|
| diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp
|
| index 4198442da454522c5c02a6f898d7dea327533004..884d76fc568122abf907d7e95965dad57735fdcf 100644
|
| --- a/src/IceTranslator.cpp
|
| +++ b/src/IceTranslator.cpp
|
| @@ -71,19 +71,33 @@ void Translator::transferErrorCode() const {
|
| Ctx->getErrorStatus()->assign(getErrorStatus().value());
|
| }
|
|
|
| -void Translator::lowerGlobals(
|
| - const VariableDeclarationListType &VariableDeclarations) {
|
| +void
|
| +Translator::lowerGlobals(const VariableDeclarationList &VariableDeclarations) {
|
| + TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx);
|
| bool DisableTranslation = Ctx->getFlags().DisableTranslation;
|
| const bool DumpGlobalVariables =
|
| ALLOW_DUMP && Ctx->getVerbose() && 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 &&
|
| - GlobalContext::matchSymbolName(Global->getName(), TranslateOnly))
|
| - GlobalLowering->lowerInit(*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->lowerInitELF(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 &&
|
| + GlobalContext::matchSymbolName(Global->getName(), TranslateOnly))
|
| + GlobalLowering->lowerInit(*Global);
|
| + }
|
| }
|
| }
|
|
|