summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold2015-12-20 21:14:59 +0100
committerTristan Gingold2015-12-20 21:14:59 +0100
commit396eb91b6e6783cb78cb22fe0a1f26b178d695a1 (patch)
treee96f0c9dc9f337b8d9640abd4dc6ec643231165f
parent92ac42fcf39d5dac4529d939a49437b2a7afe4c2 (diff)
downloadghdl-396eb91b6e6783cb78cb22fe0a1f26b178d695a1.tar.gz
ghdl-396eb91b6e6783cb78cb22fe0a1f26b178d695a1.tar.bz2
ghdl-396eb91b6e6783cb78cb22fe0a1f26b178d695a1.zip
Do not create signal type for scalar type.
Use ghdl_signal_ptr instead. Fallout of sigptr.
-rw-r--r--src/vhdl/translate/trans-chap14.adb9
-rw-r--r--src/vhdl/translate/trans-chap3.adb12
-rw-r--r--src/vhdl/translate/trans-chap7.adb2
-rw-r--r--src/vhdl/translate/translation.adb13
4 files changed, 18 insertions, 18 deletions
diff --git a/src/vhdl/translate/trans-chap14.adb b/src/vhdl/translate/trans-chap14.adb
index a737c6c..eacbf75 100644
--- a/src/vhdl/translate/trans-chap14.adb
+++ b/src/vhdl/translate/trans-chap14.adb
@@ -464,14 +464,13 @@ package body Trans.Chap14 is
-- Read signal value FIELD of signal SIG.
function Get_Signal_Value_Field
- (Sig : O_Enode; Sig_Type : Iir; Field : O_Fnode)
- return O_Lnode
+ (Sig : O_Enode; Sig_Type : Iir; Field : O_Fnode) return O_Lnode
is
- S_Type : O_Tnode;
+ Tinfo : constant Type_Info_Acc := Get_Info (Sig_Type);
+ S_Type : constant O_Tnode := Tinfo.Ortho_Ptr_Type (Mode_Value);
T : O_Lnode;
begin
- S_Type := Get_Ortho_Type (Sig_Type, Mode_Signal);
- T := New_Access_Element (New_Convert_Ov (Sig, Ghdl_Signal_Ptr));
+ T := New_Access_Element (Sig);
return New_Access_Element
(New_Unchecked_Address (New_Selected_Element (T, Field), S_Type));
end Get_Signal_Value_Field;
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index 9b67e46..a01c4c0 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -60,12 +60,12 @@ package body Trans.Chap3 is
-- Signal type.
if Info.Type_Mode in Type_Mode_Scalar then
- Info.Ortho_Type (Mode_Signal) :=
- New_Access_Type (Info.Ortho_Type (Mode_Value));
- end if;
- if Info.Ortho_Type (Mode_Signal) /= O_Tnode_Null then
- New_Type_Decl (Create_Identifier ("SIG"),
- Info.Ortho_Type (Mode_Signal));
+ Info.Ortho_Type (Mode_Signal) := Ghdl_Signal_Ptr;
+ else
+ if Info.Ortho_Type (Mode_Signal) /= O_Tnode_Null then
+ New_Type_Decl (Create_Identifier ("SIG"),
+ Info.Ortho_Type (Mode_Signal));
+ end if;
end if;
-- Signal pointer type.
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 8ce2b8a..25e9ed8 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -3616,7 +3616,7 @@ package body Trans.Chap7 is
begin
New_Assign_Stmt
(Chap14.Get_Signal_Value_Field (M2E (Targ), Targ_Type,
- Ghdl_Signal_Driving_Value_Field),
+ Ghdl_Signal_Driving_Value_Field),
M2E (Data));
end Translate_Signal_Assign_Driving_Non_Composite;
diff --git a/src/vhdl/translate/translation.adb b/src/vhdl/translate/translation.adb
index b593f47..cfc1590 100644
--- a/src/vhdl/translate/translation.adb
+++ b/src/vhdl/translate/translation.adb
@@ -542,6 +542,13 @@ package body Translation is
Ghdl_Dir_Type_Node);
end;
+ -- Create __ghdl_signal_ptr (incomplete type).
+ New_Uncomplete_Record_Type (Ghdl_Signal_Type);
+ New_Type_Decl (Get_Identifier ("__ghdl_signal"), Ghdl_Signal_Type);
+
+ Ghdl_Signal_Ptr := New_Access_Type (Ghdl_Signal_Type);
+ New_Type_Decl (Get_Identifier ("__ghdl_signal_ptr"), Ghdl_Signal_Ptr);
+
-- Create void* __ghdl_alloc (unsigned size);
Start_Function_Decl (Interfaces, Get_Identifier ("__ghdl_alloc"),
O_Storage_External, Ghdl_Ptr_Type);
@@ -1241,12 +1248,6 @@ package body Translation is
New_Type_Decl (Get_Identifier ("__ghdl_scalar_bytes"),
Ghdl_Scalar_Bytes);
- New_Uncomplete_Record_Type (Ghdl_Signal_Type);
- New_Type_Decl (Get_Identifier ("__ghdl_signal"), Ghdl_Signal_Type);
-
- Ghdl_Signal_Ptr := New_Access_Type (Ghdl_Signal_Type);
- New_Type_Decl (Get_Identifier ("__ghdl_signal_ptr"), Ghdl_Signal_Ptr);
-
-- Type __signal_signal is record
Start_Uncomplete_Record_Type (Ghdl_Signal_Type, Rec);
New_Record_Field (Rec, Ghdl_Signal_Value_Field,