- (Loc : Source_Ptr;
- Id_Ref : Node_Id;
- A_Type : Entity_Id)
- return List_Id;
- -- Build declaration for a variable that holds an identifying string
- -- to be used as a task name. Id_Ref is an identifier if the task is
- -- a variable, and a selected or indexed component if the task is a
- -- component of an object. If it is an indexed component, A_Type is
- -- the corresponding array type. Its index types are used to build the
- -- string as an image of the index values. For composite types, the
- -- result includes two declarations: one for a generated function that
- -- computes the image without using concatenation, and one for the
- -- variable that holds the result.
+ (Loc : Source_Ptr;
+ Id_Ref : Node_Id;
+ A_Type : Entity_Id;
+ In_Init_Proc : Boolean := False) return List_Id;
+ -- Build declaration for a variable that holds an identifying string to be
+ -- used as a task name. Id_Ref is an identifier if the task is a variable,
+ -- and a selected or indexed component if the task is component of an
+ -- object. If it is an indexed component, A_Type is the corresponding array
+ -- type. Its index types are used to build the string as an image of the
+ -- index values. For composite types, the result includes two declarations:
+ -- one for a generated function that computes the image without using
+ -- concatenation, and one for the variable that holds the result.
+ -- If In_Init_Proc is true, the call is part of the initialization of
+ -- a component of a composite type, and the enclosing initialization
+ -- procedure must be flagged as using the secondary stack. If In_Init_Proc
+ -- is false, the call is for a stand-alone object, and the generated
+ -- function itself must do its own cleanups.
+
+ 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.