16
16
#include " CIRGenBuilder.h"
17
17
#include " CIRGenCall.h"
18
18
#include " CIRGenModule.h"
19
+ #include " CIRGenTBAA.h"
19
20
#include " CIRGenTypeCache.h"
20
21
#include " CIRGenValue.h"
21
22
#include " EHScopeStack.h"
@@ -816,12 +817,15 @@ class CIRGenFunction : public CIRGenTypeCache {
816
817
// / the address of the lvalue, then loads the result as an rvalue,
817
818
// / returning the rvalue.
818
819
RValue buildLoadOfLValue (LValue LV, SourceLocation Loc);
819
- mlir::Value buildLoadOfScalar (Address Addr, bool Volatile, clang::QualType Ty,
820
- clang::SourceLocation Loc,
821
- LValueBaseInfo BaseInfo,
820
+ mlir::Value buildLoadOfScalar (Address addr, bool isVolatile,
821
+ clang::QualType ty, clang::SourceLocation loc,
822
+ LValueBaseInfo baseInfo,
823
+ TBAAAccessInfo tbaaInfo,
822
824
bool isNontemporal = false );
823
- mlir::Value buildLoadOfScalar (Address Addr, bool Volatile, clang::QualType Ty,
824
- mlir::Location Loc, LValueBaseInfo BaseInfo,
825
+ mlir::Value buildLoadOfScalar (Address addr, bool isVolatile,
826
+ clang::QualType ty, mlir::Location loc,
827
+ LValueBaseInfo baseInfo,
828
+ TBAAAccessInfo tbaaInfo,
825
829
bool isNontemporal = false );
826
830
827
831
int64_t getAccessedFieldNo (unsigned idx, const mlir::ArrayAttr elts);
@@ -834,12 +838,12 @@ class CIRGenFunction : public CIRGenTypeCache {
834
838
835
839
// / Load a scalar value from an address, taking care to appropriately convert
836
840
// / from the memory representation to CIR value representation.
837
- mlir::Value buildLoadOfScalar (Address Addr , bool Volatile, clang::QualType Ty ,
838
- clang::SourceLocation Loc ,
839
- AlignmentSource Source = AlignmentSource::Type,
841
+ mlir::Value buildLoadOfScalar (Address addr , bool isVolatile ,
842
+ clang::QualType ty, clang:: SourceLocation loc ,
843
+ AlignmentSource source = AlignmentSource::Type,
840
844
bool isNontemporal = false ) {
841
- return buildLoadOfScalar (Addr, Volatile, Ty, Loc , LValueBaseInfo (Source ),
842
- isNontemporal);
845
+ return buildLoadOfScalar (addr, isVolatile, ty, loc , LValueBaseInfo (source ),
846
+ CGM. getTBAAAccessInfo (ty), isNontemporal);
843
847
}
844
848
845
849
// / Load a scalar value from an address, taking care to appropriately convert
@@ -851,8 +855,9 @@ class CIRGenFunction : public CIRGenTypeCache {
851
855
// / Load a complex number from the specified l-value.
852
856
mlir::Value buildLoadOfComplex (LValue src, SourceLocation loc);
853
857
854
- Address buildLoadOfReference (LValue RefLVal, mlir::Location Loc,
855
- LValueBaseInfo *PointeeBaseInfo = nullptr );
858
+ Address buildLoadOfReference (LValue refLVal, mlir::Location loc,
859
+ LValueBaseInfo *pointeeBaseInfo = nullptr ,
860
+ TBAAAccessInfo *pointeeTBAAInfo = nullptr );
856
861
LValue buildLoadOfReferenceLValue (LValue RefLVal, mlir::Location Loc);
857
862
LValue
858
863
buildLoadOfReferenceLValue (Address RefAddr, mlir::Location Loc,
@@ -1275,9 +1280,17 @@ class CIRGenFunction : public CIRGenTypeCache {
1275
1280
clang::QualType::DestructionKind dtorKind);
1276
1281
1277
1282
void buildStoreOfScalar (mlir::Value value, LValue lvalue);
1278
- void buildStoreOfScalar (mlir::Value Value, Address Addr, bool Volatile,
1279
- clang::QualType Ty, LValueBaseInfo BaseInfo,
1280
- bool isInit = false , bool isNontemporal = false );
1283
+ void buildStoreOfScalar (mlir::Value value, Address addr, bool isVolatile,
1284
+ clang::QualType ty, LValueBaseInfo baseInfo,
1285
+ TBAAAccessInfo tbaaInfo, bool isInit = false ,
1286
+ bool isNontemporal = false );
1287
+ void buildStoreOfScalar (mlir::Value value, Address addr, bool isVolatile,
1288
+ QualType ty,
1289
+ AlignmentSource source = AlignmentSource::Type,
1290
+ bool isInit = false , bool isNontemporal = false ) {
1291
+ buildStoreOfScalar (value, addr, isVolatile, ty, LValueBaseInfo (source),
1292
+ CGM.getTBAAAccessInfo (ty), isInit, isNontemporal);
1293
+ }
1281
1294
void buildStoreOfScalar (mlir::Value value, LValue lvalue, bool isInit);
1282
1295
1283
1296
mlir::Value buildToMemory (mlir::Value Value, clang::QualType Ty);
@@ -1352,9 +1365,10 @@ class CIRGenFunction : public CIRGenTypeCache {
1352
1365
// / reasonable to just ignore the returned alignment when it isn't from an
1353
1366
// / explicit source.
1354
1367
Address
1355
- buildPointerWithAlignment (const clang::Expr *E,
1356
- LValueBaseInfo *BaseInfo = nullptr ,
1357
- KnownNonNull_t IsKnownNonNull = NotKnownNonNull);
1368
+ buildPointerWithAlignment (const clang::Expr *expr,
1369
+ LValueBaseInfo *baseInfo = nullptr ,
1370
+ TBAAAccessInfo *tbaaInfo = nullptr ,
1371
+ KnownNonNull_t isKnownNonNull = NotKnownNonNull);
1358
1372
1359
1373
LValue
1360
1374
buildConditionalOperatorLValue (const AbstractConditionalOperator *expr);
@@ -1534,19 +1548,21 @@ class CIRGenFunction : public CIRGenTypeCache {
1534
1548
};
1535
1549
1536
1550
LValue MakeNaturalAlignPointeeAddrLValue (mlir::Value V, clang::QualType T);
1537
- LValue MakeNaturalAlignAddrLValue (mlir::Value V , QualType T );
1551
+ LValue MakeNaturalAlignAddrLValue (mlir::Value val , QualType ty );
1538
1552
1539
1553
// / Construct an address with the natural alignment of T. If a pointer to T
1540
1554
// / is expected to be signed, the pointer passed to this function must have
1541
1555
// / been signed, and the returned Address will have the pointer authentication
1542
1556
// / information needed to authenticate the signed pointer.
1543
1557
Address makeNaturalAddressForPointer (
1544
- mlir::Value Ptr , QualType T, CharUnits Alignment = CharUnits::Zero(),
1545
- bool ForPointeeType = false, LValueBaseInfo *BaseInfo = nullptr,
1546
- KnownNonNull_t IsKnownNonNull = NotKnownNonNull) {
1547
- if (Alignment.isZero ())
1548
- Alignment = CGM.getNaturalTypeAlignment (T, BaseInfo, ForPointeeType);
1549
- return Address (Ptr , convertTypeForMem (T), Alignment, IsKnownNonNull);
1558
+ mlir::Value ptr, QualType t, CharUnits alignment = CharUnits::Zero(),
1559
+ bool forPointeeType = false, LValueBaseInfo *baseInfo = nullptr,
1560
+ TBAAAccessInfo *tbaaInfo = nullptr,
1561
+ KnownNonNull_t isKnownNonNull = NotKnownNonNull) {
1562
+ if (alignment.isZero ())
1563
+ alignment =
1564
+ CGM.getNaturalTypeAlignment (t, baseInfo, tbaaInfo, forPointeeType);
1565
+ return Address (ptr, convertTypeForMem (t), alignment, isKnownNonNull);
1550
1566
}
1551
1567
1552
1568
// / Load the value for 'this'. This function is only valid while generating
@@ -1590,14 +1606,16 @@ class CIRGenFunction : public CIRGenTypeCache {
1590
1606
QualType DstTy,
1591
1607
SourceLocation Loc);
1592
1608
1593
- LValue makeAddrLValue (Address Addr, clang::QualType T,
1594
- LValueBaseInfo BaseInfo) {
1595
- return LValue::makeAddr (Addr, T, getContext (), BaseInfo);
1609
+ LValue makeAddrLValue (Address addr, clang::QualType ty,
1610
+ LValueBaseInfo baseInfo) {
1611
+ return LValue::makeAddr (addr, ty, getContext (), baseInfo,
1612
+ CGM.getTBAAAccessInfo (ty));
1596
1613
}
1597
1614
1598
- LValue makeAddrLValue (Address Addr, clang::QualType T,
1599
- AlignmentSource Source = AlignmentSource::Type) {
1600
- return LValue::makeAddr (Addr, T, getContext (), LValueBaseInfo (Source));
1615
+ LValue makeAddrLValue (Address addr, clang::QualType ty,
1616
+ AlignmentSource source = AlignmentSource::Type) {
1617
+ return LValue::makeAddr (addr, ty, getContext (), LValueBaseInfo (source),
1618
+ CGM.getTBAAAccessInfo (ty));
1601
1619
}
1602
1620
1603
1621
void initializeVTablePointers (mlir::Location loc,
0 commit comments