1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1996-2006, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- Processing for handling code statements
29 with Types; use Types;
31 with System; use System;
34 procedure Expand_Asm_Call (N : Node_Id);
35 -- Expands a call to Asm into an equivalent N_Code_Statement node
37 -- The following routines provide an abstract interface to analyze
38 -- code statements, for use by Gigi processing for code statements.
39 -- Note that the implementations of these routines must not attempt
40 -- to expand tables that are frozen on entry to Gigi.
42 function Is_Asm_Volatile (N : Node_Id) return Boolean;
43 -- Given an N_Code_Statement node N, return True if Volatile=True is
44 -- specified, and False if Volatile=False is specified (or set by default).
46 function Asm_Template (N : Node_Id) return Node_Id;
47 -- Given an N_Code_Statement node N, returns string literal node for
50 procedure Clobber_Setup (N : Node_Id);
51 -- Given an N_Code_Statement node N, setup to process the clobber list
52 -- with subsequent calls to Clobber_Get_Next.
54 function Clobber_Get_Next return System.Address;
55 -- Can only be called after a previous call to Clobber_Setup. The
56 -- returned value is a pointer to a null terminated (C format) string
57 -- for the next register argument. Null_Address is returned when there
58 -- are no more arguments.
60 procedure Setup_Asm_Inputs (N : Node_Id);
61 -- Given an N_Code_Statement node N, setup to read list of Asm_Input
62 -- arguments. The protocol is to construct a loop as follows:
64 -- Setup_Asm_Inputs (N);
65 -- while Present (Asm_Input_Value)
70 -- where the loop body calls Asm_Input_Constraint or Asm_Input_Value to
71 -- obtain the constraint string or input value expression from the current
72 -- Asm_Input argument.
74 function Asm_Input_Constraint return Node_Id;
75 -- Called within a loop initialized by Setup_Asm_Inputs and controlled
76 -- by Next_Asm_Input as described above. Returns a string literal node
77 -- for the constraint component of the current Asm_Input_Parameter, or
78 -- Empty if there are no more Asm_Input parameters.
80 function Asm_Input_Value return Node_Id;
81 -- Called within a loop initialized by Setup_Asm_Inputs and controlled
82 -- by Next_Asm_Input as described above. Returns the expression node for
83 -- the value component of the current Asm_Input parameter, or Empty if
84 -- there are no more Asm_Input parameters, or Error if an error was
85 -- previously detected in the input parameters (note that the backend
86 -- need not worry about this case, since it won't be called if there
87 -- were any such serious errors detected).
89 procedure Next_Asm_Input;
90 -- Step to next Asm_Input parameter. It is an error to call this procedure
91 -- if there are no more available parameters (which is impossible if the
92 -- call appears in a loop as in the above example).
94 procedure Setup_Asm_Outputs (N : Node_Id);
95 -- Given an N_Code_Statement node N, setup to read list of Asm_Output
96 -- arguments. The protocol is to construct a loop as follows:
98 -- Setup_Asm_Outputs (N);
99 -- while Present (Asm_Output_Variable)
104 -- where the loop body calls Asm_Output_Constraint or Asm_Output_Variable
105 -- to obtain the constraint string or output variable name from the current
106 -- Asm_Output argument.
108 function Asm_Output_Constraint return Node_Id;
109 -- Called within a loop initialized by Setup_Asm_Outputs and controlled
110 -- by Next_Asm_Output as described above. Returns a string literal node
111 -- for the constraint component of the current Asm_Output_Parameter, or
112 -- Empty if there are no more Asm_Output parameters.
114 function Asm_Output_Variable return Node_Id;
115 -- Called within a loop initialized by Setup_Asm_Outputs and controlled by
116 -- Next_Asm_Output as described above. Returns the expression node for the
117 -- output variable component of the current Asm_Output parameter, or Empty
118 -- if there are no more Asm_Output parameters, or Error if an error was
119 -- previously detected in the input parameters (note that the backend need
120 -- not worry about this case, since it won't be called if there were any
121 -- such serious errors detected).
123 procedure Next_Asm_Output;
124 -- Step to next Asm_Output parameter. It is an error to call this procedure
125 -- if there are no more available parameters (which is impossible if the
126 -- call appears in a loop as in the above example).