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) {}
214 llvm::Constant *MatrixRowElts =
nullptr;
232 bool GlobalObjCRef : 1;
235 bool ThreadLocalRef : 1;
239 bool ImpreciseLifetime : 1;
243 bool Nontemporal : 1;
255 const unsigned MaxAlign = 1U << 31;
258 "initializing l-value with zero alignment!");
260 assert(
false &&
"Alignment exceeds allowed max!");
264 this->BaseInfo = BaseInfo;
265 this->TBAAInfo = TBAAInfo;
268 this->Ivar = this->ObjIsArray = this->NonGC = this->GlobalObjCRef =
false;
269 this->ImpreciseLifetime =
false;
270 this->Nontemporal =
false;
271 this->ThreadLocalRef =
false;
272 this->BaseIvarExp =
nullptr;
275 void initializeSimpleLValue(Address
Addr, QualType Type,
276 LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo,
278 Qualifiers QS = Type.getQualifiers();
279 QS.setObjCGCAttr(Context.getObjCGCAttrKind(Type));
281 Initialize(Type, QS,
Addr, BaseInfo, TBAAInfo);
300 return Quals.getCVRQualifiers() &
~Qualifiers::Const;
306 return Quals.getObjCLifetime();
341 return Quals.hasVolatile();
363 Addr.setKnownNonNull();
378 return Addr.getPointerAuthInfo();
388 return Addr.emitRawPointer(CGF);
392 return Addr.getBasePointer();
405 return Addr.getBasePointer();
419 return MatrixRowElts;
429 return Addr.emitRawPointer(CGF);
443 return Addr.emitRawPointer(CGF);
458 R.initializeSimpleLValue(
Addr,
type, BaseInfo, TBAAInfo, Context);
460 assert(
Addr.getType()->isPointerTy());
468 R.LVType = VectorElt;
470 R.Initialize(
type,
type.getQualifiers(), vecAddress, BaseInfo, TBAAInfo);
478 R.LVType = ExtVectorElt;
480 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
496 R.Initialize(
type,
type.getQualifiers(),
Addr, BaseInfo, TBAAInfo);
503 R.LVType = GlobalReg;
514 LV.LVType = MatrixRow;
516 LV.MatrixRowElts =
nullptr;
522 llvm::Constant *Cols,
QualType MatrixTy,
526 LV.LVType = MatrixRow;
529 LV.MatrixRowElts = Cols;
530 LV.Initialize(MatrixTy, MatrixTy.
getQualifiers(), MatAddr, BaseInfo,
539 R.LVType = MatrixElt;
541 R.Initialize(
type,
type.getQualifiers(), matAddress, BaseInfo, TBAAInfo);
561 bool DestructedFlag : 1;
585 bool AliasedFlag : 1;
592 bool OverlapFlag : 1;
599 bool SanitizerCheckedFlag : 1;
602 bool ObjCGCFlag,
bool ZeroedFlag,
bool AliasedFlag,
603 bool OverlapFlag,
bool SanitizerCheckedFlag)
604 :
Addr(Addr), Quals(Quals), DestructedFlag(DestructedFlag),
605 ObjCGCFlag(ObjCGCFlag), ZeroedFlag(ZeroedFlag),
606 AliasedFlag(AliasedFlag), OverlapFlag(OverlapFlag),
607 SanitizerCheckedFlag(SanitizerCheckedFlag) {}
644 return AggValueSlot(addr, quals, isDestructed, needsGC,
isZeroed, isAliased,
661 DestructedFlag = destructed;
667 return Quals.hasVolatile();
674 Quals.removeVolatile();
678 return Quals.getObjCLifetime();
688 return Addr.isValid() ? Addr.emitRawPointer(CGF) :
nullptr;
698 return Addr.getAlignment();
710 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)
llvm::Constant * getMatrixRowElts() const
bool isObjCStrong() const
bool isRestrictQualified() const
void setAlignment(CharUnits A)
bool isMatrixRowSwizzle() const
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)
static LValue MakeMatrixRowSwizzle(Address MatAddr, llvm::Value *RowIdx, llvm::Constant *Cols, QualType MatrixTy, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
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.