mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 08:18:33 +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; }
|
op_iterator op_end() const { return OperandList+NumOperands; }
|
||||||
ArrayRef<SDUse> ops() const { return makeArrayRef(op_begin(), op_end()); }
|
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 getVTList() const {
|
||||||
SDVTList X = { ValueList, NumValues };
|
SDVTList X = { ValueList, NumValues };
|
||||||
return X;
|
return X;
|
||||||
|
|||||||
@@ -1777,8 +1777,7 @@ static bool isExtendedBUILD_VECTOR(SDNode *N, SelectionDAG &DAG,
|
|||||||
if (N->getOpcode() != ISD::BUILD_VECTOR)
|
if (N->getOpcode() != ISD::BUILD_VECTOR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
for (const SDValue &Elt : N->op_values()) {
|
||||||
SDNode *Elt = N->getOperand(i).getNode();
|
|
||||||
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Elt)) {
|
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Elt)) {
|
||||||
unsigned EltSize = VT.getVectorElementType().getSizeInBits();
|
unsigned EltSize = VT.getVectorElementType().getSizeInBits();
|
||||||
unsigned HalfSize = EltSize / 2;
|
unsigned HalfSize = EltSize / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user