Skip to content

Commit 6e8a614

Browse files
committed
---
yaml --- r: 349517 b: refs/heads/master-next c: 47eb418 h: refs/heads/master i: 349515: 5900d4f
1 parent 77262e1 commit 6e8a614

File tree

2 files changed

+49
-71
lines changed

2 files changed

+49
-71
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 108f45b756b3125fbd9f578da82f3323d9220545
3+
refs/heads/master-next: 47eb418a9c585dd57ba5d8590cd4cac4388934fc
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/SIL/OperandOwnership.cpp

Lines changed: 48 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -106,40 +106,38 @@ class OperandOwnershipKindClassifier
106106

107107
} // end anonymous namespace
108108

109-
/// Implementation for instructions without operands. These should never be
110-
/// visited.
111-
#define NO_OPERAND_INST(INST) \
109+
/// Implementation for instructions that we should never visit since they are
110+
/// not valid in ossa or do not have operands. Since we should never visit
111+
/// these, we just assert.
112+
#define SHOULD_NEVER_VISIT_INST(INST) \
112113
OperandOwnershipKindMap OperandOwnershipKindClassifier::visit##INST##Inst( \
113114
INST##Inst *i) { \
114-
assert(i->getNumOperands() == 0 && \
115-
"Expected instruction without operands?!"); \
116-
llvm_unreachable("Instruction without operand can not be compatible with " \
117-
"any def's OwnershipValueKind"); \
115+
llvm_unreachable("Visited instruction that should never be visited?!"); \
118116
}
119-
NO_OPERAND_INST(AllocBox)
120-
NO_OPERAND_INST(AllocExistentialBox)
121-
NO_OPERAND_INST(AllocGlobal)
122-
NO_OPERAND_INST(AllocStack)
123-
NO_OPERAND_INST(FloatLiteral)
124-
NO_OPERAND_INST(FunctionRef)
125-
NO_OPERAND_INST(DynamicFunctionRef)
126-
NO_OPERAND_INST(PreviousDynamicFunctionRef)
127-
NO_OPERAND_INST(GlobalAddr)
128-
NO_OPERAND_INST(GlobalValue)
129-
NO_OPERAND_INST(IntegerLiteral)
130-
NO_OPERAND_INST(Metatype)
131-
NO_OPERAND_INST(ObjCProtocol)
132-
NO_OPERAND_INST(RetainValue)
133-
NO_OPERAND_INST(RetainValueAddr)
134-
NO_OPERAND_INST(StringLiteral)
135-
NO_OPERAND_INST(StrongRetain)
136-
NO_OPERAND_INST(Unreachable)
137-
NO_OPERAND_INST(Unwind)
117+
SHOULD_NEVER_VISIT_INST(AllocBox)
118+
SHOULD_NEVER_VISIT_INST(AllocExistentialBox)
119+
SHOULD_NEVER_VISIT_INST(AllocGlobal)
120+
SHOULD_NEVER_VISIT_INST(AllocStack)
121+
SHOULD_NEVER_VISIT_INST(FloatLiteral)
122+
SHOULD_NEVER_VISIT_INST(FunctionRef)
123+
SHOULD_NEVER_VISIT_INST(DynamicFunctionRef)
124+
SHOULD_NEVER_VISIT_INST(PreviousDynamicFunctionRef)
125+
SHOULD_NEVER_VISIT_INST(GlobalAddr)
126+
SHOULD_NEVER_VISIT_INST(GlobalValue)
127+
SHOULD_NEVER_VISIT_INST(IntegerLiteral)
128+
SHOULD_NEVER_VISIT_INST(Metatype)
129+
SHOULD_NEVER_VISIT_INST(ObjCProtocol)
130+
SHOULD_NEVER_VISIT_INST(RetainValue)
131+
SHOULD_NEVER_VISIT_INST(RetainValueAddr)
132+
SHOULD_NEVER_VISIT_INST(StringLiteral)
133+
SHOULD_NEVER_VISIT_INST(StrongRetain)
134+
SHOULD_NEVER_VISIT_INST(Unreachable)
135+
SHOULD_NEVER_VISIT_INST(Unwind)
138136
#define ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
139-
NO_OPERAND_INST(StrongRetain##Name) \
140-
NO_OPERAND_INST(Name##Retain)
137+
SHOULD_NEVER_VISIT_INST(StrongRetain##Name) \
138+
SHOULD_NEVER_VISIT_INST(Name##Retain)
141139
#include "swift/AST/ReferenceStorage.def"
142-
#undef NO_OPERAND_INST
140+
#undef SHOULD_NEVER_VISIT_INST
143141

144142
/// Instructions whose arguments are always compatible with one convention.
145143
#define CONSTANT_OWNERSHIP_INST(OWNERSHIP, USE_LIFETIME_CONSTRAINT, INST) \
@@ -266,49 +264,29 @@ ACCEPTS_ANY_OWNERSHIP_INST(ValueMetatype)
266264
ACCEPTS_ANY_OWNERSHIP_INST(UncheckedOwnershipConversion)
267265
ACCEPTS_ANY_OWNERSHIP_INST(ValueToBridgeObject)
268266
ACCEPTS_ANY_OWNERSHIP_INST(IsEscapingClosure)
269-
#undef ACCEPTS_ANY_OWNERSHIP_INST
270-
271-
// Trivial if trivial typed, otherwise must accept owned?
272-
#define ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE(USE_LIFETIME_CONSTRAINT, \
273-
INST) \
274-
OperandOwnershipKindMap OperandOwnershipKindClassifier::visit##INST##Inst( \
275-
INST##Inst *i) { \
276-
assert(i->getNumOperands() && "Expected to have non-zero operands"); \
277-
return Map::allLive(); \
278-
}
279-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE(MustBeLive, ClassMethod)
280-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE(MustBeLive, ObjCMethod)
281-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE(MustBeLive, ObjCSuperMethod)
282-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE(MustBeLive, SuperMethod)
283-
#undef ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE
284-
285-
// Trivial if trivial typed, otherwise must accept owned?
286-
#define ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(USE_LIFETIME_CONSTRAINT, INST) \
287-
OperandOwnershipKindMap OperandOwnershipKindClassifier::visit##INST##Inst( \
288-
INST##Inst *i) { \
289-
assert(i->getNumOperands() && "Expected to have non-zero operands"); \
290-
return Map::allLive(); \
291-
}
292-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, BridgeObjectToWord)
293-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, ClassifyBridgeObject)
294-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, CopyBlock)
295-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, OpenExistentialBox)
296-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, RefTailAddr)
297-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, RefToRawPointer)
298-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, SetDeallocating)
299-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, ProjectExistentialBox)
300-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, UnmanagedRetainValue)
301-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, UnmanagedReleaseValue)
302-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, UnmanagedAutoreleaseValue)
303-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, ConvertEscapeToNoEscape)
267+
ACCEPTS_ANY_OWNERSHIP_INST(ClassMethod)
268+
ACCEPTS_ANY_OWNERSHIP_INST(ObjCMethod)
269+
ACCEPTS_ANY_OWNERSHIP_INST(ObjCSuperMethod)
270+
ACCEPTS_ANY_OWNERSHIP_INST(SuperMethod)
271+
ACCEPTS_ANY_OWNERSHIP_INST(BridgeObjectToWord)
272+
ACCEPTS_ANY_OWNERSHIP_INST(ClassifyBridgeObject)
273+
ACCEPTS_ANY_OWNERSHIP_INST(CopyBlock)
274+
ACCEPTS_ANY_OWNERSHIP_INST(OpenExistentialBox)
275+
ACCEPTS_ANY_OWNERSHIP_INST(RefTailAddr)
276+
ACCEPTS_ANY_OWNERSHIP_INST(RefToRawPointer)
277+
ACCEPTS_ANY_OWNERSHIP_INST(SetDeallocating)
278+
ACCEPTS_ANY_OWNERSHIP_INST(ProjectExistentialBox)
279+
ACCEPTS_ANY_OWNERSHIP_INST(UnmanagedRetainValue)
280+
ACCEPTS_ANY_OWNERSHIP_INST(UnmanagedReleaseValue)
281+
ACCEPTS_ANY_OWNERSHIP_INST(UnmanagedAutoreleaseValue)
282+
ACCEPTS_ANY_OWNERSHIP_INST(ConvertEscapeToNoEscape)
304283
#define ALWAYS_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
305-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, RefTo##Name) \
306-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, Name##ToRef) \
307-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, Copy##Name##Value)
308-
#define UNCHECKED_REF_STORAGE(Name, ...) \
309-
ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP(MustBeLive, RefTo##Name)
284+
ACCEPTS_ANY_OWNERSHIP_INST(RefTo##Name) \
285+
ACCEPTS_ANY_OWNERSHIP_INST(Name##ToRef) \
286+
ACCEPTS_ANY_OWNERSHIP_INST(Copy##Name##Value)
287+
#define UNCHECKED_REF_STORAGE(Name, ...) ACCEPTS_ANY_OWNERSHIP_INST(RefTo##Name)
310288
#include "swift/AST/ReferenceStorage.def"
311-
#undef ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP
289+
#undef ACCEPTS_ANY_OWNERSHIP_INST
312290

313291
OperandOwnershipKindMap
314292
OperandOwnershipKindClassifier::visitForwardingInst(SILInstruction *i,

0 commit comments

Comments
 (0)