Skip to content

Commit d6ea606

Browse files
committed
[AST] NFC: Repack misc SILParameterInfo bits
1 parent b96731d commit d6ea606

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

include/swift/AST/Types.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,7 +2955,7 @@ enum class ParameterConvention {
29552955
};
29562956
// Check that the enum values fit inside SILFunctionTypeBits.
29572957
static_assert(unsigned(ParameterConvention::Direct_Guaranteed) < (1<<3),
2958-
"fits in SILFunctionTypeBits");
2958+
"fits in SILFunctionTypeBits and SILParameterInfo");
29592959

29602960
// Does this parameter convention require indirect storage? This reflects a
29612961
// SILFunctionType's formal (immutable) conventions, as opposed to the transient
@@ -3015,20 +3015,19 @@ inline bool isGuaranteedParameter(ParameterConvention conv) {
30153015

30163016
/// A parameter type and the rules for passing it.
30173017
class SILParameterInfo {
3018-
CanType Ty;
3019-
ParameterConvention Convention;
3018+
llvm::PointerIntPair<CanType, 3, ParameterConvention> TypeAndConvention;
30203019
public:
3021-
SILParameterInfo() : Ty(), Convention((ParameterConvention)0) {}
3020+
SILParameterInfo() = default;//: Ty(), Convention((ParameterConvention)0) {}
30223021
SILParameterInfo(CanType type, ParameterConvention conv)
3023-
: Ty(type), Convention(conv) {
3022+
: TypeAndConvention(type, conv) {
30243023
assert(type->isLegalSILType() && "SILParameterInfo has illegal SIL type");
30253024
}
30263025

30273026
CanType getType() const {
3028-
return Ty;
3027+
return TypeAndConvention.getPointer();
30293028
}
30303029
ParameterConvention getConvention() const {
3031-
return Convention;
3030+
return TypeAndConvention.getInt();
30323031
}
30333032
// Does this parameter convention require indirect storage? This reflects a
30343033
// SILFunctionType's formal (immutable) conventions, as opposed to the
@@ -3089,8 +3088,8 @@ class SILParameterInfo {
30893088
}
30903089

30913090
void profile(llvm::FoldingSetNodeID &id) {
3092-
id.AddPointer(Ty.getPointer());
3093-
id.AddInteger((unsigned)Convention);
3091+
id.AddPointer(getType().getPointer());
3092+
id.AddInteger((unsigned)getConvention());
30943093
}
30953094

30963095
void dump() const;
@@ -3104,7 +3103,7 @@ class SILParameterInfo {
31043103
}
31053104

31063105
bool operator==(SILParameterInfo rhs) const {
3107-
return Ty == rhs.Ty && Convention == rhs.Convention;
3106+
return getType() == rhs.getType() && getConvention() == rhs.getConvention();
31083107
}
31093108
bool operator!=(SILParameterInfo rhs) const {
31103109
return !(*this == rhs);

0 commit comments

Comments
 (0)