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