diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2016-07-11 22:59:09 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2016-07-11 22:59:09 +0000 |
commit | de1be7171a7fe2471761487eeac795035f885aea (patch) | |
tree | ce7cfc44c4187acfa1ad10a5f1ce9267b0df36c8 /llvm/lib/Analysis/StratifiedSets.h | |
parent | 93205af066341a53733046894bd75c72c99566db (diff) | |
download | bcm5719-llvm-de1be7171a7fe2471761487eeac795035f885aea.tar.gz bcm5719-llvm-de1be7171a7fe2471761487eeac795035f885aea.zip |
[CFLAA] Simplify CFLGraphBuilder. NFC.
This patch simplifies the graph builder by encoding nodes as {Value,
Dereference Level} pairs. This lets us kill edge types, and allows us to
get rid of hacks in StratifiedSets (like addAttrsBelow/...). This
simplification also allows us to remove InstantiatedRelations and
InstantiatedAttrs.
Patch by Jia Chen.
Differential Revision: http://reviews.llvm.org/D22080
llvm-svn: 275122
Diffstat (limited to 'llvm/lib/Analysis/StratifiedSets.h')
-rw-r--r-- | llvm/lib/Analysis/StratifiedSets.h | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/llvm/lib/Analysis/StratifiedSets.h b/llvm/lib/Analysis/StratifiedSets.h index d6873141fe4..fd3a241d79c 100644 --- a/llvm/lib/Analysis/StratifiedSets.h +++ b/llvm/lib/Analysis/StratifiedSets.h @@ -386,46 +386,12 @@ public: return addAtMerging(ToAdd, Below); } - /// \brief Set the AliasAttrs of the set "Level"-levels below "Main". If - /// there is no set below "Main", create one for it. - void addAttributesBelow(const T &Main, unsigned Level, AliasAttrs Attr) { - assert(has(Main)); - auto Index = *indexOf(Main); - auto *Link = &linksAt(Index); - - for (unsigned I = 0; I < Level; ++I) { - Index = Link->hasBelow() ? Link->getBelow() : addLinkBelow(Index); - Link = &linksAt(Index); - } - Link->setAttrs(Attr); - } - bool addWith(const T &Main, const T &ToAdd) { assert(has(Main)); auto MainIndex = *indexOf(Main); return addAtMerging(ToAdd, MainIndex); } - /// \brief Merge the set "MainBelow"-levels below "Main" and the set - /// "ToAddBelow"-levels below "ToAdd". - void addBelowWith(const T &Main, unsigned MainBelow, const T &ToAdd, - unsigned ToAddBelow) { - assert(has(Main)); - assert(has(ToAdd)); - - auto GetIndexBelow = [&](StratifiedIndex Index, unsigned NumLevel) { - for (unsigned I = 0; I < NumLevel; ++I) { - auto Link = linksAt(Index); - Index = Link.hasBelow() ? Link.getBelow() : addLinkBelow(Index); - } - return Index; - }; - auto MainIndex = GetIndexBelow(*indexOf(Main), MainBelow); - auto ToAddIndex = GetIndexBelow(*indexOf(ToAdd), ToAddBelow); - if (&linksAt(MainIndex) != &linksAt(ToAddIndex)) - merge(MainIndex, ToAddIndex); - } - void noteAttributes(const T &Main, AliasAttrs NewAttrs) { assert(has(Main)); auto *Info = *get(Main); @@ -545,6 +511,7 @@ private: NewBelow.setAbove(LinksInto->Number); } + LinksInto->setAttrs(LinksFrom->getAttrs()); LinksFrom->remapTo(LinksInto->Number); } |