@@ -284,18 +284,18 @@ def AffineForOp : Affine_Op<"for",
284
284
285
285
/// Returns loop step.
286
286
int64_t getStep() {
287
- return ::llvm::cast<IntegerAttr>((*this)->getAttr (getStepAttrStrName())).getInt();
287
+ return ::llvm::cast<IntegerAttr>(* (*this)->getInherentAttr (getStepAttrStrName())).getInt();
288
288
}
289
289
290
290
/// Returns affine map for the lower bound.
291
291
AffineMap getLowerBoundMap() { return getLowerBoundMapAttr().getValue(); }
292
292
AffineMapAttr getLowerBoundMapAttr() {
293
- return ::llvm::cast<AffineMapAttr>((*this)->getAttr (getLowerBoundAttrStrName()));
293
+ return ::llvm::cast<AffineMapAttr>(* (*this)->getInherentAttr (getLowerBoundAttrStrName()));
294
294
}
295
295
/// Returns affine map for the upper bound. The upper bound is exclusive.
296
296
AffineMap getUpperBoundMap() { return getUpperBoundMapAttr().getValue(); }
297
297
AffineMapAttr getUpperBoundMapAttr() {
298
- return ::llvm::cast<AffineMapAttr>((*this)->getAttr (getUpperBoundAttrStrName()));
298
+ return ::llvm::cast<AffineMapAttr>(* (*this)->getInherentAttr (getUpperBoundAttrStrName()));
299
299
}
300
300
301
301
/// Set lower bound. The new bound must have the same number of operands as
@@ -497,7 +497,8 @@ class AffineLoadOpBase<string mnemonic, list<Trait> traits = []> :
497
497
MemRefsNormalizable])> {
498
498
let arguments = (ins Arg<AnyMemRef, "the reference to load from",
499
499
[MemRead]>:$memref,
500
- Variadic<Index>:$indices);
500
+ Variadic<Index>:$indices,
501
+ AffineMapAttr:$map);
501
502
502
503
code extraClassDeclarationBase = [{
503
504
/// Returns the operand index of the memref.
@@ -507,7 +508,7 @@ class AffineLoadOpBase<string mnemonic, list<Trait> traits = []> :
507
508
508
509
/// Returns the affine map used to index the memref for this operation.
509
510
AffineMapAttr getAffineMapAttr() {
510
- return ::llvm::cast<AffineMapAttr>((*this)->getAttr(getMapAttrStrName())) ;
511
+ return getProperties().map ;
511
512
}
512
513
513
514
static StringRef getMapAttrStrName() { return "map"; }
@@ -801,7 +802,8 @@ def AffinePrefetchOp : Affine_Op<"prefetch",
801
802
BoolAttr:$isWrite,
802
803
ConfinedAttr<I32Attr, [IntMinValue<0>,
803
804
IntMaxValue<3>]>:$localityHint,
804
- BoolAttr:$isDataCache);
805
+ BoolAttr:$isDataCache,
806
+ AffineMapAttr:$map);
805
807
806
808
let builders = [
807
809
OpBuilder<(ins "Value":$memref, "AffineMap":$map,
@@ -814,11 +816,12 @@ def AffinePrefetchOp : Affine_Op<"prefetch",
814
816
auto isWriteAttr = $_builder.getBoolAttr(isWrite);
815
817
auto isDataCacheAttr = $_builder.getBoolAttr(isDataCache);
816
818
$_state.addOperands(memref);
817
- $_state.addAttribute(getMapAttrStrName(), AffineMapAttr::get(map));
818
819
$_state.addOperands(mapOperands);
819
- $_state.addAttribute(getLocalityHintAttrStrName(), localityHintAttr);
820
- $_state.addAttribute(getIsWriteAttrStrName(), isWriteAttr);
821
- $_state.addAttribute(getIsDataCacheAttrStrName(), isDataCacheAttr);
820
+ Properties &prop = $_state.getOrAddProperties<Properties>();
821
+ prop.map = AffineMapAttr::get(map);
822
+ prop.localityHint = localityHintAttr;
823
+ prop.isWrite = isWriteAttr;
824
+ prop.isDataCache = isDataCacheAttr;
822
825
}]>];
823
826
824
827
let extraClassDeclaration = [{
@@ -829,10 +832,10 @@ def AffinePrefetchOp : Affine_Op<"prefetch",
829
832
/// Returns the affine map used to index the memref for this operation.
830
833
AffineMap getAffineMap() { return getAffineMapAttr().getValue(); }
831
834
AffineMapAttr getAffineMapAttr() {
832
- return ::llvm::cast<AffineMapAttr>((*this)->getAttr(getMapAttrStrName())) ;
835
+ return getProperties().map ;
833
836
}
834
837
835
- /// Impelements the AffineMapAccessInterface.
838
+ /// Implements the AffineMapAccessInterface.
836
839
/// Returns the AffineMapAttr associated with 'memref'.
837
840
NamedAttribute getAffineMapAttrForMemRef(Value mref) {
838
841
assert(mref == getMemref() &&
@@ -874,7 +877,7 @@ class AffineStoreOpBase<string mnemonic, list<Trait> traits = []> :
874
877
875
878
/// Returns the affine map used to index the memref for this operation.
876
879
AffineMapAttr getAffineMapAttr() {
877
- return ::llvm::cast<AffineMapAttr>((*this)->getAttr(getMapAttrStrName())) ;
880
+ return getProperties().map ;
878
881
}
879
882
880
883
static StringRef getMapAttrStrName() { return "map"; }
@@ -912,7 +915,8 @@ def AffineStoreOp : AffineStoreOpBase<"store"> {
912
915
let arguments = (ins AnyType:$value,
913
916
Arg<AnyMemRef, "the reference to store to",
914
917
[MemWrite]>:$memref,
915
- Variadic<Index>:$indices);
918
+ Variadic<Index>:$indices,
919
+ AffineMapAttr:$map);
916
920
917
921
let skipDefaultBuilders = 1;
918
922
let builders = [
@@ -1065,7 +1069,8 @@ def AffineVectorStoreOp : AffineStoreOpBase<"vector_store"> {
1065
1069
let arguments = (ins AnyVector:$value,
1066
1070
Arg<AnyMemRef, "the reference to store to",
1067
1071
[MemWrite]>:$memref,
1068
- Variadic<Index>:$indices);
1072
+ Variadic<Index>:$indices,
1073
+ AffineMapAttr:$map);
1069
1074
1070
1075
let skipDefaultBuilders = 1;
1071
1076
let builders = [
0 commit comments