Skip to content

Commit 87d09f8

Browse files
committed
replace HLSLAggregateCast with HLSLElementwiseCast
1 parent a7252d9 commit 87d09f8

File tree

12 files changed

+23
-23
lines changed

12 files changed

+23
-23
lines changed

clang/include/clang/AST/OperationKinds.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ CAST_OPERATION(HLSLVectorTruncation)
368368
CAST_OPERATION(HLSLArrayRValue)
369369

370370
// Aggregate by Value cast (HLSL only).
371-
CAST_OPERATION(HLSLAggregateCast)
371+
CAST_OPERATION(HLSLElementwiseCast)
372372

373373
//===- Binary Operations -------------------------------------------------===//
374374
// Operators listed in order of precedence.

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ bool CastExpr::CastConsistency() const {
19421942
case CK_FixedPointToBoolean:
19431943
case CK_HLSLArrayRValue:
19441944
case CK_HLSLVectorTruncation:
1945-
case CK_HLSLAggregateCast:
1945+
case CK_HLSLElementwiseCast:
19461946
CheckNoBasePath:
19471947
assert(path_empty() && "Cast kind should not have a base path!");
19481948
break;

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14875,7 +14875,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1487514875
case CK_NoOp:
1487614876
case CK_LValueToRValueBitCast:
1487714877
case CK_HLSLArrayRValue:
14878-
case CK_HLSLAggregateCast:
14878+
case CK_HLSLElementwiseCast:
1487914879
return ExprEvaluatorBaseTy::VisitCastExpr(E);
1488014880

1488114881
case CK_MemberPointerToBoolean:
@@ -15734,7 +15734,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
1573415734
case CK_IntegralToFixedPoint:
1573515735
case CK_MatrixCast:
1573615736
case CK_HLSLVectorTruncation:
15737-
case CK_HLSLAggregateCast:
15737+
case CK_HLSLElementwiseCast:
1573815738
llvm_unreachable("invalid cast kind for complex value");
1573915739

1574015740
case CK_LValueToRValue:

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5320,7 +5320,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
53205320
case CK_MatrixCast:
53215321
case CK_HLSLVectorTruncation:
53225322
case CK_HLSLArrayRValue:
5323-
case CK_HLSLAggregateCast:
5323+
case CK_HLSLElementwiseCast:
53245324
return EmitUnsupportedLValue(E, "unexpected cast lvalue");
53255325

53265326
case CK_Dependent:

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,9 @@ static void EmitHLSLScalarFlatCast(CodeGenFunction &CGF, Address DestVal,
526526
}
527527

528528
// emit a flat cast where the RHS is an aggregate
529-
static void EmitHLSLAggregateFlatCast(CodeGenFunction &CGF, Address DestVal,
530-
QualType DestTy, Address SrcVal,
531-
QualType SrcTy, SourceLocation Loc) {
529+
static void EmitHLSLElementwiseCast(CodeGenFunction &CGF, Address DestVal,
530+
QualType DestTy, Address SrcVal,
531+
QualType SrcTy, SourceLocation Loc) {
532532
// Flatten our destination
533533
SmallVector<QualType, 16> DestTypes; // Flattened type
534534
SmallVector<std::pair<Address, llvm::Value *>, 16> StoreGEPList;
@@ -963,7 +963,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
963963
case CK_HLSLArrayRValue:
964964
Visit(E->getSubExpr());
965965
break;
966-
case CK_HLSLAggregateCast: {
966+
case CK_HLSLElementwiseCast: {
967967
Expr *Src = E->getSubExpr();
968968
QualType SrcTy = Src->getType();
969969
RValue RV = CGF.EmitAnyExpr(Src);
@@ -978,7 +978,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
978978
assert(RV.isAggregate() &&
979979
"Can't perform HLSL Aggregate cast on a complex type.");
980980
Address SrcVal = RV.getAggregateAddress();
981-
EmitHLSLAggregateFlatCast(CGF, DestVal, DestTy, SrcVal, SrcTy, Loc);
981+
EmitHLSLElementwiseCast(CGF, DestVal, DestTy, SrcVal, SrcTy, Loc);
982982
}
983983
break;
984984
}
@@ -1552,7 +1552,7 @@ static bool castPreservesZero(const CastExpr *CE) {
15521552
case CK_NonAtomicToAtomic:
15531553
case CK_AtomicToNonAtomic:
15541554
case CK_HLSLVectorTruncation:
1555-
case CK_HLSLAggregateCast:
1555+
case CK_HLSLElementwiseCast:
15561556
return true;
15571557

15581558
case CK_BaseToDerivedMemberPointer:

clang/lib/CodeGen/CGExprComplex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastKind CK, Expr *Op,
610610
case CK_MatrixCast:
611611
case CK_HLSLVectorTruncation:
612612
case CK_HLSLArrayRValue:
613-
case CK_HLSLAggregateCast:
613+
case CK_HLSLElementwiseCast:
614614
llvm_unreachable("invalid cast kind for complex value");
615615

616616
case CK_FloatingRealToComplex:

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ class ConstExprEmitter
13351335
case CK_MatrixCast:
13361336
case CK_HLSLVectorTruncation:
13371337
case CK_HLSLArrayRValue:
1338-
case CK_HLSLAggregateCast:
1338+
case CK_HLSLElementwiseCast:
13391339
return nullptr;
13401340
}
13411341
llvm_unreachable("Invalid CastKind");

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,9 +2263,9 @@ bool CodeGenFunction::ShouldNullCheckClassCastValue(const CastExpr *CE) {
22632263
}
22642264

22652265
// RHS is an aggregate type
2266-
static Value *EmitHLSLAggregateFlatCast(CodeGenFunction &CGF, Address RHSVal,
2267-
QualType RHSTy, QualType LHSTy,
2268-
SourceLocation Loc) {
2266+
static Value *EmitHLSLElementwiseCast(CodeGenFunction &CGF, Address RHSVal,
2267+
QualType RHSTy, QualType LHSTy,
2268+
SourceLocation Loc) {
22692269
SmallVector<std::pair<Address, llvm::Value *>, 16> LoadGEPList;
22702270
SmallVector<QualType, 16> SrcTypes; // Flattened type
22712271
CGF.FlattenAccessAndType(RHSVal, RHSTy, LoadGEPList, SrcTypes);
@@ -2788,15 +2788,15 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
27882788
llvm::Value *Zero = llvm::Constant::getNullValue(CGF.SizeTy);
27892789
return Builder.CreateExtractElement(Vec, Zero, "cast.vtrunc");
27902790
}
2791-
case CK_HLSLAggregateCast: {
2791+
case CK_HLSLElementwiseCast: {
27922792
RValue RV = CGF.EmitAnyExpr(E);
27932793
SourceLocation Loc = CE->getExprLoc();
27942794
QualType SrcTy = E->getType();
27952795

27962796
assert(RV.isAggregate() && "Not a valid HLSL Flat Cast.");
27972797
// RHS is an aggregate
27982798
Address SrcVal = RV.getAggregateAddress();
2799-
return EmitHLSLAggregateFlatCast(CGF, SrcVal, SrcTy, DestTy, Loc);
2799+
return EmitHLSLElementwiseCast(CGF, SrcVal, SrcTy, DestTy, Loc);
28002800
}
28012801
} // end of switch
28022802

clang/lib/Edit/RewriteObjCFoundationAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg,
10851085
llvm_unreachable("OpenCL-specific cast in Objective-C?");
10861086

10871087
case CK_HLSLVectorTruncation:
1088-
case CK_HLSLAggregateCast:
1088+
case CK_HLSLElementwiseCast:
10891089
llvm_unreachable("HLSL-specific cast in Objective-C?");
10901090
break;
10911091

clang/lib/Sema/SemaCast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2781,7 +2781,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle,
27812781
SrcExpr = Self.ImpCastExprToType(
27822782
SrcExpr.get(), Self.Context.getArrayParameterType(SrcTy),
27832783
CK_HLSLArrayRValue, VK_PRValue, nullptr, CCK);
2784-
Kind = CK_HLSLAggregateCast;
2784+
Kind = CK_HLSLElementwiseCast;
27852785
return;
27862786
}
27872787

0 commit comments

Comments
 (0)