|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2179 (0x883)
Types: TextFile
Names: »B«
└─⟦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⟧
with Instrument;
use Instrument;
---------------------
-- Subscript Calculation
---------------------
-- This test evaluates a code improvement potential that results
-- from minimizing subscript calculations when the opportunity is
-- offered to relocate a subscript calculation outside the code
-- region of a loop body.
-- The two test procedures contain a single loop enclosing a
-- camouflaged redefinition of a global variable, Global_1. The
-- redefinition includes a reference to a component of a local
-- array. In the optimized test procedure the array element is
-- identified by two subscript expressions that use a loop
-- invariant, Index_1. Since the nonoptimized test procedure
-- identifies the array element with subscript expressions that use
-- a local variable, Index_2, that is redefined for each iteration
-- of the loop, the optimization is evidenced by a difference in the
-- execution time of the two procedures and a possible difference
-- in their space requirements.
-- The definition of the loop invariant is camouflaged to avoid
-- unexpected optimizations that would invalidate the benchmark;
-- e.g., value propagation leading to constant folding.
procedure Losca2 is
package New_Procs is new Procs (Integer);
use New_Procs;
subtype Index is T range 1 .. 100;
Index_1, Index_2 : Index;
Local : array (Index range 1 .. 10, Index range 1 .. 10) of T :=
(others => (others => Ident (Init)));
begin
Start ("LOSCA2", "Loop Optimization, Subscript Calc. (test)");
for I in 1 .. 10000 loop
Let (Global, Ident (Init));
Let (Index_1, Ident (1));
for J in Ident (T'Val (1)) .. Ident (T'Val (10)) loop
Let (Index_2, Ident (1));
--------optimize---------
Let (Global, Ident (Local (Index_1 * 10, Index_1 * 5)));
-- included in test version
-- Let(Global, Ident(Local(Index_2 * 10, Index_2 * 5)));
-- included in control version
end loop;
Let (Global, Ident (Init));
end loop;
Stop;
end Losca2;