Skip to content

Commit 01bce39

Browse files
Merge pull request #71418 from nate-chandler/nfc/20240206/1/rename-inst-class
[NFC] SIL: Renamed SpecifyTestInst.
2 parents 3a5ee89 + b535725 commit 01bce39

18 files changed

+35
-38
lines changed

include/swift/SIL/ParseTestSpecification.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ struct Arguments {
201201
struct UnparsedSpecification {
202202
/// The string which specifies the test.
203203
///
204-
/// Not a StringRef because the TestSpecificationInst whose payload is of
204+
/// Not a StringRef because the SpecifyTestInst whose payload is of
205205
/// interest gets deleted.
206206
std::string string;
207207
/// The next non-debug instruction.

include/swift/SIL/SILBuilder.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,10 @@ class SILBuilder {
10651065
return createDebugValue(Loc, src, Var);
10661066
}
10671067

1068-
TestSpecificationInst *
1069-
createTestSpecificationInst(SILLocation Loc,
1070-
StringRef ArgumentsSpecification) {
1071-
return insert(TestSpecificationInst::create(
1072-
getSILDebugLocation(Loc), ArgumentsSpecification, getModule()));
1068+
SpecifyTestInst *createSpecifyTestInst(SILLocation Loc,
1069+
StringRef ArgumentsSpecification) {
1070+
return insert(SpecifyTestInst::create(getSILDebugLocation(Loc),
1071+
ArgumentsSpecification, getModule()));
10731072
}
10741073

10751074
UnownedCopyValueInst *createUnownedCopyValue(SILLocation Loc,

include/swift/SIL/SILCloner.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3124,10 +3124,9 @@ void SILCloner<ImplClass>::visitIncrementProfilerCounterInst(
31243124
}
31253125

31263126
template <typename ImplClass>
3127-
void SILCloner<ImplClass>::visitTestSpecificationInst(
3128-
TestSpecificationInst *Inst) {
3127+
void SILCloner<ImplClass>::visitSpecifyTestInst(SpecifyTestInst *Inst) {
31293128
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
3130-
recordClonedInstruction(Inst, getBuilder().createTestSpecificationInst(
3129+
recordClonedInstruction(Inst, getBuilder().createSpecifyTestInst(
31313130
getOpLocation(Inst->getLoc()),
31323131
Inst->getArgumentsSpecification()));
31333132
}

include/swift/SIL/SILInstruction.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5309,22 +5309,21 @@ class DebugValueInst final
53095309
}
53105310
};
53115311

5312-
class TestSpecificationInst final
5313-
: public InstructionBase<SILInstructionKind::TestSpecificationInst,
5312+
class SpecifyTestInst final
5313+
: public InstructionBase<SILInstructionKind::SpecifyTestInst,
53145314
NonValueInstruction>,
5315-
private llvm::TrailingObjects<TestSpecificationInst, char> {
5315+
private llvm::TrailingObjects<SpecifyTestInst, char> {
53165316
friend TrailingObjects;
53175317
friend SILBuilder;
53185318

53195319
llvm::StringMap<SILValue> values;
53205320
unsigned ArgumentsSpecificationLength;
53215321

5322-
TestSpecificationInst(SILDebugLocation Loc,
5323-
unsigned ArgumentsSpecificationLength)
5322+
SpecifyTestInst(SILDebugLocation Loc, unsigned ArgumentsSpecificationLength)
53245323
: InstructionBase(Loc),
53255324
ArgumentsSpecificationLength(ArgumentsSpecificationLength) {}
53265325

5327-
static TestSpecificationInst *
5326+
static SpecifyTestInst *
53285327
create(SILDebugLocation Loc, StringRef argumentsSpecification, SILModule &M);
53295328

53305329
public:

include/swift/SIL/SILNodes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ NON_VALUE_INST(DebugValueInst, debug_value,
842842
SILInstruction, None, DoesNotRelease)
843843
NON_VALUE_INST(DebugStepInst, debug_step,
844844
SILInstruction, MayHaveSideEffects, DoesNotRelease)
845-
NON_VALUE_INST(TestSpecificationInst, specify_test,
845+
NON_VALUE_INST(SpecifyTestInst, specify_test,
846846
SILInstruction, None, DoesNotRelease)
847847
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, ...) \
848848
NON_VALUE_INST(Store##Name##Inst, store_##name, \

lib/IRGen/IRGenSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ class IRGenSILFunction :
14401440
void visitLinearFunctionExtractInst(LinearFunctionExtractInst *i);
14411441
void visitDifferentiabilityWitnessFunctionInst(
14421442
DifferentiabilityWitnessFunctionInst *i);
1443-
void visitTestSpecificationInst(TestSpecificationInst *i) {
1443+
void visitSpecifyTestInst(SpecifyTestInst *i) {
14441444
llvm_unreachable("test-only instruction in Lowered SIL?!");
14451445
}
14461446

lib/SIL/IR/OperandOwnership.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ SHOULD_NEVER_VISIT_INST(ReleaseValueAddr)
125125
SHOULD_NEVER_VISIT_INST(StrongRelease)
126126
SHOULD_NEVER_VISIT_INST(GetAsyncContinuation)
127127
SHOULD_NEVER_VISIT_INST(IncrementProfilerCounter)
128-
SHOULD_NEVER_VISIT_INST(TestSpecification)
128+
SHOULD_NEVER_VISIT_INST(SpecifyTest)
129129
SHOULD_NEVER_VISIT_INST(ScalarPackIndex)
130130
SHOULD_NEVER_VISIT_INST(Vector)
131131

lib/SIL/IR/SILInstructions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,15 +546,15 @@ IncrementProfilerCounterInst *IncrementProfilerCounterInst::create(
546546
return Inst;
547547
}
548548

549-
TestSpecificationInst *
550-
TestSpecificationInst::create(SILDebugLocation Loc,
551-
StringRef ArgumentsSpecification, SILModule &M) {
549+
SpecifyTestInst *SpecifyTestInst::create(SILDebugLocation Loc,
550+
StringRef ArgumentsSpecification,
551+
SILModule &M) {
552552
auto ArgumentsSpecificationLength = ArgumentsSpecification.size();
553553
auto Size = totalSizeToAlloc<char>(ArgumentsSpecificationLength);
554-
auto Buffer = M.allocateInst(Size, alignof(TestSpecificationInst));
554+
auto Buffer = M.allocateInst(Size, alignof(SpecifyTestInst));
555555

556556
auto *Inst =
557-
::new (Buffer) TestSpecificationInst(Loc, ArgumentsSpecificationLength);
557+
::new (Buffer) SpecifyTestInst(Loc, ArgumentsSpecificationLength);
558558
std::uninitialized_copy(ArgumentsSpecification.begin(),
559559
ArgumentsSpecification.end(),
560560
Inst->getTrailingObjects<char>());

lib/SIL/IR/SILPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
26792679
*this << getIDAndType(RI->getOperand());
26802680
}
26812681

2682-
void visitTestSpecificationInst(TestSpecificationInst *TSI) {
2682+
void visitSpecifyTestInst(SpecifyTestInst *TSI) {
26832683
*this << QuotedString(TSI->getArgumentsSpecification());
26842684
}
26852685

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,7 +3413,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
34133413
ResultVal = B.createDebugStep(InstLoc);
34143414
break;
34153415

3416-
case SILInstructionKind::TestSpecificationInst: {
3416+
case SILInstructionKind::SpecifyTestInst: {
34173417
// Parse the specification string.
34183418
if (P.Tok.getKind() != tok::string_literal) {
34193419
P.diagnose(P.Tok, diag::expected_sil_specify_test_body);
@@ -3424,7 +3424,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
34243424
auto ArgumentsSpecification =
34253425
P.Tok.getText().drop_front(numQuotes).drop_back(numQuotes).trim();
34263426
P.consumeToken(tok::string_literal);
3427-
auto *tsi = B.createTestSpecificationInst(InstLoc, ArgumentsSpecification);
3427+
auto *tsi = B.createSpecifyTestInst(InstLoc, ArgumentsSpecification);
34283428
SmallVector<StringRef, 4> components;
34293429
test::getTestSpecificationComponents(ArgumentsSpecification, components);
34303430
for (auto component : components) {

lib/SIL/Parser/ParseTestSpecification.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ void findAndDeleteTraceValues(SILFunction *function,
4141
bool isDeleteableTestInstruction(SILInstruction const *instruction) {
4242
if (auto *dvi = dyn_cast<DebugValueInst>(instruction))
4343
return dvi->hasTrace();
44-
if (isa<TestSpecificationInst>(instruction))
44+
if (isa<SpecifyTestInst>(instruction))
4545
return true;
4646
return false;
4747
}
4848

49-
SILInstruction *findAnchorInstructionAfter(TestSpecificationInst *tsi) {
49+
SILInstruction *findAnchorInstructionAfter(SpecifyTestInst *tsi) {
5050
for (auto *instruction = tsi->getNextInstruction(); instruction;
5151
instruction = instruction->getNextInstruction()) {
5252
if (!isDeleteableTestInstruction(instruction))
5353
return instruction;
5454
}
55-
// This can't happen because a TestSpecificationInst isn't a terminator itself
55+
// This can't happen because a SpecifyTestInst isn't a terminator itself
5656
// nor are any deleteable instructions.
57-
llvm_unreachable("found no anchor after TestSpecificationInst!?");
57+
llvm_unreachable("found no anchor after SpecifyTestInst!?");
5858
}
5959

6060
// Helpers: Looking up subobjects by index
@@ -701,7 +701,7 @@ void swift::test::getTestSpecifications(
701701
SmallVectorImpl<UnparsedSpecification> &specifications) {
702702
for (auto &block : *function) {
703703
for (SILInstruction &inst : block.deletableInstructions()) {
704-
if (auto *tsi = dyn_cast<TestSpecificationInst>(&inst)) {
704+
if (auto *tsi = dyn_cast<SpecifyTestInst>(&inst)) {
705705
auto ref = tsi->getArgumentsSpecification();
706706
auto *anchor = findAnchorInstructionAfter(tsi);
707707
specifications.push_back(

lib/SIL/Parser/SILParser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class SILParser {
7070

7171
/// Data structures used to perform name lookup for local values.
7272
llvm::StringMap<ValueBase *> LocalValues;
73-
llvm::StringMap<llvm::SmallVector<TestSpecificationInst *>> TestSpecsWithRefs;
73+
llvm::StringMap<llvm::SmallVector<SpecifyTestInst *>> TestSpecsWithRefs;
7474
llvm::StringMap<SourceLoc> ForwardRefLocalValues;
7575

7676
Type performTypeResolution(TypeRepr *TyR, bool IsSILType,

lib/SIL/Utils/InstructionUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
581581
case SILInstructionKind::DebugValueInst:
582582
// Ignore runtime calls of debug_value
583583
return RuntimeEffect::NoEffect;
584-
case SILInstructionKind::TestSpecificationInst:
584+
case SILInstructionKind::SpecifyTestInst:
585585
// Ignore runtime calls of test-only instructions
586586
return RuntimeEffect::NoEffect;
587587

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,7 @@ CONSTANT_TRANSLATION(EndApplyInst, Ignored)
23922392
CONSTANT_TRANSLATION(AbortApplyInst, Ignored)
23932393
CONSTANT_TRANSLATION(DebugStepInst, Ignored)
23942394
CONSTANT_TRANSLATION(IncrementProfilerCounterInst, Ignored)
2395-
CONSTANT_TRANSLATION(TestSpecificationInst, Ignored)
2395+
CONSTANT_TRANSLATION(SpecifyTestInst, Ignored)
23962396

23972397
//===---
23982398
// Require

lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ static bool hasOpaqueArchetype(TypeExpansionContext context,
325325
case SILInstructionKind::MarkFunctionEscapeInst:
326326
case SILInstructionKind::DebugValueInst:
327327
case SILInstructionKind::DebugStepInst:
328-
case SILInstructionKind::TestSpecificationInst:
328+
case SILInstructionKind::SpecifyTestInst:
329329
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
330330
case SILInstructionKind::Store##Name##Inst:
331331
#include "swift/AST/ReferenceStorage.def"

lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ InlineCost swift::instructionInlineCost(SILInstruction &I) {
904904
case SILInstructionKind::MarkUnresolvedReferenceBindingInst:
905905
case SILInstructionKind::CopyableToMoveOnlyWrapperValueInst:
906906
case SILInstructionKind::MoveOnlyWrapperToCopyableValueInst:
907-
case SILInstructionKind::TestSpecificationInst:
907+
case SILInstructionKind::SpecifyTestInst:
908908
case SILInstructionKind::MoveOnlyWrapperToCopyableAddrInst:
909909
case SILInstructionKind::CopyableToMoveOnlyWrapperAddrInst:
910910
case SILInstructionKind::MoveOnlyWrapperToCopyableBoxInst:

lib/Serialization/DeserializeSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn,
13491349
switch (OpCode) {
13501350
case SILInstructionKind::DebugValueInst:
13511351
case SILInstructionKind::DebugStepInst:
1352-
case SILInstructionKind::TestSpecificationInst:
1352+
case SILInstructionKind::SpecifyTestInst:
13531353
case SILInstructionKind::AllocPackMetadataInst:
13541354
case SILInstructionKind::DeallocPackMetadataInst:
13551355
llvm_unreachable("not supported");

lib/Serialization/SerializeSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
939939
// sense to write those instructions at all.
940940
// TODO: decide if we want to serialize those instructions.
941941
return;
942-
case SILInstructionKind::TestSpecificationInst:
942+
case SILInstructionKind::SpecifyTestInst:
943943
// Instruction exists only for tests. Ignore it.
944944
return;
945945
case SILInstructionKind::AllocPackMetadataInst:

0 commit comments

Comments
 (0)