Skip to content

Commit 9c53465

Browse files
Merge pull request #68714 from nate-chandler/sil/test/rename-specify_test-inst
[SIL] Renamed specify_test instruction.
2 parents d85fbf6 + 28f742e commit 9c53465

37 files changed

+233
-232
lines changed

docs/SIL.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4330,13 +4330,13 @@ It is code-generated to a NOP instruction.
43304330
Testing
43314331
~~~~~~~
43324332

4333-
test_specification
4334-
``````````````````
4333+
specify_test
4334+
````````````
43354335
::
43364336

4337-
sil-instruction ::= 'test_specification' string-literal
4337+
sil-instruction ::= 'specify_test' string-literal
43384338

4339-
test_specification "parsing @trace[3] @function[other].block[2].instruction[1]"
4339+
specify_test "parsing @trace[3] @function[other].block[2].instruction[1]"
43404340

43414341
Exists only for writing FileCheck tests. Specifies a list of test arguments
43424342
which should be used in order to run a particular test "in the context" of the
@@ -4349,10 +4349,11 @@ The following types of test arguments are supported:
43494349
- boolean: true false
43504350
- unsigned integer: 0...ULONG_MAX
43514351
- string
4352+
- value: %name
43524353
- function: @function <-- the current function
43534354
@function[uint] <-- function at index ``uint``
43544355
@function[name] <-- function named ``name``
4355-
- block: @block <-- the block containing the test_specification instruction
4356+
- block: @block <-- the block containing the specify_test instruction
43564357
@block[+uint] <-- the block ``uint`` blocks after the containing block
43574358
@block[-uint] <-- the block ``uint`` blocks before the containing block
43584359
@block[uint] <-- the block at index ``uint``
@@ -4366,9 +4367,9 @@ The following types of test arguments are supported:
43664367
@argument[uint] <-- the argument at index ``uint`` of the current block
43674368
@{block}.{argument} <-- the indicated argument in the indicated block
43684369
@{function}.{argument} <-- the indicated argument in the entry block of the indicated function
4369-
- instruction: @instruction <-- the instruction after* the test_specification instruction
4370-
@instruction[+uint] <-- the instruction ``uint`` instructions after* the test_specification instruction
4371-
@instruction[-uint] <-- the instruction ``uint`` instructions before* the test_specification instruction
4370+
- instruction: @instruction <-- the instruction after* the specify_test instruction
4371+
@instruction[+uint] <-- the instruction ``uint`` instructions after* the specify_test instruction
4372+
@instruction[-uint] <-- the instruction ``uint`` instructions before* the specify_test instruction
43724373
@instruction[uint] <-- the instruction at index ``uint``
43734374
@{function}.{instruction} <-- the indicated instruction in the indicated function
43744375
Example: @function[baz].instruction[19]
@@ -4383,7 +4384,7 @@ The following types of test arguments are supported:
43834384
* Not counting instructions that are deleted when processing functions for tests.
43844385
The following instructions currently are deleted:
43854386

4386-
test_specification
4387+
specify_test
43874388
debug_value [trace]
43884389

43894390

include/swift/AST/DiagnosticsParse.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ ERROR(expected_sil_profiler_counter_total,none,
545545
"expected profiler counter total", ())
546546
ERROR(expected_sil_profiler_counter_hash,none,
547547
"expected profiler counter hash", ())
548-
ERROR(expected_sil_test_specification_body,none,
548+
ERROR(expected_sil_specify_test_body,none,
549549
"expected a string consisting of the space-separated test arguments", ())
550550

551551
// SIL Values

include/swift/SIL/ParseTestSpecification.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,13 @@ struct UnparsedSpecification {
219219
void getTestSpecificationComponents(StringRef specificationString,
220220
SmallVectorImpl<StringRef> &components);
221221

222-
/// Finds and deletes each test_specification instruction in \p function and
222+
/// Finds and deletes each specify_test instruction in \p function and
223223
/// appends its string payload to the provided vector.
224224
void getTestSpecifications(
225225
SILFunction *function,
226226
SmallVectorImpl<UnparsedSpecification> &specifications);
227227

228-
/// Given the string \p specification operand of a test_specification
228+
/// Given the string \p specification operand of a specify_test
229229
/// instruction from \p function, parse the arguments which it refers to into
230230
/// \p arguments and the component strings into \p argumentStrings.
231231
void parseTestArgumentsFromSpecification(

include/swift/SIL/SILNodes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ NON_VALUE_INST(DebugValueInst, debug_value,
836836
SILInstruction, None, DoesNotRelease)
837837
NON_VALUE_INST(DebugStepInst, debug_step,
838838
SILInstruction, MayHaveSideEffects, DoesNotRelease)
839-
NON_VALUE_INST(TestSpecificationInst, test_specification,
839+
NON_VALUE_INST(TestSpecificationInst, specify_test,
840840
SILInstruction, None, DoesNotRelease)
841841
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, ...) \
842842
NON_VALUE_INST(Store##Name##Inst, store_##name, \

include/swift/SIL/Test.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===---- Test.h - Testing based on test_specification insts -*- C++ ----*-===//
1+
//===---- Test.h - Testing based on specify_test insts -*- C++ ----*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -26,7 +26,7 @@
2626
// of a function. The goal is to get the same effect as calling a function and
2727
// checking its output.
2828
//
29-
// This is done via the test_specification instruction. Using one or more
29+
// This is done via the specify_test instruction. Using one or more
3030
// instances of it in your test case's SIL function, you can specify which test
3131
// (instance of FunctionTest) should be run and what arguments should be
3232
// provided to it. The test grabs the arguments it expects out of the
@@ -59,10 +59,10 @@
5959
// TestRunner pass:
6060
// // RUN: %target-sil-opt -test-runner %s -o /dev/null 2>&1 | %FileCheck %s
6161
// 2) A function in interesting_functionality_unit.sil contains the
62-
// test_specification instruction.
62+
// specify_test instruction.
6363
// sil @f : $() -> () {
6464
// ...
65-
// test_specification "my-neato-utility 43 @trace[2] @function[other_fun]"
65+
// specify_test "my-neato-utility 43 @trace[2] @function[other_fun]"
6666
// ...
6767
// }
6868
// 3) TestRunner finds the FunctionTest instance MyNeatoUtilityTest registered
@@ -109,18 +109,18 @@ namespace test {
109109
struct Arguments;
110110
class TestRunner;
111111

112-
/// A test that is run when the corresponding test_specification instruction is
112+
/// A test that is run when the corresponding specify_test instruction is
113113
/// processed by the TestRunner pass.
114114
///
115115
/// Tests are instantiated once at program launch. At that time, they are
116-
/// stored in a registry name -> test. When an test_specification instruction
116+
/// stored in a registry name -> test. When an specify_test instruction
117117
/// naming a particular test is processed, that test is run.
118118
class FunctionTest final {
119119
public:
120120
/// Wraps a test lambda.
121121
///
122122
/// There are three arguments in order of priority:
123-
/// - SILFunction & - the function with the test_specification instruction
123+
/// - SILFunction & - the function with the specify_test instruction
124124
/// - Arguments & - the resolved list of args specified by the instruction
125125
/// - FunctionTest & - the test being run; used to find less commonly used
126126
/// values such as the results of analyses

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3777,7 +3777,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
37773777
case SILInstructionKind::TestSpecificationInst: {
37783778
// Parse the specification string.
37793779
if (P.Tok.getKind() != tok::string_literal) {
3780-
P.diagnose(P.Tok, diag::expected_sil_test_specification_body);
3780+
P.diagnose(P.Tok, diag::expected_sil_specify_test_body);
37813781
return true;
37823782
}
37833783
// Drop the double quotes.

lib/SIL/Parser/ParseTestSpecification.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class ParseArgumentSpecification {
347347
if (!consumePrefix("argument"))
348348
return nullptr;
349349
// If this is a bare @argument reference, it refers to the first argument
350-
// of the block containing the test_specification.
350+
// of the block containing the specify_test.
351351
if (!block) {
352352
block = context->getParent();
353353
}
@@ -385,15 +385,15 @@ class ParseArgumentSpecification {
385385
if (empty() || peekPrefix(".")) {
386386
if (!within) {
387387
// If this is a bare @instruction reference, it refers to to the
388-
// context of the test_specification.
388+
// context of the specify_test.
389389
return context;
390390
}
391391
return getInstructionAtIndex(0, *within);
392392
}
393393
if (auto subscript = parseSubscript()) {
394394
// If this is a bare @instruction[...] reference, it can refer either to
395395
// an instruction counting from the beginning of the function or else to
396-
// an instruction offset from the context of the test_specification.
396+
// an instruction offset from the context of the specify_test.
397397
if (!within && subscript->isa<long long>()) {
398398
auto offset = subscript->get<long long>();
399399
return getInstructionOffsetFrom(context, offset);
@@ -422,7 +422,7 @@ class ParseArgumentSpecification {
422422
return nullptr;
423423
if (empty() || peekPrefix(".")) {
424424
// If this is a bare @block reference, it refers to the block containing
425-
// the test_specification instruction.
425+
// the specify_test instruction.
426426
if (!within) {
427427
return context->getParent();
428428
}
@@ -432,7 +432,7 @@ class ParseArgumentSpecification {
432432
if (auto subscript = parseSubscript()) {
433433
// If this is a bare @block[...] reference, it can refer either to a block
434434
// counting from the beginning of the function or else to a block offset
435-
// from the block containing the context of the test_specification.
435+
// from the block containing the context of the specify_test.
436436
if (!within && subscript->isa<long long>()) {
437437
return getBlockOffsetFrom(context->getParent(),
438438
subscript->get<long long>());
@@ -462,7 +462,7 @@ class ParseArgumentSpecification {
462462
return nullptr;
463463
if (empty() || peekPrefix(".")) {
464464
// If this is a bare @function reference, it refers to the function
465-
// containing the test_specification instruction.
465+
// containing the specify_test instruction.
466466
if (!within) {
467467
return context->getFunction();
468468
}

test/SIL/OwnershipVerifier/guaranteed_chain.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct PairC {
1515
//
1616
sil [ossa] @testSSALongForwardingChain : $@convention(thin) (@guaranteed C) -> () {
1717
bb0(%0 : @guaranteed $C):
18-
test_specification "ssa-liveness @trace[0]"
18+
specify_test "ssa-liveness @trace[0]"
1919
debug_value [trace] %0 : $C
2020
%s0 = struct $PairC(%0 : $C, %0 : $C)
2121
%s0a = struct_extract %s0 : $PairC, #PairC.first

test/SIL/Parser/test_instructions.sil

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import Builtin
88
//
99
// In particular, this doesn't test parsing the components that make up the test
1010
// specification.
11-
// CHECK-LABEL: sil [ossa] @for_test_specification : {{.*}} {
12-
// CHECK: test_specification "try-running-it foo bar 18 false baz"
13-
// CHECK-LABEL: } // end sil function 'for_test_specification'
14-
sil [ossa] @for_test_specification : $@convention(thin) () -> () {
11+
// CHECK-LABEL: sil [ossa] @for_specify_test : {{.*}} {
12+
// CHECK: specify_test "try-running-it foo bar 18 false baz"
13+
// CHECK-LABEL: } // end sil function 'for_specify_test'
14+
sil [ossa] @for_specify_test : $@convention(thin) () -> () {
1515
entry:
16-
test_specification "try-running-it foo bar 18 false baz"
16+
specify_test "try-running-it foo bar 18 false baz"
1717
%4 = tuple()
1818
return %4 : $()
1919
}

test/SIL/cloning.sil

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,18 @@ entry(%0 : @owned $X):
108108
return %res : $X
109109
}
110110

111-
// CHECK-LABEL: sil [ossa] @caller_test_specification : {{.*}} {
112-
// CHECK: test_specification "foo bar baz"
113-
// CHECK-LABEL: } // end sil function 'caller_test_specification'
114-
sil [always_inline] [ossa] @callee_test_specification : $@convention(thin) () -> () {
111+
// CHECK-LABEL: sil [ossa] @caller_specify_test : {{.*}} {
112+
// CHECK: specify_test "foo bar baz"
113+
// CHECK-LABEL: } // end sil function 'caller_specify_test'
114+
sil [always_inline] [ossa] @callee_specify_test : $@convention(thin) () -> () {
115115
entry:
116-
test_specification "foo bar baz"
116+
specify_test "foo bar baz"
117117
%retval = tuple ()
118118
return %retval : $()
119119
}
120120

121-
sil [ossa] @caller_test_specification : $@convention(thin) () -> () {
122-
%callee = function_ref @callee_test_specification : $@convention(thin) () -> ()
121+
sil [ossa] @caller_specify_test : $@convention(thin) () -> () {
122+
%callee = function_ref @callee_specify_test : $@convention(thin) () -> ()
123123
%retval = apply %callee() : $@convention(thin) () -> ()
124124
return %retval : $()
125125
}

0 commit comments

Comments
 (0)