13#include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
16#include "mlir/IR/Attributes.h"
17#include "mlir/IR/DialectImplementation.h"
18#include "llvm/ADT/TypeSwitch.h"
26 mlir::ArrayAttr &members);
33 cir::IntTypeInterface ty);
36 cir::IntTypeInterface ty);
43static mlir::ParseResult
45 mlir::FailureOr<llvm::APFloat> &value,
46 cir::FPTypeInterface fpType);
49 mlir::IntegerAttr &value);
53static mlir::ParseResult
55 mlir::DenseI32ArrayAttr &memberPath);
58 mlir::DenseI32ArrayAttr memberPath);
60#define GET_ATTRDEF_CLASSES
61#include "clang/CIR/Dialect/IR/CIROpsAttributes.cpp.inc"
71bool LangAddressSpaceAttr::isValidLoad(
72 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
73 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
74 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
75 llvm_unreachable(
"isValidLoad for LangAddressSpaceAttr NYI");
78bool LangAddressSpaceAttr::isValidStore(
79 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
80 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
81 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
82 llvm_unreachable(
"isValidStore for LangAddressSpaceAttr NYI");
85bool LangAddressSpaceAttr::isValidAtomicOp(
86 mlir::ptr::AtomicBinOp op, mlir::Type type,
87 mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment,
88 const mlir::DataLayout *dataLayout,
89 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
90 llvm_unreachable(
"isValidAtomicOp for LangAddressSpaceAttr NYI");
93bool LangAddressSpaceAttr::isValidAtomicXchg(
94 mlir::Type type, mlir::ptr::AtomicOrdering successOrdering,
95 mlir::ptr::AtomicOrdering failureOrdering, std::optional<int64_t> alignment,
96 const mlir::DataLayout *dataLayout,
97 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
98 llvm_unreachable(
"isValidAtomicXchg for LangAddressSpaceAttr NYI");
101bool LangAddressSpaceAttr::isValidAddrSpaceCast(
102 mlir::Type tgt, mlir::Type src,
103 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
104 llvm_unreachable(
"isValidAddrSpaceCast for LangAddressSpaceAttr NYI");
107bool LangAddressSpaceAttr::isValidPtrIntCast(
108 mlir::Type intLikeTy, mlir::Type ptrLikeTy,
109 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
110 llvm_unreachable(
"isValidPtrIntCast for LangAddressSpaceAttr NYI");
113bool TargetAddressSpaceAttr::isValidLoad(
114 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
115 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
116 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
117 llvm_unreachable(
"isValidLoad for TargetAddressSpaceAttr NYI");
120bool TargetAddressSpaceAttr::isValidStore(
121 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
122 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
123 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
124 llvm_unreachable(
"isValidStore for TargetAddressSpaceAttr NYI");
127bool TargetAddressSpaceAttr::isValidAtomicOp(
128 mlir::ptr::AtomicBinOp op, mlir::Type type,
129 mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment,
130 const mlir::DataLayout *dataLayout,
131 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
132 llvm_unreachable(
"isValidAtomicOp for TargetAddressSpaceAttr NYI");
135bool TargetAddressSpaceAttr::isValidAtomicXchg(
136 mlir::Type type, mlir::ptr::AtomicOrdering successOrdering,
137 mlir::ptr::AtomicOrdering failureOrdering, std::optional<int64_t> alignment,
138 const mlir::DataLayout *dataLayout,
139 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
140 llvm_unreachable(
"isValidAtomicXchg for TargetAddressSpaceAttr NYI");
143bool TargetAddressSpaceAttr::isValidAddrSpaceCast(
144 mlir::Type tgt, mlir::Type src,
145 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
146 llvm_unreachable(
"isValidAddrSpaceCast for TargetAddressSpaceAttr NYI");
149bool TargetAddressSpaceAttr::isValidPtrIntCast(
150 mlir::Type intLikeTy, mlir::Type ptrLikeTy,
151 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
152 llvm_unreachable(
"isValidPtrIntCast for TargetAddressSpaceAttr NYI");
159LogicalResult PtrSpecAttr::verify(function_ref<InFlightDiagnostic()> emitError,
162 constexpr unsigned kBitsInByte = 8;
163 if (size % kBitsInByte != 0)
164 return emitError() <<
"size entry must be divisible by 8";
165 if (abi % kBitsInByte != 0)
166 return emitError() <<
"abi entry must be divisible by 8";
167 if (preferred % kBitsInByte != 0)
168 return emitError() <<
"preferred entry must be divisible by 8";
169 if (index != kOptionalSpecValue && index % kBitsInByte != 0)
170 return emitError() <<
"index entry must be divisible by 8";
172 return emitError() <<
"preferred alignment is expected to be at least "
173 "as large as ABI alignment";
182BitFieldDeclAttr::verify(function_ref<InFlightDiagnostic()> emitError,
183 mlir::Type declaredType, uint64_t width,
185 if (width == 0 && !isUnnamed)
186 return emitError() <<
"zero-width bit-field cannot be named";
195 mlir::ArrayAttr members) {
197 llvm::interleaveComma(members, printer);
202 mlir::ArrayAttr &members) {
205 auto delimiter = AsmParser::Delimiter::Braces;
206 auto result = parser.parseCommaSeparatedList(delimiter, [&]() {
207 mlir::TypedAttr attr;
208 if (parser.parseAttribute(attr).failed())
209 return mlir::failure();
210 elts.push_back(attr);
211 return mlir::success();
215 return mlir::failure();
217 members = mlir::ArrayAttr::get(parser.getContext(), elts);
218 return mlir::success();
226ConstRecordAttr::verify(function_ref<InFlightDiagnostic()> emitError,
227 mlir::Type type, ArrayAttr members) {
228 auto sTy = mlir::dyn_cast_if_present<cir::RecordType>(type);
230 return emitError() <<
"expected !cir.struct or !cir.union type";
235 if (members.size() != 1)
236 return emitError() <<
"union constant must have exactly one element, got "
238 auto m = mlir::cast<mlir::TypedAttr>(members[0]);
240 if (!llvm::any_of(sTy.getMembers(), [&](mlir::Type memberTy) {
241 return cir::memberStorageType(memberTy) == m.getType();
243 return emitError() <<
"union element type " << m.getType()
244 <<
" is not a member of " << sTy;
252 for (mlir::Type memberTy : sTy.getMembers())
256 if (storedMembers.size() != members.size())
257 return emitError() <<
"number of elements must match";
259 for (
const auto &[attrIdx, member] : llvm::enumerate(storedMembers)) {
260 auto m = mlir::cast<mlir::TypedAttr>(members[attrIdx]);
265 if (attrIdx == storedMembers.size() - 1) {
266 auto memArrayTy = dyn_cast<cir::ArrayType>(member);
267 if (memArrayTy && memArrayTy.getSize() == 0) {
270 if (!isa<cir::ArrayType>(m.getType()))
272 <<
"element at index " << attrIdx <<
" has type "
273 << m.getType() <<
" but the expected type for this element is "
276 cir::ArrayType initArrayTy = cast<cir::ArrayType>(m.getType());
278 if (initArrayTy.getElementType() != memArrayTy.getElementType())
280 <<
"flexible array member at index " << attrIdx <<
" has type "
282 <<
" which doesn't match the expected element type of member "
288 if (member != m.getType())
289 return emitError() <<
"element at index " << attrIdx <<
" has type "
291 <<
" but the expected type for this element is "
302LogicalResult OptInfoAttr::verify(function_ref<InFlightDiagnostic()> emitError,
303 unsigned level,
unsigned size) {
306 <<
"optimization level must be between 0 and 3 inclusive";
309 <<
"size optimization level must be between 0 and 2 inclusive";
319static ParseResult
parseConstPtr(AsmParser &parser, mlir::IntegerAttr &value) {
321 if (parser.parseOptionalKeyword(
"null").succeeded()) {
322 value = parser.getBuilder().getI64IntegerAttr(0);
326 return parser.parseAttribute(value);
337 mlir::DenseI32ArrayAttr &memberPath) {
338 if (parser.parseOptionalKeyword(
"null").succeeded())
341 auto parsed = mlir::FieldParser<mlir::DenseI32ArrayAttr>::parse(parser);
342 if (mlir::failed(parsed))
344 memberPath = *parsed;
349 mlir::DenseI32ArrayAttr memberPath) {
353 p.printStrippedAttrOrType(memberPath);
361 cir::IntTypeInterface ty) {
362 llvm::SMLoc loc = parser.getCurrentLocation();
364 mlir::OptionalParseResult result = parser.parseOptionalInteger(parsed);
365 if (!result.has_value() || failed(*result))
366 return parser.emitError(loc,
"expected integer value");
368 const unsigned width = ty.getWidth();
370 ty.isSigned() ? parsed.getSignificantBits() <= width
371 : !parsed.isNegative() && parsed.getActiveBits() <= width;
373 return parser.emitError(loc,
"integer value too large for the given type");
375 value = ty.isSigned() ? parsed.sextOrTrunc(width) : parsed.zextOrTrunc(width);
380 cir::IntTypeInterface ty) {
382 value.toString(str, 10, ty.isSigned());
386LogicalResult IntAttr::verify(function_ref<InFlightDiagnostic()> emitError,
387 cir::IntTypeInterface type, llvm::APInt value) {
388 if (value.getBitWidth() != type.getWidth())
389 return emitError() <<
"type and value bitwidth mismatch: "
390 << type.getWidth() <<
" != " << value.getBitWidth();
403 FailureOr<APFloat> &value,
404 cir::FPTypeInterface fpType) {
406 APFloat parsedValue(0.0);
407 if (parser.parseFloat(fpType.getFloatSemantics(), parsedValue))
410 value.emplace(parsedValue);
414FPAttr FPAttr::getZero(Type type) {
417 mlir::cast<cir::FPTypeInterface>(type).getFloatSemantics()));
420LogicalResult FPAttr::verify(function_ref<InFlightDiagnostic()> emitError,
421 cir::FPTypeInterface fpType, APFloat value) {
422 if (APFloat::SemanticsToEnum(fpType.getFloatSemantics()) !=
423 APFloat::SemanticsToEnum(value.getSemantics()))
424 return emitError() <<
"floating-point semantics mismatch";
433std::string CmpThreeWayInfoAttr::getAlias()
const {
434 std::string alias =
"cmpinfo";
436 switch (getOrdering()) {
437 case CmpOrdering::Strong:
438 alias.append(
"_strong_");
440 case CmpOrdering::Weak:
441 alias.append(
"_weak_");
443 case CmpOrdering::Partial:
444 alias.append(
"_partial_");
448 auto appendInt = [&](int64_t value) {
450 alias.push_back(
'n');
453 alias.append(std::to_string(value));
463 if (std::optional<int> unordered = getUnordered()) {
465 appendInt(unordered.value());
472CmpThreeWayInfoAttr::verify(function_ref<InFlightDiagnostic()> emitError,
473 CmpOrdering ordering, int64_t lt, int64_t eq,
474 int64_t gt, std::optional<int64_t> unordered) {
476 if ((ordering == CmpOrdering::Strong || ordering == CmpOrdering::Weak) &&
478 emitError() <<
"strong and weak ordering do not include unordered";
481 if (ordering == CmpOrdering::Partial && !unordered) {
482 emitError() <<
"partial ordering requires unordered value";
494ConstComplexAttr::verify(function_ref<InFlightDiagnostic()> emitError,
495 cir::ComplexType type, mlir::TypedAttr real,
496 mlir::TypedAttr imag) {
497 mlir::Type elemType = type.getElementType();
498 if (real.getType() != elemType)
500 <<
"type of the real part does not match the complex type";
502 if (imag.getType() != elemType)
504 <<
"type of the imaginary part does not match the complex type";
513void CUDAVarRegistrationInfoAttr::print(AsmPrinter &p)
const {
514 p <<
"<" << getDeviceSideName();
515 p <<
", " << stringifyEnum(
getKind());
525Attribute CUDAVarRegistrationInfoAttr::parse(AsmParser &parser, Type odsType) {
526 if (parser.parseLess())
529 std::string deviceSideName;
530 if (parser.parseKeywordOrString(&deviceSideName)) {
531 parser.emitError(parser.getCurrentLocation(),
532 "expected device variable name");
536 if (parser.parseComma())
541 if (parser.parseKeyword(&kindStr))
544 std::optional<CUDADeviceVarKind>
kind = symbolizeCUDADeviceVarKind(kindStr);
546 parser.emitError(parser.getCurrentLocation(),
547 "unknown device variable kind: ")
553 bool isExtern =
false;
554 bool isConstant =
false;
555 bool isManaged =
false;
557 while (parser.parseOptionalGreater().failed()) {
558 if (parser.parseComma())
562 if (parser.parseKeyword(&flag))
565 if (flag ==
"extern")
567 else if (flag ==
"constant")
569 else if (flag ==
"managed")
572 parser.emitError(parser.getCurrentLocation(),
"unknown flag: ") << flag;
577 return get(parser.getContext(), deviceSideName, *
kind, isExtern, isConstant,
586DataMemberAttr::verify(function_ref<InFlightDiagnostic()> emitError,
587 cir::DataMemberType ty,
588 mlir::DenseI32ArrayAttr memberPath) {
592 if (memberPath.empty())
593 return emitError() <<
"#cir.data_member path must not be empty";
595 mlir::Type currentTy = ty.getClassTy();
596 for (
auto [
step, idx] : llvm::enumerate(memberPath.asArrayRef())) {
597 auto recTy = mlir::dyn_cast<cir::RecordType>(currentTy);
599 return emitError() <<
"#cir.data_member path step " <<
step
600 <<
" reaches a non-record type";
602 if (recTy.isIncomplete())
605 if (idx < 0 ||
static_cast<unsigned>(idx) >= recTy.getNumElements())
606 return emitError() <<
"#cir.data_member path index " << idx <<
" at step "
607 <<
step <<
" is out of range";
609 currentTy = recTy.getMembers()[idx];
612 if (currentTy != ty.getMemberTy())
614 <<
"member type of a #cir.data_member attribute must match "
615 "the attribute type";
624LogicalResult MethodAttr::verify(function_ref<InFlightDiagnostic()> emitError,
625 cir::MethodType type,
626 std::optional<FlatSymbolRefAttr> symbol,
627 std::optional<uint64_t> vtable_offset) {
628 if (symbol.has_value() && vtable_offset.has_value())
630 <<
"at most one of symbol and vtable_offset can be present "
636Attribute MethodAttr::parse(AsmParser &parser, Type odsType) {
637 auto ty = mlir::cast<cir::MethodType>(odsType);
639 if (parser.parseLess().failed())
643 if (parser.parseOptionalKeyword(
"null").succeeded()) {
644 if (parser.parseGreater().failed())
651 FlatSymbolRefAttr symbol;
652 mlir::OptionalParseResult parseSymbolRefResult =
653 parser.parseOptionalAttribute(symbol);
654 if (parseSymbolRefResult.has_value()) {
655 if (parseSymbolRefResult.value().failed())
657 if (parser.parseGreater().failed())
659 return get(ty, symbol);
663 std::uint64_t vtableOffset = 0;
664 if (parser.parseKeyword(
"vtable_offset"))
666 if (parser.parseEqual())
668 if (parser.parseInteger(vtableOffset))
671 if (parser.parseGreater())
674 return get(ty, vtableOffset);
677void MethodAttr::print(AsmPrinter &printer)
const {
678 auto symbol = getSymbol();
679 auto vtableOffset = getVtableOffset();
682 if (symbol.has_value()) {
684 }
else if (vtableOffset.has_value()) {
685 printer <<
"vtable_offset = " << *vtableOffset;
697ConstArrayAttr::verify(function_ref<InFlightDiagnostic()> emitError, Type type,
698 Attribute elts,
int trailingZerosNum) {
700 if (!(mlir::isa<ArrayAttr, StringAttr>(elts)))
701 return emitError() <<
"constant array expects ArrayAttr or StringAttr";
703 if (
auto strAttr = mlir::dyn_cast<StringAttr>(elts)) {
704 const auto arrayTy = mlir::cast<ArrayType>(type);
705 const auto intTy = mlir::dyn_cast<IntType>(arrayTy.getElementType());
708 if (!intTy || intTy.getWidth() != 8)
710 <<
"constant array element for string literals expects "
711 "!cir.int<u, 8> element type";
715 assert(mlir::isa<ArrayAttr>(elts));
716 const auto arrayAttr = mlir::cast<mlir::ArrayAttr>(elts);
717 const auto arrayTy = mlir::cast<ArrayType>(type);
720 if (arrayAttr.size() > arrayTy.getSize())
721 return emitError() <<
"constant array has " << arrayAttr.size()
722 <<
" values but array type has size "
723 << arrayTy.getSize();
724 if (arrayTy.getSize() != arrayAttr.size() + trailingZerosNum)
725 return emitError() <<
"constant array size should match type size";
729Attribute ConstArrayAttr::parse(AsmParser &parser, Type type) {
730 mlir::FailureOr<Type> resultTy;
731 mlir::FailureOr<Attribute> resultVal;
734 if (parser.parseLess())
738 resultVal = FieldParser<Attribute>::parse(parser);
739 if (failed(resultVal)) {
741 parser.getCurrentLocation(),
742 "failed to parse ConstArrayAttr parameter 'value' which is "
743 "to be a `Attribute`");
748 if (mlir::isa<ArrayAttr>(*resultVal)) {
750 if (parser.parseOptionalColon().failed()) {
753 resultTy = FieldParser<Type>::parse(parser);
754 if (failed(resultTy)) {
756 parser.getCurrentLocation(),
757 "failed to parse ConstArrayAttr parameter 'type' which is "
758 "to be a `::mlir::Type`");
763 auto ta = mlir::cast<TypedAttr>(*resultVal);
764 resultTy = ta.getType();
765 if (mlir::isa<mlir::NoneType>(*resultTy)) {
766 parser.emitError(parser.getCurrentLocation(),
767 "expected type declaration for string literal");
773 if (parser.parseOptionalComma().succeeded()) {
774 if (parser.parseOptionalKeyword(
"trailing_zeros").succeeded()) {
775 unsigned totalSize = mlir::cast<cir::ArrayType>(type).getSize();
776 mlir::Attribute elts = resultVal.value();
777 if (
auto str = mlir::dyn_cast<mlir::StringAttr>(elts))
778 zeros = totalSize - str.size();
780 zeros = totalSize - mlir::cast<mlir::ArrayAttr>(elts).size();
787 if (parser.parseGreater())
790 return parser.getChecked<ConstArrayAttr>(parser.getCurrentLocation(),
791 parser.getContext(), type,
792 resultVal.value(), zeros);
795void ConstArrayAttr::print(AsmPrinter &printer)
const {
797 printer.printStrippedAttrOrType(getElts());
798 if (getTrailingZerosNum())
799 printer <<
", trailing_zeros";
808cir::ConstVectorAttr::verify(function_ref<InFlightDiagnostic()> emitError,
809 Type type, ArrayAttr elts) {
811 if (!mlir::isa<cir::VectorType>(type))
812 return emitError() <<
"type of cir::ConstVectorAttr is not a "
816 const auto vecType = mlir::cast<cir::VectorType>(type);
818 if (vecType.getSize() != elts.size())
820 <<
"number of constant elements should match vector size";
823 LogicalResult elementTypeCheck =
success();
824 elts.walkImmediateSubElements(
825 [&](Attribute element) {
826 if (elementTypeCheck.failed()) {
830 auto typedElement = mlir::dyn_cast<TypedAttr>(element);
832 typedElement.getType() != vecType.getElementType()) {
833 elementTypeCheck = failure();
834 emitError() <<
"constant type should match vector element type";
839 return elementTypeCheck;
846LogicalResult cir::VTableAttr::verify(
847 llvm::function_ref<mlir::InFlightDiagnostic()> emitError, mlir::Type type,
848 mlir::ArrayAttr data) {
849 auto sTy = mlir::dyn_cast_if_present<cir::RecordType>(type);
851 return emitError() <<
"expected !cir.struct or !cir.union type result";
852 if (sTy.getMembers().empty() || data.empty())
853 return emitError() <<
"expected record type with one or more subtype";
855 if (cir::ConstRecordAttr::verify(emitError, type, data).failed())
858 for (
const auto &element : data.getAsRange<mlir::Attribute>()) {
859 const auto &constArrayAttr = mlir::dyn_cast<cir::ConstArrayAttr>(element);
861 return emitError() <<
"expected constant array subtype";
863 LogicalResult eltTypeCheck =
success();
864 auto arrayElts = mlir::cast<ArrayAttr>(constArrayAttr.getElts());
865 arrayElts.walkImmediateSubElements(
866 [&](mlir::Attribute attr) {
867 if (mlir::isa<ConstPtrAttr, GlobalViewAttr>(attr))
870 eltTypeCheck = emitError()
871 <<
"expected GlobalViewAttr or ConstPtrAttr";
873 [&](mlir::Type type) {});
874 if (eltTypeCheck.failed())
884std::string DynamicCastInfoAttr::getAlias()
const {
887 std::string alias =
"dyn_cast_info_";
889 alias.append(getSrcRtti().getSymbol().getValue());
890 alias.push_back(
'_');
891 alias.append(getDestRtti().getSymbol().getValue());
896LogicalResult DynamicCastInfoAttr::verify(
897 function_ref<InFlightDiagnostic()> emitError, cir::GlobalViewAttr srcRtti,
898 cir::GlobalViewAttr destRtti, mlir::FlatSymbolRefAttr runtimeFunc,
899 mlir::FlatSymbolRefAttr badCastFunc, cir::IntAttr offsetHint) {
900 auto isRttiPtr = [](mlir::Type ty) {
903 auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty);
907 auto pointeeIntTy = mlir::dyn_cast<cir::IntType>(ptrTy.getPointee());
911 return pointeeIntTy.isUnsigned() && pointeeIntTy.getWidth() == 8;
914 if (!isRttiPtr(srcRtti.getType()))
915 return emitError() <<
"srcRtti must be an RTTI pointer";
917 if (!isRttiPtr(destRtti.getType()))
918 return emitError() <<
"destRtti must be an RTTI pointer";
928 mlir::StringAttr name) {
931 auto dict = mod->getAttrOfType<mlir::DictionaryAttr>(
932 CIRDialect::getRecordLayoutsAttrName());
935 return dict.getAs<RecordLayoutAttr>(name);
939 mlir::StringAttr name) {
941 assert(attr &&
"record layout entry missing for named record");
949void CIRDialect::registerAttributes() {
951#define GET_ATTRDEF_LIST
952#include "clang/CIR/Dialect/IR/CIROpsAttributes.cpp.inc"
static mlir::ParseResult parseFloatLiteral(mlir::AsmParser &parser, mlir::FailureOr< llvm::APFloat > &value, cir::FPTypeInterface fpType)
static void printConstPtr(mlir::AsmPrinter &p, mlir::IntegerAttr value)
static void printRecordMembers(mlir::AsmPrinter &p, mlir::ArrayAttr members)
static mlir::ParseResult parseIntLiteral(mlir::AsmParser &parser, llvm::APInt &value, cir::IntTypeInterface ty)
static void printIntLiteral(mlir::AsmPrinter &p, llvm::APInt value, cir::IntTypeInterface ty)
static mlir::ParseResult parseConstPtr(mlir::AsmParser &parser, mlir::IntegerAttr &value)
static void printFloatLiteral(mlir::AsmPrinter &p, llvm::APFloat value, mlir::Type ty)
static mlir::ParseResult parseDataMemberPath(mlir::AsmParser &parser, mlir::DenseI32ArrayAttr &memberPath)
static void printDataMemberPath(mlir::AsmPrinter &p, mlir::DenseI32ArrayAttr memberPath)
static mlir::ParseResult parseRecordMembers(mlir::AsmParser &parser, mlir::ArrayAttr &members)
static Decl::Kind getKind(const Decl *D)
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
RecordLayoutAttr tryGetRecordLayout(mlir::ModuleOp mod, mlir::StringAttr name)
Same lookup as getRecordLayout, but returns a null attribute instead of asserting when the record has...
RecordLayoutAttr getRecordLayout(mlir::ModuleOp mod, mlir::StringAttr name)
Look up the RecordLayoutAttr for a named record in the module's cir.record_layouts dictionary.
mlir::Type memberStorageType(mlir::Type memberTy)
The storage a member is stored as: the access unit for a bit-field member, and the member type itself...
bool memberOwnsBytes(mlir::Type memberTy)
Whether a record member occupies bytes of its record.
float __ovld __cnfn step(float, float)
Returns 0.0 if x < edge, otherwise it returns 1.0.
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t