diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-03-21 17:56:52 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-03-21 17:56:52 +0100 |
commit | 2eef024e6d1e59778c07e6ccc353c7fb96fb8bc5 (patch) | |
tree | eb2d7d0090667b08d633c16eae5dfbe518aa56c4 | |
parent | 47bd6cb4b5a2465d6961b5d229dd1604f77128b5 (diff) | |
download | ghdl-2eef024e6d1e59778c07e6ccc353c7fb96fb8bc5.tar.gz ghdl-2eef024e6d1e59778c07e6ccc353c7fb96fb8bc5.tar.bz2 ghdl-2eef024e6d1e59778c07e6ccc353c7fb96fb8bc5.zip |
synth-environment: keep order of seq_assign in phi nodes.
-rw-r--r-- | src/synth/synth-environment.adb | 16 | ||||
-rw-r--r-- | src/synth/synth-environment.ads | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/synth/synth-environment.adb b/src/synth/synth-environment.adb index 83fa6fdc3..8063f17fc 100644 --- a/src/synth/synth-environment.adb +++ b/src/synth/synth-environment.adb @@ -179,6 +179,7 @@ package body Synth.Environment is procedure Push_Phi is begin Phis_Table.Append ((First => No_Seq_Assign, + Last => No_Seq_Assign, Nbr => 0)); end Push_Phi; @@ -1153,7 +1154,7 @@ package body Synth.Environment is end loop; end Merge_Phis; - procedure Phi_Insert_Assign (Asgn : Seq_Assign) + procedure Phi_Append_Assign (Asgn : Seq_Assign) is pragma Assert (Asgn /= No_Seq_Assign); Asgn_Rec : Seq_Assign_Record renames Assign_Table.Table (Asgn); @@ -1162,10 +1163,14 @@ package body Synth.Environment is P : Phi_Type renames Phis_Table.Table (Phis_Table.Last); begin -- Chain assignment in the current sequence. - Asgn_Rec.Chain := P.First; - P.First := Asgn; + if P.First = No_Seq_Assign then + P.First := Asgn; + else + Set_Assign_Chain (P.Last, Asgn); + end if; + P.Last := Asgn; P.Nbr := P.Nbr + 1; - end Phi_Insert_Assign; + end Phi_Append_Assign; -- Check consistency: -- - ordered. @@ -1358,7 +1363,7 @@ package body Synth.Environment is Chain => No_Seq_Assign, Asgns => Pasgn)); Wire_Rec.Cur_Assign := Assign_Table.Last; - Phi_Insert_Assign (Assign_Table.Last); + Phi_Append_Assign (Assign_Table.Last); else -- Overwrite. Insert_Partial_Assign (Ctxt, Cur_Asgn, Pasgn); @@ -1442,6 +1447,7 @@ begin pragma Assert (Partial_Assign_Table.Last = No_Partial_Assign); Phis_Table.Append ((First => No_Seq_Assign, + Last => No_Seq_Assign, Nbr => 0)); pragma Assert (Phis_Table.Last = No_Phi_Id); diff --git a/src/synth/synth-environment.ads b/src/synth/synth-environment.ads index acf97c45f..1abb918eb 100644 --- a/src/synth/synth-environment.ads +++ b/src/synth/synth-environment.ads @@ -279,6 +279,7 @@ private type Phi_Type is record -- Chain of sequential assignments in the current phi context (BB). First : Seq_Assign; + Last : Seq_Assign; -- Number of assignments. Nbr : Uns32; end record; |