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