15 #ifndef LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
16 #define LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
20 #include "llvm/IR/Value.h"
21 #include "llvm/IR/Type.h"
32 struct CGBitFieldInfo;
39 enum Flavor { Scalar, Complex, Aggregate };
43 enum { AggAlignShift = 4 };
46 llvm::PointerIntPair<llvm::Value *, 2, Flavor> V1;
48 llvm::PointerIntPair<llvm::Value *, 1, bool> V2;
51 bool isScalar()
const {
return V1.getInt() == Scalar; }
52 bool isComplex()
const {
return V1.getInt() == Complex; }
59 assert(
isScalar() &&
"Not a scalar!");
60 return V1.getPointer();
66 return std::make_pair(V1.getPointer(), V2.getPointer());
72 auto align =
reinterpret_cast<uintptr_t>(V2.getPointer()) >> AggAlignShift;
77 return V1.getPointer();
96 ER.V1.setInt(Complex);
109 ER.V1.setInt(Aggregate);
112 ER.V2.setPointer(reinterpret_cast<llvm::Value*>(align << AggAlignShift));
113 ER.V2.setInt(isVolatile);
194 bool GlobalObjCRef : 1;
197 bool ThreadLocalRef : 1;
201 bool ImpreciseLifetime : 1;
203 unsigned AlignSource : 2;
207 bool Nontemporal : 1;
217 llvm::MDNode *TBAAInfo;
222 llvm::MDNode *TBAAInfo =
nullptr) {
224 "initializing l-value with zero alignment!");
228 assert(this->Alignment == Alignment.
getQuantity() &&
229 "Alignment exceeds allowed max!");
230 this->AlignSource =
unsigned(AlignSource);
233 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef =
false;
234 this->ImpreciseLifetime =
false;
235 this->Nontemporal =
false;
236 this->ThreadLocalRef =
false;
237 this->BaseIvarExp =
nullptr;
240 this->TBAABaseType = Type;
241 this->TBAAOffset = 0;
242 this->TBAAInfo = TBAAInfo;
374 llvm::MDNode *TBAAInfo =
nullptr) {
380 assert(address.
getPointer()->getType()->isPointerTy());
382 R.Initialize(type, qs, address.
getAlignment(), alignSource, TBAAInfo);
389 R.LVType = VectorElt;
400 R.LVType = ExtVectorElt;
428 R.LVType = GlobalReg;
453 bool DestructedFlag : 1;
477 bool AliasedFlag : 1;
517 AV.DestructedFlag = isDestructed;
518 AV.ObjCGCFlag = needsGC;
520 AV.AliasedFlag = isAliased;
537 DestructedFlag = destructed;
567 return Addr ==
nullptr;
Defines the clang::ASTContext interface.
unsigned getVRQualifiers() const
A (possibly-)qualified type.
llvm::Value * getPointer() const
Expr * getBaseIvarExp() const
static LValue MakeBitfield(Address Addr, const CGBitFieldInfo &Info, QualType type, AlignmentSource alignSource)
Create a new object to represent a bit-field access.
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
void setAlignment(CharUnits A)
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
C Language Family Type Representation.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Address getAddress() const
void setTBAAInfo(llvm::MDNode *N)
The base class of the type hierarchy.
RValue asAggregateRValue() const
void setObjCGCAttr(GC type)
void setZeroed(bool V=true)
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
CharUnits getAlignment() const
ObjCLifetime getObjCLifetime() const
void setTBAAOffset(uint64_t O)
IsZeroed_t isZeroed() const
Address getVectorAddress() const
The collection of all-type qualifiers we support.
void setTBAABaseType(QualType T)
bool isVolatileQualified() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::Value * getVectorPointer() const
unsigned getCVRQualifiers() const
static RValue getComplex(const std::pair< llvm::Value *, llvm::Value * > &C)
void setBaseIvarExp(Expr *V)
void setNonGC(bool Value)
CharUnits getAlignment() const
CharUnits - This is an opaque type for sizes expressed in character units.
const Qualifiers & getQuals() const
Qualifiers::ObjCLifetime getObjCLifetime() const
const CGBitFieldInfo * BitFieldInfo
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...
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
bool isExtVectorElt() const
static LValue MakeExtVectorElt(Address vecAddress, llvm::Constant *Elts, QualType type, AlignmentSource alignSource)
void setThreadLocalRef(bool Value)
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
void setAddress(Address address)
Address getBitFieldAddress() const
llvm::Value * getPointer() const
Expr - This represents one expression.
llvm::Value * getPointer() const
void setObjCArray(bool Value)
Qualifiers::ObjCLifetime getObjCLifetime() const
static LValue MakeVectorElt(Address vecAddress, llvm::Value *Idx, QualType type, AlignmentSource alignSource)
llvm::Constant * VectorElts
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static LValue MakeAddr(Address address, QualType type, ASTContext &Context, AlignmentSource alignSource, llvm::MDNode *TBAAInfo=nullptr)
bool isThreadLocalRef() const
bool isRestrictQualified() const
ARCPreciseLifetime_t isARCPreciseLifetime() const
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.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
bool isNontemporal() const
llvm::Value * getExtVectorPointer() const
llvm::Value * getBitFieldPointer() const
void setVolatile(bool flag)
static RValue getIgnored()
const CGBitFieldInfo & getBitFieldInfo() const
llvm::MDNode * getTBAAInfo() const
void setObjCIvar(bool Value)
unsigned getAddressSpace() const
Address getExtVectorAddress() const
llvm::Value * getGlobalReg() const
void setAlignmentSource(AlignmentSource Source)
AlignmentSource getAlignmentSource() const
void setExternallyDestructed(bool destructed=true)
CharUnits getAlignment() const
Return the alignment of this pointer.
void setVolatile(bool flag)
llvm::Value * getAggregatePointer() const
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
bool isZero() const
isZero - Test whether the quantity equals zero.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored...
IsAliased_t isPotentiallyAliased() const
IsDestructed_t isExternallyDestructed() const
llvm::Constant * getExtVectorElts() const
NeedsGCBarriers_t requiresGCollection() const
QualType getTBAABaseType() const
Address getAddress() const
unsigned getAddressSpace() const
void setGlobalObjCRef(bool Value)
void setNontemporal(bool Value)
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
llvm::Value * getVectorIdx() const
bool isObjCStrong() const
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
static LValue MakeGlobalReg(Address Reg, QualType type)
bool isVolatileQualified() const
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)
LValue - This represents an lvalue references.
bool isGlobalObjCRef() const
Qualifiers getQualifiers() const
uint64_t getTBAAOffset() const
Structure with information about how a bitfield should be accessed.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.