Index: src/IceTranslator.cpp |
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp |
index 4198442da454522c5c02a6f898d7dea327533004..c05f58dc1151a4fec5010c1fc452d999061c53a6 100644 |
--- a/src/IceTranslator.cpp |
+++ b/src/IceTranslator.cpp |
@@ -23,8 +23,7 @@ using namespace Ice; |
Translator::Translator(GlobalContext *Ctx, const ClFlags &Flags) |
: Ctx(Ctx), Flags(Flags), |
- GlobalLowering(TargetGlobalLowering::createLowering(Ctx)), ErrorStatus() { |
-} |
+ DataLowering(TargetDataLowering::createLowering(Ctx)), ErrorStatus() {} |
Translator::~Translator() {} |
@@ -63,7 +62,7 @@ void Translator::translateFcn(Cfg *Func) { |
void Translator::emitConstants() { |
if (!getErrorStatus()) |
- GlobalLowering->lowerConstants(Ctx); |
+ DataLowering->lowerConstants(Ctx); |
} |
void Translator::transferErrorCode() const { |
@@ -71,19 +70,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); |
+ } |
+ } |
+ DataLowering->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 && |
+ GlobalContext::matchSymbolName(Global->getName(), TranslateOnly)) |
+ DataLowering->lowerGlobal(*Global); |
+ } |
} |
} |