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