[llvm] 1efbef4 - [MI] Don't use std::function for all_uses/all_defs iterators (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 2 00:47:38 PDT 2023
Author: Nikita Popov
Date: 2023-06-02T09:47:29+02:00
New Revision: 1efbef4085fbe7098af4bb7013c6295ed3682cdf
URL: https://github.com/llvm/llvm-project/commit/1efbef4085fbe7098af4bb7013c6295ed3682cdf
DIFF: https://github.com/llvm/llvm-project/commit/1efbef4085fbe7098af4bb7013c6295ed3682cdf.diff
LOG: [MI] Don't use std::function for all_uses/all_defs iterators (NFC)
This mitigates the compile-time regression from D151424. The use
of std::function is not necessary here, as we're passing in a
static function.
Added:
Modified:
llvm/include/llvm/CodeGen/MachineInstr.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h
index 609aa5466ac3e..fa287becb60fe 100644
--- a/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -710,33 +710,28 @@ class MachineInstr
}
using filtered_mop_iterator =
- filter_iterator<mop_iterator, std::function<bool(MachineOperand &)>>;
+ filter_iterator<mop_iterator, bool (*)(const MachineOperand &)>;
using filtered_const_mop_iterator =
- filter_iterator<const_mop_iterator,
- std::function<bool(const MachineOperand &)>>;
+ filter_iterator<const_mop_iterator, bool (*)(const MachineOperand &)>;
/// Returns an iterator range over all operands that are (explicit or
/// implicit) register defs.
iterator_range<filtered_mop_iterator> all_defs() {
- return make_filter_range(operands(),
- std::function<bool(MachineOperand &)>(opIsRegDef));
+ return make_filter_range(operands(), opIsRegDef);
}
/// \copydoc all_defs()
iterator_range<filtered_const_mop_iterator> all_defs() const {
- return make_filter_range(
- operands(), std::function<bool(const MachineOperand &)>(opIsRegDef));
+ return make_filter_range(operands(), opIsRegDef);
}
/// Returns an iterator range over all operands that are (explicit or
/// implicit) register uses.
iterator_range<filtered_mop_iterator> all_uses() {
- return make_filter_range(uses(),
- std::function<bool(MachineOperand &)>(opIsRegUse));
+ return make_filter_range(uses(), opIsRegUse);
}
/// \copydoc all_uses()
iterator_range<filtered_const_mop_iterator> all_uses() const {
- return make_filter_range(
- uses(), std::function<bool(const MachineOperand &)>(opIsRegUse));
+ return make_filter_range(uses(), opIsRegUse);
}
/// Returns the number of the operand iterator \p I points to.
More information about the llvm-commits
mailing list