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