clang 24.0.0git
CIRGenBuilder.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENBUILDER_H
10#define LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENBUILDER_H
11
12#include "Address.h"
13#include "CIRGenRecordLayout.h"
14#include "CIRGenTypeCache.h"
15#include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
16#include "mlir/IR/Attributes.h"
17#include "mlir/IR/Builders.h"
18#include "mlir/IR/BuiltinAttributes.h"
19#include "mlir/Support/LLVM.h"
22
25#include "llvm/ADT/APFloat.h"
26#include "llvm/ADT/STLExtras.h"
27#include "llvm/IR/FPEnv.h"
28
29namespace clang::CIRGen {
30
32 const CIRGenTypeCache &typeCache;
33
34 llvm::StringMap<unsigned> recordNames;
35 llvm::StringMap<unsigned> globalsVersioning;
36
37public:
38 CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc)
39 : CIRBaseBuilderTy(mlirContext), typeCache(tc) {}
40
41 /// Get a cir::ConstArrayAttr for a string literal.
42 /// Note: This is different from what is returned by
43 /// mlir::Builder::getStringAttr() which is an mlir::StringAttr.
44 mlir::Attribute getString(llvm::StringRef str, mlir::Type eltTy,
45 std::optional<size_t> size,
46 bool ensureNullTerm = true) {
47 size_t finalSize = size.value_or(str.size());
48
49 size_t lastNonZeroPos = str.find_last_not_of('\0');
50 // If the string is full of null bytes, emit a #cir.zero rather than
51 // a #cir.const_array.
52 if (lastNonZeroPos == llvm::StringRef::npos) {
53 auto arrayTy = cir::ArrayType::get(eltTy, finalSize);
54 return cir::ZeroAttr::get(arrayTy);
55 }
56
57 // We emit trailing zeros for all trailing zeros, so the null-terminator in
58 // a constant is always in trailing zeros, and the null-terminator is
59 // skipped in the CIR representation.
60 size_t trailingZerosNum = finalSize - lastNonZeroPos - 1;
61 auto truncatedArrayTy =
62 cir::ArrayType::get(eltTy, finalSize - trailingZerosNum);
63 auto strAttr = mlir::StringAttr::get(str.drop_back(trailingZerosNum),
64 truncatedArrayTy);
65
66 // Most C strings are null terminated, so if we are ensuring there is one,
67 // grow the array size by 1 to add a trailing zero if necessary. The 'auto'
68 // calculation of trailing zeros (the difference between the provided string
69 // and the type) will ensure we get the count correct.
70 finalSize += (ensureNullTerm && trailingZerosNum == 0);
71
72 auto fullArrayTy = cir::ArrayType::get(eltTy, finalSize);
73 return cir::ConstArrayAttr::get(fullArrayTy, strAttr);
74 }
75
76 cir::ConstArrayAttr getConstArray(mlir::Attribute attrs,
77 cir::ArrayType arrayTy) const {
78 return cir::ConstArrayAttr::get(arrayTy, attrs);
79 }
80
81 mlir::Attribute getConstRecordOrZeroAttr(mlir::ArrayAttr arrayAttr,
82 cir::RecordType recordTy);
83
84 cir::ConstRecordAttr getAnonConstRecord(mlir::ArrayAttr arrayAttr) {
86 for (auto &f : arrayAttr) {
87 auto ta = mlir::cast<mlir::TypedAttr>(f);
88 members.push_back(ta.getType());
89 }
90
91 auto sTy = getAnonRecordTy(members, /*packed=*/false,
93 return cir::ConstRecordAttr::get(sTy, arrayAttr);
94 }
95
96 cir::TypeInfoAttr getTypeInfo(mlir::ArrayAttr fieldsAttr) {
97 cir::ConstRecordAttr anonRecord = getAnonConstRecord(fieldsAttr);
98 return cir::TypeInfoAttr::get(anonRecord.getType(), fieldsAttr);
99 }
100
101 std::string getUniqueAnonRecordName() { return getUniqueRecordName("anon"); }
102
103 std::string getUniqueRecordName(const std::string &baseName) {
104 auto it = recordNames.find(baseName);
105 if (it == recordNames.end()) {
106 recordNames[baseName] = 0;
107 return baseName;
108 }
109
110 return baseName + "." + std::to_string(recordNames[baseName]++);
111 }
112
113 cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const {
114 if (&format == &llvm::APFloat::IEEEdouble())
115 return cir::LongDoubleType::get(getContext(), typeCache.doubleTy);
116 if (&format == &llvm::APFloat::x87DoubleExtended())
117 return cir::LongDoubleType::get(getContext(), typeCache.fP80Ty);
118 if (&format == &llvm::APFloat::IEEEquad())
119 return cir::LongDoubleType::get(getContext(), typeCache.fP128Ty);
120 if (&format == &llvm::APFloat::PPCDoubleDouble())
121 llvm_unreachable("NYI: PPC double-double format for long double");
122 llvm_unreachable("Unsupported format for long double");
123 }
124
125 mlir::Type getPtrToVPtrType() {
126 return getPointerTo(cir::VPtrType::get(getContext()));
127 }
128
129 cir::FuncType getFuncType(llvm::ArrayRef<mlir::Type> params, mlir::Type retTy,
130 bool isVarArg = false) {
131 return cir::FuncType::get(params, retTy, isVarArg);
132 }
133
134 /// Get a CIR record kind from a AST declaration tag.
135 /// Returns true if the tag kind represents a C++ class (as opposed to a
136 /// plain struct).
139 }
140
141 /// Returns true if the tag kind is a union.
144 }
145
146 /// Get a CIR named record type.
147 ///
148 /// If a record already exists and is complete, but the client tries to fetch
149 /// it with a different set of attributes, this method will crash.
151 llvm::ArrayRef<mlir::Type> members, bool packed, llvm::StringRef name,
153 const auto nameAttr = getStringAttr(name);
155
156 // Always a struct at this call site, never a class or a union.
157 auto type = cir::StructType::get(getContext(), members, nameAttr, packed,
158 /*is_class=*/false, memberKinds);
159
160 // If we found an existing type, verify that either it is incomplete or
161 // it matches the requested attributes.
162 assert(!type.isIncomplete() ||
163 (type.getMembers() == members && type.getPacked() == packed));
164
165 // Complete an incomplete record or ensure the existing complete record
166 // matches the requested attributes.
167 type.complete(members, packed, memberKinds);
168
169 return type;
170 }
171
172 /// Get an incomplete CIR record type. If we have a complete record
173 /// declaration, we may create an incomplete type and then add the
174 /// members, so \p rd here may be complete.
176 const clang::RecordDecl *rd) {
177 const mlir::StringAttr nameAttr = getStringAttr(name);
178 if (rd && tagKindIsUnion(rd->getTagKind()))
179 return cir::UnionType::get(getContext(), nameAttr);
180 bool is_class = rd && tagKindIsClass(rd->getTagKind());
181 return cir::StructType::get(getContext(), nameAttr, is_class);
182 }
183
184 //
185 // Operation creation helpers
186 // --------------------------
187 //
189 cir::CopyOp createCopy(Address dst, Address src, bool isVolatile = false,
190 bool skipTailPadding = false) {
191 cir::CopyOp op = createCopy(dst.getPointer(), src.getPointer(), isVolatile,
192 skipTailPadding);
193 op.setDstAlignment(dst.getAlignment().getQuantity());
194 op.setSrcAlignment(src.getAlignment().getQuantity());
195 return op;
196 }
197
198 cir::MemCpyOp createMemCpy(mlir::Location loc, mlir::Value dst,
199 mlir::Value src, mlir::Value len) {
200 return cir::MemCpyOp::create(*this, loc, dst, src, len);
201 }
202
203 cir::MemMoveOp createMemMove(mlir::Location loc, mlir::Value dst,
204 mlir::Value src, mlir::Value len) {
205 return cir::MemMoveOp::create(*this, loc, dst, src, len);
206 }
207
208 cir::MemSetOp createMemSet(mlir::Location loc, mlir::Value dst,
209 mlir::Value val, mlir::Value len) {
210 assert(val.getType() == getUInt8Ty());
211 return cir::MemSetOp::create(*this, loc, dst, {}, val, len);
212 }
213
214 cir::MemSetOp createMemSet(mlir::Location loc, Address dst, mlir::Value val,
215 mlir::Value len) {
216 mlir::IntegerAttr align = getAlignmentAttr(dst.getAlignment());
217 assert(val.getType() == getUInt8Ty());
218 return cir::MemSetOp::create(*this, loc, dst.getPointer(), align, val, len);
219 }
220 // ---------------------------
221
222 cir::DataMemberAttr getDataMemberAttr(cir::DataMemberType ty,
224 return cir::DataMemberAttr::get(ty, path);
225 }
226
227 cir::DataMemberAttr getNullDataMemberAttr(cir::DataMemberType ty) {
228 return cir::DataMemberAttr::get(ty);
229 }
230
231 // Return true if the value is a null constant such as null pointer, (+0.0)
232 // for floating-point or zero initializer
233 bool isNullValue(mlir::Attribute attr) const {
234 if (mlir::isa<cir::ZeroAttr>(attr))
235 return true;
236
237 if (const auto ptrVal = mlir::dyn_cast<cir::ConstPtrAttr>(attr))
238 return ptrVal.isNullValue();
239
240 if (const auto intVal = mlir::dyn_cast<cir::IntAttr>(attr))
241 return intVal.isNullValue();
242
243 if (const auto boolVal = mlir::dyn_cast<cir::BoolAttr>(attr))
244 return !boolVal.getValue();
245
246 if (auto fpAttr = mlir::dyn_cast<cir::FPAttr>(attr)) {
247 auto fpVal = fpAttr.getValue();
248 bool ignored;
249 llvm::APFloat fv(+0.0);
250 fv.convert(fpVal.getSemantics(), llvm::APFloat::rmNearestTiesToEven,
251 &ignored);
252 return fv.bitwiseIsEqual(fpVal);
253 }
254 if (const auto recordVal = mlir::dyn_cast<cir::ConstRecordAttr>(attr)) {
255 for (const auto elt : recordVal.getMembers()) {
256 // FIXME(cir): the record's ID should not be considered a member.
257 if (mlir::isa<mlir::StringAttr>(elt))
258 continue;
259 if (!isNullValue(elt))
260 return false;
261 }
262 return true;
263 }
264
265 if (const auto arrayVal = mlir::dyn_cast<cir::ConstArrayAttr>(attr)) {
266 if (mlir::isa<mlir::StringAttr>(arrayVal.getElts()))
267 return false;
268
269 return llvm::all_of(
270 mlir::cast<mlir::ArrayAttr>(arrayVal.getElts()),
271 [&](const mlir::Attribute &elt) { return isNullValue(elt); });
272 }
273 return false;
274 }
275
276 //
277 // Type helpers
278 // ------------
279 //
280 cir::IntType getUIntNTy(int n) {
281 switch (n) {
282 case 8:
283 return getUInt8Ty();
284 case 16:
285 return getUInt16Ty();
286 case 32:
287 return getUInt32Ty();
288 case 64:
289 return getUInt64Ty();
290 default:
291 return cir::IntType::get(getContext(), n, false);
292 }
293 }
294
295 cir::IntType getSIntNTy(int n) {
296 switch (n) {
297 case 8:
298 return getSInt8Ty();
299 case 16:
300 return getSInt16Ty();
301 case 32:
302 return getSInt32Ty();
303 case 64:
304 return getSInt64Ty();
305 default:
306 return cir::IntType::get(getContext(), n, true);
307 }
308 }
309
310 cir::VoidType getVoidTy() { return typeCache.voidTy; }
311
312 cir::IntType getSInt8Ty() { return typeCache.sInt8Ty; }
313 cir::IntType getSInt16Ty() { return typeCache.sInt16Ty; }
314 cir::IntType getSInt32Ty() { return typeCache.sInt32Ty; }
315 cir::IntType getSInt64Ty() { return typeCache.sInt64Ty; }
316
317 cir::IntType getUInt8Ty() { return typeCache.uInt8Ty; }
318 cir::IntType getUInt16Ty() { return typeCache.uInt16Ty; }
319 cir::IntType getUInt32Ty() { return typeCache.uInt32Ty; }
320 cir::IntType getUInt64Ty() { return typeCache.uInt64Ty; }
321
322 cir::FP16Type getFp16Ty() { return typeCache.fP16Ty; }
323 cir::BF16Type getBfloat6Ty() { return typeCache.bFloat16Ty; }
324 cir::SingleType getSingleTy() { return typeCache.floatTy; }
325 cir::DoubleType getDoubleTy() { return typeCache.doubleTy; }
326
327 cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal);
328
329 cir::ConstantOp getConstInt(mlir::Location loc, llvm::APInt intVal,
330 bool isUnsigned = true);
331
332 cir::ConstantOp getConstInt(mlir::Location loc, mlir::Type t, uint64_t c);
333
334 cir::ConstantOp getConstFP(mlir::Location loc, mlir::Type t,
335 llvm::APFloat fpVal);
336
337 bool isInt8Ty(mlir::Type i) {
338 return i == typeCache.uInt8Ty || i == typeCache.sInt8Ty;
339 }
340 bool isInt16Ty(mlir::Type i) {
341 return i == typeCache.uInt16Ty || i == typeCache.sInt16Ty;
342 }
343 bool isInt32Ty(mlir::Type i) {
344 return i == typeCache.uInt32Ty || i == typeCache.sInt32Ty;
345 }
346 bool isInt64Ty(mlir::Type i) {
347 return i == typeCache.uInt64Ty || i == typeCache.sInt64Ty;
348 }
349 bool isInt(mlir::Type i) { return mlir::isa<cir::IntType>(i); }
350
351 cir::IntType getExtendedIntTy(cir::IntType ty, bool isSigned) {
352 switch (ty.getWidth()) {
353 case 8:
354 return isSigned ? typeCache.sInt16Ty : typeCache.uInt16Ty;
355 case 16:
356 return isSigned ? typeCache.sInt32Ty : typeCache.uInt32Ty;
357 case 32:
358 return isSigned ? typeCache.sInt64Ty : typeCache.uInt64Ty;
359 default:
360 llvm_unreachable("NYI");
361 }
362 }
363
364 cir::IntType getTruncatedIntTy(cir::IntType ty, bool isSigned) {
365 switch (ty.getWidth()) {
366 case 16:
367 return isSigned ? typeCache.sInt8Ty : typeCache.uInt8Ty;
368 case 32:
369 return isSigned ? typeCache.sInt16Ty : typeCache.uInt16Ty;
370 case 64:
371 return isSigned ? typeCache.sInt32Ty : typeCache.uInt32Ty;
372 default:
373 llvm_unreachable("NYI");
374 }
375 }
376
377 cir::VectorType
378 getExtendedOrTruncatedElementVectorType(cir::VectorType vt, bool isExtended,
379 bool isSigned = false) {
380 auto elementTy = mlir::dyn_cast_or_null<cir::IntType>(vt.getElementType());
381 assert(elementTy && "expected int vector");
382 return cir::VectorType::get(isExtended
383 ? getExtendedIntTy(elementTy, isSigned)
384 : getTruncatedIntTy(elementTy, isSigned),
385 vt.getSize());
386 }
387
388 // Fetch the type representing a pointer to unsigned int8 values.
389 cir::PointerType getUInt8PtrTy() { return typeCache.uInt8PtrTy; }
390
391 /// Get a CIR anonymous struct type.
392 cir::StructType
396 return cir::StructType::get(getContext(), members, packed,
397 /*is_class=*/false, memberKinds);
398 }
399
400 //===--------------------------------------------------------------------===//
401 // Constant creation helpers
402 //===--------------------------------------------------------------------===//
403 cir::ConstantOp getSInt32(int32_t c, mlir::Location loc) {
404 return getConstantInt(loc, getSInt32Ty(), c);
405 }
406 cir::ConstantOp getUInt32(uint32_t c, mlir::Location loc) {
407 return getConstantInt(loc, getUInt32Ty(), c);
408 }
409 cir::ConstantOp getSInt64(uint64_t c, mlir::Location loc) {
410 return getConstantInt(loc, getSInt64Ty(), c);
411 }
412 cir::ConstantOp getUInt64(uint64_t c, mlir::Location loc) {
413 return getConstantInt(loc, getUInt64Ty(), c);
414 }
415
416 cir::ConstantOp getZero(mlir::Location loc, mlir::Type ty) {
417 // TODO: dispatch creation for primitive types.
418 assert((mlir::isa<cir::RecordType>(ty) || mlir::isa<cir::ArrayType>(ty) ||
419 mlir::isa<cir::VectorType>(ty)) &&
420 "NYI for other types");
421 return cir::ConstantOp::create(*this, loc, cir::ZeroAttr::get(ty));
422 }
423
424 //===--------------------------------------------------------------------===//
425 // UnaryOp creation helpers
426 //===--------------------------------------------------------------------===//
427 mlir::Value createNeg(mlir::Location loc, mlir::Value value,
428 bool nsw = false) {
429
430 if (auto intTy = mlir::dyn_cast<cir::IntType>(value.getType())) {
431 // Source is a unsigned integer: first cast it to signed.
432 if (intTy.isUnsigned())
433 value = createIntCast(value, getSIntNTy(intTy.getWidth()));
434 return createMinus(loc, value, nsw);
435 }
436
437 llvm_unreachable("negation for the given type is NYI");
438 }
439
440 //===--------------------------------------------------------------------===//
441 // CastOp creation helpers
442 //===--------------------------------------------------------------------===//
443
444 // TODO: split this to createFPExt/createFPTrunc when we have dedicated cast
445 // operations.
446 mlir::Value createFloatingCast(mlir::Value v, mlir::Type destType) {
447 return cir::CastOp::create(*this, v.getLoc(), destType,
448 cir::CastKind::floating, v,
450 }
451
452 mlir::Value createDynCast(mlir::Location loc, mlir::Value src,
453 cir::PointerType destType, bool isRefCast,
454 cir::DynamicCastInfoAttr info) {
455 auto castKind =
456 isRefCast ? cir::DynamicCastKind::Ref : cir::DynamicCastKind::Ptr;
457 return cir::DynamicCastOp::create(*this, loc, destType, castKind, src, info,
458 /*relative_layout=*/false);
459 }
460
461 mlir::Value createDynCastToVoid(mlir::Location loc, mlir::Value src,
462 bool vtableUseRelativeLayout) {
463 // TODO(cir): consider address space here.
465 cir::PointerType destTy = getVoidPtrTy();
466 return cir::DynamicCastOp::create(
467 *this, loc, destTy, cir::DynamicCastKind::Ptr, src,
468 cir::DynamicCastInfoAttr{}, vtableUseRelativeLayout);
469 }
470
471 //===--------------------------------------------------------------------===//
472 // Address creation helpers
473 //===--------------------------------------------------------------------===//
474 Address createBaseClassAddr(mlir::Location loc, Address addr,
475 mlir::Type destType, unsigned offset,
476 bool assumeNotNull) {
477 if (destType == addr.getElementType())
478 return addr;
479
480 auto ptrTy = getPointerTo(destType);
481 auto baseAddr =
482 cir::BaseClassAddrOp::create(*this, loc, ptrTy, addr.getPointer(),
483 mlir::APInt(64, offset), assumeNotNull);
484 return Address(baseAddr, destType, addr.getAlignment());
485 }
486
487 Address createDerivedClassAddr(mlir::Location loc, Address addr,
488 mlir::Type destType, unsigned offset,
489 bool assumeNotNull) {
490 if (destType == addr.getElementType())
491 return addr;
492
493 cir::PointerType ptrTy = getPointerTo(destType);
494 auto derivedAddr =
495 cir::DerivedClassAddrOp::create(*this, loc, ptrTy, addr.getPointer(),
496 mlir::APInt(64, offset), assumeNotNull);
497 return Address(derivedAddr, destType, addr.getAlignment());
498 }
499
500 //===--------------------------------------------------------------------===//
501 // Virtual Address creation helpers
502 //===--------------------------------------------------------------------===//
503 mlir::Value createVTTAddrPoint(mlir::Location loc, mlir::Type retTy,
504 mlir::Value addr, uint64_t offset) {
505 return cir::VTTAddrPointOp::create(*this, loc, retTy,
506 mlir::FlatSymbolRefAttr{}, addr, offset);
507 }
508
509 mlir::Value createVTTAddrPoint(mlir::Location loc, mlir::Type retTy,
510 mlir::FlatSymbolRefAttr sym, uint64_t offset) {
511 return cir::VTTAddrPointOp::create(*this, loc, retTy, sym, mlir::Value{},
512 offset);
513 }
514
515 //===--------------------------------------------------------------------===//
516 // Other creation helpers
517 //===--------------------------------------------------------------------===//
518 cir::IsFPClassOp createIsFPClass(mlir::Location loc, mlir::Value src,
519 cir::FPClassTest flags) {
520 // FPClassTest occupies bits 0-9 (fcAllFlags). Sema rejects an
521 // out-of-range __builtin_isfpclass mask, so any extra bit here is an
522 // internal error; assert and mask it off so lowering stays well-formed.
523 uint32_t raw = static_cast<uint32_t>(flags);
524 uint32_t all = static_cast<uint32_t>(cir::FPClassTest::All);
525 assert((raw & ~all) == 0 && "FPClassTest mask has bits outside 0-9");
526 flags = static_cast<cir::FPClassTest>(raw & all);
527 return cir::IsFPClassOp::create(*this, loc, src, flags);
528 }
529
530 /// Cast the element type of the given address to a different type,
531 /// preserving information like the alignment.
532 Address createElementBitCast(mlir::Location loc, Address addr,
533 mlir::Type destType) {
534 if (destType == addr.getElementType())
535 return addr;
536
537 auto ptrTy = getPointerTo(destType);
538 return Address(createBitcast(loc, addr.getPointer(), ptrTy), destType,
539 addr.getAlignment());
540 }
541
542 cir::LoadOp createLoad(mlir::Location loc, Address addr,
543 bool isVolatile = false, bool isNontemporal = false) {
544 mlir::IntegerAttr align = getAlignmentAttr(addr.getAlignment());
545 return cir::LoadOp::create(*this, loc, addr.getPointer(), /*isDeref=*/false,
546 isVolatile, isNontemporal,
547 /*alignment=*/align,
548 /*sync_scope=*/cir::SyncScopeKindAttr{},
549 /*mem_order=*/cir::MemOrderAttr{},
550 /*invariant=*/false);
551 }
552
553 cir::LoadOp createAlignedLoad(mlir::Location loc, mlir::Type ty,
554 mlir::Value ptr, llvm::MaybeAlign align) {
555 if (ty != mlir::cast<cir::PointerType>(ptr.getType()).getPointee())
556 ptr = createPtrBitcast(ptr, ty);
557 uint64_t alignment = align ? align->value() : 0;
558 mlir::IntegerAttr alignAttr = getAlignmentAttr(alignment);
559 return cir::LoadOp::create(*this, loc, ptr, /*isDeref=*/false,
560 /*isVolatile=*/false, /*isNontemporal=*/false,
561 alignAttr,
562 /*sync_scope=*/cir::SyncScopeKindAttr{},
563 /*mem_order=*/cir::MemOrderAttr{},
564 /*invariant=*/false);
565 }
566
567 cir::LoadOp
568 createAlignedLoad(mlir::Location loc, mlir::Type ty, mlir::Value ptr,
570 return createAlignedLoad(loc, ty, ptr, align.getAsAlign());
571 }
572
573 cir::StoreOp createStore(mlir::Location loc, mlir::Value val, Address dst,
574 bool isVolatile = false, bool isNontemporal = false,
575 mlir::IntegerAttr align = {},
576 cir::SyncScopeKindAttr scope = {},
577 cir::MemOrderAttr order = {}) {
578 if (!align)
579 align = getAlignmentAttr(dst.getAlignment());
580 return CIRBaseBuilderTy::createStore(loc, val, dst.getPointer(), isVolatile,
581 isNontemporal, align, scope, order);
582 }
583
584 /// Create a cir.complex.real_ptr operation that derives a pointer to the real
585 /// part of the complex value pointed to by the specified pointer value.
586 mlir::Value createComplexRealPtr(mlir::Location loc, mlir::Value value) {
587 auto srcPtrTy = mlir::cast<cir::PointerType>(value.getType());
588 auto srcComplexTy = mlir::cast<cir::ComplexType>(srcPtrTy.getPointee());
589 return cir::ComplexRealPtrOp::create(
590 *this, loc, getPointerTo(srcComplexTy.getElementType()), value);
591 }
592
593 Address createComplexRealPtr(mlir::Location loc, Address addr) {
594 return Address{createComplexRealPtr(loc, addr.getPointer()),
595 addr.getAlignment()};
596 }
597
598 /// Create a cir.complex.imag_ptr operation that derives a pointer to the
599 /// imaginary part of the complex value pointed to by the specified pointer
600 /// value.
601 mlir::Value createComplexImagPtr(mlir::Location loc, mlir::Value value) {
602 auto srcPtrTy = mlir::cast<cir::PointerType>(value.getType());
603 auto srcComplexTy = mlir::cast<cir::ComplexType>(srcPtrTy.getPointee());
604 return cir::ComplexImagPtrOp::create(
605 *this, loc, getPointerTo(srcComplexTy.getElementType()), value);
606 }
607
608 Address createComplexImagPtr(mlir::Location loc, Address addr) {
609 return Address{createComplexImagPtr(loc, addr.getPointer()),
610 addr.getAlignment()};
611 }
612
614 Address createGetMember(mlir::Location loc, Address base,
615 llvm::StringRef name, unsigned index) {
616 auto recordTy = mlir::cast<cir::RecordType>(base.getElementType());
617
618 assert(index < recordTy.getMembers().size() &&
619 "member index out of bounds");
620 mlir::Type memberTy = recordTy.getMembers()[index];
621 mlir::Type memberPtrTy = getPointerTo(memberTy);
622
623 auto moduleOp =
624 getInsertionBlock()->getParentOp()->getParentOfType<mlir::ModuleOp>();
625 mlir::DataLayout layout(moduleOp);
626 auto memberOffset =
627 CharUnits::fromQuantity(recordTy.getElementOffset(layout, index));
628
629 mlir::Value memberPtr =
630 createGetMember(loc, memberPtrTy, base.getBasePointer(), name, index);
631 return Address(memberPtr, memberTy,
632 base.getAlignment().alignmentAtOffset(memberOffset),
633 base.isKnownNonNull());
634 }
635
636 cir::GetRuntimeMemberOp createGetIndirectMember(mlir::Location loc,
637 mlir::Value objectPtr,
638 mlir::Value memberPtr) {
639 auto memberPtrTy = mlir::cast<cir::DataMemberType>(memberPtr.getType());
640
641 // TODO(cir): consider address space.
643 cir::PointerType resultTy = getPointerTo(memberPtrTy.getMemberTy());
644
645 return cir::GetRuntimeMemberOp::create(*this, loc, resultTy, objectPtr,
646 memberPtr);
647 }
648
649 /// Create a cir.ptr_stride operation to get access to an array element.
650 /// \p idx is the index of the element to access, \p shouldDecay is true if
651 /// the result should decay to a pointer to the element type.
652 mlir::Value getArrayElement(mlir::Location arrayLocBegin,
653 mlir::Location arrayLocEnd, mlir::Value arrayPtr,
654 mlir::Type eltTy, mlir::Value idx,
655 bool shouldDecay);
656
657 /// Returns a decayed pointer to the first element of the array
658 /// pointed to by \p arrayPtr.
659 mlir::Value maybeBuildArrayDecay(mlir::Location loc, mlir::Value arrayPtr,
660 mlir::Type eltTy);
661
662 // Convert byte offset to sequence of high-level indices suitable for
663 // GlobalViewAttr. Ideally we shouldn't deal with low-level offsets at all
664 // but currently some parts of Clang AST, which we don't want to touch just
665 // yet, return them.
667 int64_t offset, mlir::Type ty, cir::CIRDataLayout layout,
669
670 // Convert high-level indices (e.g. from GlobalViewAttr) to byte offset.
672 mlir::Type ty,
674
675 /// Creates a versioned global variable. If the symbol is already taken, an ID
676 /// will be appended to the symbol. The returned global must always be queried
677 /// for its name so it can be referenced correctly.
678 [[nodiscard]] cir::GlobalOp
679 createVersionedGlobal(mlir::ModuleOp module, mlir::Location loc,
680 mlir::StringRef name, mlir::Type type, bool isConstant,
681 cir::GlobalLinkageKind linkage,
682 mlir::ptr::MemorySpaceAttrInterface addrSpace = {}) {
683 // Create a unique name if the given name is already taken.
684 std::string uniqueName;
685 if (unsigned version = globalsVersioning[name.str()]++)
686 uniqueName = name.str() + "." + std::to_string(version);
687 else
688 uniqueName = name.str();
689
690 return createGlobal(module, loc, uniqueName, type, isConstant, linkage,
691 addrSpace);
692 }
693
694 cir::StackSaveOp createStackSave(mlir::Location loc, mlir::Type ty) {
695 return cir::StackSaveOp::create(*this, loc, ty);
696 }
697
698 cir::StackRestoreOp createStackRestore(mlir::Location loc, mlir::Value v) {
699 return cir::StackRestoreOp::create(*this, loc, v);
700 }
701
703 mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
704 const llvm::APSInt &ltRes, const llvm::APSInt &eqRes,
705 const llvm::APSInt &gtRes, cir::CmpOrdering ordering) {
706 assert(ltRes.getBitWidth() == eqRes.getBitWidth() &&
707 ltRes.getBitWidth() == gtRes.getBitWidth() &&
708 "the three comparison results must have the same bit width");
709 assert((ordering == cir::CmpOrdering::Strong ||
710 ordering == cir::CmpOrdering::Weak) &&
711 "total ordering must be strong or weak");
712 cir::IntType cmpResultTy = getSIntNTy(ltRes.getBitWidth());
713 auto infoAttr = cir::CmpThreeWayInfoAttr::get(
714 getContext(), ordering, ltRes.getSExtValue(), eqRes.getSExtValue(),
715 gtRes.getSExtValue());
716 return cir::CmpThreeWayOp::create(*this, loc, cmpResultTy, lhs, rhs,
717 infoAttr);
718 }
719
721 mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
722 const llvm::APSInt &ltRes, const llvm::APSInt &eqRes,
723 const llvm::APSInt &gtRes, const llvm::APSInt &unorderedRes) {
724 assert(ltRes.getBitWidth() == eqRes.getBitWidth() &&
725 ltRes.getBitWidth() == gtRes.getBitWidth() &&
726 ltRes.getBitWidth() == unorderedRes.getBitWidth() &&
727 "the four comparison results must have the same bit width");
728 cir::IntType cmpResultTy = getSIntNTy(ltRes.getBitWidth());
729 auto infoAttr = cir::CmpThreeWayInfoAttr::get(
730 getContext(), ltRes.getSExtValue(), eqRes.getSExtValue(),
731 gtRes.getSExtValue(), unorderedRes.getSExtValue());
732 return cir::CmpThreeWayOp::create(*this, loc, cmpResultTy, lhs, rhs,
733 infoAttr);
734 }
735
736 mlir::Value createSetBitfield(mlir::Location loc, mlir::Type resultType,
737 Address dstAddr, mlir::Type storageType,
738 mlir::Value src, const CIRGenBitFieldInfo &info,
739 bool isLvalueVolatile, bool useVolatile) {
740 unsigned offset = useVolatile ? info.volatileOffset : info.offset;
741
742 // If using AAPCS and the field is volatile, load with the size of the
743 // declared field
744 storageType =
745 useVolatile ? cir::IntType::get(storageType.getContext(),
746 info.volatileStorageSize, info.isSigned)
747 : storageType;
748 return cir::SetBitfieldOp::create(
749 *this, loc, resultType, dstAddr.getPointer(), storageType, src,
750 info.name, info.size, offset, info.isSigned, isLvalueVolatile,
751 dstAddr.getAlignment().getAsAlign().value());
752 }
753
754 mlir::Value createGetBitfield(mlir::Location loc, mlir::Type resultType,
755 Address addr, mlir::Type storageType,
756 const CIRGenBitFieldInfo &info,
757 bool isLvalueVolatile, bool useVolatile) {
758 unsigned offset = useVolatile ? info.volatileOffset : info.offset;
759
760 // If using AAPCS and the field is volatile, load with the size of the
761 // declared field
762 storageType =
763 useVolatile ? cir::IntType::get(storageType.getContext(),
764 info.volatileStorageSize, info.isSigned)
765 : storageType;
766 return cir::GetBitfieldOp::create(*this, loc, resultType, addr.getPointer(),
767 storageType, info.name, info.size, offset,
768 info.isSigned, isLvalueVolatile,
769 addr.getAlignment().getAsAlign().value());
770 }
771
772 mlir::Value createMaskedLoad(mlir::Location loc, mlir::Type ty,
773 mlir::Value ptr, llvm::Align alignment,
774 mlir::Value mask, mlir::Value passThru) {
775 assert(mlir::isa<cir::VectorType>(ty) && "Type should be vector");
776 assert(mask && "Mask should not be all-ones (null)");
777
778 if (!passThru)
779 passThru = this->getConstant(loc, cir::PoisonAttr::get(ty));
780
781 auto alignAttr =
782 this->getI64IntegerAttr(static_cast<int64_t>(alignment.value()));
783
784 return cir::VecMaskedLoadOp::create(*this, loc, ty, ptr, mask, passThru,
785 alignAttr);
786 }
787
788 cir::VecShuffleOp
789 createVecShuffle(mlir::Location loc, mlir::Value vec1, mlir::Value vec2,
791 auto vecType = mlir::cast<cir::VectorType>(vec1.getType());
792 auto resultTy =
793 cir::VectorType::get(vecType.getElementType(), maskAttrs.size());
794 return cir::VecShuffleOp::create(*this, loc, resultTy, vec1, vec2,
795 getArrayAttr(maskAttrs));
796 }
797
798 cir::VecShuffleOp createVecShuffle(mlir::Location loc, mlir::Value vec1,
799 mlir::Value vec2,
801 auto maskAttrs = llvm::to_vector_of<mlir::Attribute>(
802 llvm::map_range(mask, [&](int32_t idx) {
803 return cir::IntAttr::get(getSInt32Ty(), idx);
804 }));
805 return createVecShuffle(loc, vec1, vec2, maskAttrs);
806 }
807
808 cir::VecShuffleOp createVecShuffle(mlir::Location loc, mlir::Value vec1,
810 /// Create a unary shuffle. The second vector operand of the IR instruction
811 /// is poison.
812 cir::ConstantOp poison =
813 getConstant(loc, cir::PoisonAttr::get(vec1.getType()));
814 return createVecShuffle(loc, vec1, poison, mask);
815 }
816
817 template <typename... Operands>
818 mlir::Value emitIntrinsicCallOp(mlir::Location loc, const llvm::StringRef str,
819 const mlir::Type &resTy, Operands &&...op) {
820 return cir::LLVMIntrinsicCallOp::create(*this, loc,
821 this->getStringAttr(str), resTy,
822 std::forward<Operands>(op)...)
823 .getResult();
824 }
825};
826
827} // namespace clang::CIRGen
828
829#endif
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
cir::CopyOp createCopy(mlir::Value dst, mlir::Value src, bool isVolatile=false, bool skipTailPadding=false)
Create a copy with inferred length.
cir::GetMemberOp createGetMember(mlir::Location loc, mlir::Type resultTy, mlir::Value base, llvm::StringRef name, unsigned index)
cir::StoreOp createStore(mlir::Location loc, mlir::Value val, mlir::Value dst, bool isVolatile=false, bool isNontemporal=false, mlir::IntegerAttr align={}, cir::SyncScopeKindAttr scope={}, cir::MemOrderAttr order={})
cir::FenvAttr getConstrainedFPAttr()
Build the #cir.fenv attribute describing the constrained floating-point environment currently in effe...
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr)
cir::PointerType getPointerTo(mlir::Type ty)
mlir::Value createPtrBitcast(mlir::Value src, mlir::Type newPointeeTy)
mlir::Value createIntCast(mlir::Value src, mlir::Type newTy)
mlir::Value createBitcast(mlir::Value src, mlir::Type newTy)
CIRBaseBuilderTy(mlir::MLIRContext &mlirContext)
mlir::IntegerAttr getAlignmentAttr(clang::CharUnits alignment)
mlir::Value createMinus(mlir::Location loc, mlir::Value input, bool nsw=false)
cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty, int64_t value)
cir::PointerType getVoidPtrTy(clang::LangAS langAS=clang::LangAS::Default)
cir::GlobalOp createGlobal(mlir::ModuleOp mlirModule, mlir::Location loc, mlir::StringRef name, mlir::Type type, bool isConstant, cir::GlobalLinkageKind linkage, mlir::ptr::MemorySpaceAttrInterface addrSpace)
C++ view class that accepts both !cir.struct and !cir.union types.
Definition CIRTypes.h:104
static llvm::SmallVector< RecordMemberKind > getAllDataKinds(llvm::ArrayRef< mlir::Type > members)
One Data kind per member.
Definition CIRTypes.cpp:156
bool isKnownNonNull() const
Whether the pointer is known not to be null.
Definition Address.h:168
mlir::Value getPointer() const
Definition Address.h:98
mlir::Type getElementType() const
Definition Address.h:125
clang::CharUnits getAlignment() const
Definition Address.h:138
mlir::Value getBasePointer() const
Definition Address.h:103
cir::MemMoveOp createMemMove(mlir::Location loc, mlir::Value dst, mlir::Value src, mlir::Value len)
cir::StackSaveOp createStackSave(mlir::Location loc, mlir::Type ty)
cir::TypeInfoAttr getTypeInfo(mlir::ArrayAttr fieldsAttr)
cir::CmpThreeWayOp createThreeWayCmpTotalOrdering(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, const llvm::APSInt &ltRes, const llvm::APSInt &eqRes, const llvm::APSInt &gtRes, cir::CmpOrdering ordering)
mlir::Value createComplexRealPtr(mlir::Location loc, mlir::Value value)
Create a cir.complex.real_ptr operation that derives a pointer to the real part of the complex value ...
cir::VecShuffleOp createVecShuffle(mlir::Location loc, mlir::Value vec1, mlir::Value vec2, llvm::ArrayRef< int64_t > mask)
cir::ConstantOp getUInt64(uint64_t c, mlir::Location loc)
mlir::Value emitIntrinsicCallOp(mlir::Location loc, const llvm::StringRef str, const mlir::Type &resTy, Operands &&...op)
cir::IntType getSIntNTy(int n)
cir::DataMemberAttr getDataMemberAttr(cir::DataMemberType ty, llvm::ArrayRef< int32_t > path)
cir::ConstantOp getSInt64(uint64_t c, mlir::Location loc)
cir::IntType getTruncatedIntTy(cir::IntType ty, bool isSigned)
cir::RecordType getIncompleteRecordTy(llvm::StringRef name, const clang::RecordDecl *rd)
Get an incomplete CIR record type.
cir::ConstantOp getUInt32(uint32_t c, mlir::Location loc)
Address createGetMember(mlir::Location loc, Address base, llvm::StringRef name, unsigned index)
cir::MemCpyOp createMemCpy(mlir::Location loc, mlir::Value dst, mlir::Value src, mlir::Value len)
cir::VecShuffleOp createVecShuffle(mlir::Location loc, mlir::Value vec1, mlir::Value vec2, llvm::ArrayRef< mlir::Attribute > maskAttrs)
mlir::Value createNeg(mlir::Location loc, mlir::Value value, bool nsw=false)
cir::PointerType getUInt8PtrTy()
mlir::Attribute getConstRecordOrZeroAttr(mlir::ArrayAttr arrayAttr, cir::RecordType recordTy)
cir::RecordType getCompleteNamedRecordType(llvm::ArrayRef< mlir::Type > members, bool packed, llvm::StringRef name, llvm::ArrayRef< cir::RecordMemberKind > memberKinds)
Get a CIR named record type.
std::string getUniqueRecordName(const std::string &baseName)
cir::LoadOp createLoad(mlir::Location loc, Address addr, bool isVolatile=false, bool isNontemporal=false)
cir::CmpThreeWayOp createThreeWayCmpPartialOrdering(mlir::Location loc, mlir::Value lhs, mlir::Value rhs, const llvm::APSInt &ltRes, const llvm::APSInt &eqRes, const llvm::APSInt &gtRes, const llvm::APSInt &unorderedRes)
mlir::Value createVTTAddrPoint(mlir::Location loc, mlir::Type retTy, mlir::FlatSymbolRefAttr sym, uint64_t offset)
mlir::Value createMaskedLoad(mlir::Location loc, mlir::Type ty, mlir::Value ptr, llvm::Align alignment, mlir::Value mask, mlir::Value passThru)
Address createBaseClassAddr(mlir::Location loc, Address addr, mlir::Type destType, unsigned offset, bool assumeNotNull)
mlir::Value createComplexImagPtr(mlir::Location loc, mlir::Value value)
Create a cir.complex.imag_ptr operation that derives a pointer to the imaginary part of the complex v...
mlir::Value maybeBuildArrayDecay(mlir::Location loc, mlir::Value arrayPtr, mlir::Type eltTy)
Returns a decayed pointer to the first element of the array pointed to by arrayPtr.
cir::StoreOp createStore(mlir::Location loc, mlir::Value val, Address dst, bool isVolatile=false, bool isNontemporal=false, mlir::IntegerAttr align={}, cir::SyncScopeKindAttr scope={}, cir::MemOrderAttr order={})
cir::LoadOp createAlignedLoad(mlir::Location loc, mlir::Type ty, mlir::Value ptr, llvm::MaybeAlign align)
cir::ConstantOp getConstFP(mlir::Location loc, mlir::Type t, llvm::APFloat fpVal)
mlir::Value createFloatingCast(mlir::Value v, mlir::Type destType)
cir::FuncType getFuncType(llvm::ArrayRef< mlir::Type > params, mlir::Type retTy, bool isVarArg=false)
cir::MemSetOp createMemSet(mlir::Location loc, Address dst, mlir::Value val, mlir::Value len)
cir::IntType getExtendedIntTy(cir::IntType ty, bool isSigned)
Address createDerivedClassAddr(mlir::Location loc, Address addr, mlir::Type destType, unsigned offset, bool assumeNotNull)
static bool tagKindIsUnion(const clang::TagTypeKind kind)
Returns true if the tag kind is a union.
uint64_t computeOffsetFromGlobalViewIndices(const cir::CIRDataLayout &layout, mlir::Type ty, llvm::ArrayRef< int64_t > indices)
cir::GetRuntimeMemberOp createGetIndirectMember(mlir::Location loc, mlir::Value objectPtr, mlir::Value memberPtr)
Address createElementBitCast(mlir::Location loc, Address addr, mlir::Type destType)
Cast the element type of the given address to a different type, preserving information like the align...
cir::ConstRecordAttr getAnonConstRecord(mlir::ArrayAttr arrayAttr)
static bool tagKindIsClass(const clang::TagTypeKind kind)
Get a CIR record kind from a AST declaration tag.
mlir::Value createDynCastToVoid(mlir::Location loc, mlir::Value src, bool vtableUseRelativeLayout)
cir::ConstantOp getZero(mlir::Location loc, mlir::Type ty)
cir::VecShuffleOp createVecShuffle(mlir::Location loc, mlir::Value vec1, llvm::ArrayRef< int64_t > mask)
mlir::Value createDynCast(mlir::Location loc, mlir::Value src, cir::PointerType destType, bool isRefCast, cir::DynamicCastInfoAttr info)
mlir::Value createGetBitfield(mlir::Location loc, mlir::Type resultType, Address addr, mlir::Type storageType, const CIRGenBitFieldInfo &info, bool isLvalueVolatile, bool useVolatile)
bool isNullValue(mlir::Attribute attr) const
cir::StackRestoreOp createStackRestore(mlir::Location loc, mlir::Value v)
mlir::Value createSetBitfield(mlir::Location loc, mlir::Type resultType, Address dstAddr, mlir::Type storageType, mlir::Value src, const CIRGenBitFieldInfo &info, bool isLvalueVolatile, bool useVolatile)
Address createComplexRealPtr(mlir::Location loc, Address addr)
cir::GlobalOp createVersionedGlobal(mlir::ModuleOp module, mlir::Location loc, mlir::StringRef name, mlir::Type type, bool isConstant, cir::GlobalLinkageKind linkage, mlir::ptr::MemorySpaceAttrInterface addrSpace={})
Creates a versioned global variable.
cir::StructType getAnonRecordTy(llvm::ArrayRef< mlir::Type > members, bool packed, llvm::ArrayRef< cir::RecordMemberKind > memberKinds)
Get a CIR anonymous struct type.
CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc)
cir::IsFPClassOp createIsFPClass(mlir::Location loc, mlir::Value src, cir::FPClassTest flags)
mlir::Attribute getString(llvm::StringRef str, mlir::Type eltTy, std::optional< size_t > size, bool ensureNullTerm=true)
Get a cir::ConstArrayAttr for a string literal.
cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal)
void computeGlobalViewIndicesFromFlatOffset(int64_t offset, mlir::Type ty, cir::CIRDataLayout layout, llvm::SmallVectorImpl< int64_t > &indices)
Address createComplexImagPtr(mlir::Location loc, Address addr)
cir::VectorType getExtendedOrTruncatedElementVectorType(cir::VectorType vt, bool isExtended, bool isSigned=false)
cir::DataMemberAttr getNullDataMemberAttr(cir::DataMemberType ty)
cir::ConstantOp getSInt32(int32_t c, mlir::Location loc)
mlir::Value createVTTAddrPoint(mlir::Location loc, mlir::Type retTy, mlir::Value addr, uint64_t offset)
cir::MemSetOp createMemSet(mlir::Location loc, mlir::Value dst, mlir::Value val, mlir::Value len)
cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const
cir::CopyOp createCopy(Address dst, Address src, bool isVolatile=false, bool skipTailPadding=false)
cir::ConstArrayAttr getConstArray(mlir::Attribute attrs, cir::ArrayType arrayTy) const
cir::IntType getUIntNTy(int n)
mlir::Value getArrayElement(mlir::Location arrayLocBegin, mlir::Location arrayLocEnd, mlir::Value arrayPtr, mlir::Type eltTy, mlir::Value idx, bool shouldDecay)
Create a cir.ptr_stride operation to get access to an array element.
cir::LoadOp createAlignedLoad(mlir::Location loc, mlir::Type ty, mlir::Value ptr, clang::CharUnits align=clang::CharUnits::One())
CharUnits - This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
CharUnits alignmentAtOffset(CharUnits offset) const
Given that this is a non-zero alignment value, what is the alignment at the given offset?
Definition CharUnits.h:207
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
Definition CharUnits.h:189
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition CharUnits.h:185
static CharUnits One()
One - Construct a CharUnits quantity of one.
Definition CharUnits.h:58
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition CharUnits.h:63
Represents a struct/union/class.
Definition Decl.h:4459
TagKind getTagKind() const
Definition Decl.h:4051
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
TagTypeKind
The kind of a tag type.
Definition TypeBase.h:6045
@ Class
The "class" keyword.
Definition TypeBase.h:6056
@ Union
The "union" keyword.
Definition TypeBase.h:6053
int __ovld __cnfn all(char)
Returns 1 if the most significant bit in all components of x is set; otherwise returns 0.
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 int32_t
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t
static bool addressSpace()
static bool astRecordDeclAttr()
Record with information about how a bitfield should be accessed.
This structure provides a set of types that are commonly used during IR emission.