@@ -114,7 +114,6 @@ class BlockPartitionState {
114114
115115class TrackableValue ;
116116class TrackableValueState ;
117- class RepresentativeValue ;
118117
119118enum class TrackableValueFlag {
120119 // / Base value that says a value is uniquely represented and is
@@ -208,53 +207,6 @@ class regionanalysisimpl::TrackableValueState {
208207 }
209208};
210209
211- // / The representative value of the equivalence class that makes up a tracked
212- // / value.
213- // /
214- // / We use a wrapper struct here so that we can inject "fake" actor isolated
215- // / values into the regions of values that become merged into an actor by
216- // / calling a function without a non-sendable result.
217- class regionanalysisimpl ::RepresentativeValue {
218- friend llvm::DenseMapInfo<RepresentativeValue>;
219-
220- using InnerType = PointerUnion<SILValue, SILInstruction *>;
221-
222- // / If this is set to a SILValue then it is the actual represented value. If
223- // / it is set to a SILInstruction, then this is a "fake" representative value
224- // / used to inject actor isolatedness. The instruction stored is the
225- // / instruction that introduced the actor isolated-ness.
226- InnerType value;
227-
228- public:
229- RepresentativeValue () : value() {}
230- RepresentativeValue (SILValue value) : value(value) {}
231- RepresentativeValue (SILInstruction *actorRegionInst)
232- : value(actorRegionInst) {}
233-
234- operator bool () const { return bool (value); }
235-
236- void print (llvm::raw_ostream &os) const {
237- if (auto *inst = value.dyn_cast <SILInstruction *>()) {
238- os << " ActorRegionIntroducingInst: " << *inst;
239- return ;
240- }
241-
242- os << *value.get <SILValue>();
243- }
244-
245- SILValue getValue () const { return value.get <SILValue>(); }
246- SILValue maybeGetValue () const { return value.dyn_cast <SILValue>(); }
247- bool hasRegionIntroducingInst () const { return value.is <SILInstruction *>(); }
248- SILInstruction *getActorRegionIntroducingInst () const {
249- return value.get <SILInstruction *>();
250- }
251-
252- SWIFT_DEBUG_DUMP { print (llvm::dbgs ()); }
253-
254- private:
255- RepresentativeValue (InnerType value) : value(value) {}
256- };
257-
258210// / A tuple consisting of a base value and its value state.
259211// /
260212// / DISCUSSION: We are computing regions among equivalence classes of values
@@ -336,7 +288,6 @@ class RegionAnalysisValueMap {
336288 using Region = PartitionPrimitives::Region;
337289 using TrackableValue = regionanalysisimpl::TrackableValue;
338290 using TrackableValueState = regionanalysisimpl::TrackableValueState;
339- using RepresentativeValue = regionanalysisimpl::RepresentativeValue;
340291
341292private:
342293 // / A map from the representative of an equivalence class of values to their
@@ -365,6 +316,10 @@ class RegionAnalysisValueMap {
365316 // / value" returns an empty SILValue.
366317 SILValue maybeGetRepresentative (Element trackableValueID) const ;
367318
319+ // / Returns the value for this instruction if it isn't a fake "represenative
320+ // / value" to inject actor isolatedness. Asserts in such a case.
321+ RepresentativeValue getRepresentativeValue (Element trackableValueID) const ;
322+
368323 // / Returns the fake "representative value" for this element if it
369324 // / exists. Returns nullptr otherwise.
370325 SILInstruction *maybeGetActorIntroducingInst (Element trackableValueID) const ;
@@ -576,37 +531,4 @@ class RegionAnalysis final
576531
577532} // namespace swift
578533
579- namespace llvm {
580-
581- inline llvm::raw_ostream &
582- operator <<(llvm::raw_ostream &os,
583- const swift::regionanalysisimpl::RepresentativeValue &value) {
584- value.print (os);
585- return os;
586- }
587-
588- template <>
589- struct DenseMapInfo <swift::regionanalysisimpl::RepresentativeValue> {
590- using RepresentativeValue = swift::regionanalysisimpl::RepresentativeValue;
591- using InnerType = RepresentativeValue::InnerType;
592- using InnerDenseMapInfo = DenseMapInfo<InnerType>;
593-
594- static RepresentativeValue getEmptyKey () {
595- return RepresentativeValue (InnerDenseMapInfo::getEmptyKey ());
596- }
597- static RepresentativeValue getTombstoneKey () {
598- return RepresentativeValue (InnerDenseMapInfo::getTombstoneKey ());
599- }
600-
601- static unsigned getHashValue (RepresentativeValue value) {
602- return InnerDenseMapInfo::getHashValue (value.value );
603- }
604-
605- static bool isEqual (RepresentativeValue LHS, RepresentativeValue RHS) {
606- return InnerDenseMapInfo::isEqual (LHS.value , RHS.value );
607- }
608- };
609-
610- } // namespace llvm
611-
612534#endif
0 commit comments