diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-07-03 11:02:54 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-07-03 11:02:54 -0700 |
commit | c68c47198c0e0a610e49eaf072429b9214fca04f (patch) | |
tree | cfa16f856e7debe229f1d18da1e874057743d36d /lib/Bitcode/NaCl/Writer | |
parent | c5f0da9f2a5ffb5d9e8803839655f2f3d6972d83 (diff) |
Don't generate Type ID's for global variable fields.
Also removed local MaxGlobalType in WriteModuleInfo because it calls VE.getTypeID(GV->getTYpe(), which is no longer defined for globals.
Also noted that MaxAlignment in WriteModuleInfo was no longer used and removed it.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3541
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/18185005
Diffstat (limited to 'lib/Bitcode/NaCl/Writer')
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp | 6 | ||||
-rw-r--r-- | lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp index 44aaeb3f0e..33d0d84cb5 100644 --- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp @@ -546,14 +546,11 @@ static void WriteModuleInfo(const Module *M, const NaClValueEnumerator &VE, // Emit information about sections and GC, computing how many there are. Also // compute the maximum alignment value. + // TODO(kschimpf): Remove code for SectionMap and GCMap. std::map<std::string, unsigned> SectionMap; std::map<std::string, unsigned> GCMap; - unsigned MaxAlignment = 0; - unsigned MaxGlobalType = 0; for (Module::const_global_iterator GV = M->global_begin(),E = M->global_end(); GV != E; ++GV) { - MaxAlignment = std::max(MaxAlignment, GV->getAlignment()); - MaxGlobalType = std::max(MaxGlobalType, VE.getTypeID(GV->getType())); if (GV->hasSection()) { // Give section names unique ID's. unsigned &Entry = SectionMap[GV->getSection()]; @@ -565,7 +562,6 @@ static void WriteModuleInfo(const Module *M, const NaClValueEnumerator &VE, } } for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) { - MaxAlignment = std::max(MaxAlignment, F->getAlignment()); if (F->hasSection()) { // Give section names unique ID's. unsigned &Entry = SectionMap[F->getSection()]; diff --git a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp index 393c5bc934..5e2484a3f3 100644 --- a/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp +++ b/lib/Bitcode/NaCl/Writer/NaClValueEnumerator.cpp @@ -243,8 +243,10 @@ void NaClValueEnumerator::EnumerateValue(const Value *V) { return; } - // Enumerate the type of this value. - EnumerateType(V->getType()); + // Enumerate the type of this value. Skip global values since no + // types are dumped for global variables. + if (!isa<GlobalVariable>(V)) + EnumerateType(V->getType()); if (const Constant *C = dyn_cast<Constant>(V)) { if (isa<GlobalValue>(C)) { |