OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |