DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: B T

⟦ab6cf821b⟧ TextFile

    Length: 3102 (0xc1e)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

with Instrument;
use Instrument;

---------------------------------
-- Subscript Calculation Elimination
---------------------------------

--  This test evaluates a code  improvement  potential  that  results
--  from  the  elimination  of  a  hidden common subexpression in the
--  computation of the addresses of array components.

--  The test procedures contain  explicit  redefinitions  of  indexed
--  components  of  a  local  array,  Local.  A conditional statement
--  controls which of two pairs of assignment statements is executed.
--  In   the  optimized  test  procedure  the  array  components  are
--  referenced within the same row or  column  of  a  two-dimensional
--  array.   Since  the  expressions used to compute the addresses of
--  the  components  contain  a  common  arithmetic  expression,  the
--  opportunity  exists  for  the  compiler  to eliminate unnecessary
--  code.  Two opportunities are provided because it is not  known  a
--  priori  whether  the  compiler  stores  two-dimensional arrays in
--  row-major order or column-major order.

--  Because the test procedures are identical except for the branches
--  of  the  conditional  statement, no difference is expected in the
--  space requirements for the two procedures.   The  effect  of  the
--  improved  code  should  be  evident  from  the  difference in the
--  execution time of the two procedures since the elimination of the
--  hidden  common  subexpression  reduces  the amount of computation
--  required in the optimized version.

procedure Opsca1 is

    package New_Procs is new Procs (Integer);
    use New_Procs;

    Index_1 : Positive range 1 .. 10;
    Index_2 : Positive range 1 .. 10;
    Common_Index : Positive range 1 .. 10;
    Local : array (1 .. 10, 1 .. 10) of T :=
       (others => (others => Ident (Init / Init)));

begin

    Start ("OPSCA1", "Optimization Perf., Subscript Calc. (control)");
    for I in 1 .. 1000 loop

        Let (Global, Ident (Init));
        Index_1 := Local'First (1);
        Index_2 := Local'First (2);
        Common_Index := Local'First;

        if Ident (Init) = Init then

            --    Local(Common_Index, Index_2) := Local(Common_Index, Index_2 + 1);
            --    Local(Index_1, Common_Index) := Local(Index_1 + 1, Common_Index);
            -- included in test version
            Local (Common_Index, Index_2) := Local (Index_1, Index_2 + 1);
            Local (Index_1, Common_Index) := Local (Index_1 + 1, Index_2);
            -- included in control version

        else

            --    Local(Common_Index, Index_2) := Local(Index_1, Index_2 + 1);
            --    Local(Index_1, Common_Index) := Local(Index_1 + 1, Index_2);
            -- included in test version
            Local (Common_Index, Index_2) := Local (Common_Index, Index_2 + 1);
            Local (Index_1, Common_Index) := Local (Index_1 + 1, Common_Index);
            -- included in control version

        end if;

        Let (Global, Ident (Local (Common_Index, Index_2)));
        Let (Global, Ident (Init));

    end loop;
    Stop;

end Opsca1;