summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Writer
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2015-12-19 08:52:49 +0000
committerVedant Kumar <vsk@apple.com>2015-12-19 08:52:49 +0000
commit3a63fb316c74b07bb4e59a8cb6275bdd70283090 (patch)
tree79efccf5875076a812ef400420a60cca2f757aeb /llvm/lib/Bitcode/Writer
parent44dd9871e867a3164c5322b2ee4dff9cb03e0a41 (diff)
downloadbcm5719-llvm-3a63fb316c74b07bb4e59a8cb6275bdd70283090.tar.gz
bcm5719-llvm-3a63fb316c74b07bb4e59a8cb6275bdd70283090.zip
Re-reapply "[IR] Move optional data in llvm::Function into a hungoff uselist"
Make personality functions, prefix data, and prologue data hungoff operands of Function. This is based on the email thread "[RFC] Clean up the way we store optional Function data" on llvm-dev. Thanks to sanjoyd, majnemer, rnk, loladiro, and dexonsmith for feedback! Includes a fix to scrub value subclass data in dropAllReferences. Does not use binary literals. Differential Revision: http://reviews.llvm.org/D13829 llvm-svn: 256095
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
-rw-r--r--llvm/lib/Bitcode/Writer/ValueEnumerator.cpp36
1 files changed, 8 insertions, 28 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 2a9b4490ffb..faf82a7926e 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -87,15 +87,9 @@ static OrderMap orderModule(const Module &M) {
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 @@ static UseListOrderStack predictUseListOrder(const Module &M) {
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 @@ ValueEnumerator::ValueEnumerator(const Module &M,
for (const GlobalAlias &GA : M.aliases())
EnumerateValue(GA.getAliasee());
- // Enumerate the prefix data constants.
+ // Enumerate any optional Function data.
for (const Function &F : M)
- if (F.hasPrefixData())
- EnumerateValue(F.getPrefixData());
-
- // Enumerate the prologue data constants.
- 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.
//
OpenPOWER on IntegriCloud