Skip to content

[SIL] Removed Indirect_In_Constant convention. #62501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions SwiftCompilerSources/Sources/SIL/Argument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ public enum ArgumentConvention {
/// object.
case indirectIn

/// This argument is passed indirectly, i.e. by directly passing the address
/// of an object in memory. The callee must treat the object as read-only
/// The callee may assume that the address does not alias any valid object.
case indirectInConstant

/// This argument is passed indirectly, i.e. by directly passing the address
/// of an object in memory. The callee may not modify and does not destroy
/// the object.
Expand Down Expand Up @@ -130,7 +125,7 @@ public enum ArgumentConvention {

public var isIndirect: Bool {
switch self {
case .indirectIn, .indirectInConstant, .indirectInGuaranteed,
case .indirectIn, .indirectInGuaranteed,
.indirectInout, .indirectInoutAliasable, .indirectOut:
return true
case .directOwned, .directUnowned, .directGuaranteed:
Expand All @@ -140,7 +135,7 @@ public enum ArgumentConvention {

public var isIndirectIn: Bool {
switch self {
case .indirectIn, .indirectInConstant, .indirectInGuaranteed:
case .indirectIn, .indirectInGuaranteed:
return true
case .directOwned, .directUnowned, .directGuaranteed,
.indirectInout, .indirectInoutAliasable, .indirectOut:
Expand All @@ -152,7 +147,7 @@ public enum ArgumentConvention {
switch self {
case .indirectInGuaranteed, .directGuaranteed:
return true
case .indirectIn, .indirectInConstant, .directOwned, .directUnowned,
case .indirectIn, .directOwned, .directUnowned,
.indirectInout, .indirectInoutAliasable, .indirectOut:
return false
}
Expand All @@ -161,7 +156,6 @@ public enum ArgumentConvention {
public var isExclusiveIndirect: Bool {
switch self {
case .indirectIn,
.indirectInConstant,
.indirectOut,
.indirectInGuaranteed,
.indirectInout:
Expand All @@ -182,7 +176,6 @@ public enum ArgumentConvention {
return true

case .indirectIn,
.indirectInConstant,
.indirectOut,
.indirectInGuaranteed,
.directUnowned,
Expand All @@ -205,7 +198,6 @@ extension BridgedArgumentConvention {
var convention: ArgumentConvention {
switch self {
case ArgumentConvention_Indirect_In: return .indirectIn
case ArgumentConvention_Indirect_In_Constant: return .indirectInConstant
case ArgumentConvention_Indirect_In_Guaranteed: return .indirectInGuaranteed
case ArgumentConvention_Indirect_Inout: return .indirectInout
case ArgumentConvention_Indirect_InoutAliasable: return .indirectInoutAliasable
Expand Down
2 changes: 1 addition & 1 deletion SwiftCompilerSources/Sources/SIL/Effects.swift
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public struct SideEffects : CustomStringConvertible, NoReflectionChildren {
result.ownership = SideEffects.Ownership()
}
switch convention {
case .indirectIn, .indirectInConstant:
case .indirectIn:
result.memory.write = false
case .indirectInGuaranteed:
result.memory.write = false
Expand Down
8 changes: 0 additions & 8 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3707,11 +3707,6 @@ enum class ParameterConvention : uint8_t {
/// object.
Indirect_In,

/// This argument is passed indirectly, i.e. by directly passing the address
/// of an object in memory. The callee must treat the object as read-only
/// The callee may assume that the address does not alias any valid object.
Indirect_In_Constant,

/// This argument is passed indirectly, i.e. by directly passing the address
/// of an object in memory. The callee may not modify and does not destroy
/// the object.
Expand Down Expand Up @@ -3754,7 +3749,6 @@ static_assert(unsigned(ParameterConvention::Direct_Guaranteed) < (1<<3),
inline bool isIndirectFormalParameter(ParameterConvention conv) {
switch (conv) {
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_InoutAliasable:
case ParameterConvention::Indirect_In_Guaranteed:
Expand All @@ -3770,7 +3764,6 @@ inline bool isIndirectFormalParameter(ParameterConvention conv) {
inline bool isConsumedParameter(ParameterConvention conv) {
switch (conv) {
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Direct_Owned:
return true;

Expand All @@ -3796,7 +3789,6 @@ inline bool isGuaranteedParameter(ParameterConvention conv) {
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_InoutAliasable:
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Direct_Unowned:
case ParameterConvention::Direct_Owned:
return false;
Expand Down
1 change: 0 additions & 1 deletion include/swift/SIL/ApplySite.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ class ApplySite {
return pai->isOnStack() ? SILArgumentConvention::Direct_Guaranteed
: SILArgumentConvention::Direct_Owned;
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Indirect_In_Guaranteed:
return pai->isOnStack() ? SILArgumentConvention::Indirect_In_Guaranteed
: SILArgumentConvention::Indirect_In;
Expand Down
8 changes: 0 additions & 8 deletions include/swift/SIL/SILArgumentConvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace swift {
struct SILArgumentConvention {
enum ConventionType : uint8_t {
Indirect_In,
Indirect_In_Constant,
Indirect_In_Guaranteed,
Indirect_Inout,
Indirect_InoutAliasable,
Expand All @@ -43,9 +42,6 @@ struct SILArgumentConvention {
case ParameterConvention::Indirect_In:
Value = SILArgumentConvention::Indirect_In;
return;
case ParameterConvention::Indirect_In_Constant:
Value = SILArgumentConvention::Indirect_In_Constant;
return;
case ParameterConvention::Indirect_Inout:
Value = SILArgumentConvention::Indirect_Inout;
return;
Expand Down Expand Up @@ -81,7 +77,6 @@ struct SILArgumentConvention {
return true;
case SILArgumentConvention::Indirect_In_Guaranteed:
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Indirect_Out:
case SILArgumentConvention::Direct_Unowned:
case SILArgumentConvention::Direct_Owned:
Expand All @@ -94,7 +89,6 @@ struct SILArgumentConvention {
bool isOwnedConvention() const {
switch (Value) {
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Direct_Owned:
return true;
case SILArgumentConvention::Indirect_In_Guaranteed:
Expand All @@ -115,7 +109,6 @@ struct SILArgumentConvention {
return true;
case SILArgumentConvention::Indirect_Inout:
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Indirect_Out:
case SILArgumentConvention::Indirect_InoutAliasable:
case SILArgumentConvention::Direct_Unowned:
Expand All @@ -129,7 +122,6 @@ struct SILArgumentConvention {
bool isExclusiveIndirectParameter() {
switch (Value) {
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Indirect_Out:
case SILArgumentConvention::Indirect_In_Guaranteed:
case SILArgumentConvention::Indirect_Inout:
Expand Down
1 change: 0 additions & 1 deletion include/swift/SIL/SILBridging.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ typedef enum {

typedef enum {
ArgumentConvention_Indirect_In,
ArgumentConvention_Indirect_In_Constant,
ArgumentConvention_Indirect_In_Guaranteed,
ArgumentConvention_Indirect_Inout,
ArgumentConvention_Indirect_InoutAliasable,
Expand Down
1 change: 0 additions & 1 deletion include/swift/SIL/SILFunctionConventions.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ inline bool SILModuleConventions::isIndirectSILParam(SILParameterInfo param,
return false;

case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
return (loweredAddresses ||
param.getInterfaceType()->isOpenedExistentialWithError());
Expand Down
3 changes: 1 addition & 2 deletions lib/AST/ASTDemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,8 @@ static ParameterConvention
getParameterConvention(ImplParameterConvention conv) {
switch (conv) {
case Demangle::ImplParameterConvention::Indirect_In:
return ParameterConvention::Indirect_In;
case Demangle::ImplParameterConvention::Indirect_In_Constant:
return ParameterConvention::Indirect_In_Constant;
return ParameterConvention::Indirect_In;
case Demangle::ImplParameterConvention::Indirect_In_Guaranteed:
return ParameterConvention::Indirect_In_Guaranteed;
case Demangle::ImplParameterConvention::Indirect_Inout:
Expand Down
2 changes: 0 additions & 2 deletions lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1861,8 +1861,6 @@ static char getParamConvention(ParameterConvention conv) {
// different places.
switch (conv) {
case ParameterConvention::Indirect_In: return 'i';
case ParameterConvention::Indirect_In_Constant:
return 'c';
case ParameterConvention::Indirect_Inout: return 'l';
case ParameterConvention::Indirect_InoutAliasable: return 'b';
case ParameterConvention::Indirect_In_Guaranteed: return 'n';
Expand Down
3 changes: 0 additions & 3 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6197,7 +6197,6 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
Printer << "@callee_guaranteed ";
return;
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_InoutAliasable:
case ParameterConvention::Indirect_In_Guaranteed:
Expand Down Expand Up @@ -6815,8 +6814,6 @@ std::string GenericSignature::getAsString() const {
static StringRef getStringForParameterConvention(ParameterConvention conv) {
switch (conv) {
case ParameterConvention::Indirect_In: return "@in ";
case ParameterConvention::Indirect_In_Constant:
return "@in_constant ";
case ParameterConvention::Indirect_In_Guaranteed: return "@in_guaranteed ";
case ParameterConvention::Indirect_Inout: return "@inout ";
case ParameterConvention::Indirect_InoutAliasable: return "@inout_aliasable ";
Expand Down
1 change: 0 additions & 1 deletion lib/IRGen/GenCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,6 @@ const TypeInfo &SignatureExpansion::expand(SILParameterInfo param) {
auto &ti = IGM.getTypeInfo(paramSILType);
switch (auto conv = param.getConvention()) {
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
addIndirectValueParameterAttributes(IGM, Attrs, ti, ParamIRTypes.size());
addPointerParameter(IGM.getStorageType(getSILFuncConventions().getSILType(
Expand Down
3 changes: 1 addition & 2 deletions lib/IRGen/GenDistributed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,7 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
}

switch (param.getConvention()) {
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant: {
case ParameterConvention::Indirect_In: {
// The only way to load opaque type is to allocate a temporary
// variable on the stack for it and initialize from the given address
// either at +0 or +1 depending on convention.
Expand Down
7 changes: 1 addition & 6 deletions lib/IRGen/GenFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,6 @@ CanType irgen::getArgumentLoweringType(CanType type, SILParameterInfo paramInfo,
// closures don't take ownership of their arguments so we just capture the
// address.
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
if (isNoEscape)
return CanInOutType::get(type);
Expand Down Expand Up @@ -1341,7 +1340,6 @@ static llvm::Value *emitPartialApplicationForwarder(IRGenModule &IGM,
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_InoutAliasable:
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
llvm_unreachable("indirect callables not supported");
}
Expand Down Expand Up @@ -1450,7 +1448,6 @@ static llvm::Value *emitPartialApplicationForwarder(IRGenModule &IGM,
auto argConvention = conventions[nextCapturedField++];
switch (argConvention) {
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Direct_Owned:
if (!consumesContext) subIGF.emitNativeStrongRetain(rawData, subIGF.getDefaultAtomicity());
break;
Expand Down Expand Up @@ -1538,8 +1535,7 @@ static llvm::Value *emitPartialApplicationForwarder(IRGenModule &IGM,

Explosion param;
switch (fieldConvention) {
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant: {
case ParameterConvention::Indirect_In: {

auto initStackCopy = [&addressesToDeallocate, &needsAllocas, &param,
&subIGF](const TypeInfo &fieldTI, SILType fieldTy,
Expand Down Expand Up @@ -2095,7 +2091,6 @@ Optional<StackAddress> irgen::emitFunctionPartialApplication(
switch (argConventions[i]) {
// Take indirect value arguments out of memory.
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed: {
if (outType->isNoEscape()) {
cast<LoadableTypeInfo>(fieldLayout.getType())
Expand Down
1 change: 0 additions & 1 deletion lib/IRGen/GenObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,6 @@ static llvm::Function *emitObjCPartialApplicationForwarder(IRGenModule &IGM,
break;
case ParameterConvention::Indirect_In_Guaranteed:
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_InoutAliasable:
llvm_unreachable("self passed indirectly?!");
Expand Down
1 change: 0 additions & 1 deletion lib/IRGen/GenProto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ void PolymorphicConvention::considerParameter(SILParameterInfo param,
// we don't bother, for no good reason. But if this is 'self',
// consider passing an extra metatype.
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_InoutAliasable:
Expand Down
1 change: 0 additions & 1 deletion lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3546,7 +3546,6 @@ static bool isSimplePartialApply(IRGenFunction &IGF, PartialApplyInst *i) {
// direct or indirect.
switch (appliedParam.getConvention()) {
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
case ParameterConvention::Indirect_InoutAliasable:
// Indirect arguments are trivially word sized.
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/LoadableByAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ SILParameterInfo LargeSILTypeMapper::getNewParameter(GenericEnvironment *env,
param.getDifferentiability());
else
return SILParameterInfo(storageType.getASTType(),
ParameterConvention::Indirect_In_Constant,
ParameterConvention::Indirect_In,
param.getDifferentiability());
} else {
auto newType = getNewSILType(env, storageType, IGM);
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/IR/OperandOwnership.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ static OperandOwnership getFunctionArgOwnership(SILArgumentConvention argConv,

switch (argConv) {
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Direct_Owned:
return OperandOwnership::ForwardingConsume;

Expand Down
2 changes: 0 additions & 2 deletions lib/SIL/IR/SILFunctionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ static CanSILFunctionType getAutoDiffPullbackType(
break;
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
case ParameterConvention::Indirect_InoutAliasable:
conv = ResultConvention::Indirect;
Expand Down Expand Up @@ -1002,7 +1001,6 @@ CanSILFunctionType SILFunctionType::getAutoDiffTransposeFunctionType(
break;
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_In_Guaranteed:
case ParameterConvention::Indirect_InoutAliasable:
newConv = ResultConvention::Indirect;
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/IR/SILPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,6 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
// Should not apply to callees.
case ParameterConvention::Direct_Unowned:
case ParameterConvention::Indirect_In:
case ParameterConvention::Indirect_In_Constant:
case ParameterConvention::Indirect_Inout:
case ParameterConvention::Indirect_In_Guaranteed:
case ParameterConvention::Indirect_InoutAliasable:
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/IR/SILValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ ValueOwnershipKind::ValueOwnershipKind(const SILFunction &F, SILType Type,

switch (Convention) {
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
value = moduleConventions.useLoweredAddresses() ? OwnershipKind::None
: OwnershipKind::Owned;
break;
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/Utils/MemAccessUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,6 @@ bool GatherUniqueStorageUses::visitUse(Operand *use, AccessUseType useTy) {
&UniqueStorageUseVisitor::visitStore);
case SILArgumentConvention::Indirect_In_Guaranteed:
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
return visitApplyOperand(use, visitor,
&UniqueStorageUseVisitor::visitLoad);
case SILArgumentConvention::Direct_Unowned:
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/Utils/MemoryLocations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ void MemoryLocations::analyzeLocations(SILFunction *function) {
SILFunctionArgument *funcArg = cast<SILFunctionArgument>(arg);
switch (funcArg->getArgumentConvention()) {
case SILArgumentConvention::Indirect_In:
case SILArgumentConvention::Indirect_In_Constant:
case SILArgumentConvention::Indirect_In_Guaranteed:
case SILArgumentConvention::Indirect_Out:
// These are not SIL addresses under -enable-sil-opaque-values
Expand Down
4 changes: 0 additions & 4 deletions lib/SIL/Utils/SILBridging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ BridgedArgumentConvention SILArgumentConvention_getBridged(SILArgumentConvention
return ArgumentConvention_Indirect_In_Guaranteed;
case SILArgumentConvention::Indirect_In:
return ArgumentConvention_Indirect_In;
case SILArgumentConvention::Indirect_In_Constant:
return ArgumentConvention_Indirect_In_Constant;
case SILArgumentConvention::Indirect_Out:
return ArgumentConvention_Indirect_Out;
case SILArgumentConvention::Direct_Unowned:
Expand Down Expand Up @@ -392,8 +390,6 @@ static BridgedArgumentConvention bridgeArgumentConvention(SILArgumentConvention
return ArgumentConvention_Indirect_In_Guaranteed;
case SILArgumentConvention::Indirect_In:
return ArgumentConvention_Indirect_In;
case SILArgumentConvention::Indirect_In_Constant:
return ArgumentConvention_Indirect_In_Constant;
case SILArgumentConvention::Indirect_Out:
return ArgumentConvention_Indirect_Out;
case SILArgumentConvention::Direct_Unowned:
Expand Down
Loading