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