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-2020, 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 3,  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 COPYING3.  If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license.          --
20--                                                                          --
21-- GNAT was originally developed  by the GNAT team at  New York University. --
22-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23--                                                                          --
24------------------------------------------------------------------------------
25
26--  Processing for handling code statements
27
28with Types; use Types;
29
30with System; use System;
31package Exp_Code is
32
33   procedure Expand_Asm_Call (N : Node_Id);
34   --  Expands a call to Asm into an equivalent N_Code_Statement node
35
36   --  The following routines provide an abstract interface to analyze
37   --  code statements, for use by Gigi processing for code statements.
38   --  Note that the implementations of these routines must not attempt
39   --  to expand tables that are frozen on entry to Gigi.
40
41   --  WARNING: There is a matching C declaration of these subprograms in fe.h
42
43   function Is_Asm_Volatile (N : Node_Id) return Boolean;
44   --  Given an N_Code_Statement node N, return True if Volatile=True is
45   --  specified, and False if Volatile=False is specified (or set by default).
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, or Error if an error was
86   --  previously detected in the input parameters (note that the backend
87   --  need not worry about this case, since it won't be called if there
88   --  were any such serious errors detected).
89
90   procedure Next_Asm_Input;
91   --  Step to next Asm_Input parameter. It is an error to call this procedure
92   --  if there are no more available parameters (which is impossible if the
93   --  call appears in a loop as in the above example).
94
95   procedure Setup_Asm_Outputs (N : Node_Id);
96   --  Given an N_Code_Statement node N, setup to read list of Asm_Output
97   --  arguments. The protocol is to construct a loop as follows:
98   --
99   --    Setup_Asm_Outputs (N);
100   --    while Present (Asm_Output_Variable)
101   --      body
102   --      Next_Asm_Output;
103   --    end loop;
104   --
105   --  where the loop body calls Asm_Output_Constraint or Asm_Output_Variable
106   --  to obtain the constraint string or output variable name from the current
107   --  Asm_Output argument.
108
109   function Asm_Output_Constraint return Node_Id;
110   --  Called within a loop initialized by Setup_Asm_Outputs and controlled
111   --  by Next_Asm_Output as described above. Returns a string literal node
112   --  for the constraint component of the current Asm_Output_Parameter, or
113   --  Empty if there are no more Asm_Output parameters.
114
115   function Asm_Output_Variable return Node_Id;
116   --  Called within a loop initialized by Setup_Asm_Outputs and controlled by
117   --  Next_Asm_Output as described above. Returns the expression node for the
118   --  output variable component of the current Asm_Output parameter, or Empty
119   --  if there are no more Asm_Output parameters, or Error if an error was
120   --  previously detected in the input parameters (note that the backend need
121   --  not worry about this case, since it won't be called if there were any
122   --  such serious errors detected).
123
124   procedure Next_Asm_Output;
125   --  Step to next Asm_Output parameter. It is an error to call this procedure
126   --  if there are no more available parameters (which is impossible if the
127   --  call appears in a loop as in the above example).
128
129end Exp_Code;
130