summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGLoopInfo.h
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-06-14 12:04:26 +0000
committerAdam Nemet <anemet@apple.com>2016-06-14 12:04:26 +0000
commit2de463ece38ae71bd5d6487db8f84d8e17c3059b (patch)
tree93c5962300ff9b9c1523a302fc810f10356feebb /clang/lib/CodeGen/CGLoopInfo.h
parent4fbf76f7c34b1c7242340d79a0c256b0e5293346 (diff)
downloadbcm5719-llvm-2de463ece38ae71bd5d6487db8f84d8e17c3059b.tar.gz
bcm5719-llvm-2de463ece38ae71bd5d6487db8f84d8e17c3059b.zip
Add loop pragma for Loop Distribution
Summary: This is similar to other loop pragmas like 'vectorize'. Currently it only has state values: distribute(enable) and distribute(disable). When one of these is specified the corresponding loop metadata is generated: !{!"llvm.loop.distribute.enable", i1 true/false} As a result, loop distribution will be attempted on the loop even if Loop Distribution in not enabled globally. Analogously, with 'disable' distribution can be turned off for an individual loop even when the pass is otherwise enabled. There are some slight differences compared to the existing loop pragmas. 1. There is no 'assume_safety' variant which makes its handling slightly different from 'vectorize'/'interleave'. 2. Unlike the existing loop pragmas, it does not have a corresponding numeric pragma like 'vectorize' -> 'vectorize_width'. So for the consistency checks in CheckForIncompatibleAttributes we don't need to check it against other pragmas. We just need to check for duplicates of the same pragma. Reviewers: rsmith, dexonsmith, aaron.ballman Subscribers: bob.wilson, cfe-commits, hfinkel Differential Revision: http://reviews.llvm.org/D19403 llvm-svn: 272656
Diffstat (limited to 'clang/lib/CodeGen/CGLoopInfo.h')
-rw-r--r--clang/lib/CodeGen/CGLoopInfo.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGLoopInfo.h b/clang/lib/CodeGen/CGLoopInfo.h
index 7b9980c6183..a0111edde5d 100644
--- a/clang/lib/CodeGen/CGLoopInfo.h
+++ b/clang/lib/CodeGen/CGLoopInfo.h
@@ -58,6 +58,9 @@ struct LoopAttributes {
/// \brief llvm.unroll.
unsigned UnrollCount;
+
+ /// \brief Value for llvm.loop.distribute.enable metadata.
+ LVEnableState DistributeEnable;
};
/// \brief Information used when generating a structured loop.
@@ -130,6 +133,12 @@ public:
Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
}
+ /// \brief Set the next pushed loop as a distribution candidate.
+ void setDistributeState(bool Enable = true) {
+ StagedAttrs.DistributeEnable =
+ Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
+ }
+
/// \brief Set the next pushed loop unroll state.
void setUnrollState(const LoopAttributes::LVEnableState &State) {
StagedAttrs.UnrollEnable = State;
OpenPOWER on IntegriCloud