Mercurial > hg > CbC > CbC_llvm
diff lib/Bitcode/Writer/ValueEnumerator.cpp @ 100:7d135dc70f03 LLVM 3.9
LLVM 3.9
author | Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 22:53:40 +0900 |
parents | afa8332a0e37 |
children | 1172e4bd9c6f |
line wrap: on
line diff
--- a/lib/Bitcode/Writer/ValueEnumerator.cpp Tue Oct 13 17:49:56 2015 +0900 +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp Tue Jan 26 22:53:40 2016 +0900 @@ -87,15 +87,9 @@ if (!isa<GlobalValue>(A.getAliasee())) orderValue(A.getAliasee(), OM); for (const Function &F : M) { - if (F.hasPrefixData()) - if (!isa<GlobalValue>(F.getPrefixData())) - orderValue(F.getPrefixData(), OM); - if (F.hasPrologueData()) - if (!isa<GlobalValue>(F.getPrologueData())) - orderValue(F.getPrologueData(), OM); - if (F.hasPersonalityFn()) - if (!isa<GlobalValue>(F.getPersonalityFn())) - orderValue(F.getPersonalityFn(), OM); + for (const Use &U : F.operands()) + if (!isa<GlobalValue>(U.get())) + orderValue(U.get(), OM); } OM.LastGlobalConstantID = OM.size(); @@ -273,12 +267,8 @@ for (const GlobalAlias &A : M.aliases()) predictValueUseListOrder(A.getAliasee(), nullptr, OM, Stack); for (const Function &F : M) { - if (F.hasPrefixData()) - predictValueUseListOrder(F.getPrefixData(), nullptr, OM, Stack); - if (F.hasPrologueData()) - predictValueUseListOrder(F.getPrologueData(), nullptr, OM, Stack); - if (F.hasPersonalityFn()) - predictValueUseListOrder(F.getPersonalityFn(), nullptr, OM, Stack); + for (const Use &U : F.operands()) + predictValueUseListOrder(U.get(), nullptr, OM, Stack); } return Stack; @@ -321,20 +311,10 @@ for (const GlobalAlias &GA : M.aliases()) EnumerateValue(GA.getAliasee()); - // Enumerate the prefix data constants. - for (const Function &F : M) - if (F.hasPrefixData()) - EnumerateValue(F.getPrefixData()); - - // Enumerate the prologue data constants. + // Enumerate any optional Function data. for (const Function &F : M) - if (F.hasPrologueData()) - EnumerateValue(F.getPrologueData()); - - // Enumerate the personality functions. - for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->hasPersonalityFn()) - EnumerateValue(I->getPersonalityFn()); + for (const Use &U : F.operands()) + EnumerateValue(U.get()); // Enumerate the metadata type. // @@ -425,7 +405,7 @@ void ValueEnumerator::dump() const { print(dbgs(), ValueMap, "Default"); dbgs() << '\n'; - print(dbgs(), MDValueMap, "MetaData"); + print(dbgs(), MetadataMap, "MetaData"); dbgs() << '\n'; } @@ -542,7 +522,7 @@ // EnumerateMDNodeOperands() from re-visiting MD in a cyclic graph. // // Return early if there's already an ID. - if (!MDValueMap.insert(std::make_pair(MD, 0)).second) + if (!MetadataMap.insert(std::make_pair(MD, 0)).second) return; // Visit operands first to minimize RAUW. @@ -555,10 +535,10 @@ HasDILocation |= isa<DILocation>(MD); HasGenericDINode |= isa<GenericDINode>(MD); - // Replace the dummy ID inserted above with the correct one. MDValueMap may + // Replace the dummy ID inserted above with the correct one. MetadataMap may // have changed by inserting operands, so we need a fresh lookup here. MDs.push_back(MD); - MDValueMap[MD] = MDs.size(); + MetadataMap[MD] = MDs.size(); } /// EnumerateFunctionLocalMetadataa - Incorporate function-local metadata @@ -566,12 +546,12 @@ void ValueEnumerator::EnumerateFunctionLocalMetadata( const LocalAsMetadata *Local) { // Check to see if it's already in! - unsigned &MDValueID = MDValueMap[Local]; - if (MDValueID) + unsigned &MetadataID = MetadataMap[Local]; + if (MetadataID) return; MDs.push_back(Local); - MDValueID = MDs.size(); + MetadataID = MDs.size(); EnumerateValue(Local->getValue()); @@ -778,7 +758,7 @@ for (unsigned i = NumModuleValues, e = Values.size(); i != e; ++i) ValueMap.erase(Values[i].first); for (unsigned i = NumModuleMDs, e = MDs.size(); i != e; ++i) - MDValueMap.erase(MDs[i]); + MetadataMap.erase(MDs[i]); for (unsigned i = 0, e = BasicBlocks.size(); i != e; ++i) ValueMap.erase(BasicBlocks[i]);