JPH0721032A - Program optimization processing system - Google Patents

Program optimization processing system

Info

Publication number
JPH0721032A
JPH0721032A JP16354393A JP16354393A JPH0721032A JP H0721032 A JPH0721032 A JP H0721032A JP 16354393 A JP16354393 A JP 16354393A JP 16354393 A JP16354393 A JP 16354393A JP H0721032 A JPH0721032 A JP H0721032A
Authority
JP
Japan
Prior art keywords
instruction
program
processing
processing pattern
execution time
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
JP16354393A
Other languages
Japanese (ja)
Inventor
Yuzo Bessho
雄三 別所
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP16354393A priority Critical patent/JPH0721032A/en
Publication of JPH0721032A publication Critical patent/JPH0721032A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To provide the program optimization processing system for automatically regenerating a target program while more accelerating the execution without necessity for a user to be conscious of a redundant program or a program with a lot of unnecessary parts in programs prepared by the user. CONSTITUTION:An instruction analysis part 8 retrieves a processing pattern equal to the processing pattern of an instruction in the target program from a data base part 9 and possesses a processing pattern corresponding to that retrieved processing pattern, these processing patterns are executed by an instruction execution part 7, the execution times are compared by an instruction execution time comparison part 6, and an optimizing part 3 replaces the processing pattern in the target program with the processing pattern more accelerating the execution.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、使用された各命令にお
いて、低速である命令の処理パターンを自動的に最適
(高速)な命令処理パターンに変換を行なうコンパイラ
及び最適化方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compiler and an optimizing method for automatically converting a processing pattern of a low-speed instruction into an optimum (high-speed) instruction processing pattern in each used instruction. .

【0002】[0002]

【従来の技術】一般に最適化とは、利用者の作成した原
始プログラムの中で、冗長なプログラムや無駄の多いプ
ログラムなどを利用者は意識せずに、コンパイラがCP
Uの効率や、各命令の実行時間を考慮して、より実行時
間の高速な目的プログラムを作成するというものであ
り、従来、このような要求に答えるものとして、各命令
の実行時間を比較し、プログラムを最適化するという方
法がある。例えば、特開昭60−221832号公報に
示されたものなどがこの方法に当たる。
2. Description of the Related Art Generally, optimization means that the compiler does not need to be aware of redundant programs and wasteful programs among the original programs created by the user, and
The purpose is to create a target program with a faster execution time by considering the efficiency of U and the execution time of each instruction. Conventionally, the execution time of each instruction is compared to meet such a request. , There is a way to optimize the program. For example, the one disclosed in JP-A-60-221832 corresponds to this method.

【0003】図19は、従来のプログラム最適化方式の
構成図である。目的プログラムが作成されると各命令が
取り出され、あらかじめ用意された同等な処理パター
ン、及び、その実行時間(推定時間)が格納されたテー
ブル中の命令とを比較し、目的プログラム中の命令をよ
り実行時間の高速なものに変換していくというものであ
る。
FIG. 19 is a block diagram of a conventional program optimization method. When the target program is created, each instruction is fetched, and the equivalent processing pattern prepared in advance and the instruction in the table in which its execution time (estimated time) are stored are compared to determine the instruction in the target program. It is to convert to a faster execution time.

【0004】図19において、19はコンパイラ、20
は制御部、21は目的プログラムより命令を取り出す命
令取り出し部、22は命令取り出し部21で取り出した
命令を最適化する最適化部、23は最適化部22で最適
化された命令を用いて目的プログラムを再生成する目的
プログラム生成部、24は命令取り出し部21で取り出
した命令の実行時間と、あらかじめ用意された同等の処
理パターンの実行時間を比較する命令実行時間解析部、
25は処理パターンの実行時間をあらかじめ格納してい
る命令実行時間格納テーブルである。図20は、従来の
プログラム最適化方式の動作を示すフローチャート図で
ある。
In FIG. 19, 19 is a compiler and 20 is a compiler.
Is a control unit, 21 is an instruction fetching unit that fetches instructions from the target program, 22 is an optimization unit that optimizes the instructions fetched by the instruction fetching unit 21, and 23 is a target that uses the instructions optimized by the optimizing unit 22. A target program generation unit for regenerating a program, 24 is an instruction execution time analysis unit for comparing the execution time of the instruction fetched by the instruction fetching unit 21 with the execution time of an equivalent processing pattern prepared in advance,
Reference numeral 25 is an instruction execution time storage table in which execution times of processing patterns are stored in advance. FIG. 20 is a flowchart showing the operation of the conventional program optimization method.

【0005】次に、プログラム最適化方式の動作を、図
20を参照しながら説明する。まず、利用者のプログラ
ムをコンパイルすると、S26がスタートし、各命令を
命令取り出し部21によりトレースする。次に、トレー
スした命令が命令実行時間格納テーブル25に格納され
ているか検索する。S27でトレースした命令が格納さ
れていなければ、命令は変更されない(S29)。格納
されていれば、S28で目的プログラムの命令の実行時
間(ただし、実行時間とは推定実行時間のことである)
と、命令実行時間格納テーブルに格納された命令の実行
時間(推定実行時間)を、命令実行時間解析部24で比
較する。S30で命令実行時間格納テーブル25に格納
された命令の実行時間(推定実行時間)の方が低速であ
るなら、命令は変更されない(S32)。目的プログラ
ムの命令の実行時間(推定実行時間)の方が低速の時に
は、テーブルに格納されている命令に、目的プログラム
生成部23で変換される(S31)。このように、全て
の命令が終了するまで繰り返され、最小の命令実行時間
の新目的プログラムが生成される(S33)。
Next, the operation of the program optimization method will be described with reference to FIG. First, when the user's program is compiled, S26 starts and each instruction is traced by the instruction fetching section 21. Next, it is searched whether the traced instruction is stored in the instruction execution time storage table 25. If the instruction traced in S27 is not stored, the instruction is not changed (S29). If stored, the execution time of the instruction of the target program in S28 (however, the execution time is the estimated execution time)
And the instruction execution time (estimated execution time) stored in the instruction execution time storage table are compared by the instruction execution time analysis unit 24. If the execution time (estimated execution time) of the instruction stored in the instruction execution time storage table 25 in S30 is slower, the instruction is not changed (S32). When the execution time (estimated execution time) of the instruction of the object program is slower, the instruction stored in the table is converted by the object program generator 23 (S31). In this way, the process is repeated until all the instructions are completed, and the new target program with the minimum instruction execution time is generated (S33).

【0006】[0006]

【発明が解決しようとする課題】従来の最適化の方法
は、個々の命令の実行時間を減少させても、プログラム
を実行してみないと、プログラム全体の効率の良い最適
化が行なわれているのかどうか、わからないことがあっ
た。また、命令実行時間(推定実行時間)は使用する計
算機の機種によって異なるものであるので、使用する計
算機の機種によって、命令実行時間格納テーブルを変更
する必要があり、コンパイラ設計者が命令実行時間(推
定実行時間)を把握しておかなければならないという問
題点があった。
In the conventional optimization method, even if the execution time of each instruction is reduced, if the program is not executed, the entire program is efficiently optimized. I didn't know if I was there or not. Since the instruction execution time (estimated execution time) differs depending on the model of the computer used, it is necessary to change the instruction execution time storage table depending on the model of the computer used, and the compiler designer must There was a problem in that the estimated execution time) had to be known.

【0007】この発明は、このような問題点を解消する
ためになされたものである。個々の命令の最適化ではな
く、プログラム全体をより高速にするような最適化を行
なうことを目的とする。また、使用する計算機の種類に
依存せず、コンパイラ設計者が命令実行時間(推定実行
時間)を把握せずに最適化が行えることを目的とする。
The present invention has been made to solve such problems. The purpose is not to optimize individual instructions, but to optimize the entire program faster. It is also an object of the present invention to be able to perform optimization without depending on the type of computer used and without the compiler designer having to know the instruction execution time (estimated execution time).

【0008】[0008]

【課題を解決するための手段】この発明の第1の発明に
係るプログラム最適化処理方式は、以下の要素を有する
ものである。 (a)同等の機能をはたし、同等の処理結果を得る第1
と第2の処理パターンを対応させて記憶する記憶手段、
(b)目的プログラムを入力し、その目的プログラムに
用いられた命令の処理パターンを取り出す命令取り出し
手段、(c)上記記憶手段に記憶された第1の処理パタ
ーンと、上記命令取り出し手段により取り出された目的
プログラムの処理パターンの一致を検出する命令解析手
段、(d)上記命令解析手段により検出された目的プロ
グラムの処理パターンの命令を実行するとともに、上記
第1の処理パターンに対応する第2の処理パターンの命
令を実行する命令実行手段、(e)上記命令実行手段に
よる第1と第2の処理パターンの命令実行時間を比較す
る実行時間比較手段、(f)上記実行時間比較手段によ
る比較結果に基づいて、目的プログラムを第2の処理パ
ターンを用いて最適化する最適化手段。
A program optimizing system according to a first aspect of the present invention has the following elements. (A) First to perform equivalent functions and obtain equivalent processing results
And a storage unit that stores the second processing pattern in association with each other,
(B) an instruction fetching means for inputting a target program and fetching a processing pattern of an instruction used in the target program; (c) a first processing pattern stored in the storage means, and a fetched by the instruction fetching means. An instruction analyzing means for detecting a coincidence of the processing pattern of the target program, (d) a second instruction corresponding to the first processing pattern while executing the instruction of the processing pattern of the target program detected by the instruction analyzing means. Instruction execution means for executing instructions of the processing pattern, (e) execution time comparison means for comparing instruction execution times of the first and second processing patterns by the instruction execution means, (f) comparison result by the execution time comparison means Optimizing means for optimizing the target program using the second processing pattern based on

【0009】この発明の第2の発明に係るプログラム最
適化処理方式は、上記第1の発明に係るプログラム最適
化処理方式に対して、上記命令実行手段が、目的プログ
ラム全体を実行するとともに、上記実行時間比較手段
が、目的プログラム全体の実行時間の比較を行なうこと
を特徴としている。
A program optimizing method according to a second aspect of the present invention is the same as the program optimizing method according to the first aspect, in that the instruction executing means executes the entire target program. The execution time comparison means compares the execution times of the entire target programs.

【0010】この発明の第3の発明に係るプログラム最
適化処理方式は、上記第1の発明に係るプログラム最適
化処理方式に対して、上記記憶手段が、複数の命令が所
定順に並んだ第1の処理パターンに対して、これら命令
の並び換えを行った第2の処理パターンを記憶すること
を特徴としている。
According to a third aspect of the present invention, there is provided a program optimizing processing method, which is different from the program optimizing processing method according to the first aspect of the present invention in that the storage means has a plurality of instructions arranged in a predetermined order. The second processing pattern in which the instructions are rearranged is stored for the processing pattern of.

【0011】この発明の第4の発明に係るプログラム最
適化処理方式は、上記第1の発明に係るプログラム最適
化処理方式に対して、上記記憶手段が、複数の命令が所
定順に並んだ第1の処理パターンに対して、これら命令
の相対的位置を変更した第2の処理パターンを記憶する
ことを特徴としている。
A program optimization processing method according to a fourth aspect of the present invention is the program optimization processing method according to the first aspect of the present invention, in which the storage means has a plurality of instructions arranged in a predetermined order. The second processing pattern in which the relative positions of these instructions are changed with respect to the above processing pattern is stored.

【0012】この発明の第5の発明に係るプログラム最
適化処理方式は、上記第1の発明に係るプログラム最適
化処理方式に対して、上記記憶手段が、少なくとも第
1、及び、第2の処理パターンのいずれかが、ひとつの
命令で構成されていることを特徴としている。
A program optimization processing method according to a fifth aspect of the present invention is the same as the program optimization processing method according to the first aspect, wherein the storage means has at least first and second processing. One of the patterns is characterized by being composed of one instruction.

【0013】この発明の第6の発明に係るプログラム最
適化処理方式は、以下の要素を有するものである。 (a)他機種の同等の機能をはたし、同等の処理結果を
得る第1と第2の処理パターンを記憶するとともに、第
1と第2の処理パターンの実行時間を記憶する記憶手
段、(b)目的プログラムを入力し、その目的プログラ
ムに用いられた命令の処理パターンを取り出す命令取り
出し手段、(c)上記記憶手段に記憶された第1の処理
パターンと、上記命令取り出し手段により取り出された
目的プログラムの処理パターンの一致を検出する命令解
析手段、(d)上記命令解析手段により検出された第1
の処理パターンと、第1の処理パターンと同等の機能を
はたす第2の処理パターンの実行時間を、上記記憶手段
が記憶した実行時間から検索して比較する実行時間比較
手段、(f)上記実行時間比較手段による比較結果に基
づいて、目的プログラムを第2の処理パターンを用いて
最適化する最適化手段。
A program optimization processing method according to a sixth aspect of the present invention has the following elements. (A) A storage unit that stores the execution times of the first and second processing patterns while storing the first and second processing patterns that have the same functions as other models and obtain the same processing results. (B) an instruction fetching means for inputting a target program and fetching a processing pattern of an instruction used in the target program; (c) a first processing pattern stored in the storage means, and a fetched by the instruction fetching means. Command analysis means for detecting a match in processing pattern of the target program, (d) first command detected by the command analysis means
Execution time comparing means for searching and comparing execution times of the processing pattern of No. 1 and the second processing pattern having the same function as the first processing pattern from the execution times stored in the storage means, and (f) the execution Optimization means for optimizing the target program using the second processing pattern based on the comparison result by the time comparison means.

【0014】この発明の第7の発明に係るプログラム最
適化処理方式は、上記第6の発明に係るプログラム最適
化処理方式に対して、上記記憶手段が、複数の機種に対
応して、上記第1と第2の処理パターンと実行時間を記
憶することを特徴としている。
A program optimization processing method according to a seventh aspect of the present invention is the same as the program optimization processing method according to the sixth aspect, wherein the storage means corresponds to a plurality of models. It is characterized in that the first and second processing patterns and the execution time are stored.

【0015】[0015]

【作用】第1の発明におけるプログラム最適化処理方式
は、命令実行手段が、目的プログラムの処理パターンの
命令を実行するとともに、上記目的プログラムの処理パ
ターンと一致する第1の処理パターンに対応する第2の
処理パターンの命令も実際に実行し、実行時間比較手段
が、上記2つの実行時間を比較し、最適化手段が、この
比較結果に基づいて目的プログラムを最適化する。その
ため、従来のように目的プログラムの中で使用された個
々の命令の推定実行時間を用いて最適化する方法に比べ
て、実際の実行時間を用いて最適化するので、より的確
な最適化をすることができる。
In the program optimizing processing method according to the first aspect of the present invention, the instruction executing means executes the instruction of the processing pattern of the target program, and corresponds to the first processing pattern corresponding to the processing pattern of the target program. The instruction of the processing pattern 2 is also actually executed, the execution time comparison means compares the two execution times, and the optimization means optimizes the target program based on the comparison result. Therefore, compared with the conventional method that optimizes using the estimated execution time of each instruction used in the target program, the optimization is performed using the actual execution time, so a more accurate optimization is required. can do.

【0016】この発明の第2の発明におけるプログラム
最適化方式は、上記第1の発明において、上記命令実行
手段が、目的プログラム全体を実行し、上記実行時間比
較手段が、目的プログラム全体の実行時間の比較を行う
ので、上記第1の発明よりも、目的プログラム全体を効
率のよい目的プログラムに再生成することができる。
A program optimizing method according to a second aspect of the present invention is the program optimization method according to the first aspect, wherein the instruction executing means executes the entire target program, and the execution time comparing means causes the execution time of the entire target program. Therefore, the entire target program can be regenerated into an efficient target program as compared with the first invention.

【0017】この発明の第3の発明におけるプログラム
最適化方式は、上記第1の発明において、上記記憶手段
が記憶している第2の処理パターンは、上記第1の処理
パターンの命令を並び換えたものである。そのため、上
記最適化手段が、上記実行時間比較手段の比較結果に基
づいて目的プログラムの最適化を行う場合、目的プログ
ラム中のある処理パターンを、対応する上記第2の処理
パターンに変更することで、自動的に効率のよい命令の
並びに並び換えることができる。
A program optimizing method according to a third aspect of the present invention is the same as the first aspect, wherein the second processing pattern stored in the storage means rearranges the instructions of the first processing pattern. It is a thing. Therefore, when the optimizing means optimizes the target program based on the comparison result of the execution time comparing means, it is possible to change a certain processing pattern in the target program to the corresponding second processing pattern. , It is possible to automatically rearrange the order of efficient instructions.

【0018】この発明の第4の発明におけるプログラム
最適化方式は、上記第1の発明において、上記記憶手段
が記憶している第2の処理パターンは、上記第1の処理
パターンの命令の相対的位置を変更したものである。そ
のため、上記最適化手段が、上記実行時間比較手段の比
較結果に基づいて、目的プログラムの最適化を行う場
合、目的プログラム中のある処理パターンを、対応する
上記第2の処理パターンに変更することで、プログラム
内で使用するアドレスを効率のよいアドレスに変更する
ことができる。
A program optimizing method according to a fourth aspect of the present invention is the program optimization method according to the first aspect, wherein the second processing pattern stored in the storage means is a relative instruction of the first processing pattern. The position has been changed. Therefore, when the optimizing means optimizes the target program based on the comparison result of the execution time comparing means, a certain processing pattern in the target program is changed to the corresponding second processing pattern. Thus, the address used in the program can be changed to an efficient address.

【0019】この発明の第5の発明におけるプログラム
最適化方式は、上記第1の発明において、上記記憶手段
が、少なくとも第1、及び、第2の処理パターンのいず
れかがひとつの命令で構成されているので、目的プログ
ラム中の命令について、個々の命令毎にも最適化が行え
る。
A program optimizing method according to a fifth aspect of the present invention is the program optimizing method according to the first aspect, wherein at least one of the first processing pattern and the second processing pattern is constituted by one instruction in the storage means. Therefore, the instructions in the target program can be optimized for each individual instruction.

【0020】この発明の第6の発明におけるプログラム
最適化方式は、記憶手段が、他機種の第1と第2の処理
パターンと、これらの処理パターンの実行時間も同時に
記憶する。そのため、目的プログラムの処理パターンと
一致する第1、及び、第2の処理パターンを実行するこ
となしに、上記記憶手段が記憶した2つの実行時間を検
索することで、実行時間比較手段は、上記2つの実行時
間を比較することができ、他機種のプログラムの最適化
が行える。
In the program optimizing method according to the sixth aspect of the present invention, the storage means stores the first and second processing patterns of other models and the execution times of these processing patterns at the same time. Therefore, the execution time comparison means searches the two execution times stored in the storage means without executing the first and second processing patterns that match the processing pattern of the target program. Two execution times can be compared, and programs of other models can be optimized.

【0021】この発明の第7の発明におけるプログラム
最適化方式は、上記第6の発明において、上記記憶手段
が、複数の機種について上記第1、及び、第2の処理パ
ターンと、これらの処理パターンの実行時間を記憶する
ので、コンパイルしたプログラムを実行する機種を予め
指定してからコンパイルを行えば、プログラムを実行す
る機種と異なる機種でもプログラムの最適化が行える。
A program optimization method according to a seventh aspect of the present invention is the program optimization method according to the sixth aspect, wherein the storage means has the first and second processing patterns for a plurality of models, and these processing patterns. Since the execution time of the program is stored, if the model for executing the compiled program is designated in advance and then the compilation is performed, the program can be optimized even for the model different from the model for executing the program.

【0022】[0022]

【実施例】【Example】

実施例1.図1は、本実施例におけるプログラム最適化
処理方式の全体構成図である。図1において、10は一
般的なコンパイラの流れである。1はコンパイラ、2は
制御部、3は命令実行時間比較部で命令実行時間(実測
値)が速い命令を選択する最適化部である。4は最適化
部で選択した命令に変換する目的プログラム生成部、5
は目的プログラムの命令を取り出す命令取り出し部、6
は命令実行部で実行したプログラムの実行時間(実測
値)の比較を行なう命令実行時間比較部である。7は目
的プログラムと、目的プログラム中で使用された命令と
同等な命令に変更したプログラムを実行する命令実行部
である。8は同等な処理パターンを検索する命令解析
部、9は同等な処理パターンが蓄積されたデータベース
部である。11は、最適化が行われた新目的プログラム
である。また、データベース部に複数の命令の処理パタ
ーンが格納されていていても実行可能である。
Example 1. FIG. 1 is an overall configuration diagram of a program optimization processing method in this embodiment. In FIG. 1, 10 is a general compiler flow. Reference numeral 1 is a compiler, 2 is a control unit, and 3 is an instruction execution time comparison unit, which is an optimization unit that selects an instruction having a fast instruction execution time (actual measurement value). Reference numeral 4 is a target program generation unit for converting into an instruction selected by the optimization unit, 5
Is an instruction fetch unit for fetching the instruction of the target program, 6
Is an instruction execution time comparison unit that compares execution times (actually measured values) of programs executed by the instruction execution unit. Reference numeral 7 denotes an instruction execution unit that executes the target program and a program modified into instructions equivalent to the instructions used in the target program. Reference numeral 8 is an instruction analysis unit that searches for equivalent processing patterns, and 9 is a database unit in which equivalent processing patterns are stored. Reference numeral 11 is a new-purpose program that has been optimized. Further, the processing can be executed even if the processing patterns of a plurality of instructions are stored in the database unit.

【0023】図2は、プログラム最適化処理方式の実行
手順を示すフローチャート図である。図3は、本実施例
で使用する利用者プログラムを示す図であり、図4は、
データベース部に格納されている処理パターンを示す図
である。ここで処理パターンとは、1つ以上の命令から
なる集合である。図5は、命令実行時間の測定手順を示
すフローチャート図である。
FIG. 2 is a flow chart showing the execution procedure of the program optimization processing method. FIG. 3 is a diagram showing a user program used in this embodiment, and FIG.
It is a figure which shows the processing pattern stored in the database part. Here, the processing pattern is a set of one or more instructions. FIG. 5 is a flowchart showing the procedure for measuring the instruction execution time.

【0024】この実施例では、目的プログラムで使用さ
れている命令と同等な命令の処理パターンが蓄積されて
いるデータベース部より、同等の処理パターンを検索す
る。そして、目的プログラムで使用された命令と、デー
タベース部に格納された同等な命令を実行し、比較する
ことにより、最適な命令の処理パターンを選択すること
を特徴としている。以下に詳細な説明を行う。
In this embodiment, an equivalent processing pattern is retrieved from a database section in which processing patterns of instructions equivalent to the instructions used in the target program are stored. The instruction pattern used in the target program and the equivalent instruction stored in the database unit are executed and compared to select the optimum instruction processing pattern. A detailed description will be given below.

【0025】図2、及び、図5のフローチャートに従
い、図3のプログラム例、及び、図4のデータベース部
の格納例を示す図を用いて、プログラム最適化処理方式
の手順を説明する。まず、図3のような利用者のプログ
ラムをコンパイルすると、目的プログラムが生成され、
S11がスタートし、目的プログラムで使用している各
命令を命令取り出し部5でトレースする。次に、トレー
スした命令が、データベース部9に格納されているか命
令解析部8で検索する。S12でトレースした命令が格
納されていなければ、命令は変更されない(S14)。
格納されていれば、S13で命令実行部7において、目
的プログラムの処理パターンと、使用された命令の処理
パターンと同等な命令の処理パターンを実行する。S1
5で実行された目的プログラム中の処理パターンと、同
等な命令の処理パターンの実行時間(実測値)を命令実
行時間比較部6で比較する。
The procedure of the program optimization processing method will be described with reference to the flow charts of FIGS. 2 and 5 and using the program example of FIG. 3 and the storage example of the database section of FIG. First, compiling the user's program as shown in Fig. 3 generates the target program,
S11 starts and each instruction used in the target program is traced by the instruction fetching section 5. Next, the instruction analysis unit 8 searches whether the traced instruction is stored in the database unit 9. If the instruction traced in S12 is not stored, the instruction is not changed (S14).
If it is stored, in S13, the instruction execution unit 7 executes the processing pattern of the target program and the processing pattern of the instruction equivalent to the processing pattern of the used instruction. S1
The instruction execution time comparison unit 6 compares the execution time (actual measurement value) of the processing pattern of the target program executed in 5 with the processing pattern of the equivalent instruction.

【0026】実行時間の比較は図5にある手順で行う。
まず、命令実行時間比較部6に命令をセットし(S1
9)、命令実行時間比較部6は、命令実行開始時間をタ
イマでチェックする(S20)。次に、命令の実行が終
了した時、終了時の時間をタイマでチェックして(S2
1)、開始時間と終了時間により、実行時間を算出する
(S22)。このS19〜S22までの処理を、目的プ
ログラムの処理パターンと、同等な命令の処理パターン
について行い、実行時間を算出し、これら算出した2つ
の実行時間を比較する。同等な命令の処理パターンの実
行時間(実測値)の方が低速であるなら、命令は変更さ
れない(S17)。目的プログラムの処理パターンの実
行時間(実測値)の方が低速であれば、データベース部
9に格納されている命令の処理パターンが最適化部3で
選択され、目的プログラム生成部4で選択された命令に
変換される(S16)。
The comparison of the execution times is performed by the procedure shown in FIG.
First, an instruction is set in the instruction execution time comparison unit 6 (S1
9), the instruction execution time comparison unit 6 checks the instruction execution start time with a timer (S20). Next, when the execution of the instruction is completed, the time at the end is checked by the timer (S2
1) The execution time is calculated from the start time and the end time (S22). The processing from S19 to S22 is performed for the processing pattern of the target program and the processing pattern of the equivalent instruction, the execution time is calculated, and these two calculated execution times are compared. If the execution time (measured value) of the processing pattern of the equivalent instruction is slower, the instruction is not changed (S17). If the execution time (measured value) of the processing pattern of the target program is slower, the processing pattern of the instruction stored in the database unit 9 is selected by the optimization unit 3 and selected by the target program generation unit 4. It is converted into an instruction (S16).

【0027】例えば、S12において、図4aの命令に
対する命令が図4bのようにデータベース部9に格納さ
れていてS15で実行時間の比較を行う。図4bの命令
の方が実行時間が速い場合は、S16で目的プログラム
中の図4aの命令が図4bの命令に変換されるようにな
る。全ての命令が終了するまで上記S11〜S17の処
理が繰り返され、最小の命令実行時間の新目的プログラ
ム11が生成される。また、データベース部に複数の命
令の処理パターンが格納されていても実行可能である。
For example, in S12, the instruction corresponding to the instruction of FIG. 4a is stored in the database unit 9 as shown in FIG. 4b, and the execution times are compared in S15. When the execution time of the instruction of FIG. 4b is faster, the instruction of FIG. 4a in the target program is converted into the instruction of FIG. 4b in S16. The above steps S11 to S17 are repeated until all the instructions are completed, and the new object program 11 with the minimum instruction execution time is generated. Further, it can be executed even if the processing patterns of a plurality of instructions are stored in the database unit.

【0028】以上のようにこの実施例では、目的プログ
ラムで使用された命令の処理の型(パターン)と同等な
命令の処理の型(パターン)が蓄積されたデータベース
部と、データベース部を検索する命令解析部と、目的プ
ログラムの処理パターンと同等な処理パターンの命令を
実行する命令実行部と、目的プログラムの処理パターン
と同等な処理パターンの命令実行時間を比較する命令実
行時間比較部とを有し、目的プログラムでの処理パター
ンと同等な処理パターンの命令実行時間の比較結果に基
づいて、より高速に実行されるよう命令の置換を行いプ
ログラムを最適化することを可能としている。
As described above, in this embodiment, the database section in which the instruction processing type (pattern) equivalent to the instruction processing type (pattern) used in the target program is stored and the database section are searched. It has an instruction analysis unit, an instruction execution unit that executes instructions with a processing pattern equivalent to the processing pattern of the target program, and an instruction execution time comparison unit that compares instruction execution times of processing patterns equivalent to the processing pattern of the target program. However, based on the result of comparison of the instruction execution times of the processing pattern equivalent to the processing pattern in the target program, the instructions can be replaced so that the program can be optimized so as to be executed at a higher speed.

【0029】実施例2.また、上記実施例1は、目的プ
ログラムの命令の処理パターンと、同等な処理パターン
の実行時間の比較を行ない、最適化を行うパターン最適
化手段である。しかし、パターンのみの実行ではなく、
プログラムで使用された命令の処理パターンと同等な命
令の処理パターンに置き換えた後のプログラム全体を実
行し、実行時間を比較することで最適化を行なうプログ
ラム最適化手段であればさらに有効な最適化が可能であ
る。
Example 2. Further, the first embodiment is a pattern optimizing means for performing optimization by comparing the execution time of the processing pattern of the instruction of the target program with the execution time of the equivalent processing pattern. However, instead of executing only the pattern,
A program optimizing means that performs optimization by executing the entire program after replacing it with an instruction processing pattern equivalent to the instruction processing pattern used in the program and comparing the execution times Is possible.

【0030】実施例3.また、上記実施例1では、命令
の置き換えによってプログラムの最適化を実現していた
が、命令の並び換えによってもプログラムの最適化を実
現できる。以下に詳細な説明を行う。
Example 3. Further, in the first embodiment, the program optimization is realized by replacing the instructions, but the program optimization can also be realized by rearranging the instructions. A detailed description will be given below.

【0031】図6は、本実施例で使用する利用者プログ
ラムを示す図であり、図7は、データベース部に格納さ
れている処理パターンを示す図である。図8は、本実施
例におけるプログラム最適化処理方式の実行手順を示す
フローチャート図である。尚、本実施例におけるプログ
ラム最適化処理方式の全体構成図は、図1と同様とす
る。
FIG. 6 is a diagram showing a user program used in this embodiment, and FIG. 7 is a diagram showing processing patterns stored in the database unit. FIG. 8 is a flow chart showing the execution procedure of the program optimization processing method in this embodiment. The overall block diagram of the program optimization processing method in this embodiment is the same as that in FIG.

【0032】次に、図8のフローチャートに従い、図6
のプログラム例、及び、図7のデータベース部の格納例
を示す図を用いて、プログラム最適化処理方式の手順を
説明する。まず、図6のような利用者プログラムをコン
パイルすると、目的プログラムが生成され、命令取り出
し部5で目的プログラムの各命令をトレースして(S1
1a)、トレースした命令がデータベース部9に格納さ
れているか検索する(S12a)。格納されている場合
は、命令実行部7において目的プログラムの処理パター
ンと、対応する処理パターンとを実行し、命令実行時間
比較部8においてこれら2つの実行時間を比較する(S
15a)。
Next, referring to the flow chart of FIG.
The procedure of the program optimization processing method will be described with reference to the program example of FIG. 7 and the storage example of the database unit of FIG. First, when a user program as shown in FIG. 6 is compiled, a target program is generated, and the instruction fetching unit 5 traces each instruction of the target program (S1
1a), it is searched whether the traced instruction is stored in the database unit 9 (S12a). If it is stored, the instruction execution unit 7 executes the processing pattern of the target program and the corresponding processing pattern, and the instruction execution time comparison unit 8 compares these two execution times (S).
15a).

【0033】例えば、図7のような処理パターンを記憶
しているデータベース部であったとすると、図7のcと
dをそれぞれ実行し、実行時間を比較する。比較した結
果、図7のcの方が高速である場合は、命令はそのまま
で(S17a)、図7のcの方が低速である場合は、目
的プログラム中の図7のcの処理パターンが、図7のd
の処理パターンに変換される(S16a)。図7のdの
処理パターンは、図7のcの処理パターン中の命令を並
び換えたものなので、上記S16aの処理では、目的プ
ログラム中のある処理パターンを並び換えたことにな
る。
For example, if the database section stores the processing patterns as shown in FIG. 7, c and d in FIG. 7 are executed and the execution times are compared. As a result of the comparison, if c in FIG. 7 is faster, the instruction remains unchanged (S17a), and if c in FIG. 7 is slower, the processing pattern in c in FIG. , D in FIG.
Is converted into the processing pattern (S16a). Since the processing pattern of d of FIG. 7 is a rearrangement of the instructions in the processing pattern of c of FIG. 7, it means that a certain processing pattern in the target program is rearranged in the processing of S16a.

【0034】以上のように、この実施例は、データベー
スに格納されている処理パターンを用いて、命令の並べ
換えを行ったものである。命令実行時間を比較して、命
令を並べ換えた処理パターンに置き換えるということ
は、プログラム中に現れる命令をさらに効率のよい順
に、自動的に並べ換えていることになる。
As described above, in this embodiment, the instructions are rearranged by using the processing patterns stored in the database. By comparing the instruction execution times and replacing the instructions with the rearranged processing pattern, the instructions appearing in the program are automatically rearranged in a more efficient order.

【0035】実施例4.また、上記実施例1の最適化の
方式は、命令の処理パターンの最適化であり、この方式
を用いてプログラムで使用するアドレスを変更し、最適
なアドレスに配置することも可能である。以下に詳細な
説明を行う。
Example 4. In addition, the optimization method of the first embodiment is an optimization of the instruction processing pattern, and it is possible to change the address used in the program by using this method and arrange it at the optimum address. A detailed description will be given below.

【0036】図9は、本実施例で使用する利用者プログ
ラムを示す図であり、図10は、データベース部に格納
されている処理パターンを示す図である。図11は、本
実施例におけるプログラム最適化処理方式の実行手順を
示すフローチャート図である。尚、本実施例におけるプ
ログラム最適化処理方式の全体構成図は、図1と同様と
する。
FIG. 9 is a diagram showing a user program used in this embodiment, and FIG. 10 is a diagram showing processing patterns stored in the database section. FIG. 11 is a flowchart showing the execution procedure of the program optimization processing method in this embodiment. The overall block diagram of the program optimization processing method in this embodiment is the same as that in FIG.

【0037】次に、図11のフローチャートに従い、図
9のプログラム例、及び、図10のデータベース部の格
納例を示す図を用いて、プログラム最適化処理方式の手
順を説明する。まず、図9のような利用者プログラムを
コンパイルすると、目的プログラムが生成され、命令取
り出し部5で目的プログラムの各命令をトレースして
(S11b)、トレースした命令がデータベース部9に
格納されているか検索し(S12b)、格納されている
場合は、命令実行部7において目的プログラムの処理パ
ターンと、対応する処理パターンとを実行し、命令実行
時間比較部8においてこれら2つの実行時間を比較する
(S15b)。
Next, the procedure of the program optimization processing method will be described with reference to the flow chart of FIG. 11 and using the program example of FIG. 9 and the storage example of the database section of FIG. First, when a user program as shown in FIG. 9 is compiled, a target program is generated, each instruction of the target program is traced by the instruction fetching section 5 (S11b), and the traced instruction is stored in the database section 9? If it is retrieved (S12b) and stored, the instruction execution unit 7 executes the processing pattern of the target program and the corresponding processing pattern, and the instruction execution time comparison unit 8 compares these two execution times ( S15b).

【0038】例えば、図10のような処理パターンを記
憶しているデータベース部であったとすると、図10の
eとfをそれぞれ実行し、実行時間を比較する。比較し
た結果、図10eの方が高速である場合は、命令はその
ままで(S17b)、図10eの方が低速である場合
は、目的プログラム中の図10eのような処理パターン
が、図10fの処理パターンに変換される(S16
b)。この場合、この変更によって目的プログラム中の
命令アドレスが「NOOP」命令の分だけずれるので、
パイプライン制御の計算機でこの命令を実行する際、遅
れは生じない。
For example, if the database section stores the processing patterns as shown in FIG. 10, the steps e and f in FIG. 10 are executed and the execution times are compared. As a result of the comparison, when the speed of FIG. 10e is higher, the instruction remains unchanged (S17b), and when the speed of FIG. 10e is lower, the processing pattern of FIG. Converted to a processing pattern (S16)
b). In this case, this change causes the instruction address in the target program to shift by the amount of the "NOOP" instruction.
There is no delay in executing this instruction on a pipeline controlled computer.

【0039】以上のように、この実施例は、目的プログ
ラム実行結果に基づいて命令置換を行うと同時に、命令
のアドレス変更を行なう最適化方式を可能にしている。
As described above, this embodiment enables the optimization method in which the instruction address is changed at the same time as the instruction replacement is performed based on the result of execution of the object program.

【0040】実施例5.また、上記実施例1の最適化の
方式では、命令の処理パターンの最適化を行う場合、命
令置換を行っていたが、本実施例では、上記実施例1と
同様の最適化手段を用いて、プログラムで使用する一つ
の命令の変更を行なうことを特徴としている。以下に詳
細な説明を行う。
Example 5. In the optimization method of the first embodiment, when the instruction processing pattern is optimized, the instruction replacement is performed. However, in the present embodiment, the same optimization means as in the first embodiment is used. The feature is that one instruction used in the program is changed. A detailed description will be given below.

【0041】図12は、本実施例で使用する利用者プロ
グラムを示す図であり、図13は、データベース部に格
納されている命令を示す図である。図14は、本実施例
におけるプログラム最適化処理方式の実行手順を示すフ
ローチャート図である。尚、本実施例におけるプログラ
ム最適化処理方式の全体構成図は、図1と同様とする。
FIG. 12 is a diagram showing a user program used in this embodiment, and FIG. 13 is a diagram showing instructions stored in the database unit. FIG. 14 is a flow chart showing the execution procedure of the program optimization processing method in this embodiment. The overall block diagram of the program optimization processing method in this embodiment is the same as that in FIG.

【0042】次に、図14のフローチャートに従い、図
12のプログラム例、及び、図13のデータベース部の
格納例を示す図を用いて、プログラム最適化処理方式の
手順を説明する。まず、図12のような利用者プログラ
ムをコンパイルすると目的プログラムが生成され、命令
取り出し部5で目的プログラムの各命令をトレースして
DIVIDE命令を読み取る(S11c)。命令解析部
8によりDIVIDE命令がデータベース部9に格納さ
れているか検索し(S12c)、格納されていない場合
は命令はそのままにする。格納されている場合は、命令
実行部7において目的プログラムの処理パターンと対応
する処理パターンとを実行する。命令実行時間比較部8
においてこれら2つの実行時間を測定し(S13c)、
測定した実行時間を比較する(S15c)。
Next, the procedure of the program optimization processing method will be described with reference to the flow chart of FIG. 14 and using the program example of FIG. 12 and the storage example of the database section of FIG. First, a user program as shown in FIG. 12 is compiled to generate a target program, and the instruction fetching section 5 traces each command of the target program to read the DIVIDE command (S11c). The instruction analysis unit 8 searches for the DIVIDE instruction stored in the database unit 9 (S12c). If the DIVIDE instruction is not stored, the instruction is left as it is. If it is stored, the instruction execution unit 7 executes the processing pattern of the target program and the corresponding processing pattern. Instruction execution time comparison unit 8
And measure these two execution times in (S13c),
The measured execution times are compared (S15c).

【0043】例えば、図13のような処理パターンを記
憶しているデータベース部であったとする。まず、図1
3のDIVIDE命令gを実行し、更に対応する命令で
あるSHIFT命令hを実行し、実行時間を測定する。
測定した2つの実行時間を比較して、図13のgの方が
高速である場合は、命令はそのままにする(S17
c)。図13のgの実行時間の方が低速である場合は、
目的プログラム中の図13のgの命令を図13のhの命
令に変換する(S16c)。
For example, it is assumed that the database section stores the processing pattern as shown in FIG. First, Fig. 1
The DIVIDE command g of No. 3 is executed, and the corresponding SHIFT command h is executed to measure the execution time.
The two measured execution times are compared, and if g in FIG. 13 is faster, the instruction is left as it is (S17).
c). When the execution time of g in FIG. 13 is slower,
The instruction of g in FIG. 13 in the target program is converted into the instruction of h in FIG. 13 (S16c).

【0044】このように命令取り出し部5で、取り出さ
れた命令(S11c)が2のべき乗による除算(固定小
数点除算)命令であるとすると、命令解析部8が、デー
タベース部9から同等の処理を行なう命令であるシフト
命令を検索する。次に、検索したシフト命令と除算命令
とを、命令実行部7で実行する。実行した結果、命令実
行時間比較部6で命令実行時間を比較する。固定小数点
除算は一般に低速であるため、実行時間の速いシフト命
令が、命令実行時間比較部6により選択される。選択し
た結果に基づいて、最適化部3は目的プログラムの命令
(除算命令)の変換を行ない、目的プログラムは最適化
され新目的プログラムが生成される。
Assuming that the instruction fetched by the instruction fetching section 5 (S11c) is a division by a power of 2 (fixed point division) instruction, the instruction analyzing section 8 executes an equivalent process from the database section 9. Search for a shift instruction that is an instruction to execute. Next, the instruction execution unit 7 executes the retrieved shift instruction and division instruction. As a result of execution, the instruction execution time comparison unit 6 compares the instruction execution times. Since fixed-point division is generally low-speed, the instruction execution time comparison unit 6 selects a shift instruction having a short execution time. Based on the selected result, the optimization unit 3 converts the instruction (division instruction) of the target program, the target program is optimized, and a new target program is generated.

【0045】上記実施例1〜4では、目的プログラム中
の複数の命令のかたまりを処理パターンとして扱ってい
たが、この実施例では目的プログラム中の一つの命令に
対しても、実施例1の最適化手段が使えることを示して
いる。
In the above-described first to fourth embodiments, a group of a plurality of instructions in the target program is treated as a processing pattern. However, in this embodiment, even if one instruction in the target program is processed, the optimum operation of the first embodiment is performed. It shows that the means of conversion can be used.

【0046】実施例6.この実施例では、データベース
部の中に第1の処理パターンと、これに対応する第2の
処理パターンの実行時間を、プログラムを実行する機種
毎に格納することにより、上記実施例1の図1から命令
実行部7を無くした事を特徴としている。以下に詳細な
説明を行う。
Example 6. In this embodiment, the execution times of the first processing pattern and the second processing pattern corresponding to the first processing pattern are stored in the database section for each machine type that executes the program, so that the execution time of FIG. It is characterized in that the instruction execution unit 7 is eliminated from the above. A detailed description will be given below.

【0047】図15は本実施例におけるプログラム最適
化処理方式の全体構成図である。図15において、全体
構成図を構成する構成要件は、上記実施例1の図1と同
様であるが、命令実行部7が存在しない。また、データ
ベース部9aには、第1の処理パターンと、これに対応
する第2の処理パターンの実行時間を、プログラムを実
行する機種毎に格納している。図16は、データベース
部に格納されている格納内容を示す図であり、図17
は、本実施例におけるプログラム最適化処理方式の実行
手順を示すフローチャート図である。
FIG. 15 is an overall block diagram of the program optimization processing system in this embodiment. In FIG. 15, the constituent elements that make up the overall configuration diagram are the same as those in FIG. 1 of the first embodiment, but the instruction execution unit 7 does not exist. The database unit 9a also stores the execution times of the first processing pattern and the corresponding second processing pattern for each model that executes the program. FIG. 16 is a diagram showing the stored contents stored in the database unit.
FIG. 7 is a flow chart diagram showing an execution procedure of a program optimization processing method in the present embodiment.

【0048】次に、図17のフローチャートに従い、プ
ログラム最適化処理方式の手順を説明する。尚、この実
施例では、使用する利用者プログラムは上記実施例5と
同様に、図12に示されている図と同様のプログラムを
使用し、また、このプログラムをコンパイルして実行す
る実行機種を機種Aと想定する。初めに、実際にコンパ
イルされたプログラムを実行する機種をコンパイル時に
指定する(S10)。命令取り出し部5が目的プログラ
ムから命令を取り出し、命令解析部8が、データベース
部9aからその命令に対応する命令を検索する(S11
d)。検索した結果、対応する機種、命令が格納されて
いれば、その格納されている命令の実行時間を、命令実
行時間比較部6で比較する(S13d)。命令実行時間
比較部6では、検索した命令中最も高速な命令を選択し
(S15d)、その命令に変更する(S16d)。
Next, the procedure of the program optimization processing method will be described with reference to the flowchart of FIG. In this embodiment, the user program to be used uses the same program as that shown in FIG. 12 as in the fifth embodiment, and the execution model for compiling and executing this program is Assume model A. First, the model that executes the actually compiled program is specified at the time of compilation (S10). The instruction fetching section 5 fetches an instruction from the target program, and the instruction analyzing section 8 searches the database section 9a for an instruction corresponding to the instruction (S11).
d). As a result of the search, if the corresponding model and instruction are stored, the instruction execution time comparison unit 6 compares the execution times of the stored instructions (S13d). The instruction execution time comparison unit 6 selects the fastest instruction among the retrieved instructions (S15d) and changes it to that instruction (S16d).

【0049】例えば、図12の利用者プログラムをコン
パイルして作成した目的プログラムより、命令取り出し
部5がDIVIDE命令を取り出し、命令解析部8が図
16のようなデータベース部より、機種が「A」である
DIVIDE命令を検索する。機種AのDIVIDE命
令は存在しているので、命令実行時間比較部6でDIV
IDE命令に対する実行時間TimeAと、SHIFT
命令に対応する実行時間TimeBとを比較する。Ti
meA>TimeBであれば、DIVIDE命令をSH
IFT命令に置換する。目的プログラムの命令が最も高
速である時には変更しない(S17d)。また、対応す
る命令がデータベース中に格納されていない時も、命令
は変更しない。このように、全ての命令が終了するまで
S10〜S17dまでの処理が繰り返され、任意の機種
に対する最小の命令実行時間の新目的プログラムが生成
される。
For example, the instruction fetching section 5 fetches a DIVIDE instruction from the target program created by compiling the user program shown in FIG. 12, and the instruction analyzing section 8 fetches the "A" from the database section as shown in FIG. For the DIVIDE command. Since the DIVIDE command of the model A exists, the DIVIDE command is executed by the command execution time comparison unit 6.
Execution time for IDE command TimeA and SHIFT
The execution time TimeB corresponding to the instruction is compared. Ti
If meA> TimeB, the DIVIDE command is SH
Replace with IFT instruction. It is not changed when the instruction of the target program is the fastest (S17d). It also does not change the instruction when the corresponding instruction is not stored in the database. In this way, the processing from S10 to S17d is repeated until all the instructions are completed, and the new target program with the minimum instruction execution time for any model is generated.

【0050】以上のように、この実施例は、機種、命
令、命令実行時間というテーブルの構造を有すデータベ
ース部を設け、このデータベース部に複数種類の機種の
命令、命令実行時間を格納している。そして、命令取り
出し部と命令解析部において、目的プログラムと同等の
処理パターンを検索する。コンパイルしたプログラムを
実行したい機種のデータがデータベース部に格納されて
いれば、実際に処理パターンを実行してその実行時間を
比較するのではなく、データベース部に予め格納された
実行時間を比較することによって最適化を行うことを特
徴としている。
As described above, this embodiment is provided with a database section having a table structure of machine types, instructions and instruction execution times, and stores the instructions and instruction execution times of a plurality of types of machines in this database section. There is. Then, the instruction fetch section and the instruction analysis section search for a processing pattern equivalent to the target program. If the data of the model you want to execute the compiled program is stored in the database part, do not actually execute the processing pattern and compare the execution time, but compare the execution time stored in advance in the database part. It is characterized by performing optimization by.

【0051】実施例7.ここで、図1中の10は、コン
パイラの一例で、必ずしもこの流れでなくとも良い。例
えば、構文解析〜中間ファイル作成処理を2回行うよう
な言語を用いて作成された原始プログラムより目的プロ
グラムを作成する場合には、図1の10は図18の10
aのような流れになる。このような流れでも、目的プロ
グラムを最適化する方式は上記実施例1〜6のどの方式
でも可能である。
Example 7. Here, 10 in FIG. 1 is an example of a compiler, and the flow is not necessarily required. For example, when a target program is created from a source program created using a language in which syntax analysis-intermediate file creation processing is performed twice, 10 in FIG.
It becomes the flow like a. Even in such a flow, the method of optimizing the target program can be any method of the above-described first to sixth embodiments.

【0052】[0052]

【発明の効果】以上のように、この発明によれば、個々
の命令の最適化ではなく、プログラム全体をより高速に
するような最適化が行えるという効果がある。また、使
用する計算機の種類に依存せず、コンパイラ設計者が命
令実行時間(推定実行時間)を把握せずに、最適化が行
えるという効果がある。
As described above, according to the present invention, it is possible to optimize not the individual instructions but the entire program to be faster. Further, there is an effect that the compiler designer can perform the optimization without depending on the type of the computer to be used and without knowing the instruction execution time (estimated execution time).

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

【図1】この発明の実施例1におけるプログラム最適化
処理方式の全体構成図である。
FIG. 1 is an overall configuration diagram of a program optimization processing system according to a first embodiment of the present invention.

【図2】この発明の実施例1におけるプログラム最適化
処理方式の実行手順を示すフローチャート図である。
FIG. 2 is a flowchart showing an execution procedure of a program optimization processing method according to the first embodiment of the present invention.

【図3】この発明の実施例1における利用者プログラム
を示す図である。
FIG. 3 is a diagram showing a user program according to the first embodiment of the present invention.

【図4】この発明の実施例1におけるデータベース部に
格納されている処理パターンを示す図である。
FIG. 4 is a diagram showing processing patterns stored in a database unit according to the first embodiment of the present invention.

【図5】この発明の実施例1における命令実行時間の測
定手順を示すフローチャート図である。
FIG. 5 is a flowchart showing a procedure for measuring instruction execution time according to the first embodiment of the present invention.

【図6】この発明の実施例3における利用者プログラム
を示す図である。
FIG. 6 is a diagram showing a user program according to a third embodiment of the present invention.

【図7】この発明の実施例3におけるデータベース部に
格納されている処理パターンを示す図である。
FIG. 7 is a diagram showing processing patterns stored in a database unit according to the third embodiment of the present invention.

【図8】この発明の実施例3におけるプログラム最適化
処理方式の実行手順を示すフローチャート図である。
FIG. 8 is a flowchart showing an execution procedure of a program optimizing processing method according to the third embodiment of the present invention.

【図9】この発明の実施例4における利用者プログラム
を示す図である。
FIG. 9 is a diagram showing a user program in Embodiment 4 of the present invention.

【図10】この発明の実施例4におけるデータベース部
に格納されている処理パターンを示す図である。
FIG. 10 is a diagram showing processing patterns stored in a database unit according to the fourth embodiment of the present invention.

【図11】この発明の実施例4におけるプログラム最適
化処理方式の実行手順を示すフローチャート図である。
FIG. 11 is a flowchart showing an execution procedure of a program optimizing processing method according to the fourth embodiment of the present invention.

【図12】この発明の実施例5における利用者プログラ
ムを示す図である。
FIG. 12 is a diagram showing a user program in Embodiment 5 of the present invention.

【図13】この発明の実施例5におけるデータベース部
に格納されている命令を示す図である。
FIG. 13 is a diagram showing instructions stored in a database unit according to the fifth embodiment of the present invention.

【図14】この発明の実施例5におけるプログラム最適
化処理方式の実行手順を示すフローチャート図である。
FIG. 14 is a flowchart showing an execution procedure of a program optimizing processing method according to the fifth embodiment of the present invention.

【図15】この発明の実施例6におけるプログラム最適
化処理方式の全体構成図である。
FIG. 15 is an overall configuration diagram of a program optimization processing method according to a sixth embodiment of the present invention.

【図16】この発明の実施例6におけるデータベース部
に格納されている機種別処理パターン別実行時間を示す
図である。
FIG. 16 is a diagram showing execution time by processing pattern for each model stored in a database unit according to the sixth embodiment of the present invention.

【図17】この発明の実施例6におけるプログラム最適
化処理方式の実行手順を示すフローチャート図である。
FIG. 17 is a flowchart showing an execution procedure of a program optimizing processing method according to the sixth embodiment of the present invention.

【図18】この発明の実施例7におけるコンパイラの流
れを示す図である。
FIG. 18 is a diagram showing a flow of a compiler in the seventh embodiment of the present invention.

【図19】従来例におけるプログラム最適化処理方式の
全体構成図である。
FIG. 19 is an overall configuration diagram of a conventional program optimization processing method.

【図20】従来例におけるプログラム最適化処理方式の
実行手順を示すフローチャート図である。
FIG. 20 is a flowchart showing a procedure of executing a program optimization processing method in a conventional example.

【符号の説明】[Explanation of symbols]

1,19 コンパイラ 2,20 制御部 3,22 最適化部 4,23 目的プログラム生成部 5,21 命令取り出し部 6 命令実行時間比較部 7 命令実行部 8 命令解析部 9 データベース部 10 一般的なコンパイラの流れ 11 新目的プログラム 24 命令実行時間解析部 25 命令実行時間格納テーブル 1, 19 compiler 2, 20 control unit 3, 22 optimization unit 4, 23 target program generation unit 5, 21 instruction fetch unit 6 instruction execution time comparison unit 7 instruction execution unit 8 instruction analysis unit 9 database unit 10 general compiler Flow 11 New purpose program 24 Instruction execution time analysis unit 25 Instruction execution time storage table

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 以下の要素を有するプログラム最適化処
理方式 (a)同等の機能をはたし、同等の処理結果を得る第1
と第2の処理パターンを対応させて記憶する記憶手段、 (b)目的プログラムを入力し、その目的プログラムに
用いられた命令の処理パターンを取り出す命令取り出し
手段、 (c)上記記憶手段に記憶された第1の処理パターン
と、上記命令取り出し手段により取り出された目的プロ
グラムの処理パターンの一致を検出する命令解析手段、 (d)上記命令解析手段により検出された目的プログラ
ムの処理パターンの命令を実行するとともに、上記第1
の処理パターンに対応する第2の処理パターンの命令を
実行する命令実行手段、 (e)上記命令実行手段による第1と第2の処理パター
ンの命令実行時間を比較する実行時間比較手段、 (f)上記実行時間比較手段による比較結果に基づい
て、目的プログラムを第2の処理パターンを用いて最適
化する最適化手段。
1. A program optimization processing method having the following elements: (a) A first function which has equivalent functions and obtains equivalent processing results.
Storage means for storing the second processing pattern and the second processing pattern in association with each other, (b) an instruction fetching means for inputting a target program and taking out a processing pattern of a command used in the target program, (c) stored in the storage means A first processing pattern and an instruction analyzing means for detecting a match between the processing pattern of the target program extracted by the instruction extracting means, and (d) executing an instruction of the processing pattern of the target program detected by the instruction analyzing means. In addition to the above
Instruction executing means for executing an instruction of the second processing pattern corresponding to the processing pattern of (e) execution time comparing means for comparing the instruction execution times of the first and second processing patterns by the instruction executing means, ) Optimizing means for optimizing the target program using the second processing pattern based on the comparison result by the execution time comparing means.
【請求項2】 上記命令実行手段は、目的プログラム全
体を実行するとともに、上記実行時間比較手段は、目的
プログラム全体の実行時間の比較を行なうことを特徴と
する請求項1記載のプログラム最適化処理方式。
2. The program optimizing process according to claim 1, wherein the instruction executing means executes the entire target program, and the execution time comparing means compares the execution times of the entire target program. method.
【請求項3】 上記記憶手段は、複数の命令が所定順に
並んだ第1の処理パターンに対して、これら命令の並び
換えを行なった第2の処理パターンを記憶することを特
徴とする請求項1記載のプログラム最適化処理方式。
3. The storage means stores, for a first processing pattern in which a plurality of instructions are arranged in a predetermined order, a second processing pattern obtained by rearranging these instructions. 1. The program optimization processing method described in 1.
【請求項4】 上記記憶手段は、複数の命令が所定順に
並んだ第1の処理パターンに対して、これら命令の相対
的位置を変更した第2の処理パターンを記憶することを
特徴とする請求項1記載のプログラム最適化処理方式。
4. The storage means stores a second processing pattern in which the relative positions of these instructions are changed with respect to the first processing pattern in which a plurality of instructions are arranged in a predetermined order. The program optimization processing method according to item 1.
【請求項5】 上記記憶手段は、第1及び第2の処理パ
ターンのいずれかが少なくともひとつの命令で構成され
ていることを特徴とする請求項1記載のプログラム最適
化処理方式。
5. The program optimization processing method according to claim 1, wherein said storage means is configured by at least one of one of the first and second processing patterns.
【請求項6】 以下の要素を有するプログラム最適化処
理方式 (a)他機種の同等の機能をはたし、同等の処理結果を
得る第1と第2の処理パターンを記憶するとともに、第
1と第2の処理パターンの実行時間を記憶する記憶手
段、 (b)目的プログラムを入力し、その目的プログラムに
用いられた命令の処理パターンを取り出す命令取り出し
手段、 (c)上記記憶手段に記憶された第1の処理パターン
と、上記命令取り出し手段により取り出された目的プロ
グラムの処理パターンの一致を検出する命令解析手段、 (d)上記命令解析手段により検出された第1の処理パ
ターンと、第1の処理パターンと同等の機能をはたす第
2の処理パターンの実行時間を、上記記憶手段が記憶し
た実行時間から検索して比較する実行時間比較手段、 (f)上記実行時間比較手段による比較結果に基づい
て、目的プログラムを第2の処理パターンを用いて最適
化する最適化手段。
6. A program optimization processing method having the following elements: (a) The first and second processing patterns that have the same functions as those of other models and obtain the same processing result are stored, and And a storage means for storing the execution time of the second processing pattern, (b) an instruction fetching means for inputting a target program and fetching a processing pattern of a command used in the target program, (c) stored in the storage means. A first processing pattern and a command analyzing means for detecting a match between the processing patterns of the target program fetched by the command fetching means, (d) the first processing pattern detected by the command analyzing means, and Execution time comparing means for searching and comparing the execution time of the second processing pattern having a function equivalent to that of the processing pattern from the execution time stored in the storage means, Based on the comparison result by the execution time comparing means, optimizing means for optimizing using the second processing pattern object program.
【請求項7】 上記記憶手段は、複数の機種に対応して
上記第1と第2の処理パターンと実行時間を記憶するこ
とを特徴とする請求項6記載のプログラム最適化処理方
式。
7. The program optimization processing method according to claim 6, wherein said storage means stores said first and second processing patterns and execution times corresponding to a plurality of models.
JP16354393A 1993-07-01 1993-07-01 Program optimization processing system Pending JPH0721032A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16354393A JPH0721032A (en) 1993-07-01 1993-07-01 Program optimization processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16354393A JPH0721032A (en) 1993-07-01 1993-07-01 Program optimization processing system

Publications (1)

Publication Number Publication Date
JPH0721032A true JPH0721032A (en) 1995-01-24

Family

ID=15775892

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16354393A Pending JPH0721032A (en) 1993-07-01 1993-07-01 Program optimization processing system

Country Status (1)

Country Link
JP (1) JPH0721032A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000284970A (en) * 1999-03-29 2000-10-13 Matsushita Electric Ind Co Ltd Program converting device and processor
WO2006082878A1 (en) * 2005-02-03 2006-08-10 Mitsubishi Denki Kabushiki Kaisha Program code generation support device and method, program execution device and method, program code compression device and method, program for the same
JP2006215826A (en) * 2005-02-03 2006-08-17 Mitsubishi Electric Corp Program code generation supporting device and method, and program for program code generation supporting method
US7707568B2 (en) 2004-05-25 2010-04-27 International Business Machines Corporation Compiler optimization
US8296750B2 (en) 2006-10-11 2012-10-23 International Business Machines Corporation Optimization of a target program
US8448158B2 (en) 2005-02-03 2013-05-21 Mitsubishi Electric Corporation Program code generation support device and method, program execution device and method, and program code compression processing device and method and program thereof

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000284970A (en) * 1999-03-29 2000-10-13 Matsushita Electric Ind Co Ltd Program converting device and processor
US7707568B2 (en) 2004-05-25 2010-04-27 International Business Machines Corporation Compiler optimization
WO2006082878A1 (en) * 2005-02-03 2006-08-10 Mitsubishi Denki Kabushiki Kaisha Program code generation support device and method, program execution device and method, program code compression device and method, program for the same
JP2006215826A (en) * 2005-02-03 2006-08-17 Mitsubishi Electric Corp Program code generation supporting device and method, and program for program code generation supporting method
KR100902461B1 (en) * 2005-02-03 2009-06-11 미쓰비시덴키 가부시키가이샤 Program code generation support device and method, program execution device and method, program code compression device and method, program for the same
JP4638250B2 (en) * 2005-02-03 2011-02-23 三菱電機株式会社 Program code generation support apparatus and method, and program code generation support method program
US8448158B2 (en) 2005-02-03 2013-05-21 Mitsubishi Electric Corporation Program code generation support device and method, program execution device and method, and program code compression processing device and method and program thereof
US8527967B2 (en) 2005-02-03 2013-09-03 Mitsubishi Electric Corporation Program code compression processing device and method and program thereof
US8572557B2 (en) 2005-02-03 2013-10-29 Mitsubishi Electric Corporation Program code generation support device and method, program execution device and method, and program code compression processing device and method and program thereof
US8296750B2 (en) 2006-10-11 2012-10-23 International Business Machines Corporation Optimization of a target program

Similar Documents

Publication Publication Date Title
CN109254776B (en) Multi-language code compiling method and compiler
JP2749528B2 (en) Tracer system for error analysis
US6954747B1 (en) Methods for comparing versions of a program
CN113641701B (en) Data query method, system, heterogeneous acceleration platform and storage medium
JP2004102597A (en) Compile processing program, compile processing method, and compile processing program recording medium
Kohn et al. Making compiling query engines practical
JPH0721032A (en) Program optimization processing system
WO1995032476A1 (en) A system and method for creating design configurations and for controlling the execution of multiple design tools
GB2420638A (en) Method of substituting code fragments in Internal Representation
JPH06250877A (en) Device for sampling execution information
JPH0756745A (en) Compiler processing system for language processing program
JP2000231478A (en) Device and method for automatic generation of software and recording medium
JP2002312167A (en) Program for making computer calculate value of variable, compile program, variable value determining method, and program generating method
CN118092936A (en) Method and system for generating visual data stream
CN117609103A (en) Automatic mapping method for large-scale low-code system model verification based on VIATRA
JPH11327887A (en) Compiler system with automatic parts converting function and recording medium
JP3004709B2 (en) Error correction support system for knowledge editor
JP2003067195A (en) Optimization compile method and optimization compile device
JPH05204699A (en) Identifier searching system at debugging
JPH04252336A (en) Program optimization processor
JPH10133866A (en) Method for shift conversion processing
JP3367438B2 (en) Conditional execution processing device
JP2751423B2 (en) Program debug processing method
JPH06242942A (en) Source code level debugging device
JPH08314724A (en) Object-oriented program editing device