OSDN Git Service

2005-03-29 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_code.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             E X P _ C O D E                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --             Copyright (C) 1996 Free Software Foundation, Inc.            --
10 --                                                                          --
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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  Processing for handling code statements
28
29 with Types; use Types;
30
31 with System; use System;
32 package Exp_Code is
33
34    procedure Expand_Asm_Call (N : Node_Id);
35    --  Expands a call to Asm or Asm_Volatile into an equivalent
36    --  N_Code_Statement node.
37
38    --  The following routines provide an abstract interface to analyze
39    --  code statements, for use by Gigi processing for code statements.
40    --  Note that the implementations of these routines must not attempt
41    --  to expand tables that are frozen on entry to Gigi.
42
43    function Is_Asm_Volatile (N : Node_Id) return Boolean;
44    --  Given an N_Code_Statement node N, return True in the Asm_Volatile
45    --  case and False in the Asm case.
46
47    function Asm_Template (N : Node_Id) return Node_Id;
48    --  Given an N_Code_Statement node N, returns string literal node for
49    --  template in call
50
51    procedure Clobber_Setup (N : Node_Id);
52    --  Given an N_Code_Statement node N, setup to process the clobber list
53    --  with subsequent calls to Clobber_Get_Next.
54
55    function Clobber_Get_Next return System.Address;
56    --  Can only be called after a previous call to Clobber_Setup. The
57    --  returned value is a pointer to a null terminated (C format) string
58    --  for the next register argument. Null_Address is returned when there
59    --  are no more arguments.
60
61    procedure Setup_Asm_Inputs (N : Node_Id);
62    --  Given an N_Code_Statement node N, setup to read list of Asm_Input
63    --  arguments. The protocol is to construct a loop as follows:
64    --
65    --    Setup_Asm_Inputs (N);
66    --    while Present (Asm_Input_Value)
67    --      body
68    --      Next_Asm_Input;
69    --    end loop;
70    --
71    --  where the loop body calls Asm_Input_Constraint or Asm_Input_Value to
72    --  obtain the constraint string or input value expression from the current
73    --  Asm_Input argument.
74
75    function Asm_Input_Constraint return Node_Id;
76    --  Called within a loop initialized by Setup_Asm_Inputs and controlled
77    --  by Next_Asm_Input as described above. Returns a string literal node
78    --  for the constraint component of the current Asm_Input_Parameter, or
79    --  Empty if there are no more Asm_Input parameters.
80
81    function Asm_Input_Value return Node_Id;
82    --  Called within a loop initialized by Setup_Asm_Inputs and controlled
83    --  by Next_Asm_Input as described above. Returns the expression node for
84    --  the value component of the current Asm_Input parameter, or Empty if
85    --  there are no more Asm_Input parameters.
86
87    procedure Next_Asm_Input;
88    --  Step to next Asm_Input parameter. It is an error to call this procedure
89    --  if there are no more available parameters (which is impossible if the
90    --  call appears in a loop as in the above example).
91
92    procedure Setup_Asm_Outputs (N : Node_Id);
93    --  Given an N_Code_Statement node N, setup to read list of Asm_Output
94    --  arguments. The protocol is to construct a loop as follows:
95    --
96    --    Setup_Asm_Outputs (N);
97    --    while Present (Asm_Output_Value)
98    --      body
99    --      Next_Asm_Output;
100    --    end loop;
101    --
102    --  where the loop body calls Asm_Output_Constraint or Asm_Output_Variable
103    --  to obtain the constraint string or output variable name from the current
104    --  Asm_Output argument.
105
106    function Asm_Output_Constraint return Node_Id;
107    --  Called within a loop initialized by Setup_Asm_Outputs and controlled
108    --  by Next_Asm_Output as described above. Returns a string literal node
109    --  for the constraint component of the current Asm_Output_Parameter, or
110    --  Empty if there are no more Asm_Output parameters.
111
112    function Asm_Output_Variable return Node_Id;
113    --  Called within a loop initialized by Setup_Asm_Outputs and controlled
114    --  by Next_Asm_Output as described above. Returns the expression node for
115    --  the output variable component of the current Asm_Output parameter, or
116    --  Empty if there are no more Asm_Output parameters.
117
118    procedure Next_Asm_Output;
119    --  Step to next Asm_Output parameter. It is an error to call this procedure
120    --  if there are no more available parameters (which is impossible if the
121    --  call appears in a loop as in the above example).
122
123 end Exp_Code;