| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 Ostream &Stream = Ctx->getStrDump(); | 48 Ostream &Stream = Ctx->getStrDump(); |
| 49 Stream << "Warning : Default " << Kind << " prefix '" << Prefix | 49 Stream << "Warning : Default " << Kind << " prefix '" << Prefix |
| 50 << "' potentially conflicts with name '" << Name << "'.\n"; | 50 << "' potentially conflicts with name '" << Name << "'.\n"; |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { | 56 void Translator::translateFcn(std::unique_ptr<Cfg> Func) { |
| 57 Ctx->cfgQueueBlockingPush(std::move(Func)); | 57 Ctx->cfgQueueBlockingPush(std::move(Func)); |
| 58 if (Ctx->getFlags().NumTranslationThreads == 0) { | 58 if (Ctx->getFlags().getNumTranslationThreads() == 0) { |
| 59 Ctx->translateFunctions(); | 59 Ctx->translateFunctions(); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 void Translator::emitConstants() { | 63 void Translator::emitConstants() { |
| 64 if (!getErrorStatus()) | 64 if (!getErrorStatus()) |
| 65 DataLowering->lowerConstants(Ctx); | 65 DataLowering->lowerConstants(Ctx); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void Translator::transferErrorCode() const { | 68 void Translator::transferErrorCode() const { |
| 69 if (getErrorStatus()) | 69 if (getErrorStatus()) |
| 70 Ctx->getErrorStatus()->assign(getErrorStatus().value()); | 70 Ctx->getErrorStatus()->assign(getErrorStatus().value()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void | 73 void |
| 74 Translator::lowerGlobals(const VariableDeclarationList &VariableDeclarations) { | 74 Translator::lowerGlobals(const VariableDeclarationList &VariableDeclarations) { |
| 75 TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx); | 75 TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx); |
| 76 bool DisableTranslation = Ctx->getFlags().DisableTranslation; | 76 bool DisableTranslation = Ctx->getFlags().getDisableTranslation(); |
| 77 const bool DumpGlobalVariables = | 77 const bool DumpGlobalVariables = ALLOW_DUMP && Ctx->getVerbose() && |
| 78 ALLOW_DUMP && Ctx->getVerbose() && Ctx->getFlags().VerboseFocusOn.empty(); | 78 Ctx->getFlags().getVerboseFocusOn().empty(); |
| 79 if (Ctx->getFlags().UseELFWriter) { | 79 if (Ctx->getFlags().getUseELFWriter()) { |
| 80 // Dump all globals if requested, but don't interleave w/ emission. | 80 // Dump all globals if requested, but don't interleave w/ emission. |
| 81 if (DumpGlobalVariables) { | 81 if (DumpGlobalVariables) { |
| 82 OstreamLocker L(Ctx); | 82 OstreamLocker L(Ctx); |
| 83 Ostream &Stream = Ctx->getStrDump(); | 83 Ostream &Stream = Ctx->getStrDump(); |
| 84 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { | 84 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { |
| 85 Global->dump(getContext(), Stream); | 85 Global->dump(getContext(), Stream); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 DataLowering->lowerGlobalsELF(VariableDeclarations); | 88 DataLowering->lowerGlobalsELF(VariableDeclarations); |
| 89 } else { | 89 } else { |
| 90 const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly; | 90 const IceString &TranslateOnly = Ctx->getFlags().getTranslateOnly(); |
| 91 OstreamLocker L(Ctx); | 91 OstreamLocker L(Ctx); |
| 92 Ostream &Stream = Ctx->getStrDump(); | 92 Ostream &Stream = Ctx->getStrDump(); |
| 93 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { | 93 for (const Ice::VariableDeclaration *Global : VariableDeclarations) { |
| 94 // Interleave dump output w/ emit output. | 94 // Interleave dump output w/ emit output. |
| 95 if (DumpGlobalVariables) | 95 if (DumpGlobalVariables) |
| 96 Global->dump(getContext(), Stream); | 96 Global->dump(getContext(), Stream); |
| 97 if (!DisableTranslation && | 97 if (!DisableTranslation && |
| 98 GlobalContext::matchSymbolName(Global->getName(), TranslateOnly)) | 98 GlobalContext::matchSymbolName(Global->getName(), TranslateOnly)) |
| 99 DataLowering->lowerGlobal(*Global); | 99 DataLowering->lowerGlobal(*Global); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 } | 102 } |
| OLD | NEW |