JPH0337726A - Case statement optimizing system - Google Patents

Case statement optimizing system

Info

Publication number
JPH0337726A
JPH0337726A JP17240489A JP17240489A JPH0337726A JP H0337726 A JPH0337726 A JP H0337726A JP 17240489 A JP17240489 A JP 17240489A JP 17240489 A JP17240489 A JP 17240489A JP H0337726 A JPH0337726 A JP H0337726A
Authority
JP
Japan
Prior art keywords
statement
branch
case
assignment
case statement
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.)
Pending
Application number
JP17240489A
Other languages
Japanese (ja)
Inventor
Noboru Kotani
小谷 昇
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP17240489A priority Critical patent/JPH0337726A/en
Publication of JPH0337726A publication Critical patent/JPH0337726A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To improve the execution efficiency by performing data approach before a CASE statement to use results in each branch destination at the time when the same external variable appears in the right side of the first assignment statement in the branch destination of the CASE statement. CONSTITUTION:When the first statement of the branch destination of the CASE statement is an assignment statement and the variable in the right side of the assignment statement is an external variable and is equal to that in the right side of the first assignment statement of preceding branch, an optimizability deciding means 11 executes the processing of the next branch destination and makes an optimizable CASE statement after the end of branch. When a back end part 2 is started, an intermediate language for data approach is generated by a data approach generating means 21; and when this intermediate language is the optimizable CASE statement, the intermediate language for data approach is generated before the CASE statement. Reference to the variable in the right side of the assignment statement in each branch is optimized by a data approach referring means 22, and the address obtained by the data approach generating means 2 is used in the right side of the assignment statement when it is the assignment statement of branch of the optimized CASE statement, and an object program is generated. Thus, the execution efficiency is improved.

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明は目的プログラムを生成するためのコンパイラに
関し、特にCASE文の目的プログラムを生成する方式
に関する。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a compiler for generating an object program, and particularly to a method for generating an object program using a CASE statement.

(従来の技術) 従来、ソースプログラムを入力して目的プログラムを生
成する計算機システムのコンパイラの処理にかいて、C
ASE文の各分岐先の最初の文が代入文でらって、同じ
外部変数が右碧に指定されていたとしても、各分岐ごと
にデータ接近する目的プログラムを生成する方式となっ
ていた。
(Prior Art) Conventionally, in the processing of a computer system compiler that inputs a source program and generates a target program, C.
The first statement of each branch destination of the ASE statement was an assignment statement, and even if the same external variable was specified in the right direction, the system generated an object program that accessed the data for each branch.

(発明が解決しようとする課題) 上述した従来方式では、CASE文の分岐ごとく外部変
数へのデータ接近の目的プログラムを生威しなければな
らないため、それだけ目的プログラムが大きくなり1メ
モリ容量などの保管コストがかさむだけではなく、その
実行効率も低下するという欠点がある。
(Problem to be Solved by the Invention) In the conventional method described above, it is necessary to create a target program for accessing data to external variables like a branch of a CASE statement. This has the disadvantage that it not only increases cost but also reduces execution efficiency.

本発明の目的は、CASE文の分岐先の最初の文がすべ
て代入文であって、その代入文の右辺に外部変数が指定
されているとき、その変数がすべての分岐先にかいて同
じものであるか否かを判定し、可能と判定された場合に
は外部変数への接近をCASE文の前に一度だけ行うと
ともに、各分岐先の外部変数の参照に際しては得られた
アドレスを直接使用することによう上記欠点を除去し、
メモリ容量を増大させることなく、かつ実行効果を高く
保つことができるように構成したCASE文最適化方式
を提供することにある。
The purpose of the present invention is to provide the following object: When the first statement at the branch destination of a CASE statement is an assignment statement, and an external variable is specified on the right side of the assignment statement, the variable is written to all branch destinations in the same way. If it is determined that it is possible, access the external variable only once before the CASE statement, and use the obtained address directly when referencing the external variable at each branch destination. In order to eliminate the above drawbacks,
An object of the present invention is to provide a CASE statement optimization method configured to maintain high execution efficiency without increasing memory capacity.

(課題を解決するための手段) 本発明によるCASE文最適化方式は最適化可能判定手
段と、データ接近生成手段と、データ接近参照手段とを
具備し、目的プログラムを生成する計算機システムのコ
ノバイラ処理に使用できるように構成したものである。
(Means for Solving the Problems) The CASE statement optimization method according to the present invention is provided with an optimizability determination means, a data approach generation means, and a data approach reference means, and includes conoviler processing of a computer system that generates an objective program. It is designed so that it can be used for.

最適化可能判定手段は、CASE文の分岐先の最初の文
がすべて代入文であって、代入文の右辺に外部変数が指
定され、外部変数がすべての分岐先で同じであるか否か
を判定するためのものである。
The optimizability determination means determines whether the first statements at branch destinations of a CASE statement are all assignment statements, external variables are specified on the right side of the assignment statements, and whether the external variables are the same at all branch destinations. It is for judgment.

データ接近生成手段は、最適化可能判定手段により上記
条件がすべて満足されていると判定された場合には、外
部変数へのデータ接近を一度だけ行うためのものである
The data approach generation means is for accessing data to an external variable only once when the optimization possibility determination means determines that all of the above conditions are satisfied.

データ接近参照手段は、各分岐先の外部変数の参照にか
いてデータ接近生成手段で得られたアドレスを直接使用
するためのものである。
The data access reference means is for directly using the address obtained by the data access generation means for referencing external variables at each branch destination.

(実施例) 次に、本発明について図面を参照して説明する。(Example) Next, the present invention will be explained with reference to the drawings.

第1図は、本発明によるCASE文最適化方式の一実施
例を示すブロック図である。
FIG. 1 is a block diagram showing an embodiment of the CASE statement optimization method according to the present invention.

第1図において、1はフロントエンド部、2はバックエ
ンド部、11は最適化手段、21はデータ接近生成手段
、22はデータ接近参照手段である。また、111〜1
16,211〜213,221〜223はそれぞれ処理
動作ステップである。
In FIG. 1, 1 is a front end section, 2 is a back end section, 11 is an optimization means, 21 is a data approach generation means, and 22 is a data approach reference means. Also, 111-1
16, 211 to 213, and 221 to 223 are processing operation steps, respectively.

筐ず、フロントエンド部1でンースプログラムを入力す
ると、最適化可能判定手段11により最適化可能なCA
SE文であるか否かを判定する。
When a program is input into the front end section 1, the optimization possibility determination means 11 determines whether the CA can be optimized.
Determine whether it is an SE sentence.

ステップ111でCASE文であるか否かを判定し、Y
ESならばステップ112で分岐先の最初の文が代入文
であるか否かを判定する。Noならば従来技術による処
理を実行し、YESならばステップ113で代入文の右
辺の変数が外部変数であって、前の分岐の最初の代入文
の右辺と同じであるか否かを判定する。Noならば従来
技術による処理を実行し、YESならばステップ114
で次の分岐先の処理を実行する。分岐が終了したならば
、ステップ115で最適化可能なCASE文とす・る。
In step 111, it is determined whether or not it is a CASE statement, and Y
If ES, it is determined in step 112 whether the first statement at the branch destination is an assignment statement. If No, the process according to the prior art is executed, and if Yes, in step 113, it is determined whether the variable on the right side of the assignment statement is an external variable and is the same as the right side of the first assignment statement in the previous branch. . If No, execute processing using conventional technology; if Yes, step 114
Executes the process at the next branch destination. When the branch is completed, the CASE statement is determined to be optimizable in step 115.

次に、バックエンド部2が起動されると、データ接近生
成手段21によりデータ接近用の中間言語を生成する。
Next, when the back end unit 2 is activated, the data approach generation means 21 generates an intermediate language for data access.

ステップ211では、上記中間言語が最適化可能なCA
SE文であるか否かを判定する。Noであるならばステ
ップ213で従来通うに何もしないが、YESならばス
テップ212でCASE文の前にデータ接近用の中間言
語を生成する。
In step 211, the intermediate language is an optimizable CA.
Determine whether it is an SE sentence. If No, nothing is done in the conventional way at step 213, but if YES, an intermediate language for data access is generated before the CASE statement at step 212.

次に、データ接近参照手段22により各分岐での代入文
の右辺の変数の参照を最適化する。ステップ221では
、最適化されたCASE文の分岐の代入文であるか否か
を判定し、NOならばステップ223で従来通シにデー
タ接近するが、YESならばデータ接近生成手段21で
得られたアドレスを代入文の右辺に使用する。最後に、
目的プログラムを生成する。
Next, the data access reference means 22 optimizes the reference to the variable on the right side of the assignment statement in each branch. In step 221, it is determined whether or not it is an assignment statement of a branch of the optimized CASE statement. If NO, the data is approached in the conventional manner in step 223, but if YES, the data approach generation means 21 obtains the Use the address obtained on the right side of the assignment statement. lastly,
Generate the target program.

(発明の効果) 以上説明したように本発明は、CASE文の分岐先の最
初の代入文の右辺に同じ外部変数が出現した場合、CA
SE文の前にデータ接近を行い、各分岐先で上記結果を
利用することによう1目的プログラムが大幅に圧縮され
、実行効率も大幅に向上するという効果がある。
(Effects of the Invention) As explained above, in the present invention, when the same external variable appears on the right side of the first assignment statement at the branch destination of a CASE statement, the CASE
By performing data access before the SE statement and using the above results at each branch destination, a single-purpose program can be significantly compressed and execution efficiency can be greatly improved.

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

第1図は、本発明によるCASE文最適化方式の一実施
例を示すブロック図である。 1・・・フロントエンド部 2・・・バックエンド部 11・・・最適化可能判定手段 21・・・データ接近生成手段 22・・・データ接近参照手段 111〜116,211〜213,221〜223 ・処理ステップ
FIG. 1 is a block diagram showing an embodiment of the CASE statement optimization method according to the present invention. 1... Front end section 2... Back end section 11... Optimizability determination means 21... Data approach generation means 22... Data approach reference means 111-116, 211-213, 221-223・Processing step

Claims (1)

【特許請求の範囲】[Claims] CASE文の分岐先の最初の文がすべて代入文であつて
、前記代入文の右辺に外部変数が指定され、前記外部変
数がすべての分岐先で同じであるか否かを判定するため
の最適化可能判定手段と、前記最適化可能判定手段によ
り前記条件がすべて満足されていると判定された場合に
は前記外部変数へのデータ接近を一度だけ行うためのデ
ータ接近生成手段と、前記各分岐先の外部変数の参照に
おいて前記データ接近生成手段で得られたアドレスを直
接使用するためのデータ接近参照手段とを具備し、目的
プログラムを生成する計算機システムのコンパイラ処理
に使用できるように構成したことを特徴とするCASE
文最適化方式。
Optimal for determining whether the first statement at the branch destination of a CASE statement is an assignment statement, an external variable is specified on the right side of the assignment statement, and the external variable is the same at all branch destinations. a data approach generation means for accessing data to the external variable only once when the optimization possibility determination means determines that all of the conditions are satisfied; and each of the branches. and a data access reference means for directly using the address obtained by the data access generation means in referencing the external variable, and configured to be usable in compiler processing of a computer system that generates an object program. CASE featuring
Sentence optimization method.
JP17240489A 1989-07-04 1989-07-04 Case statement optimizing system Pending JPH0337726A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP17240489A JPH0337726A (en) 1989-07-04 1989-07-04 Case statement optimizing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP17240489A JPH0337726A (en) 1989-07-04 1989-07-04 Case statement optimizing system

Publications (1)

Publication Number Publication Date
JPH0337726A true JPH0337726A (en) 1991-02-19

Family

ID=15941323

Family Applications (1)

Application Number Title Priority Date Filing Date
JP17240489A Pending JPH0337726A (en) 1989-07-04 1989-07-04 Case statement optimizing system

Country Status (1)

Country Link
JP (1) JPH0337726A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10394812B2 (en) 2016-12-06 2019-08-27 International Business Machines Corporation Case statement optimization

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10394812B2 (en) 2016-12-06 2019-08-27 International Business Machines Corporation Case statement optimization
US11144547B2 (en) 2016-12-06 2021-10-12 International Business Machines Corporation Case statement optimization

Similar Documents

Publication Publication Date Title
JP3318051B2 (en) Translation processing method
JPH0337726A (en) Case statement optimizing system
CN115237390A (en) Relay protection device logic diagram code generation method and device and storage medium
WO2022099569A1 (en) Application processing program dynamic loading method for brain-like computer operating system
JPH02240744A (en) Optimization system for case sentence
JPH08272606A (en) Ladder instruction processor
JPH02170236A (en) Multi-branching function optimization system
JPS5995646A (en) Arithmetic control system
JPH0250730A (en) Language converting system based upon common machine word
JPS60178539A (en) By-pass control system of information processor
JPH0373026A (en) Compile system
JPH0553827A (en) Dynamic link optimizing system
JPS6242234A (en) Arithmetic processing system for variable having bit train attribute
JPS63163636A (en) Executing system for parallel processing
JPH04205422A (en) Automatic program translation connecting and selecting method
JPS58166455A (en) Relational type data base system
JPH0293948A (en) Computer system
JPH05100866A (en) Compile/link system
JPS6297031A (en) Matching system for bit number of mantissa part
JPS60220468A (en) Vector arithmetic control system
JPH0128414B2 (en)
JPH11175350A (en) Source program analysis device
JPH0235521A (en) Generation system for patch image
JPH0792757B2 (en) Optimal data allocation method
JPS62182843A (en) Fast compiling/linking system