aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-10-17 05:39:54 +0200
committerTristan Gingold <tgingold@free.fr>2016-10-17 05:39:54 +0200
commit20a49e1ed483deea8531fef92ac0064355eed729 (patch)
tree307e12ed530c2f04fae2f21d183095f12f4cfd3f
parentdebfbffe7fe77a51bbba85d84147cac3d806df2a (diff)
downloadghdl-20a49e1ed483deea8531fef92ac0064355eed729.tar.gz
ghdl-20a49e1ed483deea8531fef92ac0064355eed729.tar.bz2
ghdl-20a49e1ed483deea8531fef92ac0064355eed729.zip
Disable most of canon for reprint.
-rw-r--r--src/ghdldrv/ghdlprint.adb7
-rw-r--r--src/vhdl/canon.adb74
-rw-r--r--src/vhdl/canon.ads9
3 files changed, 59 insertions, 31 deletions
diff --git a/src/ghdldrv/ghdlprint.adb b/src/ghdldrv/ghdlprint.adb
index d4eb822d6..093ba00a9 100644
--- a/src/ghdldrv/ghdlprint.adb
+++ b/src/ghdldrv/ghdlprint.adb
@@ -30,6 +30,7 @@ with Iirs_Utils; use Iirs_Utils;
with Tokens;
with Scanner;
with Parse;
+with Canon;
with Version;
with Xrefs;
with Ghdlmain; use Ghdlmain;
@@ -984,8 +985,14 @@ package body Ghdlprint is
Next_Unit : Iir;
begin
Setup_Libraries (True);
+
+ -- Keep parenthesis during parse.
Parse.Flag_Parse_Parenthesis := True;
+ Canon.Canon_Flag_Concurrent_Stmts := False;
+ Canon.Canon_Flag_Configurations := False;
+ Canon.Canon_Flag_Specification_Lists := False;
+
-- Parse all files.
for I in Args'Range loop
Id := Name_Table.Get_Identifier (Args (I).all);
diff --git a/src/vhdl/canon.adb b/src/vhdl/canon.adb
index eb1eb9a5a..0e560cd5f 100644
--- a/src/vhdl/canon.adb
+++ b/src/vhdl/canon.adb
@@ -2443,34 +2443,38 @@ package body Canon is
if Canon_Flag_Expressions then
Canon_Expression (Get_Expression (Dis));
end if;
- Signal_List := Get_Signal_List (Dis);
- if Signal_List = Iir_List_All then
- Force := True;
- elsif Signal_List = Iir_List_Others then
- Force := False;
- else
- return;
- end if;
- Dis_Type := Get_Type (Get_Type_Mark (Dis));
- N_List := Create_Iir_List;
- Set_Signal_List (Dis, N_List);
- El := Get_Declaration_Chain (Decl_Parent);
- while El /= Null_Iir loop
- if Get_Kind (El) = Iir_Kind_Signal_Declaration
- and then Get_Type (El) = Dis_Type
- and then Get_Guarded_Signal_Flag (El)
- then
- if not Get_Has_Disconnect_Flag (El) then
- Set_Has_Disconnect_Flag (El, True);
- Append_Element (N_List, El);
- else
- if Force then
- raise Internal_Error;
+
+ if Canon_Flag_Specification_Lists then
+ Signal_List := Get_Signal_List (Dis);
+ if Signal_List = Iir_List_All then
+ Force := True;
+ elsif Signal_List = Iir_List_Others then
+ Force := False;
+ else
+ return;
+ end if;
+
+ Dis_Type := Get_Type (Get_Type_Mark (Dis));
+ N_List := Create_Iir_List;
+ Set_Signal_List (Dis, N_List);
+ El := Get_Declaration_Chain (Decl_Parent);
+ while El /= Null_Iir loop
+ if Get_Kind (El) = Iir_Kind_Signal_Declaration
+ and then Get_Type (El) = Dis_Type
+ and then Get_Guarded_Signal_Flag (El)
+ then
+ if not Get_Has_Disconnect_Flag (El) then
+ Set_Has_Disconnect_Flag (El, True);
+ Append_Element (N_List, El);
+ else
+ if Force then
+ raise Internal_Error;
+ end if;
end if;
end if;
- end if;
- El := Get_Chain (El);
- end loop;
+ El := Get_Chain (El);
+ end loop;
+ end if;
end Canon_Disconnection_Specification;
procedure Canon_Subtype_Indication (Def : Iir) is
@@ -2675,8 +2679,10 @@ package body Canon is
null;
when Iir_Kind_Configuration_Specification =>
- Canon_Component_Specification (Decl, Parent);
- Canon_Component_Configuration (Top, Decl);
+ if Canon_Flag_Configurations then
+ Canon_Component_Specification (Decl, Parent);
+ Canon_Component_Configuration (Top, Decl);
+ end if;
when Iir_Kind_Package_Declaration =>
Canon_Declarations (Top, Decl, Parent);
@@ -3020,17 +3026,23 @@ package body Canon is
Canon_Interface_List (Get_Generic_Chain (El));
Canon_Interface_List (Get_Port_Chain (El));
Canon_Declarations (Unit, El, El);
- Canon_Concurrent_Stmts (Unit, El);
+ if Canon_Flag_Concurrent_Stmts then
+ Canon_Concurrent_Stmts (Unit, El);
+ end if;
when Iir_Kind_Architecture_Body =>
Canon_Declarations (Unit, El, El);
- Canon_Concurrent_Stmts (Unit, El);
+ if Canon_Flag_Concurrent_Stmts then
+ Canon_Concurrent_Stmts (Unit, El);
+ end if;
when Iir_Kind_Package_Declaration =>
Canon_Declarations (Unit, El, Null_Iir);
when Iir_Kind_Package_Body =>
Canon_Declarations (Unit, El, Null_Iir);
when Iir_Kind_Configuration_Declaration =>
Canon_Declarations (Unit, El, Null_Iir);
- Canon_Block_Configuration (Unit, Get_Block_Configuration (El));
+ if Canon_Flag_Configurations then
+ Canon_Block_Configuration (Unit, Get_Block_Configuration (El));
+ end if;
when Iir_Kind_Package_Instantiation_Declaration =>
El := Canon_Package_Instantiation_Declaration (El);
Set_Library_Unit (Unit, El);
diff --git a/src/vhdl/canon.ads b/src/vhdl/canon.ads
index b78eaaa1c..40ce5088f 100644
--- a/src/vhdl/canon.ads
+++ b/src/vhdl/canon.ads
@@ -25,6 +25,15 @@ package Canon is
-- If true, canon sequentials statements (processes and subprograms).
Canon_Flag_Sequentials_Stmts : Boolean := False;
+ -- If true, canon concurrent statements.
+ Canon_Flag_Concurrent_Stmts : Boolean := True;
+
+ -- If true, canon configuration.
+ Canon_Flag_Configurations : Boolean := True;
+
+ -- If true, canon lists in specifications.
+ Canon_Flag_Specification_Lists : Boolean := True;
+
-- If true, canon expressions.
Canon_Flag_Expressions : Boolean := False;