Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPS64725B2 - - Google Patents
[go: Go Back, main page]

JPS64725B2 - - Google Patents

Info

Publication number
JPS64725B2
JPS64725B2 JP17231579A JP17231579A JPS64725B2 JP S64725 B2 JPS64725 B2 JP S64725B2 JP 17231579 A JP17231579 A JP 17231579A JP 17231579 A JP17231579 A JP 17231579A JP S64725 B2 JPS64725 B2 JP S64725B2
Authority
JP
Japan
Prior art keywords
psv
instruction
program
perform
intermediate language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired
Application number
JP17231579A
Other languages
Japanese (ja)
Other versions
JPS5697152A (en
Inventor
Takaaki Ikeda
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP17231579A priority Critical patent/JPS5697152A/en
Publication of JPS5697152A publication Critical patent/JPS5697152A/en
Publication of JPS64725B2 publication Critical patent/JPS64725B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 本発明は、COBOLのPERFORM命令における
目的プログラムの最適化方式に関するものであ
る。
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a method for optimizing a target program using a COBOL PERFORM instruction.

COBOLのPERFORM命令には書き方がいくつ
かあるが、以下の説明では書き方の違いは依存し
ないので、基本的な書き方のみを示す。
There are several ways to write the COBOL PERFORM command, but the following explanation does not depend on the different ways of writing, so only the basic way of writing will be shown.


PERFORM手続き名―1〔THRU―手続き名―
2〕 PERFORM命令の機能は、手続き名―1に制
御を移し、手続き名―1(または手続き名―2)
に属する最後の命令を実行した後に制御を
PERFORM命令の次に戻すことである。IBM、
OS F2/F4/X3では共に第1図に示すように1
つのPERFORM命令で指定された手続きの実行
中に、それと出口を共有する他のPERFORM命
令の実行を許している。図中、,,…は制
御の移行順序を示している。

PERFORM procedure name-1 [THRU-procedure name-
2] The function of the PERFORM command is to transfer control to procedure name-1 and execute procedure name-1 (or procedure name-2).
control after executing the last instruction belonging to
It is to return after the PERFORM instruction. IBM,
For OS F 2 /F 4 /X 3 , 1 is used as shown in Figure 1.
While the procedure specified by one PERFORM instruction is executing, other PERFORM instructions that share an exit with it are allowed to execute. In the figure, ,,... indicate the control transfer order.

PERFORM命令をコンパイルする従来の方法
は、基本的には出口に行先変更可能な分岐命令を
生成し、PERFORMでは出口の行先に復帰アド
レスを設定して飛べばよいが、それだけでは第1
図の第2番目のPERFORM命令で第1番目の
PERFORMの設定した復帰アドレスを破壊して
しまうので、実際には先ず出口の行先を退避して
から復帰アドレスを設定して飛び、帰つてきたあ
と出口の行先を復元するという作業が行われる。
第2図において、PSV1とPSV2は退避域、VNは
分岐先アドレス、GN1とGN2は復帰先アドレス
GO VNは分岐命令をそれぞれ示している。第2
図に示すようにPERFORM A THRU Cは PSV1←VN VN←GN1 GO A GN1 VN←PSV1 という命令列に変換される。
The conventional method of compiling a PERFORM instruction is to basically generate a branch instruction that can change the destination at the exit, and in PERFORM, you just set the return address at the exit destination and jump, but that alone is not enough.
In the second PERFORM instruction in the diagram, the first
Since this will destroy the return address set by PERFORM, the actual task is to first save the exit destination, set the return address, fly, and restore the exit destination after returning.
In Figure 2, PSV 1 and PSV 2 are save areas, VN is the branch destination address, and GN 1 and GN 2 are the return destination addresses.
GO VN each indicates a branch instruction. Second
As shown in the figure, PERFORM A THRU C is converted into the instruction sequence PSV 1 ←VN VN←GN 1 GO A GN 1 VN←PSV 1 .

PSV1←VNでは出口の分岐先アドレスが退避
域PSV1に退避され、VN←GN1では復帰点アド
レスが分岐先アドレスで指定された記憶場所に格
納され、GO AではアドレスAに飛び、GN1
VN←PSV1は退避域PSV1の内容が分岐先アドレ
スVNで指定された記憶場所にセツトされること
を示している。
When PSV 1 ← VN, the exit branch destination address is saved to the save area PSV 1 , when VN ← GN 1 , the return point address is stored in the memory location specified by the branch destination address, and when GO A, jumps to address A and GN 1
VN←PSV 1 indicates that the contents of the save area PSV 1 are set to the storage location specified by the branch destination address VN.

PERFORM B THRU Cも PSV2←VN VN ←GN2 GO B GN2 VN←PSV2 という命令列に変換される。PERFORM B THRU C is also converted to the instruction sequence PSV 2 ←VN VN ←GN 2 GO B GN 2 VN←PSV 2 .

従来技術においては、PERFORM命令が入れ
子になつているかを翻訳時に検出できなかつたた
め、常に上記のような展開形が生成されていた。
このため、第3図のような単純の場合には冗長な
オブジエクトを生成していることになり、改善の
余地があつた。第3図において〓印は不要な命令
を示している。
In the prior art, it was not possible to detect at the time of translation whether PERFORM instructions were nested, so an expanded form like the one described above was always generated.
Therefore, in a simple case as shown in FIG. 3, redundant objects are generated, and there is room for improvement. In FIG. 3, the cross mark indicates an unnecessary command.

本発明は、PERFORM命令を含むプログラム
を展開するとき、不要な命令を含まないように目
的プログラムに展開できるようになつた目的プロ
グラムの最適化方式を提供することを目的として
いる。そしてそのため、本発明の目的プログラム
の最適化方式は、PERFORM A THRU Cな
るPERFORM命令を PSV←VN VN ←GN GO A GN VN←PSV なる中間言語の命令列に展開すると共に、上記
PERFORM命令で指定されたプログラム・ルー
チンに対応する中間言語のプログラム・ルーチン
の出口に自動復帰機構GO VNを配置して、
PERFORM命令を含むCOBOLのプログラムを中
間言語のプログラムに展開し、該中間言語のプロ
グラムを最適化し最適化された中間言語のプログ
ラムを機械語の目的プログラムに変換する目的プ
ログラムの最適化方式において、 (イ) 自動復帰機構に到るすべてのパスでVN←
GN又はVN←PSVが存在すること、 (ロ) そのパス上で最後に実行されるのはVN←
GNであること、 の2条件を共に満すとき、その自動復帰機構を使
用するPERFORMの展開形の中のPSV←VNお
よびVN←PSVなる中間言語の命令を削除するこ
とを特徴とするものである。
SUMMARY OF THE INVENTION An object of the present invention is to provide an optimization method for a target program that can be expanded to a target program without including unnecessary instructions when a program including PERFORM instructions is expanded. Therefore, the optimization method of the target program of the present invention expands the PERFORM instruction PERFORM A THRU C into the intermediate language instruction sequence PSV←VN VN ←GN GO A GN VN←PSV, and
Placing an automatic return mechanism GO VN at the exit of the intermediate language program routine corresponding to the program routine specified in the PERFORM instruction,
In a target program optimization method that expands a COBOL program containing a PERFORM instruction into an intermediate language program, optimizes the intermediate language program, and converts the optimized intermediate language program into a machine language target program, ( b) VN← on all paths leading to the automatic return mechanism
GN or VN←PSV exists; (b) The last execution on that path is VN←
It is characterized by deleting the intermediate language commands PSV←VN and VN←PSV in the expanded form of PERFORM that uses the automatic return mechanism when the two conditions of GN are satisfied. be.

以下、本発明を図面を参照しつつ説明する。 Hereinafter, the present invention will be explained with reference to the drawings.

第3図の〓印の命令は、下記の2条件が共に満
たされるとき不要であり、削除してもプログラム
の論理には何らの影響も与えない。
The command marked with a cross in FIG. 3 is unnecessary when both of the following two conditions are satisfied, and even if it is deleted, it will not have any effect on the logic of the program.

(イ) 自動復帰機構に到る全てのパスでVN←GNx
またはVN←PSVnが存在する。
(b) VN←GNx on all paths leading to the automatic return mechanism
Or VN←PSVn exists.

(ロ) そのパス上で最後に実行されるのは、VN←
GNxである。
(b) The last thing to be executed on that path is VN←
It is GNx.

なお、自動復帰機構とは第3図のGO VNのこと
である。
Note that the automatic return mechanism refers to the GO VN shown in Figure 3.

次に、上記2条件を満たすか否かの判定方法を
述べる。
Next, a method for determining whether the above two conditions are satisfied will be described.

(a) プログラムを、1入力・1出力でその中では
制御が記述順に流れるような命令の集まり(以
下、ブロツクという)に分割する。
(a) Divide a program into a collection of instructions (hereinafter referred to as blocks) that have one input and one output, and within which control flows in the order in which they are written.

(b) 各ブロツクごとに、各VNに対して1ビツト
対応するビツト・ベクトル〓bを以下のように
定義する。たゞし、Vbは〓bの成分である。
(b) For each block, define a bit vector 〓b corresponding to 1 bit for each VN as follows. However, Vb is a component of 〓b.

Vb=0:bの出口でVNは VN←GNxの結果を持つ 1:bの出口でVNは初期値または VN←PSVxの結果を持つ (c) ブロツクbに対して関数fbを次のように定義
する。
Vb = 0: At the exit of b, VN has the result of VN←GNx. 1: At the exit of b, VN has the initial value or the result of VN←PSVx. (c) For block b, set the function fb as follows. Define.

fb(V)=0:b中にVNの代入があり、 最後が VN←GNx 1:b中にVNの代入があり、 最後がVN←PSVx V:b中にVNの代入がない (d) ブロツクbに制御が渡つてくる直前のブロツ
ク(Immediate Predecessorと呼ぶ)をb1,b2
…,bnとするとき Vb=fb(Vb1∨Vb2∨…∨Vbn) … によつてVb1…,VbnからVbが求まる。たゞ
し、プログラムの入口ブロツクでは Vb=fb (1) とする。
fb (V) = 0: There is an assignment of VN in b, and the end is VN←GNx 1: There is an assignment of VN, and the end is VN←PSVx V: There is no assignment of VN in b (d) The blocks immediately before control is passed to block b (called Immediate Predecessor) are b 1 and b 2
…, bn, Vb=fb (Vb 1 ∨Vb 2 ∨…∨Vbn) … Vb is found from Vb 1 …, Vbn. However, at the entrance block of the program, Vb=fb (1).

(e) 式をプログラムの入口から順に適用するこ
とにより、すべてのブロツクでVbが求まる。
自動復帰機構GO VNの存在するブロツクにお
いてVb=0であれば条件(1)、(2)が満されてお
り、Vb=1ならば満されていない。
(e) By applying the formula in order from the program entrance, Vb can be found for all blocks.
In a block where the automatic return mechanism GO VN exists, if Vb=0, conditions (1) and (2) are satisfied, and if Vb=1, they are not satisfied.

第4図は一般的なコンパイラの構成図である。
ソース・プログラム(原始プログラム)は中間言
語への展開フエーズによつて中間言語(VN←
PSVやGO VN)に展開され、最適化フエーズに
よつて以下に述べる最適化が行われ、コード生成
フエーズにおいて機械命令(ロードやストア)な
どに展開され、目的プログラムとなる。
FIG. 4 is a block diagram of a general compiler.
The source program (original program) is transformed into an intermediate language (VN←
PSV or GO VN), the optimization phase described below is performed, and the code generation phase is expanded to machine instructions (load, store), etc., and becomes the target program.

第5図は最適化フエーズの処理を示すフローチ
ヤートである。ブロツク分割段階でプログラムを
ブロツクに分割すると共に、各ブロツク内での各
VNへの代入の存否を調べて、関数fb(V)の形
式を定める。フローグラフ作成段階ではブロツク
内の制御の移行を解析し、第6図の左側のような
フローグラフを作成する。ビツト・ベクトル〓b
の計算段階では、入口から順に各ブロツクについ
ての関数fb(V)を適用することによりVbの値を
求める。
FIG. 5 is a flow chart showing the processing of the optimization phase. In the block division stage, the program is divided into blocks, and each
The format of the function fb(V) is determined by checking whether there is an assignment to VN. At the flow graph creation stage, the control transition within the block is analyzed and a flow graph like the one on the left side of FIG. 6 is created. Bit Vector〓b
In the calculation step, the value of Vb is obtained by applying the function fb(V) for each block in order from the entrance.

以上が終つたら、各VNについてGO VNのあ
るブロツクでのVbの値を調べ、VNのPSVへの
退避(PSV←VN)や回復(VN←PSV)が不要
であるのでこれらを全て削除することにより最適
化を行う。
Once the above is completed, for each VN, check the value of Vb in a certain block of GO VN, and delete all of them as there is no need to save the VN to PSV (PSV←VN) or restore (VN←PSV) Optimization is performed by

第6図はフローグラフ、fb(V)の値およびVb
の値の1例を示している。
Figure 6 is a flow graph, the value of fb (V) and Vb
An example of the value of is shown.

第7図は自動復帰機構の存在するブロツクにお
いてVbが零であるか否かを検出する装置のブロ
ツク図である。第7図において、1ないし6は単
位計算回路、7は論理「0」の定数発生回路、8
は論理「1」の定数発生回路、9はOR回路、1
0は切換スイツチ、11は出力端子をそれぞれ示
している。関数fbの値はこの切換スイツチ10の
位置に対応する。フローグラフのブロツクb1
b2,…b6のそれぞれに単位計算回路1,2,…6
のそれぞれを対応させ、関数fbの値に従つて切換
スイツチ10の位置を設定する。そして、これら
の単位計算回路1,2,…,6をフローグラフに
従つて結線し入口の単位計算回路1に定数「1」
を入力する。GO VNの存在するブロツクに対応
する単位計算回路3の出力が論理「0」であれば
最適化可能である。実際にはこの最適化処理はソ
フトウエアにより行われるが、その機能は第7図
の装置の機能と同等である。
FIG. 7 is a block diagram of a device for detecting whether or not Vb is zero in a block where an automatic return mechanism is present. In FIG. 7, 1 to 6 are unit calculation circuits, 7 is a logic "0" constant generation circuit, and 8
is a logic “1” constant generation circuit, 9 is an OR circuit, 1
0 indicates a changeover switch, and 11 indicates an output terminal. The value of the function fb corresponds to the position of this changeover switch 10. Block b 1 of the flow graph,
Unit calculation circuits 1, 2 ,...6 for b 2,...b 6, respectively
The position of the changeover switch 10 is set according to the value of the function fb. Then, connect these unit calculation circuits 1, 2, ..., 6 according to the flow graph and set the constant "1" to the unit calculation circuit 1 at the entrance.
Enter. Optimization is possible if the output of the unit calculation circuit 3 corresponding to the block in which GO VN exists is logic "0". This optimization process is actually performed by software, but its function is equivalent to that of the apparatus shown in FIG.

第8図は第6図の中間言語のプログラムを最適
化した結果を示している。
FIG. 8 shows the result of optimizing the intermediate language program of FIG.

以上の説明から明らかなように、本発明によれ
ば、PERFORM命令を含むソース・プログラム
を命令数の少ない効率的な機械語命令のプログラ
ムに展開することが出来る。
As is clear from the above description, according to the present invention, a source program including PERFORM instructions can be developed into an efficient machine language instruction program with a small number of instructions.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図はPERFORM命令が入れ子構造になつ
ているCOBOLプログラムの1例を示す図、第2
図はPERFORM命令の中間言語への展開の従来
例を示す図、第3図はPERFORM命令を含むプ
ログラムにおいて出口アドレスの退避および出口
アドレスの回復不要の場合を示す図、第4図は一
般的なコンパイラの構成図、第5図は第4図の最
適化フエーズの処理を示すフローチヤート、第6
図はフローグラフとfbの値とVbの値の1例を示
す図、第7図は最適化フエーズの処理を行う装置
のブロツク図、第8図は第6図の中間言語のプロ
グラムを最適化した結果を示す図である。 1ないし6…単位計算回路、7…論理「0」の
定数発生回路、8…論理「1」の定数発生回路、
9…OR回路、10…切換スイツチ、11…出力
端子。
Figure 1 shows an example of a COBOL program in which PERFORM instructions are nested.
The figure shows a conventional example of expansion of the PERFORM instruction into an intermediate language, Figure 3 shows a case where there is no need to save or recover the exit address in a program that includes the PERFORM instruction, and Figure 4 shows a general example. A configuration diagram of the compiler; Figure 5 is a flowchart showing the processing of the optimization phase in Figure 4;
The figure shows an example of a flow graph and the values of fb and Vb. Figure 7 is a block diagram of a device that processes the optimization phase. Figure 8 optimizes the intermediate language program in Figure 6. It is a figure showing the result. 1 to 6...Unit calculation circuit, 7...Logic "0" constant generation circuit, 8...Logic "1" constant generation circuit,
9...OR circuit, 10...changeover switch, 11...output terminal.

Claims (1)

【特許請求の範囲】 1 PERFORM A THRU CなるPERFORM
命令を PSV←VN VN ←GN GO A GN VN←PSV なる中間言語の命令列に展開すると共に、上記
PERFORM命令で指定されたプログラム・ルー
チンに対応する中間言語のプログラム・ルーチン
の出口に自動復帰機構GO VNを配置して、
PERFORM命令を含むCOBOLのプログラムを中
間言語のプログラムに展開し、該中間言語のプロ
グラムを最適化し、最適化された中間言語のプロ
グラムを機械語の目的プログラムに変換する目的
プログラムの最適化方式において、 (イ) 自動復帰機構に到るすべてのパスでVN←
GN又はVN←PSVが存在すること、 (ロ) そのパス上で最後に実行されるのはVN←
GNであること、 の2条件を共に満すとき、その自動復帰機構を使
用するPERFORM命令の展開形の中のPSV←
VNおよびVN←PSVなる中間言語の命令を削除
することを特徴とするCOBOLのPERFORM命令
における目的プログラムの最適化方式、 ただし、VNは自動復帰機構の復帰先アドレス
を示す変数、GNはPERFORM命令の展開形の中
に定義される自動復帰機構からの復帰点を示すア
ドレス、PSVはPERFORM命令毎に確保された
復帰先アドレスの退避域、PSV←VNは変数VN
を退避域PSVに退避する命令、VN←GNはアド
レスGNを変数VNに代入する命令、GO Aはア
ドレスAにジヤンプする命令、VN←PSVは退避
域PSVの内容を変数VNに代入する命令を示して
いる。
[Claims] 1 PERFORM A THRU C PERFORM
In addition to expanding the instruction into the intermediate language instruction sequence PSV←VN VN ←GN GO A GN VN←PSV, the above
Placing an automatic return mechanism GO VN at the exit of the intermediate language program routine corresponding to the program routine specified in the PERFORM instruction,
In a target program optimization method that expands a COBOL program including a PERFORM instruction into an intermediate language program, optimizes the intermediate language program, and converts the optimized intermediate language program into a machine language target program, (b) VN← on all paths leading to the automatic return mechanism
GN or VN←PSV exists; (b) The last execution on that path is VN←
PSV in the expanded form of the PERFORM instruction that uses the automatic return mechanism when the two conditions of being GN and are satisfied are ←
An optimization method for the target program in the COBOL PERFORM instruction, which is characterized by deleting the intermediate language instructions VN and VN←PSV, where VN is a variable indicating the return destination address of the automatic return mechanism, and GN is the PERFORM instruction Address indicating the return point from the automatic return mechanism defined in the expanded form, PSV is the save area for the return destination address secured for each PERFORM instruction, PSV←VN is the variable VN
VN←GN is an instruction to assign address GN to variable VN, GO A is an instruction to jump to address A, VN←PSV is an instruction to assign the contents of save area PSV to variable VN. It shows.
JP17231579A 1979-12-29 1979-12-29 Optimizing system for objective program Granted JPS5697152A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP17231579A JPS5697152A (en) 1979-12-29 1979-12-29 Optimizing system for objective program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP17231579A JPS5697152A (en) 1979-12-29 1979-12-29 Optimizing system for objective program

Publications (2)

Publication Number Publication Date
JPS5697152A JPS5697152A (en) 1981-08-05
JPS64725B2 true JPS64725B2 (en) 1989-01-09

Family

ID=15939630

Family Applications (1)

Application Number Title Priority Date Filing Date
JP17231579A Granted JPS5697152A (en) 1979-12-29 1979-12-29 Optimizing system for objective program

Country Status (1)

Country Link
JP (1) JPS5697152A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11006926B2 (en) 2018-02-27 2021-05-18 Siemens Medical Solutions Usa, Inc. Region of interest placement for quantitative ultrasound imaging

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4567574A (en) * 1983-03-14 1986-01-28 International Business Machines Corporation Optimizing cobol object code instruction path length with respect to perform statements
JPS62207390A (en) * 1986-03-07 1987-09-11 Mitsubishi Heavy Ind Ltd Control of treating combustible gas contained in coke charging hopper in red hot coke dry quenching facilities

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11006926B2 (en) 2018-02-27 2021-05-18 Siemens Medical Solutions Usa, Inc. Region of interest placement for quantitative ultrasound imaging

Also Published As

Publication number Publication date
JPS5697152A (en) 1981-08-05

Similar Documents

Publication Publication Date Title
JPH0522936B2 (en)
JPS64725B2 (en)
JPH0528088A (en) Method for automatically generating hardware constitution information
JP3461185B2 (en) Method and apparatus for registering source code line number to load module
JPS6022373B2 (en) Program conversion mechanism for programmable control equipment
US20240202522A1 (en) Device and method for generating deep learning model graph and abstract syntax tree for integrated compiler
US12373195B2 (en) Method of programming a software module associated with a firmware unit of a device
JP2585793B2 (en) Compiler system
JPH11154093A (en) Program Compiler and Recording Medium Recording Compiler Program
JPH0117175B2 (en)
JPS6126692B2 (en)
JP3240647B2 (en) Computer language structured processing
JPH0228174B2 (en)
JPS63269229A (en) Compiling system for character string operation system instruction
JPH05100866A (en) Compile/link system
JPH01287486A (en) Test pattern program generating device
JPH06103113A (en) Differential test debugging support method
JPH04205422A (en) Program automatic translation combination and selection method
JP2004139369A (en) Analysis method for pointer pointing constant address domain
JPS62219129A (en) Processing system by partial development for sum calculation in compiler
JPH0128414B2 (en)
JPH06119203A (en) Debug row deletion device
JPS60126735A (en) Compiling system
JPS60220468A (en) Vector arithmetic control system
JPS62182843A (en) Fast compiling/linking system