14#ifndef LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
15#define LLVM_CLANG_LIB_CODEGEN_CGVALUE_H
23#include "llvm/IR/Type.h"
24#include "llvm/IR/Value.h"
45 enum FlavorEnum { Scalar,
Complex, Aggregate };
58 unsigned IsVolatile : 1;
64 bool isScalar()
const {
return Flavor == Scalar; }
65 bool isComplex()
const {
return Flavor == Complex; }
72 assert(
isScalar() &&
"Not a scalar!");
79 return std::make_pair(
Vals.first,
Vals.second);
102 ER.IsVolatile =
false;
112 ER.IsVolatile =
false;
128 ER.Flavor = Aggregate;
129 ER.IsVolatile = isVolatile;
170 : AlignSource(Source) {}
224 bool GlobalObjCRef : 1;
227 bool ThreadLocalRef : 1;
231 bool ImpreciseLifetime : 1;
235 bool Nontemporal : 1;
247 const unsigned MaxAlign = 1U << 31;
250 "initializing l-value with zero alignment!");
252 assert(
false &&
"Alignment exceeds allowed max!");
256 this->BaseInfo = BaseInfo;
257 this->TBAAInfo = TBAAInfo;
260 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef =
false;
261 this->ImpreciseLifetime =
false;
262 this->Nontemporal =
false;
263 this->ThreadLocalRef =
false;
264 this->BaseIvarExp =
nullptr;
267 void initializeSimpleLValue(Address
Addr, QualType Type,
268 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo,
269 ASTContext &Context) {
270 Qualifiers QS =
Type.getQualifiers();
271 QS.setObjCGCAttr(Context.getObjCGCAttrKind(Type));
273 Initialize(Type, QS,
Addr, BaseInfo, TBAAInfo);
436 R.initializeSimpleLValue(
Addr,
type, BaseInfo, TBAAInfo, Context);
446 R.LVType = VectorElt;
448 R.Initialize(
type,
type.getQualifiers(), vecAddress, BaseInfo, TBAAInfo);
456 R.LVType = ExtVectorElt;
458 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
474 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
481 R.LVType = GlobalReg;
492 R.LVType = MatrixElt;
494 R.Initialize(
type,
type.getQualifiers(), matAddress, BaseInfo, TBAAInfo);
514 bool DestructedFlag : 1;
538 bool AliasedFlag : 1;
545 bool OverlapFlag : 1;
552 bool SanitizerCheckedFlag : 1;
555 bool ObjCGCFlag,
bool ZeroedFlag,
bool AliasedFlag,
556 bool OverlapFlag,
bool SanitizerCheckedFlag)
557 : Addr(Addr), Quals(Quals), DestructedFlag(DestructedFlag),
558 ObjCGCFlag(ObjCGCFlag), ZeroedFlag(ZeroedFlag),
559 AliasedFlag(AliasedFlag), OverlapFlag(OverlapFlag),
560 SanitizerCheckedFlag(SanitizerCheckedFlag) {}
614 DestructedFlag = destructed;
663 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 * getBasePointer() const
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
KnownNonNull_t isKnownNonNull() const
Whether the pointer is known not to be null.
Address setKnownNonNull()
void setAlignment(CharUnits Value)
const CGPointerAuthInfo & getPointerAuthInfo() const
llvm::PointerType * getType() const
Return the type of the pointer value.
void setVolatile(bool flag)
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored.
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)
llvm::Value * getPointer(QualType PointeeTy, CodeGenFunction &CGF) const
IsZeroed_t isZeroed() const
Qualifiers getQualifiers() 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
llvm::Value * emitRawPointer(CodeGenFunction &CGF) 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 * getRawExtVectorPointer(CodeGenFunction &CGF) const
Expr * getBaseIvarExp() const
llvm::Value * emitResignedPointer(QualType PointeeTy, CodeGenFunction &CGF) const
llvm::Constant * getExtVectorElts() const
static LValue MakeGlobalReg(llvm::Value *V, CharUnits alignment, QualType type)
void setObjCIvar(bool Value)
bool isObjCStrong() const
bool isRestrictQualified() const
void setAlignment(CharUnits A)
bool isGlobalObjCRef() const
void setObjCArray(bool Value)
llvm::Value * getMatrixPointer() const
bool isVolatileQualified() const
llvm::Constant * VectorElts
llvm::Value * getRawBitFieldPointer(CodeGenFunction &CGF) const
RValue asAggregateRValue() const
void setTBAAInfo(TBAAAccessInfo Info)
LangAS getAddressSpace() const
CharUnits getAlignment() const
llvm::Value * getPointer(CodeGenFunction &CGF) const
llvm::Value * getMatrixIdx() const
llvm::Value * getGlobalReg() const
static LValue MakeAddr(Address Addr, QualType type, ASTContext &Context, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
const Qualifiers & getQuals() const
static LValue MakeExtVectorElt(Address Addr, llvm::Constant *Elts, QualType type, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
llvm::Value * getVectorPointer() const
Address getAddress() const
unsigned getVRQualifiers() const
void setThreadLocalRef(bool Value)
const CGBitFieldInfo * BitFieldInfo
void setGlobalObjCRef(bool Value)
llvm::Value * getRawVectorPointer(CodeGenFunction &CGF) const
bool isExtVectorElt() const
llvm::Value * getVectorIdx() const
void setNontemporal(bool Value)
LValueBaseInfo getBaseInfo() const
ARCPreciseLifetime_t isARCPreciseLifetime() const
void setARCPreciseLifetime(ARCPreciseLifetime_t value)
const CGBitFieldInfo & getBitFieldInfo() const
CGPointerAuthInfo getPointerAuthInfo() const
bool isThreadLocalRef() const
KnownNonNull_t isKnownNonNull() const
TBAAAccessInfo getTBAAInfo() const
void setNonGC(bool Value)
void setBaseInfo(LValueBaseInfo Info)
Address getVectorAddress() const
bool isNontemporal() 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.
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
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.
llvm::Value * getAggregatePointer(QualType PointeeType, CodeGenFunction &CGF) const
static RValue getIgnored()
static RValue get(llvm::Value *V)
static RValue get(Address Addr, CodeGenFunction &CGF)
struct clang::CodeGen::RValue::@312::@314 Vals
static RValue getComplex(const std::pair< llvm::Value *, llvm::Value * > &C)
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.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
bool isVolatileQualified() const
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
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.