Lines Matching defs:attr
28 bool mlirAttributeIsALocation(MlirAttribute attr) {
29 return llvm::isa<LocationAttr>(unwrap(attr));
36 bool mlirAttributeIsAAffineMap(MlirAttribute attr) {
37 return llvm::isa<AffineMapAttr>(unwrap(attr));
44 MlirAffineMap mlirAffineMapAttrGetValue(MlirAttribute attr) {
45 return wrap(llvm::cast<AffineMapAttr>(unwrap(attr)).getValue());
56 bool mlirAttributeIsAArray(MlirAttribute attr) {
57 return llvm::isa<ArrayAttr>(unwrap(attr));
68 intptr_t mlirArrayAttrGetNumElements(MlirAttribute attr) {
69 return static_cast<intptr_t>(llvm::cast<ArrayAttr>(unwrap(attr)).size());
72 MlirAttribute mlirArrayAttrGetElement(MlirAttribute attr, intptr_t pos) {
73 return wrap(llvm::cast<ArrayAttr>(unwrap(attr)).getValue()[pos]);
82 bool mlirAttributeIsADictionary(MlirAttribute attr) {
83 return llvm::isa<DictionaryAttr>(unwrap(attr));
96 intptr_t mlirDictionaryAttrGetNumElements(MlirAttribute attr) {
97 return static_cast<intptr_t>(llvm::cast<DictionaryAttr>(unwrap(attr)).size());
100 MlirNamedAttribute mlirDictionaryAttrGetElement(MlirAttribute attr,
103 llvm::cast<DictionaryAttr>(unwrap(attr)).getValue()[pos];
107 MlirAttribute mlirDictionaryAttrGetElementByName(MlirAttribute attr,
109 return wrap(llvm::cast<DictionaryAttr>(unwrap(attr)).get(unwrap(name)));
120 bool mlirAttributeIsAFloat(MlirAttribute attr) {
121 return llvm::isa<FloatAttr>(unwrap(attr));
134 double mlirFloatAttrGetValueDouble(MlirAttribute attr) {
135 return llvm::cast<FloatAttr>(unwrap(attr)).getValueAsDouble();
144 bool mlirAttributeIsAInteger(MlirAttribute attr) {
145 return llvm::isa<IntegerAttr>(unwrap(attr));
152 int64_t mlirIntegerAttrGetValueInt(MlirAttribute attr) {
153 return llvm::cast<IntegerAttr>(unwrap(attr)).getInt();
156 int64_t mlirIntegerAttrGetValueSInt(MlirAttribute attr) {
157 return llvm::cast<IntegerAttr>(unwrap(attr)).getSInt();
160 uint64_t mlirIntegerAttrGetValueUInt(MlirAttribute attr) {
161 return llvm::cast<IntegerAttr>(unwrap(attr)).getUInt();
172 bool mlirAttributeIsABool(MlirAttribute attr) {
173 return llvm::isa<BoolAttr>(unwrap(attr));
180 bool mlirBoolAttrGetValue(MlirAttribute attr) {
181 return llvm::cast<BoolAttr>(unwrap(attr)).getValue();
188 bool mlirAttributeIsAIntegerSet(MlirAttribute attr) {
189 return llvm::isa<IntegerSetAttr>(unwrap(attr));
200 MlirIntegerSet mlirIntegerSetAttrGetValue(MlirAttribute attr) {
201 return wrap(llvm::cast<IntegerSetAttr>(unwrap(attr)).getValue());
208 bool mlirAttributeIsAOpaque(MlirAttribute attr) {
209 return llvm::isa<OpaqueAttr>(unwrap(attr));
220 MlirStringRef mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr) {
222 llvm::cast<OpaqueAttr>(unwrap(attr)).getDialectNamespace().strref());
225 MlirStringRef mlirOpaqueAttrGetData(MlirAttribute attr) {
226 return wrap(llvm::cast<OpaqueAttr>(unwrap(attr)).getAttrData());
237 bool mlirAttributeIsAString(MlirAttribute attr) {
238 return llvm::isa<StringAttr>(unwrap(attr));
249 MlirStringRef mlirStringAttrGetValue(MlirAttribute attr) {
250 return wrap(llvm::cast<StringAttr>(unwrap(attr)).getValue());
261 bool mlirAttributeIsASymbolRef(MlirAttribute attr) {
262 return llvm::isa<SymbolRefAttr>(unwrap(attr));
276 MlirStringRef mlirSymbolRefAttrGetRootReference(MlirAttribute attr) {
278 llvm::cast<SymbolRefAttr>(unwrap(attr)).getRootReference().getValue());
281 MlirStringRef mlirSymbolRefAttrGetLeafReference(MlirAttribute attr) {
283 llvm::cast<SymbolRefAttr>(unwrap(attr)).getLeafReference().getValue());
286 intptr_t mlirSymbolRefAttrGetNumNestedReferences(MlirAttribute attr) {
288 llvm::cast<SymbolRefAttr>(unwrap(attr)).getNestedReferences().size());
291 MlirAttribute mlirSymbolRefAttrGetNestedReference(MlirAttribute attr,
294 llvm::cast<SymbolRefAttr>(unwrap(attr)).getNestedReferences()[pos]);
309 bool mlirAttributeIsAFlatSymbolRef(MlirAttribute attr) {
310 return llvm::isa<FlatSymbolRefAttr>(unwrap(attr));
317 MlirStringRef mlirFlatSymbolRefAttrGetValue(MlirAttribute attr) {
318 return wrap(llvm::cast<FlatSymbolRefAttr>(unwrap(attr)).getValue());
325 bool mlirAttributeIsAType(MlirAttribute attr) {
326 return llvm::isa<TypeAttr>(unwrap(attr));
333 MlirType mlirTypeAttrGetValue(MlirAttribute attr) {
334 return wrap(llvm::cast<TypeAttr>(unwrap(attr)).getValue());
343 bool mlirAttributeIsAUnit(MlirAttribute attr) {
344 return llvm::isa<UnitAttr>(unwrap(attr));
357 bool mlirAttributeIsAElements(MlirAttribute attr) {
358 return llvm::isa<ElementsAttr>(unwrap(attr));
361 MlirAttribute mlirElementsAttrGetValue(MlirAttribute attr, intptr_t rank,
363 return wrap(llvm::cast<ElementsAttr>(unwrap(attr))
367 bool mlirElementsAttrIsValidIndex(MlirAttribute attr, intptr_t rank,
369 return llvm::cast<ElementsAttr>(unwrap(attr))
373 int64_t mlirElementsAttrGetNumElements(MlirAttribute attr) {
374 return llvm::cast<ElementsAttr>(unwrap(attr)).getNumElements();
389 bool mlirAttributeIsADenseBoolArray(MlirAttribute attr) {
390 return llvm::isa<DenseBoolArrayAttr>(unwrap(attr));
392 bool mlirAttributeIsADenseI8Array(MlirAttribute attr) {
393 return llvm::isa<DenseI8ArrayAttr>(unwrap(attr));
395 bool mlirAttributeIsADenseI16Array(MlirAttribute attr) {
396 return llvm::isa<DenseI16ArrayAttr>(unwrap(attr));
398 bool mlirAttributeIsADenseI32Array(MlirAttribute attr) {
399 return llvm::isa<DenseI32ArrayAttr>(unwrap(attr));
401 bool mlirAttributeIsADenseI64Array(MlirAttribute attr) {
402 return llvm::isa<DenseI64ArrayAttr>(unwrap(attr));
404 bool mlirAttributeIsADenseF32Array(MlirAttribute attr) {
405 return llvm::isa<DenseF32ArrayAttr>(unwrap(attr));
407 bool mlirAttributeIsADenseF64Array(MlirAttribute attr) {
408 return llvm::isa<DenseF64ArrayAttr>(unwrap(attr));
455 intptr_t mlirDenseArrayGetNumElements(MlirAttribute attr) {
456 return llvm::cast<DenseArrayAttr>(unwrap(attr)).size();
463 bool mlirDenseBoolArrayGetElement(MlirAttribute attr, intptr_t pos) {
464 return llvm::cast<DenseBoolArrayAttr>(unwrap(attr))[pos];
466 int8_t mlirDenseI8ArrayGetElement(MlirAttribute attr, intptr_t pos) {
467 return llvm::cast<DenseI8ArrayAttr>(unwrap(attr))[pos];
469 int16_t mlirDenseI16ArrayGetElement(MlirAttribute attr, intptr_t pos) {
470 return llvm::cast<DenseI16ArrayAttr>(unwrap(attr))[pos];
472 int32_t mlirDenseI32ArrayGetElement(MlirAttribute attr, intptr_t pos) {
473 return llvm::cast<DenseI32ArrayAttr>(unwrap(attr))[pos];
475 int64_t mlirDenseI64ArrayGetElement(MlirAttribute attr, intptr_t pos) {
476 return llvm::cast<DenseI64ArrayAttr>(unwrap(attr))[pos];
478 float mlirDenseF32ArrayGetElement(MlirAttribute attr, intptr_t pos) {
479 return llvm::cast<DenseF32ArrayAttr>(unwrap(attr))[pos];
481 double mlirDenseF64ArrayGetElement(MlirAttribute attr, intptr_t pos) {
482 return llvm::cast<DenseF64ArrayAttr>(unwrap(attr))[pos];
493 bool mlirAttributeIsADenseElements(MlirAttribute attr) {
494 return llvm::isa<DenseElementsAttr>(unwrap(attr));
497 bool mlirAttributeIsADenseIntElements(MlirAttribute attr) {
498 return llvm::isa<DenseIntElementsAttr>(unwrap(attr));
501 bool mlirAttributeIsADenseFPElements(MlirAttribute attr) {
502 return llvm::isa<DenseFPElementsAttr>(unwrap(attr));
680 MlirAttribute mlirDenseElementsAttrReshapeGet(MlirAttribute attr,
682 return wrap(llvm::cast<DenseElementsAttr>(unwrap(attr))
690 bool mlirDenseElementsAttrIsSplat(MlirAttribute attr) {
691 return llvm::cast<DenseElementsAttr>(unwrap(attr)).isSplat();
694 MlirAttribute mlirDenseElementsAttrGetSplatValue(MlirAttribute attr) {
696 llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<Attribute>());
698 int mlirDenseElementsAttrGetBoolSplatValue(MlirAttribute attr) {
699 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<bool>();
701 int8_t mlirDenseElementsAttrGetInt8SplatValue(MlirAttribute attr) {
702 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<int8_t>();
704 uint8_t mlirDenseElementsAttrGetUInt8SplatValue(MlirAttribute attr) {
705 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<uint8_t>();
707 int32_t mlirDenseElementsAttrGetInt32SplatValue(MlirAttribute attr) {
708 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<int32_t>();
710 uint32_t mlirDenseElementsAttrGetUInt32SplatValue(MlirAttribute attr) {
711 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<uint32_t>();
713 int64_t mlirDenseElementsAttrGetInt64SplatValue(MlirAttribute attr) {
714 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<int64_t>();
716 uint64_t mlirDenseElementsAttrGetUInt64SplatValue(MlirAttribute attr) {
717 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<uint64_t>();
719 float mlirDenseElementsAttrGetFloatSplatValue(MlirAttribute attr) {
720 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<float>();
722 double mlirDenseElementsAttrGetDoubleSplatValue(MlirAttribute attr) {
723 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<double>();
725 MlirStringRef mlirDenseElementsAttrGetStringSplatValue(MlirAttribute attr) {
727 llvm::cast<DenseElementsAttr>(unwrap(attr)).getSplatValue<StringRef>());
734 bool mlirDenseElementsAttrGetBoolValue(MlirAttribute attr, intptr_t pos) {
735 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<bool>()[pos];
737 int8_t mlirDenseElementsAttrGetInt8Value(MlirAttribute attr, intptr_t pos) {
738 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<int8_t>()[pos];
740 uint8_t mlirDenseElementsAttrGetUInt8Value(MlirAttribute attr, intptr_t pos) {
741 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<uint8_t>()[pos];
743 int16_t mlirDenseElementsAttrGetInt16Value(MlirAttribute attr, intptr_t pos) {
744 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<int16_t>()[pos];
746 uint16_t mlirDenseElementsAttrGetUInt16Value(MlirAttribute attr, intptr_t pos) {
747 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<uint16_t>()[pos];
749 int32_t mlirDenseElementsAttrGetInt32Value(MlirAttribute attr, intptr_t pos) {
750 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<int32_t>()[pos];
752 uint32_t mlirDenseElementsAttrGetUInt32Value(MlirAttribute attr, intptr_t pos) {
753 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<uint32_t>()[pos];
755 int64_t mlirDenseElementsAttrGetInt64Value(MlirAttribute attr, intptr_t pos) {
756 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<int64_t>()[pos];
758 uint64_t mlirDenseElementsAttrGetUInt64Value(MlirAttribute attr, intptr_t pos) {
759 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<uint64_t>()[pos];
761 uint64_t mlirDenseElementsAttrGetIndexValue(MlirAttribute attr, intptr_t pos) {
762 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<uint64_t>()[pos];
764 float mlirDenseElementsAttrGetFloatValue(MlirAttribute attr, intptr_t pos) {
765 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<float>()[pos];
767 double mlirDenseElementsAttrGetDoubleValue(MlirAttribute attr, intptr_t pos) {
768 return llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<double>()[pos];
770 MlirStringRef mlirDenseElementsAttrGetStringValue(MlirAttribute attr,
773 llvm::cast<DenseElementsAttr>(unwrap(attr)).getValues<StringRef>()[pos]);
780 const void *mlirDenseElementsAttrGetRawData(MlirAttribute attr) {
782 llvm::cast<DenseElementsAttr>(unwrap(attr)).getRawData().data());
789 bool mlirAttributeIsADenseResourceElements(MlirAttribute attr) {
790 return llvm::isa<DenseResourceElementsAttr>(unwrap(attr));
888 static T getDenseResourceVal(MlirAttribute attr, intptr_t pos) {
889 return (*llvm::cast<U>(unwrap(attr)).tryGetAsArrayRef())[pos];
892 bool mlirDenseBoolResourceElementsAttrGetValue(MlirAttribute attr,
894 return getDenseResourceVal<DenseBoolResourceElementsAttr, uint8_t>(attr, pos);
896 uint8_t mlirDenseUInt8ResourceElementsAttrGetValue(MlirAttribute attr,
898 return getDenseResourceVal<DenseUI8ResourceElementsAttr, uint8_t>(attr, pos);
900 uint16_t mlirDenseUInt16ResourceElementsAttrGetValue(MlirAttribute attr,
902 return getDenseResourceVal<DenseUI16ResourceElementsAttr, uint16_t>(attr,
905 uint32_t mlirDenseUInt32ResourceElementsAttrGetValue(MlirAttribute attr,
907 return getDenseResourceVal<DenseUI32ResourceElementsAttr, uint32_t>(attr,
910 uint64_t mlirDenseUInt64ResourceElementsAttrGetValue(MlirAttribute attr,
912 return getDenseResourceVal<DenseUI64ResourceElementsAttr, uint64_t>(attr,
915 int8_t mlirDenseInt8ResourceElementsAttrGetValue(MlirAttribute attr,
917 return getDenseResourceVal<DenseUI8ResourceElementsAttr, int8_t>(attr, pos);
919 int16_t mlirDenseInt16ResourceElementsAttrGetValue(MlirAttribute attr,
921 return getDenseResourceVal<DenseUI16ResourceElementsAttr, int16_t>(attr, pos);
923 int32_t mlirDenseInt32ResourceElementsAttrGetValue(MlirAttribute attr,
925 return getDenseResourceVal<DenseUI32ResourceElementsAttr, int32_t>(attr, pos);
927 int64_t mlirDenseInt64ResourceElementsAttrGetValue(MlirAttribute attr,
929 return getDenseResourceVal<DenseUI64ResourceElementsAttr, int64_t>(attr, pos);
931 float mlirDenseFloatResourceElementsAttrGetValue(MlirAttribute attr,
933 return getDenseResourceVal<DenseF32ResourceElementsAttr, float>(attr, pos);
935 double mlirDenseDoubleResourceElementsAttrGetValue(MlirAttribute attr,
937 return getDenseResourceVal<DenseF64ResourceElementsAttr, double>(attr, pos);
944 bool mlirAttributeIsASparseElements(MlirAttribute attr) {
945 return llvm::isa<SparseElementsAttr>(unwrap(attr));
957 MlirAttribute mlirSparseElementsAttrGetIndices(MlirAttribute attr) {
958 return wrap(llvm::cast<SparseElementsAttr>(unwrap(attr)).getIndices());
961 MlirAttribute mlirSparseElementsAttrGetValues(MlirAttribute attr) {
962 return wrap(llvm::cast<SparseElementsAttr>(unwrap(attr)).getValues());
973 bool mlirAttributeIsAStridedLayout(MlirAttribute attr) {
974 return llvm::isa<StridedLayoutAttr>(unwrap(attr));
984 int64_t mlirStridedLayoutAttrGetOffset(MlirAttribute attr) {
985 return llvm::cast<StridedLayoutAttr>(unwrap(attr)).getOffset();
988 intptr_t mlirStridedLayoutAttrGetNumStrides(MlirAttribute attr) {
990 llvm::cast<StridedLayoutAttr>(unwrap(attr)).getStrides().size());
993 int64_t mlirStridedLayoutAttrGetStride(MlirAttribute attr, intptr_t pos) {
994 return llvm::cast<StridedLayoutAttr>(unwrap(attr)).getStrides()[pos];