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" 33 struct CGBitFieldInfo;
40 enum Flavor { Scalar, Complex, Aggregate };
44 enum { AggAlignShift = 4 };
47 llvm::PointerIntPair<llvm::Value *, 2, Flavor> V1;
49 llvm::PointerIntPair<llvm::Value *, 1, bool> V2;
52 bool isScalar()
const {
return V1.getInt() == Scalar; }
53 bool isComplex()
const {
return V1.getInt() == Complex; }
60 assert(isScalar() &&
"Not a scalar!");
61 return V1.getPointer();
67 return std::make_pair(V1.getPointer(), V2.getPointer());
72 assert(isAggregate() &&
"Not an aggregate!");
73 auto align =
reinterpret_cast<uintptr_t>(V2.getPointer()) >> AggAlignShift;
74 return Address(V1.getPointer(), CharUnits::fromQuantity(align));
77 assert(isAggregate() &&
"Not an aggregate!");
78 return V1.getPointer();
97 ER.V1.setInt(Complex);
102 return getComplex(C.first, C.second);
110 ER.V1.setInt(Aggregate);
113 ER.V2.setPointer(reinterpret_cast<llvm::Value*>(align << AggAlignShift));
114 ER.V2.setInt(isVolatile);
147 return AlignmentSource::Decl;
155 : AlignSource(Source) {}
209 bool GlobalObjCRef : 1;
212 bool ThreadLocalRef : 1;
216 bool ImpreciseLifetime : 1;
223 bool Nontemporal : 1;
231 "initializing l-value with zero alignment!");
235 assert(this->Alignment == Alignment.
getQuantity() &&
236 "Alignment exceeds allowed max!");
237 this->BaseInfo = BaseInfo;
238 this->TBAAInfo = TBAAInfo;
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;
333 return Address(getVectorPointer(), getAlignment());
340 return Address(getExtVectorPointer(), getAlignment());
343 assert(isExtVectorElt());
347 assert(isExtVectorElt());
353 return Address(getBitFieldPointer(), getAlignment());
357 assert(isBitField());
358 return *BitFieldInfo;
371 assert(address.
getPointer()->getType()->isPointerTy());
373 R.Initialize(type, qs, address.
getAlignment(), BaseInfo, TBAAInfo);
381 R.LVType = VectorElt;
393 R.LVType = ExtVectorElt;
421 R.LVType = GlobalReg;
429 return RValue::getAggregate(getAddress(), isVolatileQualified());
446 bool DestructedFlag : 1;
470 bool AliasedFlag : 1;
481 return forAddr(Address::invalid(),
Qualifiers(), IsNotDestructed,
482 DoesNotNeedGCBarriers, IsNotAliased);
510 AV.DestructedFlag = isDestructed;
511 AV.ObjCGCFlag = needsGC;
512 AV.ZeroedFlag = isZeroed;
513 AV.AliasedFlag = isAliased;
523 LV.
getQuals(), isDestructed, needsGC, isAliased, isZeroed);
530 DestructedFlag = destructed;
556 return Address(Addr, getAlignment());
560 return Addr ==
nullptr;
564 return CharUnits::fromQuantity(Alignment);
573 return RValue::getIgnored();
575 return RValue::getAggregate(getAddress(), isVolatile());
llvm::Value * getVectorPointer() const
Defines the clang::ASTContext interface.
Address getAddress() const
A (possibly-)qualified type.
void setAlignmentSource(AlignmentSource Source)
llvm::Value * getGlobalReg() const
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)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
void setAlignment(CharUnits A)
LValueBaseInfo(AlignmentSource Source=AlignmentSource::Type)
NeedsGCBarriers_t requiresGCollection() const
C Language Family Type Representation.
llvm::Value * getPointer() const
Decl - This represents one declaration (or definition), e.g.
The base class of the type hierarchy.
void setObjCGCAttr(GC type)
bool isZero() const
isZero - Test whether the quantity equals zero.
void setZeroed(bool V=true)
IsAliased_t isPotentiallyAliased() const
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
static LValue MakeVectorElt(Address vecAddress, llvm::Value *Idx, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
IsZeroed_t isZeroed() const
llvm::Value * getPointer() const
The collection of all-type qualifiers we support.
Qualifiers::ObjCLifetime getObjCLifetime() const
IsDestructed_t isExternallyDestructed() const
Address getAddress() const
bool isRestrictQualified() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isVolatileQualified() const
CharUnits getAlignment() const
Qualifiers::ObjCLifetime getObjCLifetime() const
void setBaseIvarExp(Expr *V)
void setNonGC(bool Value)
ARCPreciseLifetime_t isARCPreciseLifetime() const
CharUnits - This is an opaque type for sizes expressed in character units.
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool isGlobalObjCRef() const
CharUnits getAlignment() const
Return the alignment of this pointer.
static LValue MakeExtVectorElt(Address vecAddress, llvm::Constant *Elts, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
const CGBitFieldInfo * BitFieldInfo
LangAS getAddressSpace() const
static AlignmentSource getFieldAlignmentSource(AlignmentSource Source)
Given that the base address has the given alignment source, what's our confidence in the alignment of...
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
void setThreadLocalRef(bool Value)
LValueBaseInfo getBaseInfo() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
Address getExtVectorAddress() const
void setAddress(Address address)
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static RValue getComplex(const std::pair< llvm::Value *, llvm::Value *> &C)
Expr - This represents one expression.
Qualifiers getQualifiers() const
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
void setObjCArray(bool Value)
llvm::Constant * VectorElts
ObjCLifetime getObjCLifetime() const
static LValue MakeBitfield(Address Addr, const CGBitFieldInfo &Info, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Create a new object to represent a bit-field access.
TBAAAccessInfo getTBAAInfo() const
const Qualifiers & getQuals() const
bool isObjCStrong() 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...
CharUnits getAlignment() const
bool isThreadLocalRef() const
void setVolatile(bool flag)
void setBaseInfo(LValueBaseInfo Info)
static RValue getIgnored()
Expr * getBaseIvarExp() const
const CGBitFieldInfo & getBitFieldInfo() const
bool isNontemporal() const
void setObjCIvar(bool Value)
Address getVectorAddress() const
void setExternallyDestructed(bool destructed=true)
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
void setVolatile(bool flag)
Dataflow Directional Tag Classes.
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored...
llvm::Value * getExtVectorPointer() const
AlignmentSource getAlignmentSource() const
bool isVolatileQualified() const
Address getBitFieldAddress() const
llvm::Value * getAggregatePointer() const
void setGlobalObjCRef(bool Value)
void setNontemporal(bool Value)
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
RValue asAggregateRValue() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
LangAS getAddressSpace() const
An attributed type is a type to which a type attribute has been applied.
llvm::Value * getBitFieldPointer() const
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
unsigned getVRQualifiers() const
unsigned getCVRQualifiers() const
static LValue MakeGlobalReg(Address Reg, QualType type)
bool isExtVectorElt() const
static RValue getAggregate(Address addr, bool isVolatile=false)
LValue - This represents an lvalue references.
void setTBAAInfo(TBAAAccessInfo Info)
static LValue MakeAddr(Address address, QualType type, ASTContext &Context, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
llvm::Value * getVectorIdx() const
llvm::Value * getPointer() const
void mergeForCast(const LValueBaseInfo &Info)
llvm::Constant * getExtVectorElts() const
Structure with information about how a bitfield should be accessed.