1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
-- Mcode back-end for ortho - Internal debugging.
-- Copyright (C) 2006 Tristan Gingold
--
-- GHDL is free software; you can redistribute it and/or modify it under
-- the terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 2, or (at your option) any later
-- version.
--
-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with GCC; see the file COPYING. If not, write to the Free
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
with Ortho_Code.Flags;
package body Ortho_Code.Debug is
procedure Disp_Mode (M : Mode_Type)
is
use Ada.Text_IO;
begin
case M is
when Mode_U8 =>
Put ("U8 ");
when Mode_U16 =>
Put ("U16");
when Mode_U32 =>
Put ("U32");
when Mode_U64 =>
Put ("U64");
when Mode_I8 =>
Put ("I8 ");
when Mode_I16 =>
Put ("I16");
when Mode_I32 =>
Put ("I32");
when Mode_I64 =>
Put ("I64");
when Mode_X1 =>
Put ("xxx");
when Mode_Nil =>
Put ("Nil");
when Mode_F32 =>
Put ("F32");
when Mode_F64 =>
Put ("F64");
when Mode_B2 =>
Put ("B2 ");
when Mode_Blk =>
Put ("Blk");
when Mode_P32 =>
Put ("P32");
when Mode_P64 =>
Put ("P64");
end case;
end Disp_Mode;
procedure Set_Debug_Be_Flag (C : Character)
is
use Ada.Text_IO;
begin
case C is
when 'a' =>
Flag_Debug_Asm := True;
when 'b' =>
Flag_Debug_Body := True;
when 'B' =>
Flag_Debug_Body2 := True;
when 'c' =>
Flag_Debug_Code := True;
when 'C' =>
Flag_Debug_Code2 := True;
when 'd' =>
Flag_Debug_Dump := True;
when 'h' =>
Flag_Debug_Hex := True;
when 'H' =>
Flag_Debug_Hli := True;
when 'i' =>
Flag_Debug_Insn := True;
when 's' =>
Flag_Debug_Stat := True;
when 'k' =>
Flag_Debug_Keep := True;
when others =>
Put_Line (Standard_Error, "unknown debug be flag '" & C & "'");
end case;
end Set_Debug_Be_Flag;
procedure Set_Be_Flag (Str : String)
is
use Ada.Text_IO;
subtype Str_Type is String (1 .. Str'Length);
S : Str_Type renames Str;
begin
if S'Length > 11 and then S (1 .. 11) = "--be-debug=" then
for I in 12 .. S'Last loop
Set_Debug_Be_Flag (S (I));
end loop;
elsif S'Length > 10 and then S (1 .. 10) = "--be-dump=" then
for I in 11 .. S'Last loop
case S (I) is
when 'c' =>
Flag_Dump_Code := True;
when others =>
Put_Line (Standard_Error,
"unknown back-end dump flag '" & S (I) & "'");
end case;
end loop;
elsif S'Length > 10 and then S (1 .. 10) = "--be-disp=" then
for I in 11 .. S'Last loop
case S (I) is
when 'c' =>
Flag_Disp_Code := True;
Flags.Flag_Type_Name := True;
when others =>
Put_Line (Standard_Error,
"unknown back-end disp flag '" & S (I) & "'");
end case;
end loop;
elsif S'Length > 9 and then S (1 .. 9) = "--be-opt=" then
for I in 10 .. S'Last loop
case S (I) is
when 'O' =>
Flags.Flag_Optimize := True;
when 'b' =>
Flags.Flag_Opt_BB := True;
when others =>
Put_Line (Standard_Error,
"unknown back-end opt flag '" & S (I) & "'");
end case;
end loop;
else
Put_Line (Standard_Error, "unknown back-end option " & Str);
end if;
end Set_Be_Flag;
end Ortho_Code.Debug;
|