Skip to content

Commit 720fe24

Browse files
committed
Add some comments
1 parent 16514cd commit 720fe24

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/include/llvm/IR/PatternMatch.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,8 @@ template <typename Class> struct bind_ty {
822822
}
823823
};
824824

825+
/// Check whether the value has the given Class and matches the nested
826+
/// pattern. Capture it into the provided variable if successful.
825827
template <typename Class, typename MatchTy> struct bind_and_match_ty {
826828
Class *&VR;
827829
MatchTy Match;
@@ -842,12 +844,14 @@ template <typename Class, typename MatchTy> struct bind_and_match_ty {
842844
inline bind_ty<Value> m_Value(Value *&V) { return V; }
843845
inline bind_ty<const Value> m_Value(const Value *&V) { return V; }
844846

847+
/// Match against the nested pattern, and capture the value if we match.
845848
template <typename MatchTy>
846849
inline bind_and_match_ty<Value, MatchTy> m_Value(Value *&V,
847850
const MatchTy &Match) {
848851
return {V, Match};
849852
}
850853

854+
/// Match against the nested pattern, and capture the value if we match.
851855
template <typename MatchTy>
852856
inline bind_and_match_ty<const Value, MatchTy> m_Value(const Value *&V,
853857
const MatchTy &Match) {
@@ -857,6 +861,7 @@ inline bind_and_match_ty<const Value, MatchTy> m_Value(const Value *&V,
857861
/// Match an instruction, capturing it if we match.
858862
inline bind_ty<Instruction> m_Instruction(Instruction *&I) { return I; }
859863

864+
/// Match against the nested pattern, and capture the instruction if we match.
860865
template <typename MatchTy>
861866
inline bind_and_match_ty<Instruction, MatchTy>
862867
m_Instruction(Instruction *&I, const MatchTy &Match) {

0 commit comments

Comments
 (0)