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