Commit e0ae4e94 by Robert Dewar Committed by Arnaud Charlet

s-osinte-tru64.adb: Mark Asm statements Volatile to prevent warnings (seems a reasonable change...

2006-10-31  Robert Dewar  <dewar@adacore.com>

	* s-osinte-tru64.adb: 
	Mark Asm statements Volatile to prevent warnings (seems a
	reasonable change anyway)
	Fixes new warnings

	* s-mastop-irix.adb: Add Volatile to Asm statements
	Suppresses warning, and seems appropriate in any case

	* s-osinte-vms.adb: Add Volatile to Asm statement

	* s-vaflop-vms-alpha.adb: Add Volatile to Asm statements

	* exp_code.ads, exp_code.adb (Asm_Input_Value): Note that Error can be
	returned.
	Add call to Check_Code_Statement

From-SVN: r118329
parent ba1cbfb9
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2004 Free Software Foundation, Inc. --
-- Copyright (C) 1996-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -36,6 +36,7 @@ with Opt; use Opt;
with Rtsfind; use Rtsfind;
with Sem_Eval; use Sem_Eval;
with Sem_Util; use Sem_Util;
with Sem_Warn; use Sem_Warn;
with Sinfo; use Sinfo;
with Stringt; use Stringt;
with Tbuild; use Tbuild;
......@@ -124,6 +125,8 @@ package body Exp_Code is
begin
if No (Operand_Var) then
return Empty;
elsif Error_Posted (Operand_Var) then
return Error;
else
return Next (First (Expressions (Operand_Var)));
end if;
......@@ -227,7 +230,6 @@ package body Exp_Code is
Name_Buffer (Name_Len + 1) := ASCII.NUL;
return Name_Buffer'Address;
end Clobber_Get_Next;
-------------------
......@@ -240,12 +242,10 @@ package body Exp_Code is
Next_Actual (
Next_Actual (
First_Actual (Call))));
begin
if not Is_OK_Static_Expression (Clob) then
Flag_Non_Static_Expr ("asm clobber argument is not static!", Clob);
Clobber_Node := Empty;
else
Clobber_Node := Get_String_Node (Clob);
Clobber_Ptr := 1;
......@@ -262,11 +262,15 @@ package body Exp_Code is
procedure Check_IO_Operand (N : Node_Id);
-- Check for incorrect input or output operand
----------------------
-- Check_IO_Operand --
----------------------
procedure Check_IO_Operand (N : Node_Id) is
Err : Node_Id := N;
begin
-- The only identifier allows is No_xxput_Operands. Since we
-- The only identifier allowed is No_xxput_Operands. Since we
-- know the type is right, it is sufficient to see if the
-- referenced entity is in a runtime routine.
......@@ -333,7 +337,6 @@ package body Exp_Code is
declare
Arg_Output : constant Node_Id := Next_Actual (First_Actual (N));
Arg_Input : constant Node_Id := Next_Actual (Arg_Output);
begin
Check_IO_Operand (Arg_Output);
Check_IO_Operand (Arg_Input);
......@@ -364,9 +367,13 @@ package body Exp_Code is
-- There is no need to reanalyze this node, it is completely analyzed
-- already, at least sufficiently for the purposes of the abstract
-- procedural interface defined in this package.
-- procedural interface defined in this package. Furthermore if we
-- let it go through the normal analysis, that would include some
-- inappropriate checks that apply only to explicit code statements
-- in the source, and not to calls to intrinsics.
Set_Analyzed (N);
Check_Code_Statement (N);
end if;
end Expand_Asm_Call;
......@@ -378,7 +385,6 @@ package body Exp_Code is
begin
if Nkind (S) = N_String_Literal then
return S;
else
pragma Assert (Ekind (Entity (S)) = E_Constant);
return Get_String_Node (Constant_Value (Entity (S)));
......@@ -397,12 +403,10 @@ package body Exp_Code is
Next_Actual (
Next_Actual (
First_Actual (Call)))));
begin
if not Is_OK_Static_Expression (Vol) then
Flag_Non_Static_Expr ("asm volatile argument is not static!", Vol);
return False;
else
return Is_True (Expr_Value (Vol));
end if;
......@@ -427,7 +431,6 @@ package body Exp_Code is
if Nkind (Parent (Operand_Var)) = N_Aggregate then
Operand_Var := Next (Operand_Var);
else
Operand_Var := Empty;
end if;
......@@ -448,7 +451,6 @@ package body Exp_Code is
procedure Setup_Asm_Inputs (N : Node_Id) is
Call : constant Node_Id := Expression (Expression (N));
begin
Setup_Asm_IO_Args
(Next_Actual (Next_Actual (First_Actual (Call))),
......@@ -488,7 +490,6 @@ package body Exp_Code is
procedure Setup_Asm_Outputs (N : Node_Id) is
Call : constant Node_Id := Expression (Expression (N));
begin
Setup_Asm_IO_Args
(Next_Actual (First_Actual (Call)),
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1996 Free Software Foundation, Inc. --
-- Copyright (C) 1996-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -32,8 +32,7 @@ with System; use System;
package Exp_Code is
procedure Expand_Asm_Call (N : Node_Id);
-- Expands a call to Asm or Asm_Volatile into an equivalent
-- N_Code_Statement node.
-- Expands a call to Asm into an equivalent N_Code_Statement node
-- The following routines provide an abstract interface to analyze
-- code statements, for use by Gigi processing for code statements.
......@@ -41,8 +40,8 @@ package Exp_Code is
-- to expand tables that are frozen on entry to Gigi.
function Is_Asm_Volatile (N : Node_Id) return Boolean;
-- Given an N_Code_Statement node N, return True in the Asm_Volatile
-- case and False in the Asm case.
-- Given an N_Code_Statement node N, return True if Volatile=True is
-- specified, and False if Volatile=False is specified (or set by default).
function Asm_Template (N : Node_Id) return Node_Id;
-- Given an N_Code_Statement node N, returns string literal node for
......@@ -82,7 +81,10 @@ package Exp_Code is
-- Called within a loop initialized by Setup_Asm_Inputs and controlled
-- by Next_Asm_Input as described above. Returns the expression node for
-- the value component of the current Asm_Input parameter, or Empty if
-- there are no more Asm_Input parameters.
-- there are no more Asm_Input parameters, or Error if an error was
-- previously detected in the input parameters (note that the backend
-- need not worry about this case, since it won't be called if there
-- were any such serious errors detected).
procedure Next_Asm_Input;
-- Step to next Asm_Input parameter. It is an error to call this procedure
......@@ -94,7 +96,7 @@ package Exp_Code is
-- arguments. The protocol is to construct a loop as follows:
--
-- Setup_Asm_Outputs (N);
-- while Present (Asm_Output_Value)
-- while Present (Asm_Output_Variable)
-- body
-- Next_Asm_Output;
-- end loop;
......@@ -110,10 +112,13 @@ package Exp_Code is
-- Empty if there are no more Asm_Output parameters.
function Asm_Output_Variable return Node_Id;
-- Called within a loop initialized by Setup_Asm_Outputs and controlled
-- by Next_Asm_Output as described above. Returns the expression node for
-- the output variable component of the current Asm_Output parameter, or
-- Empty if there are no more Asm_Output parameters.
-- Called within a loop initialized by Setup_Asm_Outputs and controlled by
-- Next_Asm_Output as described above. Returns the expression node for the
-- output variable component of the current Asm_Output parameter, or Empty
-- if there are no more Asm_Output parameters, or Error if an error was
-- previously detected in the input parameters (note that the backend need
-- not worry about this case, since it won't be called if there were any
-- such serious errors detected).
procedure Next_Asm_Output;
-- Step to next Asm_Output parameter. It is an error to call this procedure
......
......@@ -7,7 +7,7 @@
-- B o d y --
-- (Version for IRIX/MIPS) --
-- --
-- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
-- Copyright (C) 1999-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -278,12 +278,15 @@ package body System.Machine_State_Operations is
procedure Set_Machine_State (M : Machine_State) is
STOREI : constant String (1 .. 2) := 's' & LSC;
SI : constant String (1 .. 2) := 's' & LSC;
-- This is "sw" in o32 mode, and "sd" in n32 mode
STOREF : constant String (1 .. 4) := 's' & LSC & "c1";
SF : constant String (1 .. 4) := 's' & LSC & "c1";
-- This is "swc1" in o32 mode and "sdc1" in n32 mode
PI : String renames SC_Regs_Pos;
PF : String renames SC_Fpregs_Pos;
Scp : Sigcontext_Ptr;
begin
......@@ -294,41 +297,41 @@ package body System.Machine_State_Operations is
<<Past_Prolog>>
Asm (STOREI & " $16, 16*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $17, 17*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $18, 18*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $19, 19*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $20, 20*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $21, 21*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $22, 22*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $23, 23*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $24, 24*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $25, 25*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $26, 26*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $27, 27*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $28, 28*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $29, 29*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $30, 30*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (STOREI & " $31, 31*8+" & Roff & "+" & SC_Regs_Pos & "($4)");
Asm (SI & " $16, 16*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $17, 17*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $18, 18*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $19, 19*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $20, 20*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $21, 21*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $22, 22*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $23, 23*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $24, 24*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $25, 25*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $26, 26*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $27, 27*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $28, 28*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $29, 29*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $30, 30*8+" & Roff & "+" & PI & "($4)", Volatile => True);
Asm (SI & " $31, 31*8+" & Roff & "+" & PI & "($4)", Volatile => True);
-- Restore floating-point registers from machine state
Asm (STOREF & " $f16, 16*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f17, 17*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f18, 18*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f19, 19*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f20, 20*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f21, 21*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f22, 22*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f23, 23*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f24, 24*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f25, 25*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f26, 26*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f27, 27*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f28, 28*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f29, 29*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f30, 30*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (STOREF & " $f31, 31*8+" & Roff & "+" & SC_Fpregs_Pos & "($4)");
Asm (SF & " $f16, 16*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f17, 17*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f18, 18*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f19, 19*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f20, 20*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f21, 21*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f22, 22*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f23, 23*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f24, 24*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f25, 25*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f26, 26*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f27, 27*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f28, 28*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f29, 29*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f30, 30*8+" & Roff & "+" & PF & "($4)", Volatile => True);
Asm (SF & " $f31, 31*8+" & Roff & "+" & PF & "($4)", Volatile => True);
-- Set the PC value for the context to a location after the
-- prolog has been executed.
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- Copyright (C) 1998-2006, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -73,8 +73,9 @@ package body System.OS_Interface is
begin
Asm ("call_pal 0x9e" & ASCII.LF & ASCII.HT &
"bis $31, $0, %0",
Outputs => pthread_t'Asm_Output ("=r", Self),
Clobber => "$0");
Outputs => pthread_t'Asm_Output ("=r", Self),
Clobber => "$0",
Volatile => True);
return Self;
end pthread_self;
......@@ -93,8 +94,9 @@ package body System.OS_Interface is
Asm ("call_pal 0x9e" & ASCII.LF & ASCII.HT &
"bis $31, $0, %0",
Outputs => Teb_Ptr'Asm_Output ("=r", Teb),
Clobber => "$0");
Outputs => Teb_Ptr'Asm_Output ("=r", Teb),
Clobber => "$0",
Volatile => True);
-- Stick a guard page right above the Yellow Zone if it exists
......
......@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2005, AdaCore --
-- Copyright (C) 1995-2006, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -57,8 +57,9 @@ package body System.OS_Interface is
begin
Asm ("call_pal 0x9e" & LF & HT &
"bis $31, $0, %0",
Outputs => pthread_t'Asm_Output ("=r", Self),
Clobber => "$0");
Outputs => pthread_t'Asm_Output ("=r", Self),
Clobber => "$0",
Volatile => True);
return Self;
end pthread_self;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment