Add a setAttrList() method on mlir::Operation

This is an efficient method to copy attributes from one operation to
another.

PiperOrigin-RevId: 253806004
This commit is contained in:
Mehdi Amini 2019-06-18 09:38:16 -07:00 committed by Mehdi Amini
parent 14e2f4a22b
commit 847e15e3c2
1 changed files with 5 additions and 0 deletions

View File

@ -257,6 +257,11 @@ public:
/// Return the internal attribute list on this operation.
NamedAttributeList &getAttrList() { return attrs; }
/// Set the attribute list on this operation.
/// Using a NamedAttributeList is more efficient as it does not require new
/// uniquing in the MLIRContext.
void setAttrList(NamedAttributeList newAttrs) { attrs = newAttrs; }
/// Return the specified attribute if present, null otherwise.
Attribute getAttr(Identifier name) { return attrs.get(name); }
Attribute getAttr(StringRef name) { return attrs.get(name); }