14 #ifndef LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
15 #define LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
22 #include "llvm/IR/Type.h"
23 #include "llvm/IR/Value.h"
34 class CodeGenFunction;
35 struct CGBitFieldInfo;
44 enum FlavorEnum { Scalar,
Complex, Aggregate };
57 unsigned IsVolatile : 1;
63 bool isScalar()
const {
return Flavor == Scalar; }
64 bool isComplex()
const {
return Flavor == Complex; }
71 assert(
isScalar() &&
"Not a scalar!");
78 return std::make_pair(
Vals.first,
Vals.second);
101 ER.IsVolatile =
false;
111 ER.IsVolatile =
false;
127 ER.Flavor = Aggregate;
128 ER.IsVolatile = isVolatile;
169 : AlignSource(Source) {}
223 bool GlobalObjCRef : 1;
226 bool ThreadLocalRef : 1;
230 bool ImpreciseLifetime : 1;
234 bool Nontemporal : 1;
237 bool IsKnownNonNull : 1;
249 const unsigned MaxAlign = 1U << 31;
252 "initializing l-value with zero alignment!");
254 assert(
false &&
"Alignment exceeds allowed max!");
258 this->BaseInfo = BaseInfo;
259 this->TBAAInfo = TBAAInfo;
262 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef =
false;
263 this->ImpreciseLifetime =
false;
264 this->Nontemporal =
false;
265 this->ThreadLocalRef =
false;
266 this->IsKnownNonNull =
false;
267 this->BaseIvarExp =
nullptr;
270 void initializeSimpleLValue(Address
Addr, QualType Type,
271 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo,
272 ASTContext &Context) {
273 Qualifiers QS =
Type.getQualifiers();
274 QS.setObjCGCAttr(Context.getObjCGCAttrKind(Type));
276 Initialize(Type, QS,
Addr, BaseInfo, TBAAInfo);
356 IsKnownNonNull =
true;
441 R.initializeSimpleLValue(
Addr,
type, BaseInfo, TBAAInfo, Context);
451 R.LVType = VectorElt;
453 R.Initialize(
type,
type.getQualifiers(), vecAddress, BaseInfo, TBAAInfo);
461 R.LVType = ExtVectorElt;
463 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
479 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
486 R.LVType = GlobalReg;
497 R.LVType = MatrixElt;
499 R.Initialize(
type,
type.getQualifiers(), matAddress, BaseInfo, TBAAInfo);
519 bool DestructedFlag : 1;
543 bool AliasedFlag : 1;
550 bool OverlapFlag : 1;
557 bool SanitizerCheckedFlag : 1;
560 bool ObjCGCFlag,
bool ZeroedFlag,
bool AliasedFlag,
561 bool OverlapFlag,
bool SanitizerCheckedFlag)
562 : Addr(Addr), Quals(Quals), DestructedFlag(DestructedFlag),
563 ObjCGCFlag(ObjCGCFlag), ZeroedFlag(ZeroedFlag),
564 AliasedFlag(AliasedFlag), OverlapFlag(OverlapFlag),
565 SanitizerCheckedFlag(SanitizerCheckedFlag) {}
619 DestructedFlag = destructed;
668 return SanitizerCheckedFlag;
Defines the clang::ASTContext interface.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
CharUnits - This is an opaque type for sizes expressed in character units.
bool isZero() const
isZero - Test whether the quantity equals zero.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
CharUnits getAlignment() const
llvm::PointerType * getType() const
Return the type of the pointer value.
llvm::Value * getBasePointer() const
Address setKnownNonNull()
void setAlignment(CharUnits Value)
void setVolatile(bool flag)
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored.
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
bool isSanitizerChecked() const
Address getAddress() const
CharUnits getPreferredSize(ASTContext &Ctx, QualType Type) const
Get the preferred size to use when storing a value to this slot.
CharUnits getAlignment() const
NeedsGCBarriers_t requiresGCollection() const
void setExternallyDestructed(bool destructed=true)
void setZeroed(bool V=true)
IsZeroed_t isZeroed() const
Qualifiers getQualifiers() const
llvm::Value * getPointer(QualType PointeeTy, CodeGenFunction &CGF) const
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
IsAliased_t isPotentiallyAliased() const
Qualifiers::ObjCLifetime getObjCLifetime() const
static AggValueSlot forAddr(Address addr, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
forAddr - Make a slot for an aggregate value.
IsDestructed_t isExternallyDestructed() const
Overlap_t mayOverlap() const
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void setAlignmentSource(AlignmentSource Source)
void mergeForCast(const LValueBaseInfo &Info)
AlignmentSource getAlignmentSource() const
LValueBaseInfo(AlignmentSource Source=AlignmentSource::Type)
LValue - This represents an lvalue references.
llvm::Value * getVectorIdx() const
llvm::Value * getRawBitFieldPointer(CodeGenFunction &CGF) const
llvm::Value * getRawVectorPointer(CodeGenFunction &CGF) const
static LValue MakeGlobalReg(llvm::Value *V, CharUnits alignment, QualType type)
void setObjCIvar(bool Value)
llvm::Value * getMatrixIdx() const
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
bool isObjCStrong() const
bool isRestrictQualified() const
llvm::Value * getRawExtVectorPointer(CodeGenFunction &CGF) const
void setAlignment(CharUnits A)
Expr * getBaseIvarExp() const
bool isGlobalObjCRef() const
llvm::Value * getVectorPointer() const
const Qualifiers & getQuals() const
void setObjCArray(bool Value)
const CGBitFieldInfo & getBitFieldInfo() const
bool isVolatileQualified() const
llvm::Constant * VectorElts
RValue asAggregateRValue() const
void setTBAAInfo(TBAAAccessInfo Info)
LangAS getAddressSpace() const
CharUnits getAlignment() const
static LValue MakeAddr(Address Addr, QualType type, ASTContext &Context, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
static LValue MakeExtVectorElt(Address Addr, llvm::Constant *Elts, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Address getAddress() const
unsigned getVRQualifiers() const
llvm::Value * getMatrixPointer() const
void setThreadLocalRef(bool Value)
const CGBitFieldInfo * BitFieldInfo
llvm::Constant * getExtVectorElts() const
llvm::Value * getGlobalReg() const
void setGlobalObjCRef(bool Value)
bool isExtVectorElt() const
void setNontemporal(bool Value)
LValueBaseInfo getBaseInfo() const
ARCPreciseLifetime_t isARCPreciseLifetime() const
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
bool isThreadLocalRef() const
KnownNonNull_t isKnownNonNull() const
TBAAAccessInfo getTBAAInfo() const
void setNonGC(bool Value)
void setBaseInfo(LValueBaseInfo Info)
Address getVectorAddress() const
bool isNontemporal() const
llvm::Value * getPointer(CodeGenFunction &CGF) 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.
static LValue MakeVectorElt(Address vecAddress, llvm::Value *Idx, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
void setAddress(Address address)
Qualifiers::ObjCLifetime getObjCLifetime() const
void setBaseIvarExp(Expr *V)
Address getExtVectorAddress() const
static LValue MakeMatrixElt(Address matAddress, llvm::Value *Idx, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
Address getMatrixAddress() const
Address getBitFieldAddress() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue getIgnored()
static RValue get(llvm::Value *V)
static RValue get(Address Addr, CodeGenFunction &CGF)
static RValue getComplex(const std::pair< llvm::Value *, llvm::Value * > &C)
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
static RValue getComplex(llvm::Value *V1, llvm::Value *V2)
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
struct clang::CodeGen::RValue::@305::@307 Vals
llvm::Value * getAggregatePointer(QualType PointeeType, CodeGenFunction &CGF) const
bool isVolatileQualified() const
This represents one expression.
A (possibly-)qualified type.
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
ObjCLifetime getObjCLifetime() const
LangAS getAddressSpace() const
The base class of the type hierarchy.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
static AlignmentSource getFieldAlignmentSource(AlignmentSource Source)
Given that the base address has the given alignment source, what's our confidence in the alignment of...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
LangAS
Defines the address space values used by the address space qualifier of QualType.
Diagnostic wrappers for TextAPI types for error reporting.
Structure with information about how a bitfield should be accessed.
A metaprogramming class for ensuring that a value will dominate an arbitrary position in a function.