Menu

#452 compile-time optimization: recognize assignment as local constants

unclassified
open
nobody
8
2023-10-17
2023-10-17
No

If a variable is assigned a value that it can hold, the compiler could recognize this as a "local constant", at least for MOVE but also for indexes/ref-mod/calclulations

MOVE 123 TO PIC-9999-COMP-6
MOVE PIC-9999-COMP-6 TO BINARY-VAR   *> recognizing that this is 123 removes the unpacking
MOVE SOMETHING TO TAB-ITEM (PIC-9999-COMP-6)  *> same here
MOVE 321 TO PIC-9999-COMP-6
COMPUTE SOMETHING = BINARY-VAR * PIC-9999-COMP-6  *> in theory the compiler can optimize it to 123*321 -> 39,483 directly

Discussion


Log in to post a comment.