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; }
73 assert(
isScalar() &&
"Not a scalar!");
80 return std::make_pair(
Vals.first,
Vals.second);
103 ER.IsVolatile =
false;
113 ER.IsVolatile =
false;
129 ER.Flavor = Aggregate;
130 ER.IsVolatile = isVolatile;
171 : AlignSource(Source) {}
229 bool GlobalObjCRef : 1;
232 bool ThreadLocalRef : 1;
236 bool ImpreciseLifetime : 1;
240 bool Nontemporal : 1;
252 const unsigned MaxAlign = 1U << 31;
255 "initializing l-value with zero alignment!");
257 assert(
false &&
"Alignment exceeds allowed max!");
261 this->BaseInfo = BaseInfo;
262 this->TBAAInfo = TBAAInfo;
265 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef =
false;
266 this->ImpreciseLifetime =
false;
267 this->Nontemporal =
false;
268 this->ThreadLocalRef =
false;
269 this->BaseIvarExp =
nullptr;
272 void initializeSimpleLValue(Address
Addr, QualType Type,
273 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo,
275 Qualifiers QS = Type.getQualifiers();
276 QS.setObjCGCAttr(Context.getObjCGCAttrKind(Type));
278 Initialize(Type, QS,
Addr, BaseInfo, TBAAInfo);
294 return Quals.getCVRQualifiers() &
~Qualifiers::Const;
300 return Quals.getObjCLifetime();
335 return Quals.hasVolatile();
357 Addr.setKnownNonNull();
372 return Addr.getPointerAuthInfo();
382 return Addr.emitRawPointer(CGF);
386 return Addr.getBasePointer();
399 return Addr.getBasePointer();
418 return Addr.emitRawPointer(CGF);
432 return Addr.emitRawPointer(CGF);
447 R.initializeSimpleLValue(
Addr,
type, BaseInfo, TBAAInfo, Context);
449 assert(
Addr.getType()->isPointerTy());
457 R.LVType = VectorElt;
459 R.Initialize(
type,
type.getQualifiers(), vecAddress, BaseInfo, TBAAInfo);
467 R.LVType = ExtVectorElt;
469 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
485 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
492 R.LVType = GlobalReg;
503 LV.LVType = MatrixRow;
513 R.LVType = MatrixElt;
515 R.Initialize(
type,
type.getQualifiers(), matAddress, BaseInfo, TBAAInfo);
535 bool DestructedFlag : 1;
559 bool AliasedFlag : 1;
566 bool OverlapFlag : 1;
573 bool SanitizerCheckedFlag : 1;
576 bool ObjCGCFlag,
bool ZeroedFlag,
bool AliasedFlag,
577 bool OverlapFlag,
bool SanitizerCheckedFlag)
578 :
Addr(Addr), Quals(Quals), DestructedFlag(DestructedFlag),
579 ObjCGCFlag(ObjCGCFlag), ZeroedFlag(ZeroedFlag),
580 AliasedFlag(AliasedFlag), OverlapFlag(OverlapFlag),
581 SanitizerCheckedFlag(SanitizerCheckedFlag) {}
618 return AggValueSlot(addr, quals, isDestructed, needsGC,
isZeroed, isAliased,
635 DestructedFlag = destructed;
641 return Quals.hasVolatile();
648 Quals.removeVolatile();
652 return Quals.getObjCLifetime();
662 return Addr.isValid() ? Addr.emitRawPointer(CGF) :
nullptr;
672 return Addr.getAlignment();
684 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 ...
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
Address setKnownNonNull()
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 * getMatrixRowIdx() const
static LValue MakeMatrixRow(Address Addr, llvm::Value *RowIdx, QualType MatrixTy, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
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
llvm::Value * MatrixRowIdx
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)
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)
struct clang::CodeGen::RValue::@377313303130300032223230221113302037235375040355::@177233336262150053115237272127353314357374062335 Vals
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.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
The collection of all-type qualifiers we support.
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.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
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.