diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-06-17 08:27:47 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-06-17 21:50:01 +0200 |
commit | 6581cce8c6ea51b5386156fa4d21bd8f1865f851 (patch) | |
tree | 52691163eb0a509e6406a4ca930644ce13bb5253 /src/vhdl/translate/trans-chap1.adb | |
parent | e3ecb5fb3abea58e7cb30304c9b9df8646071624 (diff) | |
download | ghdl-6581cce8c6ea51b5386156fa4d21bd8f1865f851.tar.gz ghdl-6581cce8c6ea51b5386156fa4d21bd8f1865f851.tar.bz2 ghdl-6581cce8c6ea51b5386156fa4d21bd8f1865f851.zip |
vhdl/translate: minor refactoring.
Diffstat (limited to 'src/vhdl/translate/trans-chap1.adb')
-rw-r--r-- | src/vhdl/translate/trans-chap1.adb | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/vhdl/translate/trans-chap1.adb b/src/vhdl/translate/trans-chap1.adb index 05d76d6d2..06ebc970b 100644 --- a/src/vhdl/translate/trans-chap1.adb +++ b/src/vhdl/translate/trans-chap1.adb @@ -736,6 +736,7 @@ package body Trans.Chap1 is High : O_Dnode; If_Blk : O_If_Block; Label : O_Snode; + Rng_Idx : Mnode; begin Open_Temp; Rng := Stabilize (Chap3.Type_To_Range (Iter_Type)); @@ -744,21 +745,20 @@ package body Trans.Chap1 is (Dv2M (Slice, Type_Info, Mode_Value, Type_Info.B.Range_Type, Type_Info.B.Range_Ptr_Type), Get_Suffix (Spec)); + Rng_Idx := Lv2M (New_Selected_Element + (New_Obj (Slice), Type_Info.B.Range_Left), + Type_Info, Mode_Value); Left := Create_Temp_Init (Ghdl_Index_Type, Chap6.Translate_Index_To_Offset - (Rng, - New_Value (New_Selected_Element - (New_Obj (Slice), Type_Info.B.Range_Left)), - Spec, Iter_Type, Spec)); + (Rng, Rng_Idx, Spec, Iter_Type, Spec)); + Rng_Idx := Lv2M (New_Selected_Element + (New_Obj (Slice), Type_Info.B.Range_Right), + Type_Info, Mode_Value); Right := Create_Temp_Init (Ghdl_Index_Type, Chap6.Translate_Index_To_Offset - (Rng, - New_Value (New_Selected_Element - (New_Obj (Slice), - Type_Info.B.Range_Right)), - Spec, Iter_Type, Spec)); + (Rng, Rng_Idx, Spec, Iter_Type, Spec)); Index := Create_Temp (Ghdl_Index_Type); High := Create_Temp (Ghdl_Index_Type); Start_If_Stmt @@ -771,27 +771,23 @@ package body Trans.Chap1 is Type_Info.B.Range_Dir)), Ghdl_Bool_Type)); -- Same direction, so left to right. - New_Assign_Stmt (New_Obj (Index), - New_Value (New_Obj (Left))); - New_Assign_Stmt (New_Obj (High), - New_Value (New_Obj (Right))); + New_Assign_Stmt (New_Obj (Index), New_Obj_Value (Left)); + New_Assign_Stmt (New_Obj (High), New_Obj_Value (Right)); New_Else_Stmt (If_Blk); -- Opposite direction, so right to left. - New_Assign_Stmt (New_Obj (Index), - New_Value (New_Obj (Right))); - New_Assign_Stmt (New_Obj (High), - New_Value (New_Obj (Left))); + New_Assign_Stmt (New_Obj (Index), New_Obj_Value (Right)); + New_Assign_Stmt (New_Obj (High), New_Obj_Value (Left)); Finish_If_Stmt (If_Blk); -- Loop. Start_Loop_Stmt (Label); Gen_Exit_When (Label, New_Compare_Op (ON_Gt, - New_Value (New_Obj (Index)), - New_Value (New_Obj (High)), + New_Obj_Value (Index), + New_Obj_Value (High), Ghdl_Bool_Type)); Open_Temp; - Gen_Subblock_Call (New_Value (New_Obj (Index)), True); + Gen_Subblock_Call (New_Obj_Value (Index), True); Close_Temp; Inc_Var (Index); Finish_Loop_Stmt (Label); |