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

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: tweak comment 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 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);
+ }
}
}
« src/IceELFObjectWriter.cpp ('K') | « src/IceTranslator.h ('k') | src/IceUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698