*decode cond2s
Chunk 1 OBJ_HEAD Offset:0000008C Size:00000040
Chunk 2 OBJ_IDFN Offset:000000CC Size:00000018
Chunk 3 OBJ_STRT Offset:000000E4 Size:00000074
Chunk 4 OBJ_SYMT Offset:00000158 Size:00000070
Chunk 5 OBJ_AREA Offset:000001C8 Size:00000154
Chunk 6 OBJ_UNU1 Offset:00000000 Size:00000000
Chunk 7 OBJ_UNU1 Offset:00000000 Size:00000000
Chunk 8 OBJ_UNU1 Offset:00000000 Size:00000000

Area 1  Id:00000000 Attributes:6202 Size:00000108 Relocs:00000008 Base:00000000
Area 2  Id:0000000C Attributes:0002 Size:00000004 Relocs:00000001 Base:00000000


Symbol Table

attr:0001  value:0000  Area "$CODEAREA"       "$CODEAREA"
attr:0001  value:0000  Area "$DATAAREA"       "$DATAAREA"
attr:0002  value:0000  Area "$DATAAREA"       "3L_imp___entry_point"
attr:0002  value:0000  Area "$DATAAREA"       "3L_IMP___read_i"
attr:0002  value:0000  Area "$DATAAREA"       "3L_IMP_WRITE"
attr:0003  value:0010  Area "$CODEAREA"       "3L___main_program"
attr:0002  value:0000  Area "$DATAAREA"       "3L___cur_out"

Code relocations 

offset:0000 Word     PC Relative          "3L_imp___entry_point"
offset:00CC Word     PC Relative          "3L_IMP_WRITE"
offset:00B8 Word     PC Relative          "3L_IMP_WRITE"
offset:00A4 Word     PC Relative          "3L_IMP_WRITE"
offset:0034 Word     PC Relative          "3L_IMP___read_i"
offset:002C Word     PC Relative          "3L_IMP___read_i"
offset:0024 Word     PC Relative          "3L_IMP___read_i"
offset:000C Word     Additive    Symbol   "$DATAAREA"
Data relocations 

offset:0000 Word     Additive    Symbol   "3L___cur_out"

String Table

00000    $CODEAREA
0000C    $DATAAREA
00018    3L_imp___entry_point
00030    3L_IMP_WRITE
00040    3L_IMP___read_i
00050    3L___main_program
00064    3L___cur_out


Dump of Code Area

     1 !
     2 ! The hand-generated code below should be producable by PSR's compiler if it:
     3 ! A) delays stores as late as possible
     4 !
     5 ! B) remembers registers over procedure calls
     6 !
     7 ! C) has a general algorithm for drop-through conditionally executed
     8 !    instructions, i.e. if there are no instructions between a conditional 
     9 !    branch and its destination which set the condition codes, and the
    10 !    sequence is less that a certain length, then all the instructions
    11 !    within the sequence can be made conditional.
    12 !
    13 ! D) does as above, but also allows instructions within the sequence
    14 !    whose subsequent execution depends on the same condition, e.g.
    15 !
    16 !    %if a=b %and c=d %then a=b
    17 !
    18 !    CmpS   R0,R1            NAIVE STYLE
    19 !    Bne    elsepart
    20 !    Cmps   R2,R3
    21 !    Bne    elsepart
    22 !    Mov    R0,R2
    23 !
    24 !    CmpS   R0,R1            RULE (C) ABOVE
    25 !    Bne    elsepart
    26 !    CmpS   R2,R3
    27 !    MovEQ  R0,R2
    28 !
    29 !    CmpS   R0,R1            RULE (D) SPECIAL CASE
    30 !    CmpSEQ R2,R3
    31 !    MovEQ  R0,R2
    32 !
    33 ! E) alters conditions to generate similar condition codes on
    34 !    condition AND condition AND condition to generate more cases
    35 !    to which rule (D) can be applied.
    36 !
    37 ! F) adjusts constants in < or <= cases to favour above, i.e. turning
    38 !    CMP R,#const & BLE ... into CMP R,#const-1 & BLT ... etc.
    39 !
    40 ! G) changes Newline back from the current implicit printsymbol(10) -
    41 !    there is no run-time overhead in moving the MOV R0,#10 over to
    42 !    the procedure body instead of having it in every call where it
    43 !    takes up space - after all, Peter's code-moving stuff ought to
    44 !    get %permroutine newline;printsymbol(10);%end correct - it will
    45 !    place the Mov R0,#10 before the body of %permroutine printsymbol
    46 !    and generate a suitable entry point for it...
    47 !       Personally, I would recommend stacking/restoring R0 as well
    48 !    as it might keep another variable in a register for a bit longer...
    49 !
    50 ! I've only suggested optimisations which fit into the style of PSR's
    51 ! compilers...
    52 !
    53 
    54 
    55 %begin
000008 00220035 00000000                   |5.".....|
000010 E28CBF00 ADD     R11, R12, #16_00000000 =0
000014 E92C4E20 STMDB   R12!, {R5,R9,R10,R11,R14}
000018 E51F9014 LDR     R9, [PC, #-16_014]
00001C E1A0A00C MOV     R10, R12
000020 E24CCF03 SUB     R12, R12, #16_0000000C =12
    56 %integer a,i,b
    57 
    58   read(a)
000024 EB000000 BL      16_00002C
000028 E50A0004 STR     R0, [R10, #-16_004]
    59 ! BL     read_fn
    60 
    61 ! Str    R0,a
    62   read(i)
00002C EB000000 BL      16_000034
000030 E50A0008 STR     R0, [R10, #-16_008]
    63 ! BL     read_fn
    64 
    65 ! Str    R0,i
    66   read(b)
000034 EB000000 BL      16_00003C
000038 E50A000C STR     R0, [R10, #-16_00C]
    67 ! BL     read_fn
    68 
    69   %if a <= i <= b %start
00003C E51A1004 LDR     R1, [R10, #-16_004]
000040 E51A2008 LDR     R2, [R10, #-16_008]
000044 E1510002 CMPS    R1, R2
000048 CA000003 BGT     16_00005C
00004C E1520000 CMPS    R2, R0
000050 CA000001 BGT     16_00005C
    70 ! Ldr R1,a
    71 ! Ldr R2,i
    72 ! CmpS   R1,R2
    73 ! CmpSLE R2,R0
    74     i = 22
000054 E3A02016 MOV     R2, #16_00000016 =22
000058 E50A2008 STR     R2, [R10, #-16_008]
    75 ! MovLE  R2,#22
    76   %finish
    77 
    78   %if 22 <= i <= b %start
00005C E3520016 CMPS    R2, #16_00000016 =22
000060 BA000003 BLT     16_000074
000064 E1520000 CMPS    R2, R0
000068 CA000001 BGT     16_000074
    79 ! CmpS   R2,#22-1
    80 ! CmpSGT R2,R0
    81     i = 44
00006C E3A02F0B MOV     R2, #16_0000002C =44 ','
000070 E50A2008 STR     R2, [R10, #-16_008]
    82 ! MovGT  R2,#44
    83   %finish
    84 
    85   %if a <= i <= 77 %start
000074 E1510002 CMPS    R1, R2
000078 CA000003 BGT     16_00008C
00007C E352004D CMPS    R2, #16_0000004D =77 'M'
000080 CA000001 BGT     16_00008C
    86 ! CmpS   R1,R2
    87 ! CmpSLE R2,#77
    88     i = 99
000084 E3A02063 MOV     R2, #16_00000063 =99 'c'
000088 E50A2008 STR     R2, [R10, #-16_008]
    89 ! MovLE  R2,#99
    90   %finish
    91 
    92   %if 11 <= i <= 100 %start     ;! Peter's special case when both const is good
00008C E242200B SUB     R2, R2, #16_0000000B =11
000090 E3520059 CMPS    R2, #16_00000059 =89 'Y'
    93 ! Sub   R2,#11                  ;! but usually corrupts a register needed later
    94 ! CmpS  R2,#100-11
    95     i = 1
000094 93A02001 MOVLS   R2, #16_00000001 =1
000098 950A2008 STRLS   R2, [R10, #-16_008]
    96 ! MovLS R2,#1
    97   %finish
    98 
    99 ! Str   R0,b
   100   write(a,0)
00009C E1A00001 MOV     R0, R1
0000A0 E3A01000 MOV     R1, #16_00000000 =0
0000A4 EB000000 BL      16_0000AC
   101 ! Mov   R0,R1
   102 ! Mov   R1,#0
   103 ! Bl    Write
   104 
   105   newline
0000A8 E3A0000A MOV     R0, #16_0000000A =10
0000AC EB00000B BL      16_0000E0
   106 ! Bl    Newline
   107 
   108 ! Mov   R0,R2
   109   write(i,0)
0000B0 E51A0008 LDR     R0, [R10, #-16_008]
0000B4 E3A01000 MOV     R1, #16_00000000 =0
0000B8 EB000000 BL      16_0000C0
   110 ! Bl    write
   111 
   112   newline
0000BC E3A0000A MOV     R0, #16_0000000A =10
0000C0 EB000006 BL      16_0000E0
   113 ! Bl    newline
   114 
   115   write(b,0)
0000C4 E51A000C LDR     R0, [R10, #-16_00C]
0000C8 E3A01000 MOV     R1, #16_00000000 =0
0000CC EB000000 BL      16_0000D4
   116 ! Ldr   R0,b
   117 ! Bl    write
   118 
   119   newline
0000D0 E3A0000A MOV     R0, #16_0000000A =10
0000D4 EB000001 BL      16_0000E0
   120 ! Bl    newline
   121 
   122 %endofprogram
0000D8 E8DA9620 LDMIA   R10, {R5,R9,R10,R12,PC}^
0000DC 00100000                            |....|
0000E0 E5991000 LDR     R1, [R9]
0000E4 E5911000 LDR     R1, [R1]
0000E8 E891007C LDMIA   R1, {R2,R3,R4,R5,R6}
0000EC E1500005 CMPS    R0, R5
0000F0 D1A0F006 MOVLE   PC, R6
0000F4 E1520003 CMPS    R2, R3
0000F8 A1A0F004 MOVGE   PC, R4
0000FC E4C20001 STRB    R0, [R2], #16_001
000100 E4812000 STR     R2, [R1]
000104 E1A0F00E MOV     PC, R14

000000 EA000000 F82F0000                   |....../.|



Dump of Data Area

000000 00000000                            |....|


Finished after 2 min, 00.65 sec.
*spool
