14#ifndef CLANG_LIB_CIR_CIRGENVALUE_H
15#define CLANG_LIB_CIR_CIRGENVALUE_H
23#include "mlir/IR/Value.h"
34 enum Flavor { Scalar, Complex, Aggregate };
43 unsigned isVolatile : 1;
49 bool isScalar()
const {
return flavor == Scalar; }
50 bool isComplex()
const {
return flavor == Complex; }
58 assert(
isScalar() &&
"Not a scalar!");
87 er.isVolatile =
false;
95 er.isVolatile =
false;
108 er.flavor = Aggregate;
109 er.isVolatile = isVolatile;
145 : alignSource(source) {}
170 mlir::Value vectorIdx;
171 mlir::Attribute vectorElts;
172 mlir::Type elementType;
178 assert((!alignment.isZero() || type->isIncompleteType()) &&
179 "initializing l-value with zero alignment!");
182 const unsigned maxAlign = 1U << 31;
183 this->alignment = alignment.getQuantity() <= maxAlign
184 ? alignment.getQuantity()
186 assert(this->alignment == alignment.getQuantity() &&
187 "Alignment exceeds allowed max!");
188 this->baseInfo = baseInfo;
273 return mlir::cast<mlir::ArrayAttr>(vectorElts);
279 r.lvType = VectorElt;
291 r.lvType = ExtVectorElt;
295 r.initialize(type, type.getQualifiers(), vecAddress.
getAlignment(),
312 return *bitFieldInfo;
327 r.bitFieldInfo = &info;
328 r.initialize(type, type.getQualifiers(), addr.
getAlignment(), baseInfo);
343 LLVM_PREFERRED_TYPE(
bool)
unsigned destructedFlag : 1;
347 LLVM_PREFERRED_TYPE(
bool)
348 unsigned zeroedFlag : 1;
362 LLVM_PREFERRED_TYPE(
bool)
unsigned aliasedFlag : 1;
370 LLVM_PREFERRED_TYPE(
bool)
unsigned overlapFlag : 1;
386 bool zeroedFlag,
bool aliasedFlag,
bool overlapFlag)
387 : addr(addr), quals(quals), destructedFlag(destructedFlag),
388 zeroedFlag(zeroedFlag), aliasedFlag(aliasedFlag),
389 overlapFlag(overlapFlag) {}
410 destructedFlag = destructed;
421 quals.removeVolatile();
C Language Family Type Representation.
mlir::Value getPointer() const
mlir::Type getElementType() const
clang::CharUnits getAlignment() const
IsZeroed_t isZeroed() const
Overlap_t mayOverlap() const
IsDestructed_t
This is set to true if the slot might be aliased and it's not undefined behavior to access it through...
static AggValueSlot forAddr(Address addr, clang::Qualifiers quals, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
IsDestructed_t isExternallyDestructed() const
AggValueSlot(Address addr, clang::Qualifiers quals, bool destructedFlag, bool zeroedFlag, bool aliasedFlag, bool overlapFlag)
static AggValueSlot forLValue(const LValue &LV, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
Address getAddress() const
void setExternallyDestructed(bool destructed=true)
static AggValueSlot ignored()
Returns an aggregate value slot indicating that the aggregate value is being ignored.
IsAliased_t isPotentiallyAliased() const
mlir::Value getPointer() const
clang::Qualifiers getQualifiers() const
void setVolatile(bool flag)
AlignmentSource getAlignmentSource() const
void mergeForCast(const LValueBaseInfo &info)
LValueBaseInfo(AlignmentSource source=AlignmentSource::Type)
void setAlignmentSource(AlignmentSource source)
bool isExtVectorElt() const
mlir::Value getBitFieldPointer() const
mlir::Value getVectorPointer() const
const clang::Qualifiers & getQuals() const
mlir::Value getExtVectorPointer() const
static LValue makeExtVectorElt(Address vecAddress, mlir::ArrayAttr elts, clang::QualType type, LValueBaseInfo baseInfo)
mlir::Value getVectorIdx() const
Address getAddress() const
static LValue makeAddr(Address address, clang::QualType t, LValueBaseInfo baseInfo)
mlir::ArrayAttr getExtVectorElts() const
static LValue makeVectorElt(Address vecAddress, mlir::Value index, clang::QualType t, LValueBaseInfo baseInfo)
unsigned getVRQualifiers() const
clang::QualType getType() const
static LValue makeBitfield(Address addr, const CIRGenBitFieldInfo &info, clang::QualType type, LValueBaseInfo baseInfo)
Create a new object to represent a bit-field access.
mlir::Value getPointer() const
clang::Qualifiers & getQuals()
bool isVolatileQualified() const
void setAlignment(clang::CharUnits a)
Address getVectorAddress() const
clang::CharUnits getAlignment() const
LValueBaseInfo getBaseInfo() const
void setBaseInfo(LValueBaseInfo info)
const CIRGenBitFieldInfo & getBitFieldInfo() const
Address getBitFieldAddress() const
Address getExtVectorAddress() const
void setAddress(Address address)
This trivial value class is used to represent the result of an expression that is evaluated.
Address getAggregateAddress() const
Return the value of the address of the aggregate.
static RValue get(mlir::Value v)
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
mlir::Value getAggregatePointer(QualType pointeeType) const
static RValue getComplex(mlir::Value v)
bool isVolatileQualified() const
mlir::Value getValue() const
Return the value of this scalar value.
mlir::Value getComplexValue() const
Return the value of this complex value.
static RValue getIgnored()
CharUnits - This is an opaque type for sizes expressed in character units.
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.
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 ...
static AlignmentSource getFieldAlignmentSource(AlignmentSource source)
Given that the base address has the given alignment source, what's our confidence in the alignment of...
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',...
static bool aggValueSlot()
static bool addressIsKnownNonNull()
Record with information about how a bitfield should be accessed.