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);
53 cir::LangAddressSpace &addrSpace) {
54 llvm::SMLoc loc = p.getCurrentLocation();
55 mlir::FailureOr<cir::LangAddressSpace> result =
56 mlir::FieldParser<cir::LangAddressSpace>::parse(p);
57 if (mlir::failed(result))
58 return p.emitError(loc,
"expected address space keyword");
59 addrSpace = result.value();
60 return mlir::success();
64 cir::LangAddressSpace addrSpace) {
65 p << cir::stringifyEnum(addrSpace);
69 mlir::IntegerAttr &value);
73static mlir::ParseResult
75 mlir::DenseI32ArrayAttr &memberPath);
78 mlir::DenseI32ArrayAttr memberPath);
80#define GET_ATTRDEF_CLASSES
81#include "clang/CIR/Dialect/IR/CIROpsAttributes.cpp.inc"
91bool LangAddressSpaceAttr::isValidLoad(
92 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
93 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
94 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
95 llvm_unreachable(
"isValidLoad for LangAddressSpaceAttr NYI");
98bool LangAddressSpaceAttr::isValidStore(
99 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
100 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
101 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
102 llvm_unreachable(
"isValidStore for LangAddressSpaceAttr NYI");
105bool LangAddressSpaceAttr::isValidAtomicOp(
106 mlir::ptr::AtomicBinOp op, mlir::Type type,
107 mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment,
108 const mlir::DataLayout *dataLayout,
109 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
110 llvm_unreachable(
"isValidAtomicOp for LangAddressSpaceAttr NYI");
113bool LangAddressSpaceAttr::isValidAtomicXchg(
114 mlir::Type type, mlir::ptr::AtomicOrdering successOrdering,
115 mlir::ptr::AtomicOrdering failureOrdering, std::optional<int64_t> alignment,
116 const mlir::DataLayout *dataLayout,
117 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
118 llvm_unreachable(
"isValidAtomicXchg for LangAddressSpaceAttr NYI");
121bool LangAddressSpaceAttr::isValidAddrSpaceCast(
122 mlir::Type tgt, mlir::Type src,
123 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
124 llvm_unreachable(
"isValidAddrSpaceCast for LangAddressSpaceAttr NYI");
127bool LangAddressSpaceAttr::isValidPtrIntCast(
128 mlir::Type intLikeTy, mlir::Type ptrLikeTy,
129 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
130 llvm_unreachable(
"isValidPtrIntCast for LangAddressSpaceAttr NYI");
133bool TargetAddressSpaceAttr::isValidLoad(
134 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
135 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
136 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
137 llvm_unreachable(
"isValidLoad for TargetAddressSpaceAttr NYI");
140bool TargetAddressSpaceAttr::isValidStore(
141 mlir::Type type, mlir::ptr::AtomicOrdering ordering,
142 std::optional<int64_t> alignment,
const mlir::DataLayout *dataLayout,
143 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
144 llvm_unreachable(
"isValidStore for TargetAddressSpaceAttr NYI");
147bool TargetAddressSpaceAttr::isValidAtomicOp(
148 mlir::ptr::AtomicBinOp op, mlir::Type type,
149 mlir::ptr::AtomicOrdering ordering, std::optional<int64_t> alignment,
150 const mlir::DataLayout *dataLayout,
151 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
152 llvm_unreachable(
"isValidAtomicOp for TargetAddressSpaceAttr NYI");
155bool TargetAddressSpaceAttr::isValidAtomicXchg(
156 mlir::Type type, mlir::ptr::AtomicOrdering successOrdering,
157 mlir::ptr::AtomicOrdering failureOrdering, std::optional<int64_t> alignment,
158 const mlir::DataLayout *dataLayout,
159 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
160 llvm_unreachable(
"isValidAtomicXchg for TargetAddressSpaceAttr NYI");
163bool TargetAddressSpaceAttr::isValidAddrSpaceCast(
164 mlir::Type tgt, mlir::Type src,
165 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
166 llvm_unreachable(
"isValidAddrSpaceCast for TargetAddressSpaceAttr NYI");
169bool TargetAddressSpaceAttr::isValidPtrIntCast(
170 mlir::Type intLikeTy, mlir::Type ptrLikeTy,
171 llvm::function_ref<mlir::InFlightDiagnostic()> emitError)
const {
172 llvm_unreachable(
"isValidPtrIntCast for TargetAddressSpaceAttr NYI");
179LogicalResult PtrSpecAttr::verify(function_ref<InFlightDiagnostic()> emitError,
182 constexpr unsigned kBitsInByte = 8;
183 if (size % kBitsInByte != 0)
184 return emitError() <<
"size entry must be divisible by 8";
185 if (abi % kBitsInByte != 0)
186 return emitError() <<
"abi entry must be divisible by 8";
187 if (preferred % kBitsInByte != 0)
188 return emitError() <<
"preferred entry must be divisible by 8";
189 if (index != kOptionalSpecValue && index % kBitsInByte != 0)
190 return emitError() <<
"index entry must be divisible by 8";
192 return emitError() <<
"preferred alignment is expected to be at least "
193 "as large as ABI alignment";
202 mlir::ArrayAttr members) {
204 llvm::interleaveComma(members, printer);
209 mlir::ArrayAttr &members) {
212 auto delimiter = AsmParser::Delimiter::Braces;
213 auto result = parser.parseCommaSeparatedList(delimiter, [&]() {
214 mlir::TypedAttr attr;
215 if (parser.parseAttribute(attr).failed())
216 return mlir::failure();
217 elts.push_back(attr);
218 return mlir::success();
222 return mlir::failure();
224 members = mlir::ArrayAttr::get(parser.getContext(), elts);
225 return mlir::success();
233ConstRecordAttr::verify(function_ref<InFlightDiagnostic()> emitError,
234 mlir::Type type, ArrayAttr members) {
235 auto sTy = mlir::dyn_cast_if_present<cir::RecordType>(type);
237 return emitError() <<
"expected !cir.struct or !cir.union type";
242 if (members.size() != 1)
243 return emitError() <<
"union constant must have exactly one element, got "
245 auto m = mlir::cast<mlir::TypedAttr>(members[0]);
246 if (!llvm::is_contained(sTy.getMembers(), m.getType()))
247 return emitError() <<
"union element type " << m.getType()
248 <<
" is not a member of " << sTy;
252 if (sTy.getMembers().size() != members.size())
253 return emitError() <<
"number of elements must match";
255 for (
const auto &[attrIdx, member] : llvm::enumerate(sTy.getMembers())) {
256 auto m = mlir::cast<mlir::TypedAttr>(members[attrIdx]);
261 if (attrIdx == sTy.getMembers().size() - 1) {
262 auto memArrayTy = dyn_cast<cir::ArrayType>(member);
263 if (memArrayTy && memArrayTy.getSize() == 0) {
266 if (!isa<cir::ArrayType>(m.getType()))
268 <<
"element at index " << attrIdx <<
" has type "
269 << m.getType() <<
" but the expected type for this element is "
272 cir::ArrayType initArrayTy = cast<cir::ArrayType>(m.getType());
274 if (initArrayTy.getElementType() != memArrayTy.getElementType())
276 <<
"flexible array member at index " << attrIdx <<
" has type "
278 <<
" which doesn't match the expected element type of member "
284 if (member != m.getType())
285 return emitError() <<
"element at index " << attrIdx <<
" has type "
287 <<
" but the expected type for this element is "
298LogicalResult OptInfoAttr::verify(function_ref<InFlightDiagnostic()> emitError,
299 unsigned level,
unsigned size) {
302 <<
"optimization level must be between 0 and 3 inclusive";
305 <<
"size optimization level must be between 0 and 2 inclusive";
315static ParseResult
parseConstPtr(AsmParser &parser, mlir::IntegerAttr &value) {
317 if (parser.parseOptionalKeyword(
"null").succeeded()) {
318 value = parser.getBuilder().getI64IntegerAttr(0);
322 return parser.parseAttribute(value);
333 mlir::DenseI32ArrayAttr &memberPath) {
334 if (parser.parseOptionalKeyword(
"null").succeeded())
337 auto parsed = mlir::FieldParser<mlir::DenseI32ArrayAttr>::parse(parser);
338 if (mlir::failed(parsed))
340 memberPath = *parsed;
345 mlir::DenseI32ArrayAttr memberPath) {
349 p.printStrippedAttrOrType(memberPath);
357 cir::IntTypeInterface ty) {
358 llvm::SMLoc loc = parser.getCurrentLocation();
360 mlir::OptionalParseResult result = parser.parseOptionalInteger(parsed);
361 if (!result.has_value() || failed(*result))
362 return parser.emitError(loc,
"expected integer value");
364 const unsigned width = ty.getWidth();
366 ty.isSigned() ? parsed.getSignificantBits() <= width
367 : !parsed.isNegative() && parsed.getActiveBits() <= width;
369 return parser.emitError(loc,
"integer value too large for the given type");
371 value = ty.isSigned() ? parsed.sextOrTrunc(width) : parsed.zextOrTrunc(width);
376 cir::IntTypeInterface ty) {
378 value.toString(str, 10, ty.isSigned());
382LogicalResult IntAttr::verify(function_ref<InFlightDiagnostic()> emitError,
383 cir::IntTypeInterface type, llvm::APInt value) {
384 if (value.getBitWidth() != type.getWidth())
385 return emitError() <<
"type and value bitwidth mismatch: "
386 << type.getWidth() <<
" != " << value.getBitWidth();
399 FailureOr<APFloat> &value,
400 cir::FPTypeInterface fpType) {
402 APFloat parsedValue(0.0);
403 if (parser.parseFloat(fpType.getFloatSemantics(), parsedValue))
406 value.emplace(parsedValue);
410FPAttr FPAttr::getZero(Type type) {
413 mlir::cast<cir::FPTypeInterface>(type).getFloatSemantics()));
416LogicalResult FPAttr::verify(function_ref<InFlightDiagnostic()> emitError,
417 cir::FPTypeInterface fpType, APFloat value) {
418 if (APFloat::SemanticsToEnum(fpType.getFloatSemantics()) !=
419 APFloat::SemanticsToEnum(value.getSemantics()))
420 return emitError() <<
"floating-point semantics mismatch";
429std::string CmpThreeWayInfoAttr::getAlias()
const {
430 std::string alias =
"cmpinfo";
432 switch (getOrdering()) {
433 case CmpOrdering::Strong:
434 alias.append(
"_strong_");
436 case CmpOrdering::Weak:
437 alias.append(
"_weak_");
439 case CmpOrdering::Partial:
440 alias.append(
"_partial_");
444 auto appendInt = [&](int64_t value) {
446 alias.push_back(
'n');
449 alias.append(std::to_string(value));
459 if (std::optional<int> unordered = getUnordered()) {
461 appendInt(unordered.value());
468CmpThreeWayInfoAttr::verify(function_ref<InFlightDiagnostic()> emitError,
469 CmpOrdering ordering, int64_t lt, int64_t eq,
470 int64_t gt, std::optional<int64_t> unordered) {
472 if ((ordering == CmpOrdering::Strong || ordering == CmpOrdering::Weak) &&
474 emitError() <<
"strong and weak ordering do not include unordered";
477 if (ordering == CmpOrdering::Partial && !unordered) {
478 emitError() <<
"partial ordering requires unordered value";
490ConstComplexAttr::verify(function_ref<InFlightDiagnostic()> emitError,
491 cir::ComplexType type, mlir::TypedAttr real,
492 mlir::TypedAttr imag) {
493 mlir::Type elemType = type.getElementType();
494 if (real.getType() != elemType)
496 <<
"type of the real part does not match the complex type";
498 if (imag.getType() != elemType)
500 <<
"type of the imaginary part does not match the complex type";
509void CUDAVarRegistrationInfoAttr::print(AsmPrinter &p)
const {
510 p <<
"<" << getDeviceSideName();
511 p <<
", " << stringifyEnum(
getKind());
521Attribute CUDAVarRegistrationInfoAttr::parse(AsmParser &parser, Type odsType) {
522 if (parser.parseLess())
525 std::string deviceSideName;
526 if (parser.parseKeywordOrString(&deviceSideName)) {
527 parser.emitError(parser.getCurrentLocation(),
528 "expected device variable name");
532 if (parser.parseComma())
537 if (parser.parseKeyword(&kindStr))
540 std::optional<CUDADeviceVarKind>
kind = symbolizeCUDADeviceVarKind(kindStr);
542 parser.emitError(parser.getCurrentLocation(),
543 "unknown device variable kind: ")
549 bool isExtern =
false;
550 bool isConstant =
false;
551 bool isManaged =
false;
553 while (parser.parseOptionalGreater().failed()) {
554 if (parser.parseComma())
558 if (parser.parseKeyword(&flag))
561 if (flag ==
"extern")
563 else if (flag ==
"constant")
565 else if (flag ==
"managed")
568 parser.emitError(parser.getCurrentLocation(),
"unknown flag: ") << flag;
573 return get(parser.getContext(), deviceSideName, *
kind, isExtern, isConstant,
582DataMemberAttr::verify(function_ref<InFlightDiagnostic()> emitError,
583 cir::DataMemberType ty,
584 mlir::DenseI32ArrayAttr memberPath) {
588 if (memberPath.empty())
589 return emitError() <<
"#cir.data_member path must not be empty";
591 mlir::Type currentTy = ty.getClassTy();
592 for (
auto [
step, idx] : llvm::enumerate(memberPath.asArrayRef())) {
593 auto recTy = mlir::dyn_cast<cir::RecordType>(currentTy);
595 return emitError() <<
"#cir.data_member path step " <<
step
596 <<
" reaches a non-record type";
598 if (recTy.isIncomplete())
601 if (idx < 0 ||
static_cast<unsigned>(idx) >= recTy.getNumElements())
602 return emitError() <<
"#cir.data_member path index " << idx <<
" at step "
603 <<
step <<
" is out of range";
605 currentTy = recTy.getMembers()[idx];
608 if (currentTy != ty.getMemberTy())
610 <<
"member type of a #cir.data_member attribute must match "
611 "the attribute type";
620LogicalResult MethodAttr::verify(function_ref<InFlightDiagnostic()> emitError,
621 cir::MethodType type,
622 std::optional<FlatSymbolRefAttr> symbol,
623 std::optional<uint64_t> vtable_offset) {
624 if (symbol.has_value() && vtable_offset.has_value())
626 <<
"at most one of symbol and vtable_offset can be present "
632Attribute MethodAttr::parse(AsmParser &parser, Type odsType) {
633 auto ty = mlir::cast<cir::MethodType>(odsType);
635 if (parser.parseLess().failed())
639 if (parser.parseOptionalKeyword(
"null").succeeded()) {
640 if (parser.parseGreater().failed())
647 FlatSymbolRefAttr symbol;
648 mlir::OptionalParseResult parseSymbolRefResult =
649 parser.parseOptionalAttribute(symbol);
650 if (parseSymbolRefResult.has_value()) {
651 if (parseSymbolRefResult.value().failed())
653 if (parser.parseGreater().failed())
655 return get(ty, symbol);
659 std::uint64_t vtableOffset = 0;
660 if (parser.parseKeyword(
"vtable_offset"))
662 if (parser.parseEqual())
664 if (parser.parseInteger(vtableOffset))
667 if (parser.parseGreater())
670 return get(ty, vtableOffset);
673void MethodAttr::print(AsmPrinter &printer)
const {
674 auto symbol = getSymbol();
675 auto vtableOffset = getVtableOffset();
678 if (symbol.has_value()) {
680 }
else if (vtableOffset.has_value()) {
681 printer <<
"vtable_offset = " << *vtableOffset;
693ConstArrayAttr::verify(function_ref<InFlightDiagnostic()> emitError, Type type,
694 Attribute elts,
int trailingZerosNum) {
696 if (!(mlir::isa<ArrayAttr, StringAttr>(elts)))
697 return emitError() <<
"constant array expects ArrayAttr or StringAttr";
699 if (
auto strAttr = mlir::dyn_cast<StringAttr>(elts)) {
700 const auto arrayTy = mlir::cast<ArrayType>(type);
701 const auto intTy = mlir::dyn_cast<IntType>(arrayTy.getElementType());
704 if (!intTy || intTy.getWidth() != 8)
706 <<
"constant array element for string literals expects "
707 "!cir.int<u, 8> element type";
711 assert(mlir::isa<ArrayAttr>(elts));
712 const auto arrayAttr = mlir::cast<mlir::ArrayAttr>(elts);
713 const auto arrayTy = mlir::cast<ArrayType>(type);
716 if (arrayAttr.size() > arrayTy.getSize())
717 return emitError() <<
"constant array has " << arrayAttr.size()
718 <<
" values but array type has size "
719 << arrayTy.getSize();
720 if (arrayTy.getSize() != arrayAttr.size() + trailingZerosNum)
721 return emitError() <<
"constant array size should match type size";
725Attribute ConstArrayAttr::parse(AsmParser &parser, Type type) {
726 mlir::FailureOr<Type> resultTy;
727 mlir::FailureOr<Attribute> resultVal;
730 if (parser.parseLess())
734 resultVal = FieldParser<Attribute>::parse(parser);
735 if (failed(resultVal)) {
737 parser.getCurrentLocation(),
738 "failed to parse ConstArrayAttr parameter 'value' which is "
739 "to be a `Attribute`");
744 if (mlir::isa<ArrayAttr>(*resultVal)) {
746 if (parser.parseOptionalColon().failed()) {
749 resultTy = FieldParser<Type>::parse(parser);
750 if (failed(resultTy)) {
752 parser.getCurrentLocation(),
753 "failed to parse ConstArrayAttr parameter 'type' which is "
754 "to be a `::mlir::Type`");
759 auto ta = mlir::cast<TypedAttr>(*resultVal);
760 resultTy = ta.getType();
761 if (mlir::isa<mlir::NoneType>(*resultTy)) {
762 parser.emitError(parser.getCurrentLocation(),
763 "expected type declaration for string literal");
769 if (parser.parseOptionalComma().succeeded()) {
770 if (parser.parseOptionalKeyword(
"trailing_zeros").succeeded()) {
771 unsigned totalSize = mlir::cast<cir::ArrayType>(type).getSize();
772 mlir::Attribute elts = resultVal.value();
773 if (
auto str = mlir::dyn_cast<mlir::StringAttr>(elts))
774 zeros = totalSize - str.size();
776 zeros = totalSize - mlir::cast<mlir::ArrayAttr>(elts).size();
783 if (parser.parseGreater())
786 return parser.getChecked<ConstArrayAttr>(parser.getCurrentLocation(),
787 parser.getContext(), type,
788 resultVal.value(), zeros);
791void ConstArrayAttr::print(AsmPrinter &printer)
const {
793 printer.printStrippedAttrOrType(getElts());
794 if (getTrailingZerosNum())
795 printer <<
", trailing_zeros";
804cir::ConstVectorAttr::verify(function_ref<InFlightDiagnostic()> emitError,
805 Type type, ArrayAttr elts) {
807 if (!mlir::isa<cir::VectorType>(type))
808 return emitError() <<
"type of cir::ConstVectorAttr is not a "
812 const auto vecType = mlir::cast<cir::VectorType>(type);
814 if (vecType.getSize() != elts.size())
816 <<
"number of constant elements should match vector size";
819 LogicalResult elementTypeCheck =
success();
820 elts.walkImmediateSubElements(
821 [&](Attribute element) {
822 if (elementTypeCheck.failed()) {
826 auto typedElement = mlir::dyn_cast<TypedAttr>(element);
828 typedElement.getType() != vecType.getElementType()) {
829 elementTypeCheck = failure();
830 emitError() <<
"constant type should match vector element type";
835 return elementTypeCheck;
842LogicalResult cir::VTableAttr::verify(
843 llvm::function_ref<mlir::InFlightDiagnostic()> emitError, mlir::Type type,
844 mlir::ArrayAttr data) {
845 auto sTy = mlir::dyn_cast_if_present<cir::RecordType>(type);
847 return emitError() <<
"expected !cir.struct or !cir.union type result";
848 if (sTy.getMembers().empty() || data.empty())
849 return emitError() <<
"expected record type with one or more subtype";
851 if (cir::ConstRecordAttr::verify(emitError, type, data).failed())
854 for (
const auto &element : data.getAsRange<mlir::Attribute>()) {
855 const auto &constArrayAttr = mlir::dyn_cast<cir::ConstArrayAttr>(element);
857 return emitError() <<
"expected constant array subtype";
859 LogicalResult eltTypeCheck =
success();
860 auto arrayElts = mlir::cast<ArrayAttr>(constArrayAttr.getElts());
861 arrayElts.walkImmediateSubElements(
862 [&](mlir::Attribute attr) {
863 if (mlir::isa<ConstPtrAttr, GlobalViewAttr>(attr))
866 eltTypeCheck = emitError()
867 <<
"expected GlobalViewAttr or ConstPtrAttr";
869 [&](mlir::Type type) {});
870 if (eltTypeCheck.failed())
880std::string DynamicCastInfoAttr::getAlias()
const {
883 std::string alias =
"dyn_cast_info_";
885 alias.append(getSrcRtti().getSymbol().getValue());
886 alias.push_back(
'_');
887 alias.append(getDestRtti().getSymbol().getValue());
892LogicalResult DynamicCastInfoAttr::verify(
893 function_ref<InFlightDiagnostic()> emitError, cir::GlobalViewAttr srcRtti,
894 cir::GlobalViewAttr destRtti, mlir::FlatSymbolRefAttr runtimeFunc,
895 mlir::FlatSymbolRefAttr badCastFunc, cir::IntAttr offsetHint) {
896 auto isRttiPtr = [](mlir::Type ty) {
899 auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty);
903 auto pointeeIntTy = mlir::dyn_cast<cir::IntType>(ptrTy.getPointee());
907 return pointeeIntTy.isUnsigned() && pointeeIntTy.getWidth() == 8;
910 if (!isRttiPtr(srcRtti.getType()))
911 return emitError() <<
"srcRtti must be an RTTI pointer";
913 if (!isRttiPtr(destRtti.getType()))
914 return emitError() <<
"destRtti must be an RTTI pointer";
924 mlir::StringAttr name) {
927 auto dict = mod->getAttrOfType<mlir::DictionaryAttr>(
928 CIRDialect::getRecordLayoutsAttrName());
931 return dict.getAs<RecordLayoutAttr>(name);
935 mlir::StringAttr name) {
937 assert(attr &&
"record layout entry missing for named record");
945void CIRDialect::registerAttributes() {
947#define GET_ATTRDEF_LIST
948#include "clang/CIR/Dialect/IR/CIROpsAttributes.cpp.inc"
static mlir::ParseResult parseFloatLiteral(mlir::AsmParser &parser, mlir::FailureOr< llvm::APFloat > &value, cir::FPTypeInterface fpType)
void printAddressSpaceValue(mlir::AsmPrinter &p, cir::LangAddressSpace addrSpace)
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)
mlir::ParseResult parseAddressSpaceValue(mlir::AsmParser &p, cir::LangAddressSpace &addrSpace)
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.
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