This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Contributing tree-ssa to mainline
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: dnovillo at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 19 Jan 04 14:15:51 EST
- Subject: Re: [RFC] Contributing tree-ssa to mainline
Well, I know nothing about Ada so I'm not sure what you mean by that
remark. That's why I was asking for specific examples. Annotated, if
possible.
OK. Here's a test program:
procedure Tparray (X: Integer) is
type Barr is array (Integer range <>) of Boolean;
pragma Pack (Barr); -- So we have a packed array of 1 bit
Y: constant Integer := 31; -- Here's a variable whose value we know.
subtype Barr1 is Barr(1..X); -- This type has variable size.
subtype Barr2 is Barr(1..Y); -- ... and this one has a fixed size (31 bits).
-- Now we have two identical functions, one on each type.
function F1 (A, B : Barr1) return Barr1 is
Arr: Barr1 := A;
begin
Arr (2) := False;
return Arr xor B;
end F1;
function F2 (A, B : Barr2) return Barr2 is
Arr: Barr2 := A;
begin
Arr (2) := False;
return Arr xor B;
end F2;
begin
null;
end Tparray;
Now here's the Ada expanded code for this. Note the very different forms
of tparray__f1 and tparray__f2:
Source recreated from tree for Tparray (body)
---------------------------------------------
with system.system__unsigned_types;
with system.system__bit_ops;
with system;
with system.system__secondary_stack;
procedure tparray (x : integer) is
type tparray__barr is array (-16#8000_0000# .. 16#7FFF_FFFF#
range <>) of boolean;
pragma pack (tparray__barr);
y : constant integer := 31;
subtype tparray__barr1 is tparray__barr (1 .. x);
subtype tparray__barr2 is tparray__barr (1 .. 31);
freeze tparray__barr []
freeze tparray__barr1 []
freeze tparray__barr2 []
function tparray__f1 (a : tparray__barr1; b : tparray__barr1)
return tparray__barr1 is
arr : tparray__barr1 := a;
begin
arr (0) := system__unsigned_types__packed_byte!(arr (0) and 16#FD#);
null;
T3b : tparray__barr1;
system__bit_ops__bit_xor (arr'address, tparray__Tbarr1P1'
range_length, b'address, tparray__Tbarr1P1'range_length, T3b'
address);
return T3b;
end tparray__f1;
function tparray__f2 (a : tparray__barr2; b : tparray__barr2)
return tparray__barr2 is
arr : tparray__barr2 := a;
begin
arr := tparray__barr2___XP1!(arr and 16#FFFF_FFFD#);
null;
return tparray__barr2!(arr xor b);
end tparray__f2;
begin
null;
return;
end tparray;