Skip to content

Commit 0592380

Browse files
author
Oron Port
committed
fix referncial propagation
1 parent 9d70aac commit 0592380

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

compiler/ir/src/main/scala/dfhdl/compiler/ir/DFMember.scala

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ object DFVal:
400400
case _ => false
401401
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
402402
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
403-
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs
403+
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ meta.getRefs
404404
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
405405
def copyWithoutGlobalCtx: this.type = copy().asInstanceOf[this.type]
406406
def copyWithNewRefs(using RefGen): this.type = copy(
@@ -439,7 +439,8 @@ object DFVal:
439439
case _ => false
440440
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
441441
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
442-
lazy val getRefs: List[DFRef.TwoWayAny] = dfValRef :: defaultRef :: dfType.getRefs
442+
lazy val getRefs: List[DFRef.TwoWayAny] =
443+
dfValRef :: defaultRef :: dfType.getRefs ++ meta.getRefs
443444
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
444445
def copyWithNewRefs(using RefGen): this.type = copy(
445446
meta = meta.copyWithNewRefs,
@@ -466,7 +467,7 @@ object DFVal:
466467
case _ => false
467468
protected def setMeta(meta: Meta): this.type = this
468469
protected def setTags(tags: DFTags): this.type = this
469-
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs
470+
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ meta.getRefs
470471
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
471472
def copyWithNewRefs(using RefGen): this.type = copy(
472473
dfType = dfType.copyWithNewRefs,
@@ -489,7 +490,7 @@ object DFVal:
489490
this == that
490491
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
491492
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
492-
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs
493+
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ meta.getRefs
493494
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
494495
def copyWithNewRefs(using RefGen): this.type = copy(
495496
meta = meta.copyWithNewRefs,
@@ -520,7 +521,7 @@ object DFVal:
520521
def initList(using MemberGetSet): List[DFVal] = initRefList.map(_.get)
521522
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
522523
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
523-
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ initRefList
524+
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ initRefList ++ meta.getRefs
524525
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
525526
def copyWithNewRefs(using RefGen): this.type = copy(
526527
meta = meta.copyWithNewRefs,
@@ -574,7 +575,7 @@ object DFVal:
574575
case _ => false
575576
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
576577
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
577-
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ args
578+
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ args ++ meta.getRefs
578579
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
579580
def copyWithoutGlobalCtx: this.type = copy().asInstanceOf[this.type]
580581
def copyWithNewRefs(using RefGen): this.type = copy(
@@ -615,7 +616,7 @@ object DFVal:
615616
case _ => false
616617
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
617618
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
618-
lazy val getRefs: List[DFRef.TwoWayAny] = designInstRef :: dfType.getRefs
619+
lazy val getRefs: List[DFRef.TwoWayAny] = designInstRef :: dfType.getRefs ++ meta.getRefs
619620
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
620621
def copyWithNewRefs(using RefGen): this.type = copy(
621622
meta = meta.copyWithNewRefs,
@@ -636,7 +637,7 @@ object DFVal:
636637

637638
sealed trait Alias extends CanBeExpr:
638639
val relValRef: Alias.Ref
639-
lazy val getRefs: List[DFRef.TwoWayAny] = relValRef :: dfType.getRefs
640+
lazy val getRefs: List[DFRef.TwoWayAny] = relValRef :: dfType.getRefs ++ meta.getRefs
640641

641642
object Alias:
642643
type Ref = DFRef.TwoWay[DFVal, Alias]
@@ -724,7 +725,7 @@ object DFVal:
724725
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
725726
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
726727
override lazy val getRefs: List[DFRef.TwoWayAny] =
727-
relValRef :: dfType.getRefs ++ initRefOption
728+
relValRef :: dfType.getRefs ++ initRefOption ++ meta.getRefs
728729
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
729730
def copyWithoutGlobalCtx: this.type = copy().asInstanceOf[this.type]
730731
def copyWithNewRefs(using RefGen): this.type = copy(
@@ -788,7 +789,7 @@ object DFVal:
788789
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
789790
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
790791
override lazy val getRefs: List[DFRef.TwoWayAny] =
791-
dfType.getRefs ++ List(relValRef) ++ (idxHighRef match
792+
dfType.getRefs ++ meta.getRefs ++ List(relValRef) ++ (idxHighRef match
792793
case ref: DFRef.TypeRef => List(ref);
793794
case _ => Nil) ++ (idxLowRef match
794795
case ref: DFRef.TypeRef => List(ref);
@@ -849,7 +850,8 @@ object DFVal:
849850
case _ => false
850851
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
851852
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
852-
override lazy val getRefs: List[DFRef.TwoWayAny] = relIdx :: relValRef :: dfType.getRefs
853+
override lazy val getRefs: List[DFRef.TwoWayAny] =
854+
relIdx :: relValRef :: dfType.getRefs ++ meta.getRefs
853855
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
854856
def copyWithoutGlobalCtx: this.type = copy().asInstanceOf[this.type]
855857
def copyWithNewRefs(using RefGen): this.type = copy(
@@ -928,7 +930,7 @@ final case class DFRange(
928930
case _ => false
929931
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
930932
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
931-
lazy val getRefs: List[DFRef.TwoWayAny] = List(startRef, endRef, stepRef)
933+
lazy val getRefs: List[DFRef.TwoWayAny] = startRef :: endRef :: stepRef :: meta.getRefs
932934
def copyWithNewRefs(using RefGen): this.type = copy(
933935
meta = meta.copyWithNewRefs,
934936
startRef = startRef.copyAsNewRef,
@@ -958,7 +960,7 @@ final case class DFNet(
958960
case _ => false
959961
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
960962
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
961-
lazy val getRefs: List[DFRef.TwoWayAny] = List(lhsRef, rhsRef)
963+
lazy val getRefs: List[DFRef.TwoWayAny] = lhsRef :: rhsRef :: meta.getRefs
962964
def copyWithNewRefs(using RefGen): this.type = copy(
963965
meta = meta.copyWithNewRefs,
964966
lhsRef = lhsRef.copyAsNewRef,
@@ -1039,7 +1041,7 @@ final case class StepBlock(
10391041
case _ => false
10401042
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
10411043
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1042-
lazy val getRefs: List[DFRef.TwoWayAny] = Nil
1044+
lazy val getRefs: List[DFRef.TwoWayAny] = meta.getRefs
10431045
def copyWithNewRefs(using RefGen): this.type = copy(
10441046
meta = meta.copyWithNewRefs,
10451047
ownerRef = ownerRef.copyAsNewRef
@@ -1066,7 +1068,7 @@ final case class Goto(
10661068
case _ => false
10671069
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
10681070
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1069-
lazy val getRefs: List[DFRef.TwoWayAny] = List(stepRef)
1071+
lazy val getRefs: List[DFRef.TwoWayAny] = List(stepRef) ++ meta.getRefs
10701072
def copyWithNewRefs(using RefGen): this.type = copy(
10711073
meta = meta.copyWithNewRefs,
10721074
stepRef = stepRef.copyAsNewRef,
@@ -1106,7 +1108,7 @@ final case class DFInterfaceOwner(
11061108
case _ => false
11071109
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
11081110
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1109-
lazy val getRefs: List[DFRef.TwoWayAny] = domainType.getRefs
1111+
lazy val getRefs: List[DFRef.TwoWayAny] = domainType.getRefs ++ meta.getRefs
11101112
def copyWithNewRefs(using RefGen): this.type = copy(
11111113
meta = meta.copyWithNewRefs,
11121114
domainType = domainType.copyWithNewRefs,
@@ -1139,7 +1141,7 @@ final case class ProcessBlock(
11391141
case _ => false
11401142
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
11411143
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1142-
lazy val getRefs: List[DFRef.TwoWayAny] = sensitivity.getRefs
1144+
lazy val getRefs: List[DFRef.TwoWayAny] = sensitivity.getRefs ++ meta.getRefs
11431145
def copyWithNewRefs(using RefGen): this.type = copy(
11441146
meta = meta.copyWithNewRefs,
11451147
sensitivity = sensitivity.copyWithNewRefs,
@@ -1201,7 +1203,7 @@ object DFConditional:
12011203
false
12021204
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
12031205
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1204-
lazy val getRefs: List[DFRef.TwoWayAny] = selectorRef :: dfType.getRefs
1206+
lazy val getRefs: List[DFRef.TwoWayAny] = selectorRef :: dfType.getRefs ++ meta.getRefs
12051207
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
12061208
def copyWithNewRefs(using RefGen): this.type = copy(
12071209
meta = meta.copyWithNewRefs,
@@ -1340,7 +1342,7 @@ object DFConditional:
13401342
case _ => false
13411343
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
13421344
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1343-
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs
1345+
lazy val getRefs: List[DFRef.TwoWayAny] = dfType.getRefs ++ meta.getRefs
13441346
protected[ir] def protIsSimilarTo(that: DFVal.CanBeExpr)(using MemberGetSet): Boolean =
13451347
false
13461348
def updateDFType(dfType: DFType): this.type = copy(dfType = dfType).asInstanceOf[this.type]
@@ -1366,7 +1368,7 @@ object DFConditional:
13661368
case _ => false
13671369
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
13681370
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1369-
lazy val getRefs: List[DFRef.TwoWayAny] = List(guardRef, prevBlockOrHeaderRef)
1371+
lazy val getRefs: List[DFRef.TwoWayAny] = guardRef :: prevBlockOrHeaderRef :: meta.getRefs
13701372
def copyWithNewRefs(using RefGen): this.type = copy(
13711373
meta = meta.copyWithNewRefs,
13721374
guardRef = guardRef.copyAsNewRef,
@@ -1395,7 +1397,7 @@ object DFLoop:
13951397
case _ => false
13961398
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
13971399
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1398-
lazy val getRefs: List[DFRef.TwoWayAny] = List(iteratorRef, rangeRef)
1400+
lazy val getRefs: List[DFRef.TwoWayAny] = iteratorRef :: rangeRef :: meta.getRefs
13991401
def copyWithNewRefs(using RefGen): this.type = copy(
14001402
meta = meta.copyWithNewRefs,
14011403
iteratorRef = iteratorRef.copyAsNewRef,
@@ -1420,7 +1422,7 @@ object DFLoop:
14201422
case _ => false
14211423
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
14221424
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1423-
lazy val getRefs: List[DFRef.TwoWayAny] = List(guardRef)
1425+
lazy val getRefs: List[DFRef.TwoWayAny] = guardRef :: meta.getRefs
14241426
def copyWithNewRefs(using RefGen): this.type = copy(
14251427
meta = meta.copyWithNewRefs,
14261428
guardRef = guardRef.copyAsNewRef,
@@ -1514,7 +1516,7 @@ final case class DomainBlock(
15141516
case _ => false
15151517
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
15161518
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1517-
lazy val getRefs: List[DFRef.TwoWayAny] = domainType.getRefs
1519+
lazy val getRefs: List[DFRef.TwoWayAny] = domainType.getRefs ++ meta.getRefs
15181520
def copyWithNewRefs(using RefGen): this.type = copy(
15191521
meta = meta.copyWithNewRefs,
15201522
domainType = domainType.copyWithNewRefs,
@@ -1613,7 +1615,7 @@ final case class Wait(
16131615
case _ => false
16141616
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
16151617
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1616-
lazy val getRefs: List[DFRef.TwoWayAny] = List(triggerRef)
1618+
lazy val getRefs: List[DFRef.TwoWayAny] = triggerRef :: meta.getRefs
16171619
def copyWithNewRefs(using RefGen): this.type = copy(
16181620
meta = meta.copyWithNewRefs,
16191621
triggerRef = triggerRef.copyAsNewRef,
@@ -1640,7 +1642,7 @@ final case class TextOut(
16401642
case _ => false
16411643
protected def setMeta(meta: Meta): this.type = copy(meta = meta).asInstanceOf[this.type]
16421644
protected def setTags(tags: DFTags): this.type = copy(tags = tags).asInstanceOf[this.type]
1643-
lazy val getRefs: List[DFRef.TwoWayAny] = op.getRefs ++ msgArgs
1645+
lazy val getRefs: List[DFRef.TwoWayAny] = op.getRefs ++ msgArgs ++ meta.getRefs
16441646
def copyWithNewRefs(using RefGen): this.type = copy(
16451647
meta = meta.copyWithNewRefs,
16461648
op = op.copyWithNewRefs,

0 commit comments

Comments
 (0)