Prefix_Length : Natural := 0);
-- Internal recursive procedure to compute the max length
+ procedure List_Component_Layout
+ (Ent : Entity_Id;
+ Starting_Position : Uint := Uint_0;
+ Starting_First_Bit : Uint := Uint_0;
+ Prefix : String := "");
+ -- Procedure to display the layout of a single component
+
procedure List_Record_Layout
(Ent : Entity_Id;
Starting_Position : Uint := Uint_0;
end loop;
end Compute_Max_Length;
+ ---------------------------
+ -- List_Component_Layout --
+ ---------------------------
+
+ procedure List_Component_Layout
+ (Ent : Entity_Id;
+ Starting_Position : Uint := Uint_0;
+ Starting_First_Bit : Uint := Uint_0;
+ Prefix : String := "")
+ is
+ Esiz : constant Uint := Esize (Ent);
+ Npos : constant Uint := Normalized_Position (Ent);
+ Fbit : constant Uint := Normalized_First_Bit (Ent);
+ Spos : Uint;
+ Sbit : Uint;
+ Lbit : Uint;
+
+ begin
+ Write_Str (" ");
+ Write_Str (Prefix);
+ Write_Str (Name_Buffer (1 .. Name_Len));
+ Spaces (Max_Name_Length - Prefix'Length - Name_Len);
+ Write_Str (" at ");
+
+ if Known_Static_Normalized_Position (Ent) then
+ Spos := Starting_Position + Npos;
+ Sbit := Starting_First_Bit + Fbit;
+
+ if Sbit >= SSU then
+ Spos := Spos + 1;
+ end if;
+
+ UI_Image (Spos);
+ Spaces (Max_Spos_Length - UI_Image_Length);
+ Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));
+
+ elsif Known_Normalized_Position (Ent)
+ and then List_Representation_Info = 3
+ then
+ Spaces (Max_Spos_Length - 2);
+
+ if Starting_Position /= Uint_0 then
+ UI_Write (Starting_Position);
+ Write_Str (" + ");
+ end if;
+
+ Write_Val (Npos);
+
+ else
+ Write_Unknown_Val;
+ end if;
+
+ Write_Str (" range ");
+ Sbit := Starting_First_Bit + Fbit;
+
+ if Sbit >= SSU then
+ Sbit := Sbit - SSU;
+ end if;
+
+ UI_Write (Sbit);
+ Write_Str (" .. ");
+
+ -- Allowing Uint_0 here is an annoying special case. Really
+ -- this should be a fine Esize value but currently it means
+ -- unknown, except that we know after gigi has back annotated
+ -- that a size of zero is real, since otherwise gigi back
+ -- annotates using No_Uint as the value to indicate unknown.
+
+ if (Esize (Ent) = Uint_0 or else Known_Static_Esize (Ent))
+ and then Known_Static_Normalized_First_Bit (Ent)
+ then
+ Lbit := Sbit + Esiz - 1;
+
+ if Lbit < 10 then
+ Write_Char (' ');
+ end if;
+
+ UI_Write (Lbit);
+
+ -- The test for Esize (Ent) not Uint_0 here is an annoying
+ -- special case. Officially a value of zero for Esize means
+ -- unknown, but here we use the fact that we know that gigi
+ -- annotates Esize with No_Uint, not Uint_0. Really everyone
+ -- should use No_Uint???
+
+ elsif List_Representation_Info < 3
+ or else (Esize (Ent) /= Uint_0 and then Unknown_Esize (Ent))
+ then
+ Write_Unknown_Val;
+
+ -- List_Representation >= 3 and Known_Esize (Ent)
+
+ else
+ Write_Val (Esiz, Paren => True);
+
+ -- If in front end layout mode, then dynamic size is stored
+ -- in storage units, so renormalize for output
+
+ if not Back_End_Layout then
+ Write_Str (" * ");
+ Write_Int (SSU);
+ end if;
+
+ -- Add appropriate first bit offset
+
+ if Sbit = 0 then
+ Write_Str (" - 1");
+
+ elsif Sbit = 1 then
+ null;
+
+ else
+ Write_Str (" + ");
+ Write_Int (UI_To_Int (Sbit) - 1);
+ end if;
+ end if;
+
+ Write_Line (";");
+ end List_Component_Layout;
+
------------------------
-- List_Record_Layout --
------------------------
declare
Ctyp : constant Entity_Id := Underlying_Type (Etype (Comp));
- Esiz : constant Uint := Esize (Comp);
Npos : constant Uint := Normalized_Position (Comp);
Fbit : constant Uint := Normalized_First_Bit (Comp);
Spos : Uint;
Sbit : Uint;
- Lbit : Uint;
begin
Get_Decoded_Name_String (Chars (Comp));
goto Continue;
end if;
- Write_Str (" ");
- Write_Str (Prefix);
- Write_Str (Name_Buffer (1 .. Name_Len));
-
- for J in 1 .. Max_Name_Length - Prefix'Length - Name_Len loop
- Write_Char (' ');
- end loop;
-
- Write_Str (" at ");
-
- if Known_Static_Normalized_Position (Comp) then
- Spos := Starting_Position + Npos;
- Sbit := Starting_First_Bit + Fbit;
-
- if Sbit >= SSU then
- Spos := Spos + 1;
- end if;
-
- UI_Image (Spos);
- Spaces (Max_Spos_Length - UI_Image_Length);
- Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));
-
- elsif Known_Normalized_Position (Comp)
- and then List_Representation_Info = 3
- then
- Spaces (Max_Spos_Length - 2);
-
- if Starting_Position /= Uint_0 then
- UI_Write (Starting_Position);
- Write_Str (" + ");
- end if;
-
- Write_Val (Npos);
-
- else
- -- For the packed case, we don't know the bit positions if
- -- we don't know the starting position.
-
- if Is_Packed (Ent) then
- Write_Line ("?? range ? .. ??;");
- goto Continue;
-
- -- Otherwise we can continue
-
- else
- Write_Unknown_Val;
- end if;
- end if;
-
- Write_Str (" range ");
- Sbit := Starting_First_Bit + Fbit;
-
- if Sbit >= SSU then
- Sbit := Sbit - SSU;
- end if;
-
- UI_Write (Sbit);
- Write_Str (" .. ");
-
- -- Allowing Uint_0 here is an annoying special case. Really
- -- this should be a fine Esize value but currently it means
- -- unknown, except that we know after gigi has back annotated
- -- that a size of zero is real, since otherwise gigi back
- -- annotates using No_Uint as the value to indicate unknown.
-
- if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp))
- and then Known_Static_Normalized_First_Bit (Comp)
- then
- Lbit := Sbit + Esiz - 1;
-
- if Lbit < 10 then
- Write_Char (' ');
- end if;
-
- UI_Write (Lbit);
-
- -- The test for Esize (Comp) not Uint_0 here is an annoying
- -- special case. Officially a value of zero for Esize means
- -- unknown, but here we use the fact that we know that gigi
- -- annotates Esize with No_Uint, not Uint_0. Really everyone
- -- should use No_Uint???
-
- elsif List_Representation_Info < 3
- or else (Esize (Comp) /= Uint_0 and then Unknown_Esize (Comp))
- then
- Write_Unknown_Val;
-
- -- List_Representation >= 3 and Known_Esize (Comp)
-
- else
- Write_Val (Esiz, Paren => True);
-
- -- If in front end layout mode, then dynamic size is stored
- -- in storage units, so renormalize for output
-
- if not Back_End_Layout then
- Write_Str (" * ");
- Write_Int (SSU);
- end if;
-
- -- Add appropriate first bit offset
-
- if Sbit = 0 then
- Write_Str (" - 1");
-
- elsif Sbit = 1 then
- null;
-
- else
- Write_Str (" + ");
- Write_Int (UI_To_Int (Sbit) - 1);
- end if;
- end if;
-
- Write_Line (";");
+ List_Component_Layout (Comp,
+ Starting_Position, Starting_First_Bit, Prefix);
end;
<<Continue>>