| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 Ctx->setVerbose(OldVerboseMask); | 97 Ctx->setVerbose(OldVerboseMask); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void Translator::emitConstants() { | 100 void Translator::emitConstants() { |
| 101 if (!Ctx->getFlags().DisableTranslation && Func) | 101 if (!Ctx->getFlags().DisableTranslation && Func) |
| 102 Func->getTarget()->emitConstants(); | 102 Func->getTarget()->emitConstants(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void Translator::lowerGlobals( | 105 void Translator::lowerGlobals( |
| 106 const VariableDeclarationListType &VariableDeclarations) { | 106 const VariableDeclarationList &VariableDeclarations) { |
| 107 TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx); |
| 107 std::unique_ptr<TargetGlobalInitLowering> GlobalLowering( | 108 std::unique_ptr<TargetGlobalInitLowering> GlobalLowering( |
| 108 TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); | 109 TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); |
| 109 bool DisableTranslation = Ctx->getFlags().DisableTranslation; | 110 bool DisableTranslation = Ctx->getFlags().DisableTranslation; |
| 110 const bool DumpGlobalVariables = | 111 const bool DumpGlobalVariables = |
| 111 ALLOW_DUMP && Ctx->isVerbose() && Ctx->getFlags().VerboseFocusOn.empty(); | 112 ALLOW_DUMP && Ctx->isVerbose() && Ctx->getFlags().VerboseFocusOn.empty(); |
| 112 OstreamLocker L(Ctx); | 113 if (Ctx->getFlags().UseELFWriter) { |
| 113 Ostream &Stream = Ctx->getStrDump(); | 114 // Dump all globals if requested, but don't interleave w/ emission. |
| 114 const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly; | 115 if (DumpGlobalVariables) { |
| 115 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { | 116 OstreamLocker L(Ctx); |
| 116 if (DumpGlobalVariables) | 117 Ostream &Stream = Ctx->getStrDump(); |
| 117 Global->dump(getContext(), Stream); | 118 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { |
| 118 if (!DisableTranslation && | 119 Global->dump(getContext(), Stream); |
| 119 matchSymbolName(Global->getName(), TranslateOnly)) | 120 } |
| 120 GlobalLowering->lower(*Global); | 121 } |
| 122 GlobalLowering->lowerGlobalsELF(VariableDeclarations); |
| 123 } else { |
| 124 const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly; |
| 125 OstreamLocker L(Ctx); |
| 126 Ostream &Stream = Ctx->getStrDump(); |
| 127 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { |
| 128 // Interleave dump output w/ emit output. |
| 129 if (DumpGlobalVariables) |
| 130 Global->dump(getContext(), Stream); |
| 131 if (!DisableTranslation && |
| 132 matchSymbolName(Global->getName(), TranslateOnly)) |
| 133 GlobalLowering->lower(*Global); |
| 134 } |
| 121 } | 135 } |
| 122 GlobalLowering.reset(); | 136 GlobalLowering.reset(); |
| 123 } | 137 } |
| OLD | NEW |