diff options
author | gingold | 2008-08-30 13:30:19 +0000 |
---|---|---|
committer | gingold | 2008-08-30 13:30:19 +0000 |
commit | cd9300765e7e3fd43e450777e98a778146f700c2 (patch) | |
tree | f013fea17ae4eee9c1649e63b99b9bfe377fafb4 /ortho/mcode | |
parent | 4b6571671497ecc1f846bfa49678254e14511fc9 (diff) | |
download | ghdl-cd9300765e7e3fd43e450777e98a778146f700c2.tar.gz ghdl-cd9300765e7e3fd43e450777e98a778146f700c2.tar.bz2 ghdl-cd9300765e7e3fd43e450777e98a778146f700c2.zip |
Switch to gcc 4.3
Don't use tagged types in grt (not supported by recent versions of GNAT)
Fix warnings
Diffstat (limited to 'ortho/mcode')
-rw-r--r-- | ortho/mcode/binary_file.adb | 18 | ||||
-rw-r--r-- | ortho/mcode/binary_file.ads | 2 | ||||
-rw-r--r-- | ortho/mcode/disa_x86.adb | 1 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-decls.adb | 4 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-disps.adb | 8 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-dwarf.adb | 7 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-exprs.adb | 3 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-opts.adb | 2 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-types.adb | 1 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-x86-abi.adb | 7 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-x86-abi.ads | 1 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-x86-emits.adb | 25 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-x86-insns.adb | 32 | ||||
-rw-r--r-- | ortho/mcode/ortho_ident.adb | 6 | ||||
-rw-r--r-- | ortho/mcode/ortho_mcode.adb | 5 |
15 files changed, 39 insertions, 83 deletions
diff --git a/ortho/mcode/binary_file.adb b/ortho/mcode/binary_file.adb index 488aac8..1407424 100644 --- a/ortho/mcode/binary_file.adb +++ b/ortho/mcode/binary_file.adb @@ -16,12 +16,9 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with System; -with System.Storage_Elements; with Ada.Text_IO; use Ada.Text_IO; with Ada.Characters.Latin_1; with Ada.Unchecked_Conversion; -with Ada.Unchecked_Deallocation; -with GNAT.Table; with Hex_Images; use Hex_Images; with Disassemble; @@ -169,7 +166,7 @@ package body Binary_File is Resize (Sect, New_Max); end Sect_Prealloc; - procedure Merge_Section (Dest : Section_Acc; Src : in out Section_Acc) + procedure Merge_Section (Dest : Section_Acc; Src : Section_Acc) is Rel : Reloc_Acc; begin @@ -309,7 +306,7 @@ package body Binary_File is while Reloc /= null loop if Reloc.Addr = Off then declare - Str : String := Get_Symbol_Name (Reloc.Sym); + Str : constant String := Get_Symbol_Name (Reloc.Sym); begin Line (Line'First .. Line'First + Str'Length - 1) := Str; Line_Len := Line_Len + Str'Length; @@ -671,9 +668,7 @@ package body Binary_File is Cur_Sect.Pc := Cur_Sect.Pc + Pc_Type (Length); end Gen_Space; - procedure Set_Symbol_Pc (Sym : Symbol; Export : Boolean) - is - use Ada.Text_IO; + procedure Set_Symbol_Pc (Sym : Symbol; Export : Boolean) is begin case Get_Scope (Sym) is when Sym_Local => @@ -953,9 +948,8 @@ package body Binary_File is -- Tmp := Val + N - 1; -- return Tmp - (Tmp mod N); -- end Align_Pow; - procedure Disp_Stats - is - use Ada.Text_IO; + + procedure Disp_Stats is begin Put_Line ("Number of Symbols: " & Symbol'Image (Symbols.Last)); end Disp_Stats; @@ -964,7 +958,6 @@ package body Binary_File is is Sect : Section_Acc; Rel, N_Rel : Reloc_Acc; - Old_Rel : Reloc_Acc; begin Symbols.Free; Sect := Section_Chain; @@ -973,7 +966,6 @@ package body Binary_File is Rel := Sect.First_Reloc; while Rel /= null loop N_Rel := Rel.Sect_Next; - Old_Rel := Rel; Free (Rel); Rel := N_Rel; end loop; diff --git a/ortho/mcode/binary_file.ads b/ortho/mcode/binary_file.ads index 1433627..db31cb6 100644 --- a/ortho/mcode/binary_file.ads +++ b/ortho/mcode/binary_file.ads @@ -59,7 +59,7 @@ package Binary_File is Align : Natural; Esize : Natural); - procedure Merge_Section (Dest : Section_Acc; Src : in out Section_Acc); + procedure Merge_Section (Dest : Section_Acc; Src : Section_Acc); -- Set the current section. procedure Set_Current_Section (Sect : Section_Acc); diff --git a/ortho/mcode/disa_x86.adb b/ortho/mcode/disa_x86.adb index 24c70cf..0653ce7 100644 --- a/ortho/mcode/disa_x86.adb +++ b/ortho/mcode/disa_x86.adb @@ -15,7 +15,6 @@ -- 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 Interfaces; use Interfaces; with System.Address_To_Access_Conversions; package body Disa_X86 is diff --git a/ortho/mcode/ortho_code-decls.adb b/ortho/mcode/ortho_code-decls.adb index 0a8b02c..741d2cc 100644 --- a/ortho/mcode/ortho_code-decls.adb +++ b/ortho/mcode/ortho_code-decls.adb @@ -231,7 +231,7 @@ package body Ortho_Code.Decls is function Get_Subprg_Interfaces (Decl : O_Dnode) return O_Dnode is - Res : O_Dnode := Decl + 1; + Res : constant O_Dnode := Decl + 1; begin if Get_Decl_Kind (Res) = OD_Interface then return Res; @@ -242,7 +242,7 @@ package body Ortho_Code.Decls is function Get_Interface_Chain (Decl : O_Dnode) return O_Dnode is - Res : O_Dnode := Decl + 1; + Res : constant O_Dnode := Decl + 1; begin if Get_Decl_Kind (Res) = OD_Interface then return Res; diff --git a/ortho/mcode/ortho_code-disps.adb b/ortho/mcode/ortho_code-disps.adb index d017576..2f29414 100644 --- a/ortho/mcode/ortho_code-disps.adb +++ b/ortho/mcode/ortho_code-disps.adb @@ -432,9 +432,6 @@ package body Ortho_Code.Disps is end loop; Put ('}'); end; - when others => - Put_Line (Standard_Error, "disps.disp_type: unknown type " - & OT_Kind'Image (Kind)); end case; end Disp_Type; @@ -549,9 +546,6 @@ package body Ortho_Code.Disps is Disp_Subprg (Indent, Get_Body_Stmt (Decl)); when OD_Block => null; - when others => - Put_Line (Standard_Error, "debug.disp_decl: unknown decl " - & OD_Kind'Image (Kind)); end case; if Nl then New_Line; @@ -743,12 +737,10 @@ package body Ortho_Code.Disps is is Stmt : O_Enode; N_Ident : Natural := Ident; - Kind : OE_Kind; begin Stmt := S_Entry; loop Stmt := Get_Stmt_Link (Stmt); - Kind := Get_Expr_Kind (Stmt); Disp_Stmt (N_Ident, Stmt); exit when Get_Expr_Kind (Stmt) = OE_Leave; end loop; diff --git a/ortho/mcode/ortho_code-dwarf.adb b/ortho/mcode/ortho_code-dwarf.adb index 6f807d0..6816199 100644 --- a/ortho/mcode/ortho_code-dwarf.adb +++ b/ortho/mcode/ortho_code-dwarf.adb @@ -27,7 +27,6 @@ with Ortho_Code.Consts; with Ortho_Code.Flags; with Ortho_Ident; with Ortho_Code.Binary; -with Binary_File; use Binary_File; package body Ortho_Code.Dwarf is -- Dwarf debugging format. @@ -336,11 +335,7 @@ package body Ortho_Code.Dwarf is Gen_Ua_32 (Orig_Sym, 0); Gen_Ua_32 (End_Sym, 0); Gen_String_Nul ("T.Gingold ortho_mcode (2004)"); - declare - Dir : String := GNAT.Directory_Operations.Get_Current_Dir; - begin - Gen_String_Nul (Dir); - end; + Gen_String_Nul (GNAT.Directory_Operations.Get_Current_Dir); end Init; procedure Emit_Decl (Decl : O_Dnode); diff --git a/ortho/mcode/ortho_code-exprs.adb b/ortho/mcode/ortho_code-exprs.adb index 0724bcc..e47c75e 100644 --- a/ortho/mcode/ortho_code-exprs.adb +++ b/ortho/mcode/ortho_code-exprs.adb @@ -638,7 +638,7 @@ package body Ortho_Code.Exprs is is Res : O_Enode := O_Enode_Null; Blk : O_Enode; - Last_Blk : O_Enode := Get_Label_Block (Label); + Last_Blk : constant O_Enode := Get_Label_Block (Label); begin Blk := Cur_Block; while Blk /= Last_Blk loop @@ -1546,7 +1546,6 @@ package body Ortho_Code.Exprs is procedure Disp_Enode (Indent : Natural; N : O_Enode) is use Ada.Text_IO; - use Ortho_Code.Debug; use Ortho_Code.Debug.Int32_IO; begin Set_Col (Count (Indent)); diff --git a/ortho/mcode/ortho_code-opts.adb b/ortho/mcode/ortho_code-opts.adb index 83071b4..0ea6b03 100644 --- a/ortho/mcode/ortho_code-opts.adb +++ b/ortho/mcode/ortho_code-opts.adb @@ -157,7 +157,7 @@ package body Ortho_Code.Opts is N_Stmt := Next; P_Stmt := Stmt; Label := Get_Jump_Label (Stmt); - Flag_Discard := Kind = OE_Jump; + Flag_Discard := True; loop if N_Stmt = Label then -- Remove STMT. diff --git a/ortho/mcode/ortho_code-types.adb b/ortho/mcode/ortho_code-types.adb index fda7a21..004b15c 100644 --- a/ortho/mcode/ortho_code-types.adb +++ b/ortho/mcode/ortho_code-types.adb @@ -18,7 +18,6 @@ with Ada.Text_IO; with Ada.Unchecked_Conversion; with GNAT.Table; -with Ada.Text_IO; with Ortho_Code.Consts; use Ortho_Code.Consts; with Ortho_Code.Debug; with Ortho_Code.Abi; use Ortho_Code.Abi; diff --git a/ortho/mcode/ortho_code-x86-abi.adb b/ortho/mcode/ortho_code-x86-abi.adb index 5456235..ff766b0 100644 --- a/ortho/mcode/ortho_code-x86-abi.adb +++ b/ortho/mcode/ortho_code-x86-abi.adb @@ -16,7 +16,6 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Ortho_Code.Decls; use Ortho_Code.Decls; -with Ortho_Code.Types; use Ortho_Code.Types; with Ortho_Code.Exprs; use Ortho_Code.Exprs; with Ortho_Code.Consts; with Ortho_Code.Debug; @@ -177,8 +176,8 @@ package body Ortho_Code.X86.Abi is is use Ada.Text_IO; use Ortho_Code.Debug.Int32_IO; - Obj : O_Dnode := Get_Addr_Object (Stmt); - Frame : O_Enode := Get_Addrl_Frame (Stmt); + Obj : constant O_Dnode := Get_Addr_Object (Stmt); + Frame : constant O_Enode := Get_Addrl_Frame (Stmt); begin if Frame = O_Enode_Null then Put ("fp"); @@ -550,13 +549,11 @@ package body Ortho_Code.X86.Abi is is use Ada.Text_IO; - Last : O_Enode; Stmt : O_Enode; begin Disp_Subprg_Decl (Get_Body_Decl (Subprg)); Stmt := Get_Body_Stmt (Subprg); - Last := Get_Entry_Leave (Stmt); loop exit when Stmt = O_Enode_Null; Disp_Stmt (Stmt); diff --git a/ortho/mcode/ortho_code-x86-abi.ads b/ortho/mcode/ortho_code-x86-abi.ads index 613e37b..eb3b5a1 100644 --- a/ortho/mcode/ortho_code-x86-abi.ads +++ b/ortho/mcode/ortho_code-x86-abi.ads @@ -15,7 +15,6 @@ -- 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.Exprs; use Ortho_Code.Exprs; with Ortho_Code.Types; use Ortho_Code.Types; package Ortho_Code.X86.Abi is diff --git a/ortho/mcode/ortho_code-x86-emits.adb b/ortho/mcode/ortho_code-x86-emits.adb index d64d096..059711a 100644 --- a/ortho/mcode/ortho_code-x86-emits.adb +++ b/ortho/mcode/ortho_code-x86-emits.adb @@ -28,7 +28,6 @@ with Ortho_Code.Binary; use Ortho_Code.Binary; with Ortho_Ident; with Ada.Text_IO; with Interfaces; use Interfaces; -with Binary_File; use Binary_File; package body Ortho_Code.X86.Emits is type Insn_Size is (Sz_8, Sz_16, Sz_32l, Sz_32h); @@ -126,9 +125,7 @@ package body Ortho_Code.X86.Emits is -- end case; -- end Gen_Imm32; - procedure Gen_Imm (N : O_Enode; Sz : Insn_Size) - is - use Interfaces; + procedure Gen_Imm (N : O_Enode; Sz : Insn_Size) is begin case Get_Expr_Kind (N) is when OE_Const => @@ -811,7 +808,7 @@ package body Ortho_Code.X86.Emits is -- addl esp, val Gen_B8 (2#100000_01#); Gen_B8 (2#11_000_100#); - Gen_Le32 (Unsigned_32 (Val)); + Gen_Le32 (Val); end if; End_Insn; end if; @@ -1199,11 +1196,9 @@ package body Ortho_Code.X86.Emits is procedure Gen_Conv_U8 (Stmt : O_Enode) is Op : O_Enode; - Reg_Op : O_Reg; Reg_Res : O_Reg; begin Op := Get_Expr_Operand (Stmt); - Reg_Op := Get_Expr_Reg (Op); Reg_Res := Get_Expr_Reg (Stmt); case Get_Expr_Mode (Stmt) is when Mode_U32 @@ -1223,11 +1218,9 @@ package body Ortho_Code.X86.Emits is procedure Gen_Conv_B2 (Stmt : O_Enode) is Op : O_Enode; - Reg_Op : O_Reg; Reg_Res : O_Reg; begin Op := Get_Expr_Operand (Stmt); - Reg_Op := Get_Expr_Reg (Op); Reg_Res := Get_Expr_Reg (Stmt); case Get_Expr_Mode (Stmt) is when Mode_U32 @@ -1244,12 +1237,8 @@ package body Ortho_Code.X86.Emits is procedure Gen_Conv_I64 (Stmt : O_Enode) is Op : O_Enode; - Reg_Op : O_Reg; - Reg_Res : O_Reg; begin Op := Get_Expr_Operand (Stmt); - Reg_Op := Get_Expr_Reg (Op); - Reg_Res := Get_Expr_Reg (Stmt); case Get_Expr_Mode (Stmt) is when Mode_I32 => -- move dx to reg_helper @@ -1285,11 +1274,8 @@ package body Ortho_Code.X86.Emits is end Gen_Conv_I64; -- Convert FP to xxx. - procedure Gen_Conv_Fp (Stmt : O_Enode) - is - Op : O_Enode; + procedure Gen_Conv_Fp (Stmt : O_Enode) is begin - Op := Get_Expr_Operand (Stmt); case Get_Expr_Mode (Stmt) is when Mode_I32 => -- subl %esp, 4 @@ -1842,9 +1828,11 @@ package body Ortho_Code.X86.Emits is Error_Emit ("emit_insn: oe_arg", Stmt); end case; when OE_Setup_Frame => + pragma Warnings (Off); if Flags.Stack_Boundary > 4 then Emit_Setup_Frame (Stmt); end if; + pragma Warnings (On); when OE_Call => Emit_Call (Stmt); when OE_Intrinsic => @@ -1985,8 +1973,6 @@ package body Ortho_Code.X86.Emits is procedure Emit_Prologue (Subprg : Subprogram_Data_Acc) is use Ortho_Code.Decls; - use Binary_File; - use Interfaces; use Ortho_Code.Flags; use Ortho_Code.X86.Insns; Sym : Symbol; @@ -2070,7 +2056,6 @@ package body Ortho_Code.X86.Emits is procedure Emit_Epilogue (Subprg : Subprogram_Data_Acc) is - use Binary_File; use Ortho_Code.Decls; use Ortho_Code.Types; use Ortho_Code.Flags; diff --git a/ortho/mcode/ortho_code-x86-insns.adb b/ortho/mcode/ortho_code-x86-insns.adb index bfd1635..819e670 100644 --- a/ortho/mcode/ortho_code-x86-insns.adb +++ b/ortho/mcode/ortho_code-x86-insns.adb @@ -72,8 +72,6 @@ package body Ortho_Code.X86.Insns is -- Swap Stack_Offset with Max_Stack of STMT. procedure Swap_Stack_Offset (Blk : O_Dnode) is - use Ortho_Code.Decls; - Prev_Offset : Uns32; begin Prev_Offset := Get_Block_Max_Stack (Blk); @@ -227,16 +225,16 @@ package body Ortho_Code.X86.Insns is return N; end Insert_Move; - function Insert_Spill (Expr : O_Enode) return O_Enode - is - N : O_Enode; - begin - N := New_Enode (OE_Spill, Get_Expr_Mode (Expr), O_Tnode_Null, - Expr, O_Enode_Null); - Set_Expr_Reg (N, R_Spill); - Link_Stmt (N); - return N; - end Insert_Spill; +-- function Insert_Spill (Expr : O_Enode) return O_Enode +-- is +-- N : O_Enode; +-- begin +-- N := New_Enode (OE_Spill, Get_Expr_Mode (Expr), O_Tnode_Null, +-- Expr, O_Enode_Null); +-- Set_Expr_Reg (N, R_Spill); +-- Link_Stmt (N); +-- return N; +-- end Insert_Spill; procedure Error_Gen_Insn (Stmt : O_Enode; Reg : O_Reg) is @@ -290,9 +288,9 @@ package body Ortho_Code.X86.Insns is Used : Boolean; end record; - Init_Reg_Info : Reg_Info_Type := (Num => O_Free, - Stmt => O_Enode_Null, - Used => False); + Init_Reg_Info : constant Reg_Info_Type := (Num => O_Free, + Stmt => O_Enode_Null, + Used => False); type Reg32_Info_Array is array (Regs_R32) of Reg_Info_Type; Regs : Reg32_Info_Array := (others => Init_Reg_Info); Reg_Cc : Reg_Info_Type := Init_Reg_Info; @@ -349,6 +347,8 @@ package body Ortho_Code.X86.Insns is end loop; end Dump_Regs; + pragma Unreferenced (Dump_Regs); + procedure Error_Reg (Msg : String; Stmt : O_Enode; Reg : O_Reg) is use Ada.Text_IO; @@ -1881,7 +1881,6 @@ package body Ortho_Code.X86.Insns is procedure Gen_Subprg_Insns (Subprg : Subprogram_Data_Acc) is First : O_Enode; - Last : O_Enode; Stmt : O_Enode; N_Stmt : O_Enode; begin @@ -1906,7 +1905,6 @@ package body Ortho_Code.X86.Insns is Stack_Offset := 0; First := Subprg.E_Entry; Expand_Decls (Subprg.D_Body + 1); - Last := Get_Entry_Leave (First); Abi.Last_Link := First; -- Generate instructions. diff --git a/ortho/mcode/ortho_ident.adb b/ortho/mcode/ortho_ident.adb index 59c1276..034aeae 100644 --- a/ortho/mcode/ortho_ident.adb +++ b/ortho/mcode/ortho_ident.adb @@ -66,7 +66,7 @@ package body Ortho_Ident is function Get_String (Id : O_Ident) return String is Res : String (1 .. Get_String_Length (Id)); - Start : Natural := Ids.Table (Id); + Start : constant Natural := Ids.Table (Id); begin for I in Res'Range loop Res (I) := Strs.Table (Start + I - 1); @@ -76,8 +76,8 @@ package body Ortho_Ident is function Is_Equal (Id : O_Ident; Str : String) return Boolean is - Start : Natural := Ids.Table (Id); - Len : Natural := Get_String_Length (Id); + Start : constant Natural := Ids.Table (Id); + Len : constant Natural := Get_String_Length (Id); begin if Len /= Str'Length then return False; diff --git a/ortho/mcode/ortho_mcode.adb b/ortho/mcode/ortho_mcode.adb index bc4dc32..e774483 100644 --- a/ortho/mcode/ortho_mcode.adb +++ b/ortho/mcode/ortho_mcode.adb @@ -15,7 +15,6 @@ -- 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.Abi; with Ada.Text_IO; with Ortho_Code.Debug; with Ortho_Code.Sysdeps; @@ -61,7 +60,9 @@ package body Ortho_Mcode is null; end Start_Const_Value; - procedure Finish_Const_Value (Const : in out O_Dnode; Val : O_Cnode) is + procedure Finish_Const_Value (Const : in out O_Dnode; Val : O_Cnode) + is + pragma Warnings (Off, Const); begin New_Const_Value (Const, Val); end Finish_Const_Value; |