Index: src/IceTranslator.cpp |
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp |
index c47769d0a4293410755831965e3c8eacb5c40350..c78bbcb02563e0ac890a825827871c1aabe13515 100644 |
--- a/src/IceTranslator.cpp |
+++ b/src/IceTranslator.cpp |
@@ -21,9 +21,9 @@ |
using namespace Ice; |
-Translator::Translator(GlobalContext *Ctx, const ClFlags &Flags) |
- : Ctx(Ctx), Flags(Flags), |
- DataLowering(TargetDataLowering::createLowering(Ctx)), ErrorStatus() {} |
+Translator::Translator(GlobalContext *Ctx) |
+ : Ctx(Ctx), NextSequenceNumber(GlobalContext::getFirstSequenceNumber()), |
+ ErrorStatus() {} |
Translator::~Translator() {} |
@@ -54,15 +54,12 @@ bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, |
} |
void Translator::translateFcn(std::unique_ptr<Cfg> Func) { |
- Ctx->cfgQueueBlockingPush(std::move(Func)); |
- if (Ctx->getFlags().getNumTranslationThreads() == 0) { |
- Ctx->translateFunctions(); |
- } |
+ Ctx->optQueueBlockingPush(std::move(Func)); |
} |
void Translator::emitConstants() { |
if (!getErrorStatus()) |
- DataLowering->lowerConstants(Ctx); |
+ TargetDataLowering::createLowering(Ctx)->lowerConstants(); |
} |
void Translator::transferErrorCode() const { |
@@ -70,33 +67,9 @@ void Translator::transferErrorCode() const { |
Ctx->getErrorStatus()->assign(getErrorStatus().value()); |
} |
-void |
-Translator::lowerGlobals(const VariableDeclarationList &VariableDeclarations) { |
- TimerMarker T(TimerStack::TT_emitGlobalInitializers, Ctx); |
- bool DisableTranslation = Ctx->getFlags().getDisableTranslation(); |
- const bool DumpGlobalVariables = ALLOW_DUMP && Ctx->getVerbose() && |
- Ctx->getFlags().getVerboseFocusOn().empty(); |
- if (Ctx->getFlags().getUseELFWriter()) { |
- // 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().getTranslateOnly(); |
- 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); |
- } |
- } |
+void Translator::lowerGlobals( |
+ std::unique_ptr<VariableDeclarationList> VariableDeclarations) { |
+ EmitterWorkItem *Item = new EmitterWorkItem(getNextSequenceNumber(), |
+ VariableDeclarations.release()); |
+ Ctx->emitQueueBlockingPush(Item); |
} |