forked from OSchip/llvm-project
[ODG] Add iterators for results in Operator
PiperOrigin-RevId: 251417085
This commit is contained in:
parent
f7b9ac8245
commit
3f517af9ad
|
@ -68,6 +68,13 @@ public:
|
|||
// Returns this op's C++ class name prefixed with namespaces.
|
||||
std::string getQualCppClassName() const;
|
||||
|
||||
using value_iterator = NamedTypeConstraint *;
|
||||
|
||||
// Op result iterators.
|
||||
value_iterator result_begin();
|
||||
value_iterator result_end();
|
||||
llvm::iterator_range<value_iterator> getResults();
|
||||
|
||||
// Returns the number of results this op produces.
|
||||
int getNumResults() const;
|
||||
|
||||
|
@ -101,10 +108,9 @@ public:
|
|||
const NamedAttribute &getAttribute(int index) const;
|
||||
|
||||
// Op operand iterators.
|
||||
using operand_iterator = NamedTypeConstraint *;
|
||||
operand_iterator operand_begin();
|
||||
operand_iterator operand_end();
|
||||
llvm::iterator_range<operand_iterator> getOperands();
|
||||
value_iterator operand_begin();
|
||||
value_iterator operand_end();
|
||||
llvm::iterator_range<value_iterator> getOperands();
|
||||
|
||||
int getNumOperands() const { return operands.size(); }
|
||||
NamedTypeConstraint &getOperand(int index) { return operands[index]; }
|
||||
|
|
|
@ -89,6 +89,16 @@ StringRef tblgen::Operator::getExtraClassDeclaration() const {
|
|||
|
||||
const llvm::Record &tblgen::Operator::getDef() const { return def; }
|
||||
|
||||
auto tblgen::Operator::result_begin() -> value_iterator {
|
||||
return results.begin();
|
||||
}
|
||||
|
||||
auto tblgen::Operator::result_end() -> value_iterator { return results.end(); }
|
||||
|
||||
auto tblgen::Operator::getResults() -> llvm::iterator_range<value_iterator> {
|
||||
return {result_begin(), result_end()};
|
||||
}
|
||||
|
||||
tblgen::TypeConstraint
|
||||
tblgen::Operator::getResultTypeConstraint(int index) const {
|
||||
DagInit *results = def.getValueAsDag("results");
|
||||
|
@ -189,13 +199,13 @@ auto tblgen::Operator::getAttributes() const
|
|||
return {attribute_begin(), attribute_end()};
|
||||
}
|
||||
|
||||
auto tblgen::Operator::operand_begin() -> operand_iterator {
|
||||
auto tblgen::Operator::operand_begin() -> value_iterator {
|
||||
return operands.begin();
|
||||
}
|
||||
auto tblgen::Operator::operand_end() -> operand_iterator {
|
||||
auto tblgen::Operator::operand_end() -> value_iterator {
|
||||
return operands.end();
|
||||
}
|
||||
auto tblgen::Operator::getOperands() -> llvm::iterator_range<operand_iterator> {
|
||||
auto tblgen::Operator::getOperands() -> llvm::iterator_range<value_iterator> {
|
||||
return {operand_begin(), operand_end()};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue