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-2007, 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 function Is_Asm_Volatile (N : Node_Id) return Boolean; 42 -- Given an N_Code_Statement node N, return True if Volatile=True is 43 -- specified, and False if Volatile=False is specified (or set by default). 44 45 function Asm_Template (N : Node_Id) return Node_Id; 46 -- Given an N_Code_Statement node N, returns string literal node for 47 -- template in call 48 49 procedure Clobber_Setup (N : Node_Id); 50 -- Given an N_Code_Statement node N, setup to process the clobber list 51 -- with subsequent calls to Clobber_Get_Next. 52 53 function Clobber_Get_Next return System.Address; 54 -- Can only be called after a previous call to Clobber_Setup. The 55 -- returned value is a pointer to a null terminated (C format) string 56 -- for the next register argument. Null_Address is returned when there 57 -- are no more arguments. 58 59 procedure Setup_Asm_Inputs (N : Node_Id); 60 -- Given an N_Code_Statement node N, setup to read list of Asm_Input 61 -- arguments. The protocol is to construct a loop as follows: 62 -- 63 -- Setup_Asm_Inputs (N); 64 -- while Present (Asm_Input_Value) 65 -- body 66 -- Next_Asm_Input; 67 -- end loop; 68 -- 69 -- where the loop body calls Asm_Input_Constraint or Asm_Input_Value to 70 -- obtain the constraint string or input value expression from the current 71 -- Asm_Input argument. 72 73 function Asm_Input_Constraint return Node_Id; 74 -- Called within a loop initialized by Setup_Asm_Inputs and controlled 75 -- by Next_Asm_Input as described above. Returns a string literal node 76 -- for the constraint component of the current Asm_Input_Parameter, or 77 -- Empty if there are no more Asm_Input parameters. 78 79 function Asm_Input_Value return Node_Id; 80 -- Called within a loop initialized by Setup_Asm_Inputs and controlled 81 -- by Next_Asm_Input as described above. Returns the expression node for 82 -- the value component of the current Asm_Input parameter, or Empty if 83 -- there are no more Asm_Input parameters, or Error if an error was 84 -- previously detected in the input parameters (note that the backend 85 -- need not worry about this case, since it won't be called if there 86 -- were any such serious errors detected). 87 88 procedure Next_Asm_Input; 89 -- Step to next Asm_Input parameter. It is an error to call this procedure 90 -- if there are no more available parameters (which is impossible if the 91 -- call appears in a loop as in the above example). 92 93 procedure Setup_Asm_Outputs (N : Node_Id); 94 -- Given an N_Code_Statement node N, setup to read list of Asm_Output 95 -- arguments. The protocol is to construct a loop as follows: 96 -- 97 -- Setup_Asm_Outputs (N); 98 -- while Present (Asm_Output_Variable) 99 -- body 100 -- Next_Asm_Output; 101 -- end loop; 102 -- 103 -- where the loop body calls Asm_Output_Constraint or Asm_Output_Variable 104 -- to obtain the constraint string or output variable name from the current 105 -- Asm_Output argument. 106 107 function Asm_Output_Constraint return Node_Id; 108 -- Called within a loop initialized by Setup_Asm_Outputs and controlled 109 -- by Next_Asm_Output as described above. Returns a string literal node 110 -- for the constraint component of the current Asm_Output_Parameter, or 111 -- Empty if there are no more Asm_Output parameters. 112 113 function Asm_Output_Variable return Node_Id; 114 -- Called within a loop initialized by Setup_Asm_Outputs and controlled by 115 -- Next_Asm_Output as described above. Returns the expression node for the 116 -- output variable component of the current Asm_Output parameter, or Empty 117 -- if there are no more Asm_Output parameters, or Error if an error was 118 -- previously detected in the input parameters (note that the backend need 119 -- not worry about this case, since it won't be called if there were any 120 -- such serious errors detected). 121 122 procedure Next_Asm_Output; 123 -- Step to next Asm_Output parameter. It is an error to call this procedure 124 -- if there are no more available parameters (which is impossible if the 125 -- call appears in a loop as in the above example). 126 127end Exp_Code; 128