Easy Array References


    (AREF X (+ -8 (* 8 I)))

One way to generate code for the array reference is to:


        add     %fp,-808,%l1    !  + -808

        mov     -8,%l2          !  -8
        mov     8,%l3           !  8
        ld      [%fp-8],%l4     !  i 
        smul    %l3,%l4,%l3     !  *
        add     %l2,%l3,%l2     !  +

        ldd     [%l1+%l2],%f2   !  x[]

This is easy from the viewpoint of the compiler writer, but it generates 7 instructions, including a possibly expensive multiply.

Contents    Page-10    Prev    Next    Page+10    Index