clang 22.0.0git
CGValue.h
Go to the documentation of this file.
1//===-- CGValue.h - LLVM CodeGen wrappers for llvm::Value* ------*- C++ -*-===//
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// These classes implement wrappers around llvm::Value in order to
10// fully represent the range of values for C L- and R- values.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
15#define LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
16
17#include "Address.h"
18#include "CGPointerAuthInfo.h"
19#include "CodeGenTBAA.h"
20#include "EHScopeStack.h"
22#include "clang/AST/Type.h"
23#include "llvm/IR/Type.h"
24#include "llvm/IR/Value.h"
25
26namespace llvm {
27 class Constant;
28 class MDNode;
29}
30
31namespace clang {
32namespace CodeGen {
33class AggValueSlot;
34class CGBuilderTy;
35class CodeGenFunction;
36struct CGBitFieldInfo;
37
38/// RValue - This trivial value class is used to represent the result of an
39/// expression that is evaluated. It can be one of three things: either a
40/// simple LLVM SSA value, a pair of SSA values for complex numbers, or the
41/// address of an aggregate value in memory.
42class RValue {
43 friend struct DominatingValue<RValue>;
44
45 enum FlavorEnum { Scalar, Complex, Aggregate };
46
47 union {
48 // Stores first and second value.
49 struct {
50 llvm::Value *first;
51 llvm::Value *second;
52 } Vals;
53
54 // Stores aggregate address.
56 };
57
58 unsigned IsVolatile : 1;
59 unsigned Flavor : 2;
60
61public:
62 RValue() : Vals{nullptr, nullptr}, Flavor(Scalar) {}
63
64 bool isScalar() const { return Flavor == Scalar; }
65 bool isComplex() const { return Flavor == Complex; }
66 bool isAggregate() const { return Flavor == Aggregate; }
67 bool isIgnored() const { return isScalar() && !getScalarVal(); }
68
69 bool isVolatileQualified() const { return IsVolatile; }
70
71 /// getScalarVal() - Return the Value* of this scalar value.
72 llvm::Value *getScalarVal() const {
73 assert(isScalar() && "Not a scalar!");
74 return Vals.first;
75 }
76
77 /// getComplexVal - Return the real/imag components of this complex value.
78 ///
79 std::pair<llvm::Value *, llvm::Value *> getComplexVal() const {
80 return std::make_pair(Vals.first, Vals.second);
81 }
82
83 /// getAggregateAddr() - Return the Value* of the address of the aggregate.
85 assert(isAggregate() && "Not an aggregate!");
86 return AggregateAddr;
87 }
88
89 llvm::Value *getAggregatePointer(QualType PointeeType,
90 CodeGenFunction &CGF) const {
92 }
93
94 static RValue getIgnored() {
95 // FIXME: should we make this a more explicit state?
96 return get(nullptr);
97 }
98
99 static RValue get(llvm::Value *V) {
100 RValue ER;
101 ER.Vals.first = V;
102 ER.Flavor = Scalar;
103 ER.IsVolatile = false;
104 return ER;
105 }
107 return RValue::get(Addr.emitRawPointer(CGF));
108 }
109 static RValue getComplex(llvm::Value *V1, llvm::Value *V2) {
110 RValue ER;
111 ER.Vals = {V1, V2};
112 ER.Flavor = Complex;
113 ER.IsVolatile = false;
114 return ER;
115 }
116 static RValue getComplex(const std::pair<llvm::Value *, llvm::Value *> &C) {
117 return getComplex(C.first, C.second);
118 }
119 // FIXME: Aggregate rvalues need to retain information about whether they are
120 // volatile or not. Remove default to find all places that probably get this
121 // wrong.
122
123 /// Convert an Address to an RValue. If the Address is not
124 /// signed, create an RValue using the unsigned address. Otherwise, resign the
125 /// address using the provided type.
126 static RValue getAggregate(Address addr, bool isVolatile = false) {
127 RValue ER;
128 ER.AggregateAddr = addr;
129 ER.Flavor = Aggregate;
130 ER.IsVolatile = isVolatile;
131 return ER;
132 }
133};
134
135/// Does an ARC strong l-value have precise lifetime?
139
140/// The source of the alignment of an l-value; an expression of
141/// confidence in the alignment actually matching the estimate.
142enum class AlignmentSource {
143 /// The l-value was an access to a declared entity or something
144 /// equivalently strong, like the address of an array allocated by a
145 /// language runtime.
147
148 /// The l-value was considered opaque, so the alignment was
149 /// determined from a type, but that type was an explicitly-aligned
150 /// typedef.
152
153 /// The l-value was considered opaque, so the alignment was
154 /// determined from a type.
156};
157
158/// Given that the base address has the given alignment source, what's
159/// our confidence in the alignment of the field?
161 // For now, we don't distinguish fields of opaque pointers from
162 // top-level declarations, but maybe we should.
164}
165
167 AlignmentSource AlignSource;
168
169public:
171 : AlignSource(Source) {}
172 AlignmentSource getAlignmentSource() const { return AlignSource; }
173 void setAlignmentSource(AlignmentSource Source) { AlignSource = Source; }
174
175 void mergeForCast(const LValueBaseInfo &Info) {
177 }
178};
179
180/// LValue - This represents an lvalue references. Because C/C++ allow
181/// bitfields, this is not a simple LLVM pointer, it may be a pointer plus a
182/// bitrange.
183class LValue {
184 enum {
185 Simple, // This is a normal l-value, use getAddress().
186 VectorElt, // This is a vector element l-value (V[i]), use getVector*
187 BitField, // This is a bitfield l-value, use getBitfield*.
188 ExtVectorElt, // This is an extended vector subset, use getExtVectorComp
189 GlobalReg, // This is a register l-value, use getGlobalReg()
190 MatrixElt, // This is a matrix element, use getVector*
191 MatrixRow // This is a matrix vector subset, use getVector*
192 } LVType;
193
194 union {
196 llvm::Value *V;
197 };
198
199 union {
200 // Index into a vector subscript: V[i]
201 llvm::Value *VectorIdx;
202
203 // Index into a matrix row subscript: M[i]
204 llvm::Value *MatrixRowIdx;
205
206 // ExtVector element subset: V.xyx
207 llvm::Constant *VectorElts;
208
209 // BitField start bit and size
211 };
212
214
215 // 'const' is unused here
216 Qualifiers Quals;
217
218 // objective-c's ivar
219 bool Ivar:1;
220
221 // objective-c's ivar is an array
222 bool ObjIsArray:1;
223
224 // LValue is non-gc'able for any reason, including being a parameter or local
225 // variable.
226 bool NonGC: 1;
227
228 // Lvalue is a global reference of an objective-c object
229 bool GlobalObjCRef : 1;
230
231 // Lvalue is a thread local reference
232 bool ThreadLocalRef : 1;
233
234 // Lvalue has ARC imprecise lifetime. We store this inverted to try
235 // to make the default bitfield pattern all-zeroes.
236 bool ImpreciseLifetime : 1;
237
238 // This flag shows if a nontemporal load/stores should be used when accessing
239 // this lvalue.
240 bool Nontemporal : 1;
241
242 LValueBaseInfo BaseInfo;
243 TBAAAccessInfo TBAAInfo;
244
245 Expr *BaseIvarExp;
246
247private:
248 void Initialize(QualType Type, Qualifiers Quals, Address Addr,
249 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo) {
250 this->Type = Type;
251 this->Quals = Quals;
252 const unsigned MaxAlign = 1U << 31;
253 CharUnits Alignment = Addr.getAlignment();
254 assert((isGlobalReg() || !Alignment.isZero() || Type->isIncompleteType()) &&
255 "initializing l-value with zero alignment!");
256 if (Alignment.getQuantity() > MaxAlign) {
257 assert(false && "Alignment exceeds allowed max!");
258 Alignment = CharUnits::fromQuantity(MaxAlign);
259 }
260 this->Addr = Addr;
261 this->BaseInfo = BaseInfo;
262 this->TBAAInfo = TBAAInfo;
263
264 // Initialize Objective-C flags.
265 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef = false;
266 this->ImpreciseLifetime = false;
267 this->Nontemporal = false;
268 this->ThreadLocalRef = false;
269 this->BaseIvarExp = nullptr;
270 }
271
272 void initializeSimpleLValue(Address Addr, QualType Type,
273 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo,
274 ASTContext &Context) {
275 Qualifiers QS = Type.getQualifiers();
276 QS.setObjCGCAttr(Context.getObjCGCAttrKind(Type));
277 LVType = Simple;
278 Initialize(Type, QS, Addr, BaseInfo, TBAAInfo);
279 assert(Addr.getBasePointer()->getType()->isPointerTy());
280 }
281
282public:
283 bool isSimple() const { return LVType == Simple; }
284 bool isVectorElt() const { return LVType == VectorElt; }
285 bool isBitField() const { return LVType == BitField; }
286 bool isExtVectorElt() const { return LVType == ExtVectorElt; }
287 bool isGlobalReg() const { return LVType == GlobalReg; }
288 bool isMatrixElt() const { return LVType == MatrixElt; }
289 bool isMatrixRow() const { return LVType == MatrixRow; }
290
291 bool isVolatileQualified() const { return Quals.hasVolatile(); }
292 bool isRestrictQualified() const { return Quals.hasRestrict(); }
293 unsigned getVRQualifiers() const {
294 return Quals.getCVRQualifiers() & ~Qualifiers::Const;
295 }
296
297 QualType getType() const { return Type; }
298
300 return Quals.getObjCLifetime();
301 }
302
303 bool isObjCIvar() const { return Ivar; }
304 void setObjCIvar(bool Value) { Ivar = Value; }
305
306 bool isObjCArray() const { return ObjIsArray; }
307 void setObjCArray(bool Value) { ObjIsArray = Value; }
308
309 bool isNonGC () const { return NonGC; }
310 void setNonGC(bool Value) { NonGC = Value; }
311
312 bool isGlobalObjCRef() const { return GlobalObjCRef; }
313 void setGlobalObjCRef(bool Value) { GlobalObjCRef = Value; }
314
315 bool isThreadLocalRef() const { return ThreadLocalRef; }
316 void setThreadLocalRef(bool Value) { ThreadLocalRef = Value;}
317
319 return ARCPreciseLifetime_t(!ImpreciseLifetime);
320 }
322 ImpreciseLifetime = (value == ARCImpreciseLifetime);
323 }
324 bool isNontemporal() const { return Nontemporal; }
325 void setNontemporal(bool Value) { Nontemporal = Value; }
326
327 bool isObjCWeak() const {
328 return Quals.getObjCGCAttr() == Qualifiers::Weak;
329 }
330 bool isObjCStrong() const {
331 return Quals.getObjCGCAttr() == Qualifiers::Strong;
332 }
333
334 bool isVolatile() const {
335 return Quals.hasVolatile();
336 }
337
338 Expr *getBaseIvarExp() const { return BaseIvarExp; }
339 void setBaseIvarExp(Expr *V) { BaseIvarExp = V; }
340
341 TBAAAccessInfo getTBAAInfo() const { return TBAAInfo; }
342 void setTBAAInfo(TBAAAccessInfo Info) { TBAAInfo = Info; }
343
344 const Qualifiers &getQuals() const { return Quals; }
345 Qualifiers &getQuals() { return Quals; }
346
347 LangAS getAddressSpace() const { return Quals.getAddressSpace(); }
348
349 CharUnits getAlignment() const { return Addr.getAlignment(); }
350 void setAlignment(CharUnits A) { Addr.setAlignment(A); }
351
352 LValueBaseInfo getBaseInfo() const { return BaseInfo; }
353 void setBaseInfo(LValueBaseInfo Info) { BaseInfo = Info; }
354
355 KnownNonNull_t isKnownNonNull() const { return Addr.isKnownNonNull(); }
357 Addr.setKnownNonNull();
358 return *this;
359 }
360
361 // simple lvalue
362 llvm::Value *getPointer(CodeGenFunction &CGF) const;
363 llvm::Value *emitResignedPointer(QualType PointeeTy,
364 CodeGenFunction &CGF) const;
365 llvm::Value *emitRawPointer(CodeGenFunction &CGF) const;
366
367 Address getAddress() const { return Addr; }
368
369 void setAddress(Address address) { Addr = address; }
370
372 return Addr.getPointerAuthInfo();
373 }
374
375 // vector elt lvalue
377 assert(isVectorElt());
378 return Addr;
379 }
380 llvm::Value *getRawVectorPointer(CodeGenFunction &CGF) const {
381 assert(isVectorElt());
382 return Addr.emitRawPointer(CGF);
383 }
384 llvm::Value *getVectorPointer() const {
385 assert(isVectorElt());
386 return Addr.getBasePointer();
387 }
388 llvm::Value *getVectorIdx() const {
389 assert(isVectorElt());
390 return VectorIdx;
391 }
392
394 assert(isMatrixElt());
395 return Addr;
396 }
397 llvm::Value *getMatrixPointer() const {
398 assert(isMatrixElt());
399 return Addr.getBasePointer();
400 }
401 llvm::Value *getMatrixIdx() const {
402 assert(isMatrixElt());
403 return VectorIdx;
404 }
405
406 llvm::Value *getMatrixRowIdx() const {
407 assert(isMatrixRow());
408 return MatrixRowIdx;
409 }
410
411 // extended vector elements.
413 assert(isExtVectorElt());
414 return Addr;
415 }
416 llvm::Value *getRawExtVectorPointer(CodeGenFunction &CGF) const {
417 assert(isExtVectorElt());
418 return Addr.emitRawPointer(CGF);
419 }
420 llvm::Constant *getExtVectorElts() const {
421 assert(isExtVectorElt());
422 return VectorElts;
423 }
424
425 // bitfield lvalue
427 assert(isBitField());
428 return Addr;
429 }
430 llvm::Value *getRawBitFieldPointer(CodeGenFunction &CGF) const {
431 assert(isBitField());
432 return Addr.emitRawPointer(CGF);
433 }
434
436 assert(isBitField());
437 return *BitFieldInfo;
438 }
439
440 // global register lvalue
441 llvm::Value *getGlobalReg() const { assert(isGlobalReg()); return V; }
442
444 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo) {
445 LValue R;
446 R.LVType = Simple;
447 R.initializeSimpleLValue(Addr, type, BaseInfo, TBAAInfo, Context);
448 R.Addr = Addr;
449 assert(Addr.getType()->isPointerTy());
450 return R;
451 }
452
453 static LValue MakeVectorElt(Address vecAddress, llvm::Value *Idx,
454 QualType type, LValueBaseInfo BaseInfo,
455 TBAAAccessInfo TBAAInfo) {
456 LValue R;
457 R.LVType = VectorElt;
458 R.VectorIdx = Idx;
459 R.Initialize(type, type.getQualifiers(), vecAddress, BaseInfo, TBAAInfo);
460 return R;
461 }
462
463 static LValue MakeExtVectorElt(Address Addr, llvm::Constant *Elts,
464 QualType type, LValueBaseInfo BaseInfo,
465 TBAAAccessInfo TBAAInfo) {
466 LValue R;
467 R.LVType = ExtVectorElt;
468 R.VectorElts = Elts;
469 R.Initialize(type, type.getQualifiers(), Addr, BaseInfo, TBAAInfo);
470 return R;
471 }
472
473 /// Create a new object to represent a bit-field access.
474 ///
475 /// \param Addr - The base address of the bit-field sequence this
476 /// bit-field refers to.
477 /// \param Info - The information describing how to perform the bit-field
478 /// access.
480 QualType type, LValueBaseInfo BaseInfo,
481 TBAAAccessInfo TBAAInfo) {
482 LValue R;
483 R.LVType = BitField;
484 R.BitFieldInfo = &Info;
485 R.Initialize(type, type.getQualifiers(), Addr, BaseInfo, TBAAInfo);
486 return R;
487 }
488
489 static LValue MakeGlobalReg(llvm::Value *V, CharUnits alignment,
490 QualType type) {
491 LValue R;
492 R.LVType = GlobalReg;
493 R.Initialize(type, type.getQualifiers(), Address::invalid(),
495 R.V = V;
496 return R;
497 }
498
499 static LValue MakeMatrixRow(Address Addr, llvm::Value *RowIdx,
500 QualType MatrixTy, LValueBaseInfo BaseInfo,
501 TBAAAccessInfo TBAAInfo) {
502 LValue LV;
503 LV.LVType = MatrixRow;
504 LV.MatrixRowIdx = RowIdx; // store the row index here
505 LV.Initialize(MatrixTy, MatrixTy.getQualifiers(), Addr, BaseInfo, TBAAInfo);
506 return LV;
507 }
508
509 static LValue MakeMatrixElt(Address matAddress, llvm::Value *Idx,
510 QualType type, LValueBaseInfo BaseInfo,
511 TBAAAccessInfo TBAAInfo) {
512 LValue R;
513 R.LVType = MatrixElt;
514 R.VectorIdx = Idx;
515 R.Initialize(type, type.getQualifiers(), matAddress, BaseInfo, TBAAInfo);
516 return R;
517 }
518
522};
523
524/// An aggregate value slot.
525class AggValueSlot {
526 /// The address.
527 Address Addr;
528
529 // Qualifiers
530 Qualifiers Quals;
531
532 /// DestructedFlag - This is set to true if some external code is
533 /// responsible for setting up a destructor for the slot. Otherwise
534 /// the code which constructs it should push the appropriate cleanup.
535 bool DestructedFlag : 1;
536
537 /// ObjCGCFlag - This is set to true if writing to the memory in the
538 /// slot might require calling an appropriate Objective-C GC
539 /// barrier. The exact interaction here is unnecessarily mysterious.
540 bool ObjCGCFlag : 1;
541
542 /// ZeroedFlag - This is set to true if the memory in the slot is
543 /// known to be zero before the assignment into it. This means that
544 /// zero fields don't need to be set.
545 bool ZeroedFlag : 1;
546
547 /// AliasedFlag - This is set to true if the slot might be aliased
548 /// and it's not undefined behavior to access it through such an
549 /// alias. Note that it's always undefined behavior to access a C++
550 /// object that's under construction through an alias derived from
551 /// outside the construction process.
552 ///
553 /// This flag controls whether calls that produce the aggregate
554 /// value may be evaluated directly into the slot, or whether they
555 /// must be evaluated into an unaliased temporary and then memcpy'ed
556 /// over. Since it's invalid in general to memcpy a non-POD C++
557 /// object, it's important that this flag never be set when
558 /// evaluating an expression which constructs such an object.
559 bool AliasedFlag : 1;
560
561 /// This is set to true if the tail padding of this slot might overlap
562 /// another object that may have already been initialized (and whose
563 /// value must be preserved by this initialization). If so, we may only
564 /// store up to the dsize of the type. Otherwise we can widen stores to
565 /// the size of the type.
566 bool OverlapFlag : 1;
567
568 /// If is set to true, sanitizer checks are already generated for this address
569 /// or not required. For instance, if this address represents an object
570 /// created in 'new' expression, sanitizer checks for memory is made as a part
571 /// of 'operator new' emission and object constructor should not generate
572 /// them.
573 bool SanitizerCheckedFlag : 1;
574
575 AggValueSlot(Address Addr, Qualifiers Quals, bool DestructedFlag,
576 bool ObjCGCFlag, bool ZeroedFlag, bool AliasedFlag,
577 bool OverlapFlag, bool SanitizerCheckedFlag)
578 : Addr(Addr), Quals(Quals), DestructedFlag(DestructedFlag),
579 ObjCGCFlag(ObjCGCFlag), ZeroedFlag(ZeroedFlag),
580 AliasedFlag(AliasedFlag), OverlapFlag(OverlapFlag),
581 SanitizerCheckedFlag(SanitizerCheckedFlag) {}
582
583public:
590
591 /// ignored - Returns an aggregate value slot indicating that the
592 /// aggregate value is being ignored.
597
598 /// forAddr - Make a slot for an aggregate value.
599 ///
600 /// \param quals - The qualifiers that dictate how the slot should
601 /// be initialied. Only 'volatile' and the Objective-C lifetime
602 /// qualifiers matter.
603 ///
604 /// \param isDestructed - true if something else is responsible
605 /// for calling destructors on this object
606 /// \param needsGC - true if the slot is potentially located
607 /// somewhere that ObjC GC calls should be emitted for
608 static AggValueSlot forAddr(Address addr,
609 Qualifiers quals,
610 IsDestructed_t isDestructed,
611 NeedsGCBarriers_t needsGC,
612 IsAliased_t isAliased,
616 if (addr.isValid())
617 addr.setKnownNonNull();
618 return AggValueSlot(addr, quals, isDestructed, needsGC, isZeroed, isAliased,
619 mayOverlap, isChecked);
620 }
621
622 static AggValueSlot
623 forLValue(const LValue &LV, IsDestructed_t isDestructed,
624 NeedsGCBarriers_t needsGC, IsAliased_t isAliased,
627 return forAddr(LV.getAddress(), LV.getQuals(), isDestructed, needsGC,
628 isAliased, mayOverlap, isZeroed, isChecked);
629 }
630
632 return IsDestructed_t(DestructedFlag);
633 }
634 void setExternallyDestructed(bool destructed = true) {
635 DestructedFlag = destructed;
636 }
637
638 Qualifiers getQualifiers() const { return Quals; }
639
640 bool isVolatile() const {
641 return Quals.hasVolatile();
642 }
643
644 void setVolatile(bool flag) {
645 if (flag)
646 Quals.addVolatile();
647 else
648 Quals.removeVolatile();
649 }
650
652 return Quals.getObjCLifetime();
653 }
654
656 return NeedsGCBarriers_t(ObjCGCFlag);
657 }
658
659 llvm::Value *getPointer(QualType PointeeTy, CodeGenFunction &CGF) const;
660
661 llvm::Value *emitRawPointer(CodeGenFunction &CGF) const {
662 return Addr.isValid() ? Addr.emitRawPointer(CGF) : nullptr;
663 }
664
666 return Addr;
667 }
668
669 bool isIgnored() const { return !Addr.isValid(); }
670
672 return Addr.getAlignment();
673 }
674
676 return IsAliased_t(AliasedFlag);
677 }
678
680 return Overlap_t(OverlapFlag);
681 }
682
683 bool isSanitizerChecked() const {
684 return SanitizerCheckedFlag;
685 }
686
687 RValue asRValue() const {
688 if (isIgnored()) {
689 return RValue::getIgnored();
690 } else {
692 }
693 }
694
695 void setZeroed(bool V = true) { ZeroedFlag = V; }
697 return IsZeroed_t(ZeroedFlag);
698 }
699
700 /// Get the preferred size to use when storing a value to this slot. This
701 /// is the type size unless that might overlap another object, in which
702 /// case it's the dsize.
707};
708
709} // end namespace CodeGen
710} // end namespace clang
711
712#endif
Defines the clang::ASTContext interface.
#define V(N, I)
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
CharUnits - This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
bool isZero() const
isZero - Test whether the quantity equals zero.
Definition CharUnits.h:122
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition CharUnits.h:185
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition CharUnits.h:63
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
Definition Address.h:128
llvm::Value * getBasePointer() const
Definition Address.h:198
static Address invalid()
Definition Address.h:176
Address setKnownNonNull()
Definition Address.h:238
bool isValid() const
Definition Address.h:177
An aggregate value slot.
Definition CGValue.h:525
void setVolatile(bool flag)
Definition CGValue.h:644
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored.
Definition CGValue.h:593
bool isSanitizerChecked() const
Definition CGValue.h:683
Address getAddress() const
Definition CGValue.h:665
CharUnits getPreferredSize(ASTContext &Ctx, QualType Type) const
Get the preferred size to use when storing a value to this slot.
Definition CGValue.h:703
CharUnits getAlignment() const
Definition CGValue.h:671
NeedsGCBarriers_t requiresGCollection() const
Definition CGValue.h:655
void setExternallyDestructed(bool destructed=true)
Definition CGValue.h:634
void setZeroed(bool V=true)
Definition CGValue.h:695
llvm::Value * getPointer(QualType PointeeTy, CodeGenFunction &CGF) const
IsZeroed_t isZeroed() const
Definition CGValue.h:696
Qualifiers getQualifiers() const
Definition CGValue.h:638
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
Definition CGValue.h:623
IsAliased_t isPotentiallyAliased() const
Definition CGValue.h:675
Qualifiers::ObjCLifetime getObjCLifetime() const
Definition CGValue.h:651
static AggValueSlot forAddr(Address addr, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
forAddr - Make a slot for an aggregate value.
Definition CGValue.h:608
IsDestructed_t isExternallyDestructed() const
Definition CGValue.h:631
Overlap_t mayOverlap() const
Definition CGValue.h:679
RValue asRValue() const
Definition CGValue.h:687
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Definition CGValue.h:661
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void setAlignmentSource(AlignmentSource Source)
Definition CGValue.h:173
void mergeForCast(const LValueBaseInfo &Info)
Definition CGValue.h:175
AlignmentSource getAlignmentSource() const
Definition CGValue.h:172
LValueBaseInfo(AlignmentSource Source=AlignmentSource::Type)
Definition CGValue.h:170
LValue - This represents an lvalue references.
Definition CGValue.h:183
llvm::Value * getMatrixRowIdx() const
Definition CGValue.h:406
static LValue MakeMatrixRow(Address Addr, llvm::Value *RowIdx, QualType MatrixTy, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Definition CGValue.h:499
llvm::Value * getRawExtVectorPointer(CodeGenFunction &CGF) const
Definition CGValue.h:416
bool isBitField() const
Definition CGValue.h:285
bool isMatrixElt() const
Definition CGValue.h:288
Expr * getBaseIvarExp() const
Definition CGValue.h:338
llvm::Value * emitResignedPointer(QualType PointeeTy, CodeGenFunction &CGF) const
llvm::Constant * getExtVectorElts() const
Definition CGValue.h:420
static LValue MakeGlobalReg(llvm::Value *V, CharUnits alignment, QualType type)
Definition CGValue.h:489
void setObjCIvar(bool Value)
Definition CGValue.h:304
bool isObjCArray() const
Definition CGValue.h:306
bool isObjCStrong() const
Definition CGValue.h:330
bool isRestrictQualified() const
Definition CGValue.h:292
void setAlignment(CharUnits A)
Definition CGValue.h:350
bool isGlobalObjCRef() const
Definition CGValue.h:312
bool isVectorElt() const
Definition CGValue.h:284
void setObjCArray(bool Value)
Definition CGValue.h:307
bool isSimple() const
Definition CGValue.h:283
llvm::Value * getMatrixPointer() const
Definition CGValue.h:397
bool isVolatileQualified() const
Definition CGValue.h:291
llvm::Constant * VectorElts
Definition CGValue.h:207
llvm::Value * getRawBitFieldPointer(CodeGenFunction &CGF) const
Definition CGValue.h:430
RValue asAggregateRValue() const
Definition CGValue.h:519
void setTBAAInfo(TBAAAccessInfo Info)
Definition CGValue.h:342
LangAS getAddressSpace() const
Definition CGValue.h:347
CharUnits getAlignment() const
Definition CGValue.h:349
llvm::Value * getPointer(CodeGenFunction &CGF) const
llvm::Value * getMatrixIdx() const
Definition CGValue.h:401
llvm::Value * getGlobalReg() const
Definition CGValue.h:441
static LValue MakeAddr(Address Addr, QualType type, ASTContext &Context, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Definition CGValue.h:443
bool isVolatile() const
Definition CGValue.h:334
const Qualifiers & getQuals() const
Definition CGValue.h:344
bool isGlobalReg() const
Definition CGValue.h:287
static LValue MakeExtVectorElt(Address Addr, llvm::Constant *Elts, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Definition CGValue.h:463
llvm::Value * getVectorPointer() const
Definition CGValue.h:384
bool isObjCWeak() const
Definition CGValue.h:327
Address getAddress() const
Definition CGValue.h:367
unsigned getVRQualifiers() const
Definition CGValue.h:293
Qualifiers & getQuals()
Definition CGValue.h:345
bool isMatrixRow() const
Definition CGValue.h:289
void setThreadLocalRef(bool Value)
Definition CGValue.h:316
const CGBitFieldInfo * BitFieldInfo
Definition CGValue.h:210
LValue setKnownNonNull()
Definition CGValue.h:356
bool isNonGC() const
Definition CGValue.h:309
llvm::Value * MatrixRowIdx
Definition CGValue.h:204
void setGlobalObjCRef(bool Value)
Definition CGValue.h:313
llvm::Value * getRawVectorPointer(CodeGenFunction &CGF) const
Definition CGValue.h:380
bool isExtVectorElt() const
Definition CGValue.h:286
llvm::Value * getVectorIdx() const
Definition CGValue.h:388
void setNontemporal(bool Value)
Definition CGValue.h:325
LValueBaseInfo getBaseInfo() const
Definition CGValue.h:352
ARCPreciseLifetime_t isARCPreciseLifetime() const
Definition CGValue.h:318
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
Definition CGValue.h:321
QualType getType() const
Definition CGValue.h:297
const CGBitFieldInfo & getBitFieldInfo() const
Definition CGValue.h:435
CGPointerAuthInfo getPointerAuthInfo() const
Definition CGValue.h:371
bool isThreadLocalRef() const
Definition CGValue.h:315
KnownNonNull_t isKnownNonNull() const
Definition CGValue.h:355
TBAAAccessInfo getTBAAInfo() const
Definition CGValue.h:341
void setNonGC(bool Value)
Definition CGValue.h:310
llvm::Value * V
Definition CGValue.h:196
void setBaseInfo(LValueBaseInfo Info)
Definition CGValue.h:353
Address getVectorAddress() const
Definition CGValue.h:376
bool isNontemporal() const
Definition CGValue.h:324
static LValue MakeBitfield(Address Addr, const CGBitFieldInfo &Info, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Create a new object to represent a bit-field access.
Definition CGValue.h:479
bool isObjCIvar() const
Definition CGValue.h:303
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
static LValue MakeVectorElt(Address vecAddress, llvm::Value *Idx, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Definition CGValue.h:453
void setAddress(Address address)
Definition CGValue.h:369
Qualifiers::ObjCLifetime getObjCLifetime() const
Definition CGValue.h:299
void setBaseIvarExp(Expr *V)
Definition CGValue.h:339
Address getExtVectorAddress() const
Definition CGValue.h:412
llvm::Value * VectorIdx
Definition CGValue.h:201
static LValue MakeMatrixElt(Address matAddress, llvm::Value *Idx, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Definition CGValue.h:509
Address getMatrixAddress() const
Definition CGValue.h:393
Address getBitFieldAddress() const
Definition CGValue.h:426
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
Definition CGValue.h:42
llvm::Value * getAggregatePointer(QualType PointeeType, CodeGenFunction &CGF) const
Definition CGValue.h:89
bool isScalar() const
Definition CGValue.h:64
static RValue getIgnored()
Definition CGValue.h:94
static RValue get(llvm::Value *V)
Definition CGValue.h:99
static RValue get(Address Addr, CodeGenFunction &CGF)
Definition CGValue.h:106
static RValue getComplex(const std::pair< llvm::Value *, llvm::Value * > &C)
Definition CGValue.h:116
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
Definition CGValue.h:126
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
Definition CGValue.h:109
struct clang::CodeGen::RValue::@377313303130300032223230221113302037235375040355::@177233336262150053115237272127353314357374062335 Vals
bool isAggregate() const
Definition CGValue.h:66
bool isIgnored() const
Definition CGValue.h:67
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
Definition CGValue.h:84
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
Definition CGValue.h:72
llvm::Value * second
Definition CGValue.h:51
bool isComplex() const
Definition CGValue.h:65
bool isVolatileQualified() const
Definition CGValue.h:69
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
Definition CGValue.h:79
llvm::Value * first
Definition CGValue.h:50
This represents one expression.
Definition Expr.h:112
A (possibly-)qualified type.
Definition TypeBase.h:937
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Definition TypeBase.h:8333
The collection of all-type qualifiers we support.
Definition TypeBase.h:331
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
Definition CGValue.h:142
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
Definition CGValue.h:151
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
Definition CGValue.h:155
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
Definition CGValue.h:146
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
Definition CGValue.h:136
@ ARCImpreciseLifetime
Definition CGValue.h:137
static AlignmentSource getFieldAlignmentSource(AlignmentSource Source)
Given that the base address has the given alignment source, what's our confidence in the alignment of...
Definition CGValue.h:160
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
LangAS
Defines the address space values used by the address space qualifier of QualType.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
Structure with information about how a bitfield should be accessed.
A metaprogramming class for ensuring that a value will dominate an arbitrary position in a function.