summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorHideto Ueno <uenoku.tokotoko@gmail.com>2019-10-08 15:20:19 +0000
committerHideto Ueno <uenoku.tokotoko@gmail.com>2019-10-08 15:20:19 +0000
commit08daf8cf0a554990caa8a559053c12e41af52dd2 (patch)
tree388aa16c88a0c62a2edf55ce7023c0fc6c6fcb81 /llvm/lib/Transforms
parented5d1c12dc4e59990fbb3d1940d3efa8742e7968 (diff)
downloadbcm5719-llvm-08daf8cf0a554990caa8a559053c12e41af52dd2.tar.gz
bcm5719-llvm-08daf8cf0a554990caa8a559053c12e41af52dd2.zip
[Attributor] Add helper class to compose two structured deduction.
Summary: This patch introduces a generic way to compose two structured deductions. This will be used for composing generic deduction with `MustBeExecutedExplorer` and other existing generic deduction. Reviewers: jdoerfert, sstefan1 Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66645 llvm-svn: 374060
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/Attributor.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 629be921fb4..3a1562252f5 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -560,6 +560,21 @@ static void clampReturnedValueStates(Attributor &A, const AAType &QueryingAA,
S ^= *T;
}
+/// Helper class to compose two generic deduction
+template <typename AAType, typename Base, typename StateType,
+ template <typename...> class F, template <typename...> class G>
+struct AAComposeTwoGenericDeduction
+ : public F<AAType, G<AAType, Base, StateType>, StateType> {
+ AAComposeTwoGenericDeduction(const IRPosition &IRP)
+ : F<AAType, G<AAType, Base, StateType>, StateType>(IRP) {}
+
+ /// See AbstractAttribute::updateImpl(...).
+ ChangeStatus updateImpl(Attributor &A) override {
+ return F<AAType, G<AAType, Base, StateType>, StateType>::updateImpl(A) |
+ G<AAType, Base, StateType>::updateImpl(A);
+ }
+};
+
/// Helper class for generic deduction: return value -> returned position.
template <typename AAType, typename Base,
typename StateType = typename AAType::StateType>
OpenPOWER on IntegriCloud