-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-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- --
--
-- Implementation limitation: Assoc_Node must be a statement. We can
-- generalize to expressions if there is a need but this is tricky to
- -- implement because of short-ciruits (among other things).???
+ -- implement because of short-circuits (among other things).???
procedure Insert_Library_Level_Action (N : Node_Id);
-- This procedure inserts and analyzes the node N as an action at the
-- computes the image without using concatenation, and one for the
-- variable that holds the result.
+ function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean;
+ -- This function is in charge of detecting record components that may
+ -- cause trouble in the back end if an attempt is made to assign the
+ -- component. The back end can handle such assignments with no problem
+ -- if the components involved are small (64-bits or less) records or
+ -- scalar items (including bit-packed arrays represented with modular
+ -- types) or are both aligned on a byte boundary (starting on a byte
+ -- boundary, and occupying an integral number of bytes).
+ --
+ -- However, problems arise for records larger than 64 bits, or for
+ -- arrays (other than bit-packed arrays represented with a modular
+ -- type) if the component starts on a non-byte boundary, or does
+ -- not occupy an integral number of bytes (i.e. there are some bits
+ -- possibly shared with fields at the start or beginning of the
+ -- component). The back end cannot handle loading and storing such
+ -- components in a single operation.
+ --
+ -- This function is used to detect the troublesome situation. it is
+ -- conservative in the sense that it produces True unless it knows
+ -- for sure that the component is safe (as outlined in the first
+ -- paragraph above). The code generation for record and array
+ -- assignment checks for trouble using this function, and if so
+ -- the assignment is generated component-wise, which the back end
+ -- is required to handle correctly.
+ --
+ -- Note that in GNAT 3, the back end will reject such components
+ -- anyway, so the hard work in checking for this case is wasted
+ -- in GNAT 3, but it's harmless, so it is easier to do it in
+ -- all cases, rather than conditionalize it in GNAT 5 or beyond.
+
procedure Convert_To_Actual_Subtype (Exp : Node_Id);
-- The Etype of an expression is the nominal type of the expression,
-- not the actual subtype. Often these are the same, but not always.
-- Empty, then simply returns Cond1 (this allows the use of Empty to
-- initialize a series of checks evolved by this routine, with a final
-- result of Empty indicating that no checks were required). The Sloc
- -- field of the constructed N_And_Then node is copied from Cond1.
+ -- field of the constructed N_Or_Else node is copied from Cond1.
procedure Expand_Subtype_From_Expr
(N : Node_Id;
function May_Generate_Large_Temp (Typ : Entity_Id) return Boolean;
-- Determines if the given type, Typ, may require a large temporary
- -- of the type that causes trouble if stack checking is enabled. The
- -- result is True only if stack checking is enabled and the size of
- -- the type is known at compile time and large, where large is defined
- -- hueristically by the body of this routine. The purpose of this
- -- routine is to help avoid generating troublesome temporaries that
- -- intefere with the stack checking mechanism.
+ -- of the kind that causes back-end trouble if stack checking is enabled.
+ -- The result is True only the size of the type is known at compile time
+ -- and large, where large is defined heuristically by the body of this
+ -- routine. The purpose of this routine is to help avoid generating
+ -- troublesome temporaries that interfere with stack checking mechanism.
+ -- Note that the caller has to check whether stack checking is actually
+ -- enabled in order to guide the expansion (typically of a function call).
procedure Remove_Side_Effects
(Exp : Node_Id;
-- if necessary by an equivalent subexpression that is guaranteed to be
-- side effect free. This is done by extracting any actions that could
-- cause side effects, and inserting them using Insert_Actions into the
- -- tree to which Exp is attached. Exp must be analayzed and resolved
+ -- tree to which Exp is attached. Exp must be analyzed and resolved
-- before the call and is analyzed and resolved on return. The Name_Req
-- may only be set to True if Exp has the form of a name, and the
-- effect is to guarantee that any replacement maintains the form of a
-- name. If Variable_Ref is set to TRUE, a variable is considered as a
-- side effect (used in implementing Force_Evaluation). Note: after a
- -- call to Remove_Side_Effects, it is safe to use a call to
- -- New_Copy_Tree to obtain a copy of the resulting expression.
+ -- call to Remove_Side_Effects, it is safe to call New_Copy_Tree to
+ -- obtain a copy of the resulting expression.
function Safe_Unchecked_Type_Conversion (Exp : Node_Id) return Boolean;
-- Given the node for an N_Unchecked_Type_Conversion, return True
-- operand and result types. This is called in package Exp_Fixd to
-- determine whether to expand such operations.
+ function Type_May_Have_Bit_Aligned_Components
+ (Typ : Entity_Id) return Boolean;
+ -- Determines if Typ is a composite type that has within it (looking
+ -- down recursively at any subcomponents), a record type which has a
+ -- component that may be bit aligned (see Possible_Bit_Aligned_Component).
+ -- The result is conservative, in that a result of False is decisive.
+ -- A result of True means that such a component may or may not be present.
+
procedure Wrap_Cleanup_Procedure (N : Node_Id);
-- Given an N_Subprogram_Body node, this procedure adds an Abort_Defer
-- call at the start of the statement sequence, and an Abort_Undefer call