forked from OSchip/llvm-project
Standardize the definition and usage of getAllArgAttrs between FuncOp and Function.
PiperOrigin-RevId: 255988352
This commit is contained in:
parent
54cd6a7e97
commit
694975ddbc
|
@ -232,8 +232,8 @@ public:
|
|||
}
|
||||
|
||||
/// Return all argument attributes of this function.
|
||||
MutableArrayRef<NamedAttributeList> getAllArgAttrs() {
|
||||
return impl->argAttrs;
|
||||
void getAllArgAttrs(SmallVectorImpl<NamedAttributeList> &result) {
|
||||
result.assign(impl->argAttrs.begin(), impl->argAttrs.end());
|
||||
}
|
||||
|
||||
/// Return the specified attribute if present, null otherwise.
|
||||
|
@ -465,7 +465,7 @@ public:
|
|||
}
|
||||
|
||||
/// Return all argument attributes of this function.
|
||||
void getAllArgAttrs(SmallVectorImpl<DictionaryAttr> &result) {
|
||||
void getAllArgAttrs(SmallVectorImpl<NamedAttributeList> &result) {
|
||||
for (unsigned i = 0, e = getNumArguments(); i != e; ++i)
|
||||
result.emplace_back(getArgAttrDict(i));
|
||||
}
|
||||
|
|
|
@ -310,9 +310,6 @@ void ModuleState::initialize(Module *module) {
|
|||
visitType(fn.getType());
|
||||
for (auto attr : fn.getAttrs())
|
||||
ModuleState::visitAttribute(attr.second);
|
||||
for (auto attrList : fn.getAllArgAttrs())
|
||||
for (auto attr : attrList.getAttrs())
|
||||
ModuleState::visitAttribute(attr.second);
|
||||
|
||||
fn.walk([&](Operation *op) { ModuleState::visitOperation(op); });
|
||||
}
|
||||
|
|
|
@ -1148,10 +1148,13 @@ LogicalResult mlir::applyConversionPatterns(
|
|||
FunctionConverter funcConverter(ctx, target, patterns, &converter);
|
||||
|
||||
// Try to convert each of the functions within the module.
|
||||
SmallVector<NamedAttributeList, 4> argAttrs;
|
||||
for (auto func : fns) {
|
||||
argAttrs.clear();
|
||||
func.getAllArgAttrs(argAttrs);
|
||||
|
||||
// Convert the function type using the type converter.
|
||||
auto conversion =
|
||||
converter.convertSignature(func.getType(), func.getAllArgAttrs());
|
||||
auto conversion = converter.convertSignature(func.getType(), argAttrs);
|
||||
if (!conversion)
|
||||
return failure();
|
||||
|
||||
|
|
Loading…
Reference in New Issue