Skip to content

Commit

Permalink
[MI] Don't use std::function for all_uses/all_defs iterators (NFC)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Jun 2, 2023
1 parent 5563543 commit 1efbef4
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions llvm/include/llvm/CodeGen/MachineInstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1efbef4

Please sign in to comment.