mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
Add op_values() to iterate over the SDValue operands of an SDNode.
SDNode already had ops() which would iterate over the operands and return SDUse*. This version instead gets the SDValue's out of the SDUse's so that we can use foreach in more places. Reviewed by David Blaikie. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -579,6 +579,23 @@ public:
|
||||
op_iterator op_end() const { return OperandList+NumOperands; }
|
||||
ArrayRef<SDUse> ops() const { return makeArrayRef(op_begin(), op_end()); }
|
||||
|
||||
/// Iterator for directly iterating over the operand SDValue's.
|
||||
struct value_op_iterator
|
||||
: iterator_adaptor_base<value_op_iterator, op_iterator,
|
||||
std::random_access_iterator_tag, SDValue,
|
||||
ptrdiff_t, value_op_iterator *,
|
||||
value_op_iterator *> {
|
||||
explicit value_op_iterator(SDUse *U = nullptr)
|
||||
: iterator_adaptor_base(U) {}
|
||||
|
||||
const SDValue &operator*() const { return I->get(); }
|
||||
};
|
||||
|
||||
iterator_range<value_op_iterator> op_values() {
|
||||
return iterator_range<value_op_iterator>(value_op_iterator(op_begin()),
|
||||
value_op_iterator(op_end()));
|
||||
}
|
||||
|
||||
SDVTList getVTList() const {
|
||||
SDVTList X = { ValueList, NumValues };
|
||||
return X;
|
||||
|
||||
Reference in New Issue
Block a user