Optimizing COBOL generated assembler

Consider the cobol statements:

000034                    02  R-CNTR          PIC S99 COMP SYNC VALUE +0.
...
0000072  ADD 1 to R-CNTR

Which generated the following assembler code:

         000620  4830 A012               LH   3,18(0,10)              PGMLIT AT 
+6
         000624  4A30 9028               AH   3,40(0,9)               R-CNTR
         000628  1823                    LR   2,3
         00062A  8E20 0020               SRDA 2,32(0)
         00062E  5D20 C000               D    2,0(0,12)               SYSLIT AT 
+0
         000632  4020 9028               STH  2,40(0,9)               R-CNTR

This snippet of code is from the following COBOL/370 generated assembler 
LIST option:

http://www.cs.niu.edu/~t90jfl1/class/job2.htm

I think the LR, SRDA, and D instructions could be surpressed by specifying the 
option NOTRUNC to allow values greater than the PIC digits 99.  

With the new z10 instruction ADD LOGICAL WITH SIGNED IMMEDIATE, the 
entire 6 instruction sequence could be reduced to a single instruction:

  ALSI  R-CNTR,1

Of course this would require that the COBOL compile have such a z10
optimization option.  For compute intensive applications, such optimizations 
along with the new z10 compare and branch instructions could be significant.

To aid in analyzing mainframe COBOL programs a new z390 COBOL Portable 
Assembler option has been added in z390 PTF v1.4.01b.  With this option 
installed, you can convert Enterprise COBOL or COBOL for OS/390 generated 
assembler listings into z390 assembler source programs which can be 
assembled, linked, and executed specifying starting and ending line numbers in
order to unit test or benchmark specific generated code or supported COBOL 
statments with called functions.  In this initial release only DISPLAY and STOP 
RUN function calls are supported, but requests for additional functions are 
welcome.  Support for COBOL/370, COBOL for MVS, and VS COBOL II are also 
in development. For example generation and execution of DISPLAY and STOP 
RUN demo, install z390 v1.4.01, v1.4.01b PTF, and then enter the command 
cobol\paos\OSDEMO1.

Don Higgins
[EMAIL PROTECTED] 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to