clang  6.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  bool MayAlias;
153 
154 public:
155  explicit LValueBaseInfo(AlignmentSource Source = AlignmentSource::Type,
156  bool Alias = false)
157  : AlignSource(Source), MayAlias(Alias) {}
158  AlignmentSource getAlignmentSource() const { return AlignSource; }
159  void setAlignmentSource(AlignmentSource Source) { AlignSource = Source; }
160  bool getMayAlias() const { return MayAlias; }
161  void setMayAlias(bool Alias) { MayAlias = Alias; }
162 
163  void mergeForCast(const LValueBaseInfo &Info) {
164  setAlignmentSource(Info.getAlignmentSource());
165  setMayAlias(getMayAlias() || Info.getMayAlias());
166  }
167 };
168 
169 /// LValue - This represents an lvalue references. Because C/C++ allow
170 /// bitfields, this is not a simple LLVM pointer, it may be a pointer plus a
171 /// bitrange.
172 class LValue {
173  enum {
174  Simple, // This is a normal l-value, use getAddress().
175  VectorElt, // This is a vector element l-value (V[i]), use getVector*
176  BitField, // This is a bitfield l-value, use getBitfield*.
177  ExtVectorElt, // This is an extended vector subset, use getExtVectorComp
178  GlobalReg // This is a register l-value, use getGlobalReg()
179  } LVType;
180 
181  llvm::Value *V;
182 
183  union {
184  // Index into a vector subscript: V[i]
186 
187  // ExtVector element subset: V.xyx
188  llvm::Constant *VectorElts;
189 
190  // BitField start bit and size
192  };
193 
194  QualType Type;
195 
196  // 'const' is unused here
197  Qualifiers Quals;
198 
199  // The alignment to use when accessing this lvalue. (For vector elements,
200  // this is the alignment of the whole vector.)
201  int64_t Alignment;
202 
203  // objective-c's ivar
204  bool Ivar:1;
205 
206  // objective-c's ivar is an array
207  bool ObjIsArray:1;
208 
209  // LValue is non-gc'able for any reason, including being a parameter or local
210  // variable.
211  bool NonGC: 1;
212 
213  // Lvalue is a global reference of an objective-c object
214  bool GlobalObjCRef : 1;
215 
216  // Lvalue is a thread local reference
217  bool ThreadLocalRef : 1;
218 
219  // Lvalue has ARC imprecise lifetime. We store this inverted to try
220  // to make the default bitfield pattern all-zeroes.
221  bool ImpreciseLifetime : 1;
222 
223  LValueBaseInfo BaseInfo;
224  TBAAAccessInfo TBAAInfo;
225 
226  // This flag shows if a nontemporal load/stores should be used when accessing
227  // this lvalue.
228  bool Nontemporal : 1;
229 
230  Expr *BaseIvarExp;
231 
232 private:
233  void Initialize(QualType Type, Qualifiers Quals, CharUnits Alignment,
234  LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo) {
235  assert((!Alignment.isZero() || Type->isIncompleteType()) &&
236  "initializing l-value with zero alignment!");
237  this->Type = Type;
238  this->Quals = Quals;
239  this->Alignment = Alignment.getQuantity();
240  assert(this->Alignment == Alignment.getQuantity() &&
241  "Alignment exceeds allowed max!");
242  this->BaseInfo = BaseInfo;
243  this->TBAAInfo = TBAAInfo;
244 
245  // Initialize Objective-C flags.
246  this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef = false;
247  this->ImpreciseLifetime = false;
248  this->Nontemporal = false;
249  this->ThreadLocalRef = false;
250  this->BaseIvarExp = nullptr;
251  }
252 
253 public:
254  bool isSimple() const { return LVType == Simple; }
255  bool isVectorElt() const { return LVType == VectorElt; }
256  bool isBitField() const { return LVType == BitField; }
257  bool isExtVectorElt() const { return LVType == ExtVectorElt; }
258  bool isGlobalReg() const { return LVType == GlobalReg; }
259 
260  bool isVolatileQualified() const { return Quals.hasVolatile(); }
261  bool isRestrictQualified() const { return Quals.hasRestrict(); }
262  unsigned getVRQualifiers() const {
263  return Quals.getCVRQualifiers() & ~Qualifiers::Const;
264  }
265 
266  QualType getType() const { return Type; }
267 
269  return Quals.getObjCLifetime();
270  }
271 
272  bool isObjCIvar() const { return Ivar; }
273  void setObjCIvar(bool Value) { Ivar = Value; }
274 
275  bool isObjCArray() const { return ObjIsArray; }
276  void setObjCArray(bool Value) { ObjIsArray = Value; }
277 
278  bool isNonGC () const { return NonGC; }
279  void setNonGC(bool Value) { NonGC = Value; }
280 
281  bool isGlobalObjCRef() const { return GlobalObjCRef; }
282  void setGlobalObjCRef(bool Value) { GlobalObjCRef = Value; }
283 
284  bool isThreadLocalRef() const { return ThreadLocalRef; }
285  void setThreadLocalRef(bool Value) { ThreadLocalRef = Value;}
286 
288  return ARCPreciseLifetime_t(!ImpreciseLifetime);
289  }
291  ImpreciseLifetime = (value == ARCImpreciseLifetime);
292  }
293  bool isNontemporal() const { return Nontemporal; }
294  void setNontemporal(bool Value) { Nontemporal = Value; }
295 
296  bool isObjCWeak() const {
297  return Quals.getObjCGCAttr() == Qualifiers::Weak;
298  }
299  bool isObjCStrong() const {
300  return Quals.getObjCGCAttr() == Qualifiers::Strong;
301  }
302 
303  bool isVolatile() const {
304  return Quals.hasVolatile();
305  }
306 
307  Expr *getBaseIvarExp() const { return BaseIvarExp; }
308  void setBaseIvarExp(Expr *V) { BaseIvarExp = V; }
309 
310  TBAAAccessInfo getTBAAInfo() const { return TBAAInfo; }
311  void setTBAAInfo(TBAAAccessInfo Info) { TBAAInfo = Info; }
312 
313  const Qualifiers &getQuals() const { return Quals; }
314  Qualifiers &getQuals() { return Quals; }
315 
316  LangAS getAddressSpace() const { return Quals.getAddressSpace(); }
317 
318  CharUnits getAlignment() const { return CharUnits::fromQuantity(Alignment); }
319  void setAlignment(CharUnits A) { Alignment = A.getQuantity(); }
320 
321  LValueBaseInfo getBaseInfo() const { return BaseInfo; }
322  void setBaseInfo(LValueBaseInfo Info) { BaseInfo = Info; }
323 
324  // simple lvalue
326  assert(isSimple());
327  return V;
328  }
329  Address getAddress() const { return Address(getPointer(), getAlignment()); }
330  void setAddress(Address address) {
331  assert(isSimple());
332  V = address.getPointer();
333  Alignment = address.getAlignment().getQuantity();
334  }
335 
336  // vector elt lvalue
338  return Address(getVectorPointer(), getAlignment());
339  }
340  llvm::Value *getVectorPointer() const { assert(isVectorElt()); return V; }
341  llvm::Value *getVectorIdx() const { assert(isVectorElt()); return VectorIdx; }
342 
343  // extended vector elements.
345  return Address(getExtVectorPointer(), getAlignment());
346  }
348  assert(isExtVectorElt());
349  return V;
350  }
351  llvm::Constant *getExtVectorElts() const {
352  assert(isExtVectorElt());
353  return VectorElts;
354  }
355 
356  // bitfield lvalue
358  return Address(getBitFieldPointer(), getAlignment());
359  }
360  llvm::Value *getBitFieldPointer() const { assert(isBitField()); return V; }
362  assert(isBitField());
363  return *BitFieldInfo;
364  }
365 
366  // global register lvalue
367  llvm::Value *getGlobalReg() const { assert(isGlobalReg()); return V; }
368 
369  static LValue MakeAddr(Address address, QualType type, ASTContext &Context,
370  LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo) {
371  Qualifiers qs = type.getQualifiers();
372  qs.setObjCGCAttr(Context.getObjCGCAttrKind(type));
373 
374  LValue R;
375  R.LVType = Simple;
376  assert(address.getPointer()->getType()->isPointerTy());
377  R.V = address.getPointer();
378  R.Initialize(type, qs, address.getAlignment(), BaseInfo, TBAAInfo);
379  return R;
380  }
381 
382  static LValue MakeVectorElt(Address vecAddress, llvm::Value *Idx,
383  QualType type, LValueBaseInfo BaseInfo,
384  TBAAAccessInfo TBAAInfo) {
385  LValue R;
386  R.LVType = VectorElt;
387  R.V = vecAddress.getPointer();
388  R.VectorIdx = Idx;
389  R.Initialize(type, type.getQualifiers(), vecAddress.getAlignment(),
390  BaseInfo, TBAAInfo);
391  return R;
392  }
393 
394  static LValue MakeExtVectorElt(Address vecAddress, llvm::Constant *Elts,
395  QualType type, LValueBaseInfo BaseInfo,
396  TBAAAccessInfo TBAAInfo) {
397  LValue R;
398  R.LVType = ExtVectorElt;
399  R.V = vecAddress.getPointer();
400  R.VectorElts = Elts;
401  R.Initialize(type, type.getQualifiers(), vecAddress.getAlignment(),
402  BaseInfo, TBAAInfo);
403  return R;
404  }
405 
406  /// \brief Create a new object to represent a bit-field access.
407  ///
408  /// \param Addr - The base address of the bit-field sequence this
409  /// bit-field refers to.
410  /// \param Info - The information describing how to perform the bit-field
411  /// access.
412  static LValue MakeBitfield(Address Addr, const CGBitFieldInfo &Info,
413  QualType type, LValueBaseInfo BaseInfo,
414  TBAAAccessInfo TBAAInfo) {
415  LValue R;
416  R.LVType = BitField;
417  R.V = Addr.getPointer();
418  R.BitFieldInfo = &Info;
419  R.Initialize(type, type.getQualifiers(), Addr.getAlignment(), BaseInfo,
420  TBAAInfo);
421  return R;
422  }
423 
425  LValue R;
426  R.LVType = GlobalReg;
427  R.V = Reg.getPointer();
428  R.Initialize(type, type.getQualifiers(), Reg.getAlignment(),
429  LValueBaseInfo(AlignmentSource::Decl, false),
430  TBAAAccessInfo());
431  return R;
432  }
433 
435  return RValue::getAggregate(getAddress(), isVolatileQualified());
436  }
437 };
438 
439 /// An aggregate value slot.
441  /// The address.
442  llvm::Value *Addr;
443 
444  // Qualifiers
445  Qualifiers Quals;
446 
447  unsigned Alignment;
448 
449  /// DestructedFlag - This is set to true if some external code is
450  /// responsible for setting up a destructor for the slot. Otherwise
451  /// the code which constructs it should push the appropriate cleanup.
452  bool DestructedFlag : 1;
453 
454  /// ObjCGCFlag - This is set to true if writing to the memory in the
455  /// slot might require calling an appropriate Objective-C GC
456  /// barrier. The exact interaction here is unnecessarily mysterious.
457  bool ObjCGCFlag : 1;
458 
459  /// ZeroedFlag - This is set to true if the memory in the slot is
460  /// known to be zero before the assignment into it. This means that
461  /// zero fields don't need to be set.
462  bool ZeroedFlag : 1;
463 
464  /// AliasedFlag - This is set to true if the slot might be aliased
465  /// and it's not undefined behavior to access it through such an
466  /// alias. Note that it's always undefined behavior to access a C++
467  /// object that's under construction through an alias derived from
468  /// outside the construction process.
469  ///
470  /// This flag controls whether calls that produce the aggregate
471  /// value may be evaluated directly into the slot, or whether they
472  /// must be evaluated into an unaliased temporary and then memcpy'ed
473  /// over. Since it's invalid in general to memcpy a non-POD C++
474  /// object, it's important that this flag never be set when
475  /// evaluating an expression which constructs such an object.
476  bool AliasedFlag : 1;
477 
478 public:
479  enum IsAliased_t { IsNotAliased, IsAliased };
480  enum IsDestructed_t { IsNotDestructed, IsDestructed };
481  enum IsZeroed_t { IsNotZeroed, IsZeroed };
482  enum NeedsGCBarriers_t { DoesNotNeedGCBarriers, NeedsGCBarriers };
483 
484  /// ignored - Returns an aggregate value slot indicating that the
485  /// aggregate value is being ignored.
487  return forAddr(Address::invalid(), Qualifiers(), IsNotDestructed,
488  DoesNotNeedGCBarriers, IsNotAliased);
489  }
490 
491  /// forAddr - Make a slot for an aggregate value.
492  ///
493  /// \param quals - The qualifiers that dictate how the slot should
494  /// be initialied. Only 'volatile' and the Objective-C lifetime
495  /// qualifiers matter.
496  ///
497  /// \param isDestructed - true if something else is responsible
498  /// for calling destructors on this object
499  /// \param needsGC - true if the slot is potentially located
500  /// somewhere that ObjC GC calls should be emitted for
502  Qualifiers quals,
503  IsDestructed_t isDestructed,
504  NeedsGCBarriers_t needsGC,
505  IsAliased_t isAliased,
506  IsZeroed_t isZeroed = IsNotZeroed) {
507  AggValueSlot AV;
508  if (addr.isValid()) {
509  AV.Addr = addr.getPointer();
510  AV.Alignment = addr.getAlignment().getQuantity();
511  } else {
512  AV.Addr = nullptr;
513  AV.Alignment = 0;
514  }
515  AV.Quals = quals;
516  AV.DestructedFlag = isDestructed;
517  AV.ObjCGCFlag = needsGC;
518  AV.ZeroedFlag = isZeroed;
519  AV.AliasedFlag = isAliased;
520  return AV;
521  }
522 
523  static AggValueSlot forLValue(const LValue &LV,
524  IsDestructed_t isDestructed,
525  NeedsGCBarriers_t needsGC,
526  IsAliased_t isAliased,
527  IsZeroed_t isZeroed = IsNotZeroed) {
528  return forAddr(LV.getAddress(),
529  LV.getQuals(), isDestructed, needsGC, isAliased, isZeroed);
530  }
531 
533  return IsDestructed_t(DestructedFlag);
534  }
535  void setExternallyDestructed(bool destructed = true) {
536  DestructedFlag = destructed;
537  }
538 
539  Qualifiers getQualifiers() const { return Quals; }
540 
541  bool isVolatile() const {
542  return Quals.hasVolatile();
543  }
544 
545  void setVolatile(bool flag) {
546  Quals.setVolatile(flag);
547  }
548 
550  return Quals.getObjCLifetime();
551  }
552 
554  return NeedsGCBarriers_t(ObjCGCFlag);
555  }
556 
558  return Addr;
559  }
560 
561  Address getAddress() const {
562  return Address(Addr, getAlignment());
563  }
564 
565  bool isIgnored() const {
566  return Addr == nullptr;
567  }
568 
570  return CharUnits::fromQuantity(Alignment);
571  }
572 
574  return IsAliased_t(AliasedFlag);
575  }
576 
577  RValue asRValue() const {
578  if (isIgnored()) {
579  return RValue::getIgnored();
580  } else {
581  return RValue::getAggregate(getAddress(), isVolatile());
582  }
583  }
584 
585  void setZeroed(bool V = true) { ZeroedFlag = V; }
587  return IsZeroed_t(ZeroedFlag);
588  }
589 };
590 
591 } // end namespace CodeGen
592 } // end namespace clang
593 
594 #endif
bool isAggregate() const
Definition: CGValue.h:54
llvm::Value * getVectorPointer() const
Definition: CGValue.h:340
Defines the clang::ASTContext interface.
Address getAddress() const
Definition: CGValue.h:561
A (possibly-)qualified type.
Definition: Type.h:614
void setAlignmentSource(AlignmentSource Source)
Definition: CGValue.h:159
llvm::Value * getGlobalReg() const
Definition: CGValue.h:367
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
Definition: CGValue.h:126
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
Definition: CGValue.h:523
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:26
void setAlignment(CharUnits A)
Definition: CGValue.h:319
NeedsGCBarriers_t requiresGCollection() const
Definition: CGValue.h:553
C Language Family Type Representation.
llvm::Value * getPointer() const
Definition: CGValue.h:557
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:81
bool isVolatile() const
Definition: CGValue.h:303
The base class of the type hierarchy.
Definition: Type.h:1300
void setObjCGCAttr(GC type)
Definition: Type.h:285
bool isZero() const
isZero - Test whether the quantity equals zero.
Definition: CharUnits.h:116
void setZeroed(bool V=true)
Definition: CGValue.h:585
IsAliased_t isPotentiallyAliased() const
Definition: CGValue.h:573
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:382
IsZeroed_t isZeroed() const
Definition: CGValue.h:586
llvm::Value * getPointer() const
Definition: Address.h:38
The collection of all-type qualifiers we support.
Definition: Type.h:116
llvm::Value * VectorIdx
Definition: CGValue.h:185
Qualifiers::ObjCLifetime getObjCLifetime() const
Definition: CGValue.h:549
IsDestructed_t isExternallyDestructed() const
Definition: CGValue.h:532
bool isObjCIvar() const
Definition: CGValue.h:272
Address getAddress() const
Definition: CGValue.h:329
bool isRestrictQualified() const
Definition: CGValue.h:261
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:128
bool isVolatileQualified() const
Definition: CGValue.h:260
CharUnits getAlignment() const
Definition: CGValue.h:318
Qualifiers::ObjCLifetime getObjCLifetime() const
Definition: CGValue.h:268
void setBaseIvarExp(Expr *V)
Definition: CGValue.h:308
void setNonGC(bool Value)
Definition: CGValue.h:279
ARCPreciseLifetime_t isARCPreciseLifetime() const
Definition: CGValue.h:287
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:281
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:394
const CGBitFieldInfo * BitFieldInfo
Definition: CGValue.h:191
bool isComplex() const
Definition: CGValue.h:53
LangAS getAddressSpace() const
Definition: Type.h:331
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:296
bool isSimple() const
Definition: CGValue.h:254
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
Definition: CGValue.h:290
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
Definition: CGValue.h:71
void setThreadLocalRef(bool Value)
Definition: CGValue.h:285
bool isVectorElt() const
Definition: CGValue.h:255
bool isValid() const
Definition: Address.h:36
LValueBaseInfo getBaseInfo() const
Definition: CGValue.h:321
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:344
void setAddress(Address address)
Definition: CGValue.h:330
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
Expr - This represents one expression.
Definition: Expr.h:106
Qualifiers getQualifiers() const
Definition: CGValue.h:539
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:276
llvm::Constant * VectorElts
Definition: CGValue.h:188
void setMayAlias(bool Alias)
Definition: CGValue.h:161
ObjCLifetime getObjCLifetime() const
Definition: Type.h:305
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:412
TBAAAccessInfo getTBAAInfo() const
Definition: CGValue.h:310
const Qualifiers & getQuals() const
Definition: CGValue.h:313
bool isObjCStrong() const
Definition: CGValue.h:299
static AggValueSlot forAddr(Address addr, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
forAddr - Make a slot for an aggregate value.
Definition: CGValue.h:501
__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:569
bool isThreadLocalRef() const
Definition: CGValue.h:284
LValueBaseInfo(AlignmentSource Source=AlignmentSource::Type, bool Alias=false)
Definition: CGValue.h:155
void setVolatile(bool flag)
Definition: Type.h:241
void setBaseInfo(LValueBaseInfo Info)
Definition: CGValue.h:322
static RValue getIgnored()
Definition: CGValue.h:81
Expr * getBaseIvarExp() const
Definition: CGValue.h:307
const CGBitFieldInfo & getBitFieldInfo() const
Definition: CGValue.h:361
An aggregate value slot.
Definition: CGValue.h:440
bool isNontemporal() const
Definition: CGValue.h:293
bool hasRestrict() const
Definition: Type.h:247
An aligned address.
Definition: Address.h:25
void setObjCIvar(bool Value)
Definition: CGValue.h:273
Address getVectorAddress() const
Definition: CGValue.h:337
bool isNonGC() const
Definition: CGValue.h:278
QualType getType() const
Definition: CGValue.h:266
void setExternallyDestructed(bool destructed=true)
Definition: CGValue.h:535
Qualifiers & getQuals()
Definition: CGValue.h:314
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
Definition: CGValue.h:59
void setVolatile(bool flag)
Definition: CGValue.h:545
GC getObjCGCAttr() const
Definition: Type.h:284
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:486
bool isBitField() const
Definition: CGValue.h:256
llvm::Value * getExtVectorPointer() const
Definition: CGValue.h:347
AlignmentSource getAlignmentSource() const
Definition: CGValue.h:158
bool isVolatileQualified() const
Definition: CGValue.h:56
Address getBitFieldAddress() const
Definition: CGValue.h:357
llvm::Value * getAggregatePointer() const
Definition: CGValue.h:76
void setGlobalObjCRef(bool Value)
Definition: CGValue.h:282
void setNontemporal(bool Value)
Definition: CGValue.h:294
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
Definition: CGValue.h:120
RValue asAggregateRValue() const
Definition: CGValue.h:434
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
Definition: Type.cpp:1951
LangAS getAddressSpace() const
Definition: CGValue.h:316
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:3892
llvm::Value * getBitFieldPointer() const
Definition: CGValue.h:360
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Definition: Type.h:5570
unsigned getVRQualifiers() const
Definition: CGValue.h:262
bool isObjCArray() const
Definition: CGValue.h:275
unsigned getCVRQualifiers() const
Definition: Type.h:255
bool hasVolatile() const
Definition: Type.h:240
bool isGlobalReg() const
Definition: CGValue.h:258
static LValue MakeGlobalReg(Address Reg, QualType type)
Definition: CGValue.h:424
bool isExtVectorElt() const
Definition: CGValue.h:257
static RValue getAggregate(Address addr, bool isVolatile=false)
Definition: CGValue.h:107
LValue - This represents an lvalue references.
Definition: CGValue.h:172
RValue asRValue() const
Definition: CGValue.h:577
void setTBAAInfo(TBAAAccessInfo Info)
Definition: CGValue.h:311
static LValue MakeAddr(Address address, QualType type, ASTContext &Context, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Definition: CGValue.h:369
llvm::Value * getVectorIdx() const
Definition: CGValue.h:341
llvm::Value * getPointer() const
Definition: CGValue.h:325
bool isScalar() const
Definition: CGValue.h:52
void mergeForCast(const LValueBaseInfo &Info)
Definition: CGValue.h:163
llvm::Constant * getExtVectorElts() const
Definition: CGValue.h:351
Structure with information about how a bitfield should be accessed.