Skip to content

Commit 24b3328

Browse files
committed
---
yaml --- r: 294751 b: refs/heads/tensorflow c: d3a192f h: refs/heads/master i: 294749: 38345f5 294747: 6be99cf 294743: 9aa014e 294735: b62db52 294719: 4decc18
1 parent 7eff7bd commit 24b3328

File tree

112 files changed

+1043
-2669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1043
-2669
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 6a204b7ddad6b19176f95bd32f654cf9d3144f69
819+
refs/heads/tensorflow: d3a192f3c532f69af0a064fb780f771d3ee9b5bd
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/docs/SIL.rst

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3053,73 +3053,6 @@ function_ref
30533053

30543054
Creates a reference to a SIL function.
30553055

3056-
dynamic_function_ref
3057-
````````````
3058-
::
3059-
3060-
sil-instruction ::= 'dynamic_function_ref' sil-function-name ':' sil-type
3061-
3062-
%1 = dynamic_function_ref @function : $@convention(thin) T -> U
3063-
// $@convention(thin) T -> U must be a thin function type
3064-
// %1 has type $T -> U
3065-
3066-
Creates a reference to a `dynamically_replacable` SIL function. A
3067-
`dynamically_replacable` SIL function can be replaced at runtime.
3068-
3069-
For the following Swift code::
3070-
3071-
dynamic func test_dynamically_replaceable() {}
3072-
3073-
func test_dynamic_call() {
3074-
test_dynamically_replaceable()
3075-
}
3076-
3077-
We will generate::
3078-
3079-
sil [dynamically_replacable] @test_dynamically_replaceable : $@convention(thin) () -> () {
3080-
bb0:
3081-
%0 = tuple ()
3082-
return %0 : $()
3083-
}
3084-
3085-
sil @test_dynamic_call : $@convention(thin) () -> () {
3086-
bb0:
3087-
%0 = dynamic_function_ref @test_dynamically_replaceable : $@convention(thin) () -> ()
3088-
%1 = apply %0() : $@convention(thin) () -> ()
3089-
%2 = tuple ()
3090-
return %2 : $()
3091-
}
3092-
3093-
prev_dynamic_function_ref
3094-
````````````
3095-
::
3096-
3097-
sil-instruction ::= 'prev_dynamic_function_ref' sil-function-name ':' sil-type
3098-
3099-
%1 = prev_dynamic_function_ref @function : $@convention(thin) T -> U
3100-
// $@convention(thin) T -> U must be a thin function type
3101-
// %1 has type $T -> U
3102-
3103-
Creates a reference to a previous implemenation of a `dynamic_replacement` SIL
3104-
function.
3105-
3106-
For the following Swift code::
3107-
3108-
@_dynamicReplacement(for: test_dynamically_replaceable())
3109-
func test_replacement() {
3110-
test_dynamically_replaceable() // calls previous implementation
3111-
}
3112-
3113-
We will generate::
3114-
3115-
sil [dynamic_replacement_for "test_dynamically_replaceable"] @test_replacement : $@convention(thin) () -> () {
3116-
bb0:
3117-
%0 = prev_dynamic_function_ref @test_replacement : $@convention(thin) () -> ()
3118-
%1 = apply %0() : $@convention(thin) () -> ()
3119-
%2 = tuple ()
3120-
return %2 : $()
3121-
}
3122-
31233056
global_addr
31243057
```````````
31253058

branches/tensorflow/include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,6 @@ ERROR(expected_type_after_arrow,none,
731731
ERROR(function_type_argument_label,none,
732732
"function types cannot have argument labels; use '_' before %0",
733733
(Identifier))
734-
ERROR(expected_dynamic_func_attr,none,
735-
"expected a dynamically_replaceable function", ())
736734

737735
// Enum Types
738736
ERROR(expected_expr_enum_case_raw_value,PointsToFirstBadToken,

branches/tensorflow/include/swift/AST/DiagnosticsSema.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3953,9 +3953,17 @@ ERROR(borrowed_on_objc_protocol_requirement,none,
39533953
// MARK: dynamic
39543954
//------------------------------------------------------------------------------
39553955

3956+
ERROR(dynamic_not_in_class,none,
3957+
"only members of classes may be dynamic", ())
3958+
ERROR(dynamic_with_nonobjc,none,
3959+
"a declaration cannot be both '@nonobjc' and 'dynamic'",
3960+
())
39563961
ERROR(dynamic_with_transparent,none,
39573962
"a declaration cannot be both '@_tranparent' and 'dynamic'",
39583963
())
3964+
ERROR(dynamic_requires_objc,none,
3965+
"'dynamic' %0 %1 must also be '@objc'",
3966+
(DescriptiveDeclKind, DeclName))
39593967

39603968
//------------------------------------------------------------------------------
39613969
// MARK: @_dynamicReplacement(for:)

branches/tensorflow/include/swift/Basic/ClusteredBitVector.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,48 @@ class ClusteredBitVector {
539539
return !any();
540540
}
541541

542+
/// A class for scanning for set bits, from low indices to high ones.
543+
class SetBitEnumerator {
544+
ChunkType CurChunk;
545+
const ChunkType *Chunks;
546+
unsigned CurChunkIndex;
547+
unsigned NumChunks;
548+
public:
549+
explicit SetBitEnumerator(const ClusteredBitVector &vector) {
550+
if (vector.isInlineAndAllClear()) {
551+
CurChunkIndex = 0;
552+
NumChunks = 0;
553+
} else {
554+
Chunks = vector.getChunksPtr();
555+
CurChunk = Chunks[0];
556+
CurChunkIndex = 0;
557+
NumChunks = vector.getLengthInChunks();
558+
}
559+
}
560+
561+
/// Search for another bit. Returns false if it can't find one.
562+
Optional<size_t> findNext() {
563+
if (CurChunkIndex == NumChunks) return None;
564+
auto cur = CurChunk;
565+
while (!cur) {
566+
if (++CurChunkIndex == NumChunks) return None;
567+
cur = Chunks[CurChunkIndex];
568+
}
569+
570+
// Find the index of the lowest set bit.
571+
size_t bitIndex = llvm::countTrailingZeros(cur, llvm::ZB_Undefined);
572+
573+
// Clear that bit in the current chunk.
574+
CurChunk = cur ^ (ChunkType(1) << bitIndex);
575+
assert(!(CurChunk & (ChunkType(1) << bitIndex)));
576+
577+
return (CurChunkIndex * ChunkSizeInBits + bitIndex);
578+
}
579+
};
580+
SetBitEnumerator enumerateSetBits() const {
581+
return SetBitEnumerator(*this);
582+
}
583+
542584
friend bool operator==(const ClusteredBitVector &lhs,
543585
const ClusteredBitVector &rhs) {
544586
if (lhs.size() != rhs.size())

branches/tensorflow/include/swift/FrontendTool/FrontendTool.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ class FrontendObserver {
4242

4343
/// The frontend has configured the compiler instance.
4444
virtual void configuredCompiler(CompilerInstance &instance);
45-
46-
/// The frontend has performed semantic analysis.
47-
virtual void performedSemanticAnalysis(CompilerInstance &instance);
48-
49-
/// The frontend has performed basic SIL generation.
50-
/// SIL diagnostic passes have not yet been applied.
51-
virtual void performedSILGeneration(SILModule &module);
52-
53-
/// The frontend has executed the SIL optimization and diagnostics pipelines.
54-
virtual void performedSILProcessing(SILModule &module);
55-
56-
// TODO: maybe enhance this interface to hear about IRGen and LLVM
57-
// progress.
5845
};
5946

6047
namespace frontend {

branches/tensorflow/include/swift/SIL/SILBasicBlock.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,11 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
232232
const ValueDecl *D = nullptr);
233233

234234
/// Replace the \p{i}th BB arg with a new BBArg with SILType \p Ty and
235-
/// ValueDecl \p D.
236-
///
237-
/// NOTE: This assumes that the current argument in position \p i has had its
238-
/// uses eliminated. To replace/replace all uses with, use
239-
/// replacePhiArgumentAndRAUW.
240-
SILPhiArgument *replacePhiArgument(unsigned i, SILType type,
241-
ValueOwnershipKind kind,
242-
const ValueDecl *decl = nullptr);
243-
244-
/// Replace phi argument \p i and RAUW all uses.
245-
SILPhiArgument *
246-
replacePhiArgumentAndReplaceAllUses(unsigned i, SILType type,
247-
ValueOwnershipKind kind,
248-
const ValueDecl *decl = nullptr);
235+
/// ValueDecl
236+
/// \p D.
237+
SILPhiArgument *replacePhiArgument(unsigned i, SILType Ty,
238+
ValueOwnershipKind Kind,
239+
const ValueDecl *D = nullptr);
249240

250241
/// Allocate a new argument of type \p Ty and append it to the argument
251242
/// list. Optionally you can pass in a value decl parameter.

branches/tensorflow/include/swift/SIL/SILBuilder.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,11 @@ class SILBuilder {
19381938
SILType destTy, SILBasicBlock *successBB,
19391939
SILBasicBlock *failureBB,
19401940
ProfileCounter Target1Count = ProfileCounter(),
1941-
ProfileCounter Target2Count = ProfileCounter());
1941+
ProfileCounter Target2Count = ProfileCounter()) {
1942+
return insertTerminator(CheckedCastBranchInst::create(
1943+
getSILDebugLocation(Loc), isExact, op, destTy, successBB, failureBB,
1944+
getFunction(), C.OpenedArchetypes, Target1Count, Target2Count));
1945+
}
19421946

19431947
CheckedCastValueBranchInst *
19441948
createCheckedCastValueBranch(SILLocation Loc, SILValue op, SILType destTy,

branches/tensorflow/include/swift/SIL/SILFunction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ class SILFunction
590590
return IsDynamicallyReplaceable_t(IsDynamicReplaceable);
591591
}
592592
void setIsDynamic(IsDynamicallyReplaceable_t value = IsDynamic) {
593+
assert(IsDynamicReplaceable == IsNotDynamic && "already set");
593594
IsDynamicReplaceable = value;
594595
assert(!Transparent || !IsDynamicReplaceable);
595596
}

branches/tensorflow/include/swift/SIL/SILInstruction.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,8 +1841,6 @@ class ApplyInstBase<Impl, Base, false> : public Base {
18411841
/// issues. It is at the bottom of the file.
18421842
SILFunction *getCalleeFunction() const;
18431843

1844-
bool isCalleeDynamicallyReplaceable() const;
1845-
18461844
/// Gets the referenced function if the callee is a function_ref instruction.
18471845
SILFunction *getReferencedFunction() const {
18481846
if (auto *FRI = dyn_cast<FunctionRefBaseInst>(getCallee()))
@@ -7775,27 +7773,6 @@ SILValue ApplyInstBase<Impl, Base, false>::getCalleeOrigin() const {
77757773
}
77767774
}
77777775

7778-
template <class Impl, class Base>
7779-
bool ApplyInstBase<Impl, Base, false>::isCalleeDynamicallyReplaceable() const {
7780-
SILValue Callee = getCalleeOrigin();
7781-
7782-
while (true) {
7783-
if (auto *FRI = dyn_cast<FunctionRefInst>(Callee))
7784-
return false;
7785-
7786-
if (auto *FRI = dyn_cast<DynamicFunctionRefInst>(Callee))
7787-
return true;
7788-
if (auto *FRI = dyn_cast<PreviousDynamicFunctionRefInst>(Callee))
7789-
return true;
7790-
7791-
if (auto *PAI = dyn_cast<PartialApplyInst>(Callee)) {
7792-
Callee = PAI->getCalleeOrigin();
7793-
continue;
7794-
}
7795-
return false;
7796-
}
7797-
}
7798-
77997776
template <class Impl, class Base>
78007777
SILFunction *ApplyInstBase<Impl, Base, false>::getCalleeFunction() const {
78017778
SILValue Callee = getCalleeOrigin();

branches/tensorflow/lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,6 @@ static bool performCompile(CompilerInstance &Instance,
10051005
if (Action == FrontendOptions::ActionType::ResolveImports)
10061006
return Context.hadError();
10071007

1008-
if (observer)
1009-
observer->performedSemanticAnalysis(Instance);
1010-
10111008
if (Stats)
10121009
countStatsPostSema(*Stats, Instance);
10131010

@@ -1241,9 +1238,6 @@ static bool performCompileStepsPostSILGen(
12411238
if (auto *SF = MSF.dyn_cast<SourceFile *>())
12421239
ricd.emplace(*SF);
12431240

1244-
if (observer)
1245-
observer->performedSILGeneration(*SM);
1246-
12471241
if (Stats)
12481242
countStatsPostSILGen(*Stats, *SM);
12491243

@@ -1290,9 +1284,6 @@ static bool performCompileStepsPostSILGen(
12901284
if (Instance.performSILProcessing(SM.get(), Stats))
12911285
return true;
12921286

1293-
if (observer)
1294-
observer->performedSILProcessing(*SM);
1295-
12961287
emitAnyWholeModulePostTypeCheckSupplementaryOutputs(Instance, Invocation,
12971288
moduleIsPublic);
12981289

@@ -1856,6 +1847,3 @@ int swift::performFrontend(ArrayRef<const char *> Args,
18561847

18571848
void FrontendObserver::parsedArgs(CompilerInvocation &invocation) {}
18581849
void FrontendObserver::configuredCompiler(CompilerInstance &instance) {}
1859-
void FrontendObserver::performedSemanticAnalysis(CompilerInstance &instance) {}
1860-
void FrontendObserver::performedSILGeneration(SILModule &module) {}
1861-
void FrontendObserver::performedSILProcessing(SILModule &module) {}

0 commit comments

Comments
 (0)