2004-06-07 Robert Dewar <dewar@gnat.com> * a-direct.ads, einfo.ads: Minor comment updates * s-taprop-lynxos.adb, s-taprop-tru64.adb, s-taprop-irix.adb, s-taprop-irix-athread.adb, s-taprop-hpux-dce.adb, s-taprop-linux.adb, s-taprop-dummy.adb, s-taprop-os2.adb, s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb, s-taprop-vxworks.adb, s-taprop-posix.adb, s-taprop.ads, exp_dbug.adb: Minor reformatting. * s-interr-sigaction.adb: Remove unreferenced variable (Attached_Interrupts). Minor reformatting. Avoid use of variable I (replace by J). * par-ch10.adb: Fix text of one error message * checks.adb, checks.ads, cstand.adb, vms_data.ads, errout.ads, exp_aggr.adb, exp_ch3.adb, exp_ch3.ads, exp_ch5.adb, exp_ch6.adb, exp_ch9.adb, exp_code.adb, gnat1drv.adb, lib-load.adb, lib-writ.adb, opt.adb, par.adb, opt.ads, par-ch11.adb, par-ch3.adb, par-ch4.adb, par-ch5.adb, par-ch6.adb, par-ch8.adb, par-ch9.adb, par-prag.adb, par-util.adb, scng.adb, sem_aggr.adb, sem_attr.adb, sem_cat.adb, sem_ch10.adb, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch2.adb, sem_ch3.adb, sem_ch3.ads, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_eval.adb, sem_prag.adb, sem_res.adb, sem_type.adb, sem_util.adb, sinfo.ads, snames.adb, snames.ads, snames.h, sprint.adb, switch-c.adb: Modifications for Ada 2005 support. 2004-06-07 Doug Rupp <rupp@gnat.com> * mlib-tgt-vms.adb: Rename mlib-tgt-vms.adb mlib-tgt-vms-alpha.adb * s-vaflop-vms.adb: Rename s-vaflop-vms.adb to s-vaflop-vms-alpha.adb * mlib-tgt-vms-ia64.adb: New file. * Makefile.in: Rename mlib-tgt-vms.adb to mlib-tgt-vms-alpha.adb Add mlib-tgt-vms-ia64.adb Rename s-vaflop-vms.adb to s-vaflop-vms-alpha.adb. Move to alpha specific ifeq section. Add VMS specific versions of symbols.adb Renaming of 5q vms files. * 5qsystem.ads renamed to system-vms_64.ads. 2004-06-07 Vincent Celier <celier@gnat.com> * a-calend.ads: Add a GNAT Note comment after function Time_Of to explain that when a time of day corresponding to the non existing hour on the day switching to DST is specified, Split may return a different value for Seconds. * gnatcmd.adb: Add processing of GNAT METRIC (for gnatmetric), similar to GNAT PRETTY. * g-os_lib.adb (OpenVMS): New Boolean value imported from System. (Normalize_Pathname): Only resolve VMS logical names when on VMS. * mlib-prj.adb (Build_Library): New flag Gtrasymobj_Needed, initialize to False. If Gtrasymobj_Needed is True, add the full path of g-trasym.obj to the linking options. (Build_Library.Check_Libs): On VMS, if there is a dependency on g-trasym.ads, set Gtrasymobj_Needed to True. * prj-attr.adb: Add new package Metrics for gnatmetric * prj-nmsc.adb (Record_Other_Sources): Put source file names in canonical case to take into account files with upper case characters on Windows. (Ada_Check): Load the reference symbol file name in the name buffer to check it, not the symbol file name. * snames.ads, snames.adb: Add standard name Metrics (name of project file package for gnatmetric). * vms_conv.ads: Add Metric to Comment_Type * vms_conv.adb (Initialize): Add component dor Metric in Command_List * vms_data.ads: Add qualifiers for GNAT METRIC * makegpr.adb (Link_Executables): Take into account the switches specified in package Linker of the main project. 2004-06-07 Thomas Quinot <quinot@act-europe.fr> * bindgen.adb (Set_Unit_Number): Units is an instance of Table, and so the index of the last element is Units.Last, not Units.Table'Last (which is usually not a valid index within the actually allocated storage for the table). * exp_ch4.adb (Insert_Dereference_Action): Change predicate that determines whether to generate a call to a checked storage pool Dereference action. Generate such a call only for a dereference that either comes from source, or is the result of rewriting a dereference that comes from source. 2004-06-07 Romain Berrendonner <berrendo@act-europe.fr> * bindgen.adb (Gen_Output_File): Add support for GAP builds. 2004-06-07 Eric Botcazou <ebotcazou@act-europe.fr> (gnat_to_gnu_entity) <E_Array_Subtype>: For multi-dimensional arrays at file level, elaborate the stride for inner dimensions in alignment units, not bytes. * exp_ch5.adb: Correct wrong reference to Component_May_Be_Bit_Aligned in a comment. 2004-06-07 Javier Miranda <miranda@gnat.com> * exp_ch6.adb: Correct wrong modification in previous patch 2004-06-07 Vasiliy Fofanov <fofanov@act-europe.fr> * g-trasym.ads: Corrected comment to properly reflect level of support on VMS. 2004-06-07 Hristian Kirtchev <kirtchev@gnat.com> * lib-xref.adb (Generate_Reference): Add nested function Is_On_LHS. It includes case of a variable referenced on the left hand side of an assignment, therefore remove redundant code. Variables and prefixes of indexed or selected components are now marked as referenced on left hand side. Warnings are now properly emitted when variables or prefixes are assigned but not read. * sem_warn.adb (Output_Unreferenced_Messages): Add additional checks to left hand side referenced variables. Private access types do not produce the warning "variable ... is assigned but never read". Add also additional checks to left hand side referenced variables. Aliased, renamed objects and access types do not produce the warning "variable ... is assigned but never read" since other entities may read the memory location. 2004-06-07 Jerome Guitton <guitton@act-europe.fr> * Makefile.in: In the powerpc/vxworks-specific section, restore EXTRA_GNATRTL_NONTASKING_OBJS and EXTRA_GNATRTL_TASKING_OBJS (removed by mistake). 2004-06-07 Ed Schonberg <schonberg@gnat.com> * sem_ch4.adb (Remove_Abstract_Operations): Refine the removal of predefined operators. Removes spurious type errors from g-trasym-vms.adb. * sem_res.adb (Rewrite_Renamed_Operator): If intrinsic operator is distinct from the operator appearing in the source, call appropriate routine to insert conversions when needed, and complete resolution of node. (Resolve_Intrinsic_Operator): Fix cut-and-paste bug on transfer of interpretations for rewritten right operand. (Set_Mixed_Mode_Operand): Handle properly a universal real operand when the other operand is overloaded and the context is a type conversion. 2004-06-07 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * ada-tree.def (BLOCK_STMT): Now has two operands. (BREAK_STMT): New. * ada-tree.h: (BLOCK_STMT_BLOCK): New macro. * gigi.h: (gnat_poplevel): Now returns a tree. * trans.c (end_block_stmt): Add arg; all callers changed. (tree_transform, case N_Case_Statement): Make a BLOCK_STMT for a WHEN. (start_block_stmt): Clear BLOCK_STMT_BLOCK. (add_stmt): Set TREE_TYPE. (gnat_expand_stmt, case BLOCK_STMT): Handle BLOCK_STMT_BLOCK. (gnat_expand_stmt, case BREAK_STMT): New case. * utils.c (gnat_poplevel): Return a BLOCK, if we made one. 2004-06-07 Jose Ruiz <ruiz@act-europe.fr> * s-stchop.adsm s-stchop.adb, s-stchop-vxworks.adb: Remove the procedure Set_Stack_Size that is not needed. 2004-06-07 Sergey Rybin <rybin@act-europe.fr> * gnat_ugn.texi: Clarify the case when non-standard naming scheme is used for gnatpp input file and for the files upon which it depends 2004-06-07 Ben Brosgol <brosgol@gnat.com> * gnat_ugn.texi: Wordsmithing of "GNAT and Libraries" chapter 2004-06-07 Arnaud Charlet <charlet@act-europe.fr> * gnatvsn.ads: Bump version numbers appropriately. Add new build type. 2004-06-07 Pascal Obry <obry@gnat.com> * gnat_ugn.texi: Improve comments about imported names and link names on Windows. Add a note about the requirement to use -k gnatdll's option when working with a DLL which has stripped stdcall symbols (no @nn suffix). From-SVN: r82691
499 lines
16 KiB
Ada
499 lines
16 KiB
Ada
------------------------------------------------------------------------------
|
|
-- --
|
|
-- GNAT COMPILER COMPONENTS --
|
|
-- --
|
|
-- E X P _ C O D E --
|
|
-- --
|
|
-- B o d y --
|
|
-- --
|
|
-- Copyright (C) 1996-2004 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- --
|
|
-- ware Foundation; either version 2, or (at your option) any later ver- --
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
|
-- for more details. You should have received a copy of the GNU General --
|
|
-- Public License distributed with GNAT; see file COPYING. If not, write --
|
|
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
|
|
-- MA 02111-1307, USA. --
|
|
-- --
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
-- --
|
|
------------------------------------------------------------------------------
|
|
|
|
with Atree; use Atree;
|
|
with Einfo; use Einfo;
|
|
with Errout; use Errout;
|
|
with Fname; use Fname;
|
|
with Lib; use Lib;
|
|
with Namet; use Namet;
|
|
with Nlists; use Nlists;
|
|
with Nmake; use Nmake;
|
|
with Opt; use Opt;
|
|
with Rtsfind; use Rtsfind;
|
|
with Sem_Eval; use Sem_Eval;
|
|
with Sem_Util; use Sem_Util;
|
|
with Sinfo; use Sinfo;
|
|
with Stringt; use Stringt;
|
|
with Tbuild; use Tbuild;
|
|
|
|
package body Exp_Code is
|
|
|
|
-----------------------
|
|
-- Local_Subprograms --
|
|
-----------------------
|
|
|
|
function Asm_Constraint (Operand_Var : Node_Id) return Node_Id;
|
|
-- Common processing for Asm_Input_Constraint and Asm_Output_Constraint.
|
|
-- Obtains the constraint argument from the global operand variable
|
|
-- Operand_Var, which must be non-Empty.
|
|
|
|
function Asm_Operand (Operand_Var : Node_Id) return Node_Id;
|
|
-- Common processing for Asm_Input_Value and Asm_Output_Variable. Obtains
|
|
-- the value/variable argument from Operand_Var, the global operand
|
|
-- variable. Returns Empty if no operand available.
|
|
|
|
function Get_String_Node (S : Node_Id) return Node_Id;
|
|
-- Given S, a static expression node of type String, returns the
|
|
-- string literal node. This is needed to deal with the use of constants
|
|
-- for these expressions, which is perfectly permissible.
|
|
|
|
procedure Next_Asm_Operand (Operand_Var : in out Node_Id);
|
|
-- Common processing for Next_Asm_Input and Next_Asm_Output, updates
|
|
-- the value of the global operand variable Operand_Var appropriately.
|
|
|
|
procedure Setup_Asm_IO_Args (Arg : Node_Id; Operand_Var : out Node_Id);
|
|
-- Common processing for Setup_Asm_Inputs and Setup_Asm_Outputs. Arg
|
|
-- is the actual parameter from the call, and Operand_Var is the global
|
|
-- operand variable to be initialized to the first operand.
|
|
|
|
----------------------
|
|
-- Global Variables --
|
|
----------------------
|
|
|
|
Current_Input_Operand : Node_Id := Empty;
|
|
-- Points to current Asm_Input_Operand attribute reference. Initialized
|
|
-- by Setup_Asm_Inputs, updated by Next_Asm_Input, and referenced by
|
|
-- Asm_Input_Constraint and Asm_Input_Value.
|
|
|
|
Current_Output_Operand : Node_Id := Empty;
|
|
-- Points to current Asm_Output_Operand attribute reference. Initialized
|
|
-- by Setup_Asm_Outputs, updated by Next_Asm_Output, and referenced by
|
|
-- Asm_Output_Constraint and Asm_Output_Variable.
|
|
|
|
--------------------
|
|
-- Asm_Constraint --
|
|
--------------------
|
|
|
|
function Asm_Constraint (Operand_Var : Node_Id) return Node_Id is
|
|
begin
|
|
pragma Assert (Present (Operand_Var));
|
|
return Get_String_Node (First (Expressions (Operand_Var)));
|
|
end Asm_Constraint;
|
|
|
|
--------------------------
|
|
-- Asm_Input_Constraint --
|
|
--------------------------
|
|
|
|
-- Note: error checking on Asm_Input attribute done in Sem_Attr
|
|
|
|
function Asm_Input_Constraint return Node_Id is
|
|
begin
|
|
return Get_String_Node (Asm_Constraint (Current_Input_Operand));
|
|
end Asm_Input_Constraint;
|
|
|
|
---------------------
|
|
-- Asm_Input_Value --
|
|
---------------------
|
|
|
|
-- Note: error checking on Asm_Input attribute done in Sem_Attr
|
|
|
|
function Asm_Input_Value return Node_Id is
|
|
begin
|
|
return Asm_Operand (Current_Input_Operand);
|
|
end Asm_Input_Value;
|
|
|
|
-----------------
|
|
-- Asm_Operand --
|
|
-----------------
|
|
|
|
function Asm_Operand (Operand_Var : Node_Id) return Node_Id is
|
|
begin
|
|
if No (Operand_Var) then
|
|
return Empty;
|
|
else
|
|
return Next (First (Expressions (Operand_Var)));
|
|
end if;
|
|
end Asm_Operand;
|
|
|
|
---------------------------
|
|
-- Asm_Output_Constraint --
|
|
---------------------------
|
|
|
|
-- Note: error checking on Asm_Output attribute done in Sem_Attr
|
|
|
|
function Asm_Output_Constraint return Node_Id is
|
|
begin
|
|
return Asm_Constraint (Current_Output_Operand);
|
|
end Asm_Output_Constraint;
|
|
|
|
-------------------------
|
|
-- Asm_Output_Variable --
|
|
-------------------------
|
|
|
|
-- Note: error checking on Asm_Output attribute done in Sem_Attr
|
|
|
|
function Asm_Output_Variable return Node_Id is
|
|
begin
|
|
return Asm_Operand (Current_Output_Operand);
|
|
end Asm_Output_Variable;
|
|
|
|
------------------
|
|
-- Asm_Template --
|
|
------------------
|
|
|
|
function Asm_Template (N : Node_Id) return Node_Id is
|
|
Call : constant Node_Id := Expression (Expression (N));
|
|
Temp : constant Node_Id := First_Actual (Call);
|
|
|
|
begin
|
|
-- Require static expression for template. We also allow a string
|
|
-- literal (this is useful for Ada 83 mode where string expressions
|
|
-- are never static).
|
|
|
|
if Is_OK_Static_Expression (Temp)
|
|
or else (Ada_Version = Ada_83
|
|
and then Nkind (Temp) = N_String_Literal)
|
|
then
|
|
return Get_String_Node (Temp);
|
|
|
|
else
|
|
Flag_Non_Static_Expr ("asm template argument is not static!", Temp);
|
|
return Empty;
|
|
end if;
|
|
end Asm_Template;
|
|
|
|
----------------------
|
|
-- Clobber_Get_Next --
|
|
----------------------
|
|
|
|
Clobber_Node : Node_Id;
|
|
-- String literal node for clobber string. Initialized by Clobber_Setup,
|
|
-- and not modified by Clobber_Get_Next. Empty if clobber string was in
|
|
-- error (resulting in no clobber arguments being returned).
|
|
|
|
Clobber_Ptr : Nat;
|
|
-- Pointer to current character of string. Initialized to 1 by the call
|
|
-- to Clobber_Setup, and then updated by Clobber_Get_Next.
|
|
|
|
function Clobber_Get_Next return Address is
|
|
Str : constant String_Id := Strval (Clobber_Node);
|
|
Len : constant Nat := String_Length (Str);
|
|
C : Character;
|
|
|
|
begin
|
|
if No (Clobber_Node) then
|
|
return Null_Address;
|
|
end if;
|
|
|
|
-- Skip spaces and commas before next register name
|
|
|
|
loop
|
|
-- Return null string if no more names
|
|
|
|
if Clobber_Ptr > Len then
|
|
return Null_Address;
|
|
end if;
|
|
|
|
C := Get_Character (Get_String_Char (Str, Clobber_Ptr));
|
|
exit when C /= ',' and then C /= ' ';
|
|
Clobber_Ptr := Clobber_Ptr + 1;
|
|
end loop;
|
|
|
|
-- Acquire next register name
|
|
|
|
Name_Len := 0;
|
|
loop
|
|
Name_Len := Name_Len + 1;
|
|
Name_Buffer (Name_Len) := C;
|
|
Clobber_Ptr := Clobber_Ptr + 1;
|
|
exit when Clobber_Ptr > Len;
|
|
C := Get_Character (Get_String_Char (Str, Clobber_Ptr));
|
|
exit when C = ',' or else C = ' ';
|
|
end loop;
|
|
|
|
Name_Buffer (Name_Len + 1) := ASCII.NUL;
|
|
return Name_Buffer'Address;
|
|
|
|
end Clobber_Get_Next;
|
|
|
|
-------------------
|
|
-- Clobber_Setup --
|
|
-------------------
|
|
|
|
procedure Clobber_Setup (N : Node_Id) is
|
|
Call : constant Node_Id := Expression (Expression (N));
|
|
Clob : constant Node_Id := Next_Actual (
|
|
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;
|
|
end if;
|
|
end Clobber_Setup;
|
|
|
|
---------------------
|
|
-- Expand_Asm_Call --
|
|
---------------------
|
|
|
|
procedure Expand_Asm_Call (N : Node_Id) is
|
|
Loc : constant Source_Ptr := Sloc (N);
|
|
|
|
procedure Check_IO_Operand (N : Node_Id);
|
|
-- Check for incorrect input or output operand
|
|
|
|
procedure Check_IO_Operand (N : Node_Id) is
|
|
Err : Node_Id := N;
|
|
|
|
begin
|
|
-- The only identifier allows 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.
|
|
|
|
if Is_Entity_Name (N)
|
|
and then
|
|
Is_Predefined_File_Name (Unit_File_Name
|
|
(Get_Source_Unit (Entity (N))))
|
|
then
|
|
return;
|
|
|
|
-- An attribute reference is fine, again the analysis reasonably
|
|
-- guarantees that the attribute must be subtype'Asm_??put.
|
|
|
|
elsif Nkind (N) = N_Attribute_Reference then
|
|
return;
|
|
|
|
-- The only other allowed form is an array aggregate in which
|
|
-- all the entries are positional and are attribute references.
|
|
|
|
elsif Nkind (N) = N_Aggregate then
|
|
if Present (Component_Associations (N)) then
|
|
Err := First (Component_Associations (N));
|
|
|
|
elsif Present (Expressions (N)) then
|
|
Err := First (Expressions (N));
|
|
while Present (Err) loop
|
|
exit when Nkind (Err) /= N_Attribute_Reference;
|
|
Next (Err);
|
|
end loop;
|
|
|
|
if No (Err) then
|
|
return;
|
|
end if;
|
|
end if;
|
|
end if;
|
|
|
|
-- If we fall through, Err is pointing to the bad node
|
|
|
|
Error_Msg_N ("Asm operand has wrong form", Err);
|
|
end Check_IO_Operand;
|
|
|
|
-- Start of processing for Expand_Asm_Call
|
|
|
|
begin
|
|
-- Check that the input and output operands have the right
|
|
-- form, as required by the documentation of the Asm feature:
|
|
|
|
-- OUTPUT_OPERAND_LIST ::=
|
|
-- No_Output_Operands
|
|
-- | OUTPUT_OPERAND_ATTRIBUTE
|
|
-- | (OUTPUT_OPERAND_ATTRIBUTE @{,OUTPUT_OPERAND_ATTRIBUTE@})
|
|
|
|
-- OUTPUT_OPERAND_ATTRIBUTE ::=
|
|
-- SUBTYPE_MARK'Asm_Output (static_string_EXPRESSION, NAME)
|
|
|
|
-- INPUT_OPERAND_LIST ::=
|
|
-- No_Input_Operands
|
|
-- | INPUT_OPERAND_ATTRIBUTE
|
|
-- | (INPUT_OPERAND_ATTRIBUTE @{,INPUT_OPERAND_ATTRIBUTE@})
|
|
|
|
-- INPUT_OPERAND_ATTRIBUTE ::=
|
|
-- SUBTYPE_MARK'Asm_Input (static_string_EXPRESSION, EXPRESSION)
|
|
|
|
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);
|
|
end;
|
|
|
|
-- If we have the function call case, we are inside a code statement,
|
|
-- and the tree is already in the necessary form for gigi.
|
|
|
|
if Nkind (N) = N_Function_Call then
|
|
null;
|
|
|
|
-- For the procedure case, we convert the call into a code statement
|
|
|
|
else
|
|
pragma Assert (Nkind (N) = N_Procedure_Call_Statement);
|
|
|
|
-- Note: strictly we should change the procedure call to a function
|
|
-- call in the qualified expression, but since we are not going to
|
|
-- reanalyze (see below), and the interface subprograms in this
|
|
-- package don't care, we can leave it as a procedure call.
|
|
|
|
Rewrite (N,
|
|
Make_Code_Statement (Loc,
|
|
Expression =>
|
|
Make_Qualified_Expression (Loc,
|
|
Subtype_Mark => New_Occurrence_Of (RTE (RE_Asm_Insn), Loc),
|
|
Expression => Relocate_Node (N))));
|
|
|
|
-- 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.
|
|
|
|
Set_Analyzed (N);
|
|
end if;
|
|
end Expand_Asm_Call;
|
|
|
|
---------------------
|
|
-- Get_String_Node --
|
|
---------------------
|
|
|
|
function Get_String_Node (S : Node_Id) return Node_Id 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)));
|
|
end if;
|
|
end Get_String_Node;
|
|
|
|
---------------------
|
|
-- Is_Asm_Volatile --
|
|
---------------------
|
|
|
|
function Is_Asm_Volatile (N : Node_Id) return Boolean is
|
|
Call : constant Node_Id := Expression (Expression (N));
|
|
Vol : constant Node_Id :=
|
|
Next_Actual (
|
|
Next_Actual (
|
|
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;
|
|
end Is_Asm_Volatile;
|
|
|
|
--------------------
|
|
-- Next_Asm_Input --
|
|
--------------------
|
|
|
|
procedure Next_Asm_Input is
|
|
begin
|
|
Next_Asm_Operand (Current_Input_Operand);
|
|
end Next_Asm_Input;
|
|
|
|
----------------------
|
|
-- Next_Asm_Operand --
|
|
----------------------
|
|
|
|
procedure Next_Asm_Operand (Operand_Var : in out Node_Id) is
|
|
begin
|
|
pragma Assert (Present (Operand_Var));
|
|
|
|
if Nkind (Parent (Operand_Var)) = N_Aggregate then
|
|
Operand_Var := Next (Operand_Var);
|
|
|
|
else
|
|
Operand_Var := Empty;
|
|
end if;
|
|
end Next_Asm_Operand;
|
|
|
|
---------------------
|
|
-- Next_Asm_Output --
|
|
---------------------
|
|
|
|
procedure Next_Asm_Output is
|
|
begin
|
|
Next_Asm_Operand (Current_Output_Operand);
|
|
end Next_Asm_Output;
|
|
|
|
----------------------
|
|
-- Setup_Asm_Inputs --
|
|
----------------------
|
|
|
|
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))),
|
|
Current_Input_Operand);
|
|
end Setup_Asm_Inputs;
|
|
|
|
-----------------------
|
|
-- Setup_Asm_IO_Args --
|
|
-----------------------
|
|
|
|
procedure Setup_Asm_IO_Args (Arg : Node_Id; Operand_Var : out Node_Id) is
|
|
begin
|
|
-- Case of single argument
|
|
|
|
if Nkind (Arg) = N_Attribute_Reference then
|
|
Operand_Var := Arg;
|
|
|
|
-- Case of list of arguments
|
|
|
|
elsif Nkind (Arg) = N_Aggregate then
|
|
if Expressions (Arg) = No_List then
|
|
Operand_Var := Empty;
|
|
else
|
|
Operand_Var := First (Expressions (Arg));
|
|
end if;
|
|
|
|
-- Otherwise must be default (no operands) case
|
|
|
|
else
|
|
Operand_Var := Empty;
|
|
end if;
|
|
end Setup_Asm_IO_Args;
|
|
|
|
-----------------------
|
|
-- Setup_Asm_Outputs --
|
|
-----------------------
|
|
|
|
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)),
|
|
Current_Output_Operand);
|
|
end Setup_Asm_Outputs;
|
|
|
|
end Exp_Code;
|