aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans-chap3.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-01-02 05:51:48 +0100
committerTristan Gingold <tgingold@free.fr>2017-01-02 05:51:48 +0100
commit43a504a9722b739ab33393ecb2d1abc6962cc52f (patch)
tree5fa83a8745b239cbb4b8f7c5d06079db681f67f0 /src/vhdl/translate/trans-chap3.adb
parent0f62d8b9acc29a4726a17c72c315a0a94ec18688 (diff)
downloadghdl-43a504a9722b739ab33393ecb2d1abc6962cc52f.tar.gz
ghdl-43a504a9722b739ab33393ecb2d1abc6962cc52f.tar.bz2
ghdl-43a504a9722b739ab33393ecb2d1abc6962cc52f.zip
iirs_utils: reimplement Are_Bounds_Locally_Static.
Diffstat (limited to 'src/vhdl/translate/trans-chap3.adb')
-rw-r--r--src/vhdl/translate/trans-chap3.adb66
1 files changed, 22 insertions, 44 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index 773f4ed8f..e8c0c779c 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -558,8 +558,7 @@ package body Trans.Chap3 is
-- Declare the bounds types for DEF.
procedure Translate_Array_Type_Bounds
- (Def : Iir_Array_Type_Definition;
- Info : Type_Info_Acc)
+ (Def : Iir_Array_Type_Definition; Info : Type_Info_Acc)
is
Indexes_List : constant Iir_List :=
Get_Index_Subtype_Definition_List (Def);
@@ -828,22 +827,6 @@ package body Trans.Chap3 is
Close_Temp;
end Create_Array_Subtype_Bounds;
- -- Get staticness of the array bounds.
- function Get_Array_Bounds_Staticness (Def : Iir) return Iir_Staticness
- is
- List : constant Iir_List := Get_Index_Subtype_List (Def);
- Idx_Type : Iir;
- begin
- for I in Natural loop
- Idx_Type := Get_Index_Type (List, I);
- exit when Idx_Type = Null_Iir;
- if Get_Type_Staticness (Idx_Type) /= Locally then
- return Globally;
- end if;
- end loop;
- return Locally;
- end Get_Array_Bounds_Staticness;
-
-- Create a variable containing the bounds for array subtype DEF.
procedure Create_Array_Subtype_Bounds_Var (Def : Iir; Elab_Now : Boolean)
is
@@ -855,32 +838,27 @@ package body Trans.Chap3 is
return;
end if;
Base_Info := Get_Info (Get_Base_Type (Def));
- case Get_Array_Bounds_Staticness (Def) is
- when None
- | Globally =>
- Info.S.Static_Bounds := False;
- Info.S.Array_Bounds := Create_Var
- (Create_Var_Identifier ("STB"), Base_Info.B.Bounds_Type);
- if Elab_Now then
- Create_Array_Subtype_Bounds
- (Def, Get_Var (Info.S.Array_Bounds));
- end if;
- when Locally =>
- Info.S.Static_Bounds := True;
- if Global_Storage = O_Storage_External then
- -- Do not create the value of the type desc, since it
- -- is never dereferenced in a static type desc.
- Val := O_Cnode_Null;
- else
- Val := Create_Static_Array_Subtype_Bounds (Def);
- end if;
- Info.S.Array_Bounds := Create_Global_Const
- (Create_Identifier ("STB"),
- Base_Info.B.Bounds_Type, Global_Storage, Val);
-
- when Unknown =>
- raise Internal_Error;
- end case;
+ if Are_Bounds_Locally_Static (Def) then
+ Info.S.Static_Bounds := True;
+ if Global_Storage = O_Storage_External then
+ -- Do not create the value of the type desc, since it
+ -- is never dereferenced in a static type desc.
+ Val := O_Cnode_Null;
+ else
+ Val := Create_Static_Array_Subtype_Bounds (Def);
+ end if;
+ Info.S.Array_Bounds := Create_Global_Const
+ (Create_Identifier ("STB"),
+ Base_Info.B.Bounds_Type, Global_Storage, Val);
+ else
+ Info.S.Static_Bounds := False;
+ Info.S.Array_Bounds := Create_Var
+ (Create_Var_Identifier ("STB"), Base_Info.B.Bounds_Type);
+ if Elab_Now then
+ Create_Array_Subtype_Bounds
+ (Def, Get_Var (Info.S.Array_Bounds));
+ end if;
+ end if;
end Create_Array_Subtype_Bounds_Var;
procedure Create_Array_Type_Builder