Chromium Code Reviews| Index: src/IceGlobalContext.cpp |
| diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp |
| index 349db7cc4ff4bb7db75c5233ce3d3ec1f318a91b..7a77575e6b2fec28d61998476e65113f7bd61581 100644 |
| --- a/src/IceGlobalContext.cpp |
| +++ b/src/IceGlobalContext.cpp |
| @@ -23,6 +23,7 @@ |
| #include "IceGlobalInits.h" |
| #include "IceLiveness.h" |
| #include "IceOperand.h" |
| +#include "IceRevision.h" |
| #include "IceTargetLowering.h" |
| #include "IceTimerTree.h" |
| #include "IceTypes.def" |
| @@ -466,6 +467,27 @@ void GlobalContext::saveBlockInfoPtrs() { |
| } |
| } |
| +void GlobalContext::lowerGlobalsIfNoCodeHasBeenSeen() { |
| + if (HasSeenCode) |
| + return; |
| + |
| + if (getFlags().getEmitRevision()) { |
|
John
2016/08/08 11:47:28
This method is supposed to emit globals, but it al
Jim Stichnoth
2016/08/08 14:46:18
A side effect of lowering globals is that Globals
John
2016/08/08 14:55:36
Or maybe just add the global in the GlobalContext'
Jim Stichnoth
2016/08/08 17:48:09
Brilliant! Done.
|
| + // Embed the Subzero revision into the compiled binary by creating a special |
| + // global variable initialized with the revision string. |
| + auto *Revision = VariableDeclaration::create(&Globals, true); |
| + Revision->setName(this, "__Sz_revision"); |
| + Revision->setIsConstant(true); |
| + const char *RevisionString = getSubzeroRevision(); |
| + Revision->addInitializer(VariableDeclaration::DataInitializer::create( |
| + &Globals, RevisionString, 1 + strlen(RevisionString))); |
| + Globals.push_back(Revision); |
| + } |
| + |
| + constexpr char NoSuffix[] = ""; |
| + lowerGlobals(NoSuffix); |
| + HasSeenCode = true; |
| +} |
| + |
| void GlobalContext::lowerGlobals(const std::string &SectionSuffix) { |
| TimerMarker T(TimerStack::TT_emitGlobalInitializers, this); |
| const bool DumpGlobalVariables = |