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

Side by Side 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: review #1 Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===// 1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines the general driver class for translating ICE to 10 // This file defines the general driver class for translating ICE to
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 void Translator::emitConstants() { 64 void Translator::emitConstants() {
65 if (!getErrorStatus()) 65 if (!getErrorStatus())
66 GlobalLowering->lowerConstants(Ctx); 66 GlobalLowering->lowerConstants(Ctx);
67 } 67 }
68 68
69 void Translator::transferErrorCode() const { 69 void Translator::transferErrorCode() const {
70 if (getErrorStatus()) 70 if (getErrorStatus())
71 Ctx->getErrorStatus()->assign(getErrorStatus().value()); 71 Ctx->getErrorStatus()->assign(getErrorStatus().value());
72 } 72 }
73 73
74 void Translator::lowerGlobals( 74 void
75 const VariableDeclarationListType &VariableDeclarations) { 75 Translator::lowerGlobals(const VariableDeclarationList &VariableDeclarations) {
76 TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx);
76 bool DisableTranslation = Ctx->getFlags().DisableTranslation; 77 bool DisableTranslation = Ctx->getFlags().DisableTranslation;
77 const bool DumpGlobalVariables = 78 const bool DumpGlobalVariables =
78 ALLOW_DUMP && Ctx->getVerbose() && Ctx->getFlags().VerboseFocusOn.empty(); 79 ALLOW_DUMP && Ctx->getVerbose() && Ctx->getFlags().VerboseFocusOn.empty();
79 OstreamLocker L(Ctx); 80 if (Ctx->getFlags().UseELFWriter) {
80 Ostream &Stream = Ctx->getStrDump(); 81 // Dump all globals if requested, but don't interleave w/ emission.
81 const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly; 82 if (DumpGlobalVariables) {
82 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { 83 OstreamLocker L(Ctx);
83 if (DumpGlobalVariables) 84 Ostream &Stream = Ctx->getStrDump();
84 Global->dump(getContext(), Stream); 85 for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
85 if (!DisableTranslation && 86 Global->dump(getContext(), Stream);
86 GlobalContext::matchSymbolName(Global->getName(), TranslateOnly)) 87 }
87 GlobalLowering->lowerInit(*Global); 88 }
89 GlobalLowering->lowerInitELF(VariableDeclarations);
90 } else {
91 const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly;
92 OstreamLocker L(Ctx);
93 Ostream &Stream = Ctx->getStrDump();
94 for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
95 // Interleave dump output w/ emit output.
96 if (DumpGlobalVariables)
97 Global->dump(getContext(), Stream);
98 if (!DisableTranslation &&
99 GlobalContext::matchSymbolName(Global->getName(), TranslateOnly))
100 GlobalLowering->lowerInit(*Global);
101 }
88 } 102 }
89 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698