15 #ifndef LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
16 #define LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
21 #include "llvm/IR/Value.h"
22 #include "llvm/IR/Type.h"
32 struct CGBitFieldInfo;
39 enum Flavor { Scalar, Complex, Aggregate };
42 llvm::PointerIntPair<llvm::Value *, 2, Flavor> V1;
44 llvm::PointerIntPair<llvm::Value *, 1, bool> V2;
47 bool isScalar()
const {
return V1.getInt() == Scalar; }
48 bool isComplex()
const {
return V1.getInt() == Complex; }
55 assert(
isScalar() &&
"Not a scalar!");
56 return V1.getPointer();
62 return std::make_pair(V1.getPointer(), V2.getPointer());
68 return V1.getPointer();
82 ER.V1.setInt(Complex);
95 ER.V1.setInt(Aggregate);
96 ER.V2.setInt(Volatile);
151 bool GlobalObjCRef : 1;
154 bool ThreadLocalRef : 1;
158 bool ImpreciseLifetime : 1;
168 llvm::MDNode *TBAAInfo;
173 llvm::MDNode *TBAAInfo =
nullptr) {
177 assert(this->Alignment == Alignment.
getQuantity() &&
178 "Alignment exceeds allowed max!");
181 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef =
false;
182 this->ImpreciseLifetime =
false;
183 this->ThreadLocalRef =
false;
184 this->BaseIvarExp =
nullptr;
187 this->TBAABaseType = Type;
188 this->TBAAOffset = 0;
189 this->TBAAInfo = TBAAInfo;
297 llvm::MDNode *TBAAInfo =
nullptr) {
303 assert(address->getType()->isPointerTy());
305 R.Initialize(type, qs, alignment, TBAAInfo);
312 R.LVType = VectorElt;
322 R.LVType = ExtVectorElt;
350 R.LVType = GlobalReg;
370 unsigned short Alignment;
375 bool DestructedFlag : 1;
399 bool AliasedFlag : 1;
434 AV.DestructedFlag = isDestructed;
435 AV.ObjCGCFlag = needsGC;
437 AV.AliasedFlag = isAliased;
454 DestructedFlag = destructed;
480 return Addr ==
nullptr;
Defines the clang::ASTContext interface.
unsigned getVRQualifiers() const
Expr * getBaseIvarExp() const
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
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
void setTBAAInfo(llvm::MDNode *N)
RValue asAggregateRValue() const
void setObjCGCAttr(GC type)
void setZeroed(bool V=true)
llvm::Value * getAddress() const
CharUnits getAlignment() const
ObjCLifetime getObjCLifetime() const
void setTBAAOffset(uint64_t O)
IsZeroed_t isZeroed() const
void setAddress(llvm::Value *address)
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 ...
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
const Qualifiers & getQuals() const
Qualifiers::ObjCLifetime getObjCLifetime() const
const CGBitFieldInfo * BitFieldInfo
llvm::Value * getAggregateAddr() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
bool isExtVectorElt() const
void setThreadLocalRef(bool Value)
static LValue MakeGlobalReg(llvm::Value *Reg, QualType type, CharUnits Alignment)
llvm::Value * getBitFieldAddr() const
void setObjCArray(bool Value)
Qualifiers::ObjCLifetime getObjCLifetime() const
llvm::Constant * VectorElts
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
bool isThreadLocalRef() const
bool isRestrictQualified() const
llvm::Value * getExtVectorAddr() const
ARCPreciseLifetime_t isARCPreciseLifetime() const
void setVolatile(bool flag)
const CGBitFieldInfo & getBitFieldInfo() const
static LValue MakeVectorElt(llvm::Value *Vec, llvm::Value *Idx, QualType type, CharUnits Alignment)
llvm::MDNode * getTBAAInfo() const
static RValue getAggregate(llvm::Value *V, bool Volatile=false)
static LValue MakeAddr(llvm::Value *address, QualType type, CharUnits alignment, ASTContext &Context, llvm::MDNode *TBAAInfo=nullptr)
void setObjCIvar(bool Value)
unsigned getAddressSpace() const
llvm::Value * getGlobalReg() const
void setExternallyDestructed(bool destructed=true)
void setVolatile(bool flag)
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
static LValue MakeBitfield(llvm::Value *Addr, const CGBitFieldInfo &Info, QualType type, CharUnits Alignment)
Create a new object to represent a bit-field access.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
static AggValueSlot ignored()
IsAliased_t isPotentiallyAliased() const
IsDestructed_t isExternallyDestructed() const
llvm::Constant * getExtVectorElts() const
NeedsGCBarriers_t requiresGCollection() const
QualType getTBAABaseType() const
unsigned getAddressSpace() const
void setGlobalObjCRef(bool Value)
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
llvm::Value * getVectorIdx() const
llvm::Value * getAddr() const
bool isObjCStrong() const
bool isVolatileQualified() const
static AggValueSlot forAddr(llvm::Value *addr, CharUnits align, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, IsZeroed_t isZeroed=IsNotZeroed)
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool isGlobalObjCRef() const
llvm::Value * getVectorAddr() const
Qualifiers getQualifiers() const
static LValue MakeExtVectorElt(llvm::Value *Vec, llvm::Constant *Elts, QualType type, CharUnits Alignment)
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.