JP2001216168A - Program converter, program converting method and program storage medium - Google Patents

Program converter, program converting method and program storage medium

Info

Publication number
JP2001216168A
JP2001216168A JP2000028277A JP2000028277A JP2001216168A JP 2001216168 A JP2001216168 A JP 2001216168A JP 2000028277 A JP2000028277 A JP 2000028277A JP 2000028277 A JP2000028277 A JP 2000028277A JP 2001216168 A JP2001216168 A JP 2001216168A
Authority
JP
Japan
Prior art keywords
instruction sequence
program
basic block
common
sequence set
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.)
Granted
Application number
JP2000028277A
Other languages
Japanese (ja)
Other versions
JP3650713B2 (en
Inventor
Hiroji Nakajima
廣二 中嶋
Kensuke 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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2000028277A priority Critical patent/JP3650713B2/en
Publication of JP2001216168A publication Critical patent/JP2001216168A/en
Application granted granted Critical
Publication of JP3650713B2 publication Critical patent/JP3650713B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a program converter to generate a program to minimize execution time by minimizing increase of the number of branching instructions to be executed in a program after tail merge is optimized. SOLUTION: This program converter is provided with an extracting means 309 to extract a set of common instructions 307, 308, 309 hierarchically exiting from the tail end of plural basic blocks 301, 302, 303 304, 305 to be unconditionally branched to the same basic block 306 to the head by targeting at them, a selecting means to select one basic block in each of the extracted set of common instruction strings according to positional relation of the basic blocks in which instruction strings are included and a code converting means to convert the program so that the instruction string to be included in the selected basic block is shared.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、コンピュータプロ
グラムの変換技術に関し、特にプログラムの最適化技術
に関する。
[0001] 1. Field of the Invention [0002] The present invention relates to a computer program conversion technique, and more particularly to a program optimization technique.

【0002】[0002]

【従来の技術】近年、ソフトウェア開発においては、開
発効率、および保守性向上を指向して高水準言語を用い
た開発が主流となっている。しかしながら、このような
高水準言語からコンパイラが生成する目的プログラム
は、アセンブラ等を用いて人間が作成する目的プログラ
ムに比べると、一般に実行時間がより長くコードサイズ
がより大きい。このため、実行時間がより短くコードサ
イズがより小さいプログラムを生成することが、コンパ
イラに求められている。特に、記憶容量が厳しく制限さ
れる実行環境において稼動するプログラム、例えば組込
み用途などのプログラムについては、コードサイズ削減
への強い要請がある。
2. Description of the Related Art In recent years, in software development, development using a high-level language has become mainstream in order to improve development efficiency and maintainability. However, a target program generated by a compiler from such a high-level language generally has a longer execution time and a larger code size than a target program created by a human using an assembler or the like. For this reason, it is required for a compiler to generate a program having a shorter execution time and a smaller code size. In particular, there is a strong demand for code size reduction for programs that operate in an execution environment where storage capacity is severely limited, for example, programs for embedded applications.

【0003】実行時間を短縮しかつコードサイズを削減
する目的でプログラムを変換すること、または、実行時
間またはコードサイズの一方を改善する目的でプログラ
ムを変換することを最適化という。実行時間またはコー
ドサイズの一方を改善する最適化においては、実行時間
を短縮することによってコードサイズが増大する場合
や、コードサイズを削減することによって実行時間が増
加する場合があり得る。
[0003] The conversion of a program for the purpose of reducing the execution time and the code size or the conversion of the program for the purpose of improving either the execution time or the code size is called optimization. In the optimization for improving either the execution time or the code size, the code size may be increased by reducing the execution time, or the execution time may be increased by reducing the code size.

【0004】最適化を行うための様々な技術が公知とな
っており、その中で、コードサイズを削減するものの1
つに共通命令列合流最適化(テールマージ最適化ともい
う)がある。テールマージ最適化とは、同一の基本ブロ
ックに無条件に制御を移す複数の基本ブロックの後尾に
ある同一の命令列のうち、1の命令列が共用されるよう
にプログラムを変換してコードサイズを削減する技法で
ある。前記同一の命令列を要素とする集合を、以下、共
通命令列集合と称する。
[0004] Various techniques for performing optimization are known. Among them, one technique for reducing the code size is known.
One is common instruction sequence merging optimization (also called tail merge optimization). Tail merge optimization is a code size conversion by converting a program so that one instruction sequence is shared among the same instruction sequences at the end of a plurality of basic blocks that unconditionally transfer control to the same basic block. Is a technique to reduce The set having the same instruction sequence as an element is hereinafter referred to as a common instruction sequence set.

【0005】ここで、基本ブロックとは、一連の命令列
であって、途中の命令から分岐せずかつ途中の命令へ分
岐されることもない最長の命令列をいう。図19は、テ
ールマージ最適化前後のプログラムの例を示しており、
1100aは最適化前のプログラム、1100bは最適
化後のプログラム、1101a、1101b、1102
a、1102b、1103、1104は基本ブロック、
1105は共通命令列集合、1106は共用される命令
列、1107〜1110は分岐命令である。
Here, the basic block is a series of instruction strings, and is the longest instruction string that does not branch from an intermediate instruction and does not branch to an intermediate instruction. FIG. 19 shows examples of programs before and after tail merge optimization.
1100a is a program before optimization, 1100b is a program after optimization, 1101a, 1101b, 1102
a, 1102b, 1103, and 1104 are basic blocks;
1105 is a common instruction sequence set, 1106 is a shared instruction sequence, and 1107 to 1110 are branch instructions.

【0006】従来のコンパイラは、この例のテールマー
ジ最適化において、共通命令列集合1105について基
本ブロック1102aに含まれる共通命令列を残し、基
本ブロック1101aに含まれる共通命令列を削除し、
分岐命令1107の分岐先を変更して前記残した命令列
1106が実行されるよう、プログラムを変換する。こ
の変換により、基本ブロック1101aから削除した共
通命令列に相当するコードサイズを削減できる。
In the tail merge optimization of this example, the conventional compiler leaves the common instruction sequence included in the basic block 1102a for the common instruction sequence set 1105 and deletes the common instruction sequence included in the basic block 1101a.
The program is converted such that the branch destination of the branch instruction 1107 is changed and the remaining instruction sequence 1106 is executed. By this conversion, the code size corresponding to the common instruction sequence deleted from the basic block 1101a can be reduced.

【0007】しかしながら、この最適化を行うことによ
り、プログラムの実行時間が増加する。最適化前のプロ
グラム1100aでは基本ブロック1101aを通る処
理において1つの分岐命令1107が実行されるが、最
適化後のプログラム1100bでは分岐命令1109、
1110の2つが実行される。すなわち、最適化を行う
ことによって基本ブロック1101bを通る処理におい
て実行される分岐命令数が1増加し、このためにプログ
ラムの実行時間が増加する。
However, by performing this optimization, the execution time of the program increases. In the program 1100a before optimization, one branch instruction 1107 is executed in the processing passing through the basic block 1101a, but in the program 1100b after optimization, the branch instruction 1109,
Two of 1110 are performed. That is, by performing the optimization, the number of branch instructions executed in the processing passing through the basic block 1101b increases by one, and therefore, the execution time of the program increases.

【0008】最適化後、基本ブロック1102bを通る
処理において実行される分岐命令数は最適化前と変わら
ず、プログラム全体として分岐命令数は1増加する。図
20は、テールマージ最適化を2回繰返し行った過程を
示すプログラム例である。1200aは最適化前のプロ
グラム、1200bは1回目のテールマージ最適化後の
プログラム、1200cは2回目のテールマージ最適化
後のプログラム、1201a、1201b、1202
a、1202b、1202c、1203a、1203
b、1203c、1204、1205、1206は基本
ブロック、1207〜1208は共通命令列集合、12
09〜1210は共用される命令列、1211〜121
8は分岐命令である。
After the optimization, the number of branch instructions executed in the processing passing through the basic block 1102b is the same as before the optimization, and the number of branch instructions increases by 1 as a whole program. FIG. 20 is a program example showing a process in which tail merge optimization is repeated twice. 1200a is a program before optimization, 1200b is a program after the first tail merge optimization, 1200c is a program after the second tail merge optimization, 1201a, 1201b, and 1202
a, 1202b, 1202c, 1203a, 1203
b, 1203c, 1204, 1205, 1206 are basic blocks, 1207 to 1208 are common instruction sequence sets, 12
09-1210 are shared instruction sequences, 1211-121
8 is a branch instruction.

【0009】このように、テールマージ最適化を繰返し
行って命令列を共用させることを、多段階テールマージ
最適化と呼ぶ。図20の多段階テールマージ最適化は、
1回目に共通命令列集合1207について基本ブロック
1201aに含まれる共通命令列が共用されるようにプ
ログラムを変換し、2回目に共通命令列集合1208に
ついて基本ブロック1203bに含まれる共通命令列が
共用されるようにプログラムを変換した例を示してい
る。
[0009] Repeating the tail merge optimization to share the instruction sequence in this manner is called multi-stage tail merge optimization. The multi-stage tail merge optimization of FIG.
The program is converted such that the common instruction sequence included in the basic block 1201a is shared for the first common instruction sequence set 1207, and the common instruction sequence included in the basic block 1203b is shared for the second common instruction sequence set 1208. An example is shown in which the program is converted as follows.

【0010】この最適化後のプログラム1200cにつ
いて、基本ブロック1201b、1202c、1203
cを通る処理において実行される分岐命令数は、それぞ
れ、1、3、2であり、合計6である。図21は、図2
0とは異なる基本ブロックに含まれる命令列が共用され
るように多段階テールマージ最適化行った過程を示すプ
ログラム例である。1300aは最適化前のプログラ
ム、1300bは1回目のテールマージ最適化後のプロ
グラム、1300cは2回目のテールマージ最適化後の
プログラム、1301a、1301b、1302a、1
302b、1302c、1303a、1303b、13
03c、1304、1305、1306は基本ブロッ
ク、1307〜1308は共通命令列集合、1309〜
1310は共用される命令列、1311〜1318は分
岐命令である。
With respect to the program 1200c after the optimization, basic blocks 1201b, 1202c, 1203
The number of branch instructions executed in the process passing through c is 1, 3, and 2, respectively, for a total of 6. FIG. 21 shows FIG.
9 is a program example showing a process of performing multi-stage tail merge optimization so that an instruction sequence included in a basic block different from 0 is shared. 1300a is a program before optimization, 1300b is a program after the first tail merge optimization, 1300c is a program after the second tail merge optimization, 1301a, 1301b, 1302a, 1
302b, 1302c, 1303a, 1303b, 13
03c, 1304, 1305, and 1306 are basic blocks, 1307 to 1308 are a common instruction sequence set, and 1309 to 1309.
1310 is a shared instruction sequence, and 1311 to 1318 are branch instructions.

【0011】図21の多段階テールマージ最適化は、1
回目に共通命令列集合1307について基本ブロック1
303aに含まれる共通命令列が共用されるようにプロ
グラムを変換し、2回目に共通命令列集合1308につ
いて基本ブロック1303bに含まれる共通命令列が共
用されるようにプログラムを変換した例を示している。
The multi-stage tail merge optimization shown in FIG.
Basic block 1 for common instruction sequence set 1307
An example is shown in which the program is converted so that the common instruction sequence included in the basic block 1303b is shared by sharing the common instruction sequence included in the basic block 1303b with respect to the common instruction sequence set 1308 for the second time. I have.

【0012】この最適化後のプログラム1300cにつ
いて、基本ブロック1301b、1302c、1303
cを通る処理において実行される分岐命令数は、それぞ
れ、2、2、1であり、合計5である。このように、多
段階テールマージ最適化においては、各段階において何
れの基本ブロックに含まれる共通命令列が共用されるか
の組合せに応じて、最適化後のプログラム全体として実
行される分岐命令数が異なる。図20および図21の例
の比較では、各段階で同一の基本ブロックに含まれる共
通命令列が共用されるほうが(図21)異なる基本ブロ
ックに含まれる共通命令列が共用されるよりも(図2
0)分岐命令数がより少なく抑えられる。
With respect to the program 1300c after the optimization, basic blocks 1301b, 1302c, and 1303
The number of branch instructions executed in the process passing through c is 2, 2, and 1, respectively, for a total of 5. As described above, in the multi-stage tail merge optimization, the number of branch instructions to be executed as an entire program after optimization depends on the combination of the common instruction sequence included in each basic block in each stage. Are different. In the comparison of the examples of FIGS. 20 and 21, it is more common to share the common instruction sequence included in the same basic block in each stage (FIG. 21) than to share the common instruction sequence included in different basic blocks (FIG. 21). 2
0) The number of branch instructions can be reduced.

【0013】[0013]

【発明が解決しようとする課題】しかしながら、従来の
多段階テールマージ最適化においては、図20に示した
ように最適化後のプログラムにおいて実行される分岐命
令数を最小に抑えるような組合せによって命令列が共用
されない場合がある。すなわち、必ずしも実行時間が最
短となるプログラムが得られないという問題がある。
However, in the conventional multi-stage tail merge optimization, as shown in FIG. 20, the instruction is executed by a combination that minimizes the number of branch instructions executed in the program after optimization. Columns may not be shared. In other words, there is a problem that a program with the shortest execution time cannot always be obtained.

【0014】上記の問題に鑑み、本発明は、複数の基本
ブロックの末尾にある同一の命令列についてそのうちの
1が共用されるようにプログラムを変換してコードサイ
ズを削減するプログラム変換装置であって、実行される
分岐命令数が最小となるプログラムを生成する装置の提
供を目的とする。
In view of the above problems, the present invention is a program conversion apparatus for converting a program so that one of the same instruction strings at the end of a plurality of basic blocks is shared, thereby reducing the code size. It is another object of the present invention to provide an apparatus for generating a program in which the number of executed branch instructions is minimized.

【0015】[0015]

【課題を解決するための手段】上記問題を解決するた
め、本発明のプログラム変換装置は、複数の基本ブロッ
クの後尾にある同一の命令列についてそのうちの1が共
用されるようにプログラムを変換してコードサイズを削
減するプログラム変換装置であって、特定の基本ブロッ
クに無条件に後続する他の複数の基本ブロックを対象と
して、それらの異なる基本ブロック内に存在する同一の
命令列の集合であって、それらの基本ブロックの後尾か
ら先頭に向けて階層的に存在する共通命令列集合を抽出
する抽出手段と、抽出された各共通命令列集合において
何れか1の命令列を含む基本ブロックを、他の共通命令
列集合において選択した基本ブロックとの位置関係に応
じて選択する選択手段と、選択された基本ブロック中の
命令列が他の基本ブロックにおいて共用されるようにプ
ログラムを変換するコード変換手段とを備える。
In order to solve the above-mentioned problem, a program conversion apparatus according to the present invention converts a program so that one of the same instruction sequence at the end of a plurality of basic blocks is shared. A program conversion device for reducing a code size by using a set of the same instruction sequences existing in different basic blocks for a plurality of other basic blocks that unconditionally follow a specific basic block. Extracting means for extracting a common instruction sequence set hierarchically existing from the tail to the beginning of the basic blocks, and a basic block including any one of the instruction sequences in each of the extracted common instruction sequence sets. Selecting means for selecting according to a positional relationship with a basic block selected in another common instruction sequence set, and an instruction sequence in the selected basic block being a different basic block. Tsu and a code converting means for converting the program to be shared in the click.

【0016】前記抽出手段は、複数の基本ブロックを対
象として、それらの基本ブロックの後尾にある共通命令
列集合を抽出する共通命令列集合抽出手段と、初回は同
一の基本ブロックに無条件に後続する複数の基本ブロッ
クを対象として共通命令列集合抽出手段に共通命令列集
合を抽出させ、2回目以降は共通の命令列を有する複数
の基本ブロックから直前までに抽出された共通の命令列
を除外したプログラム部分を対象として共通命令列集合
抽出手段に共通命令列集合を抽出させる抽出制御手段と
を備えてもよい。
[0016] The extraction means is a common instruction string set extraction means for extracting a common instruction string set at the end of the basic blocks for a plurality of basic blocks, and unconditionally follows the same basic block for the first time. The common instruction sequence set extraction unit extracts a common instruction sequence set for a plurality of basic blocks, and excludes a common instruction sequence extracted immediately before from a plurality of basic blocks having a common instruction sequence for the second and subsequent times. Extraction control means for causing the common instruction sequence set extraction means to extract the common instruction sequence set with respect to the program part.

【0017】前記選択手段は、上下に連続する複数の階
層にわたる共通命令列集合について、一対の共通命令列
集合が上下に接する場合に、双方において同一の基本ブ
ロックを選択してもよい。前記選択手段は、上下に連続
する複数の階層にわたる共通命令列集合について、下層
の1の共通命令列集合に対し上層の複数の共通命令列集
合が接する場合に、要素数が最も多い上層の共通命令列
集合と下層の共通命令列集合とにおいて同一の基本ブロ
ックを選択してもよい。
[0017] The selecting means may select the same basic block for a common instruction sequence set extending over a plurality of vertically consecutive layers when a pair of common instruction sequence sets is vertically adjacent. The selecting means, when a plurality of upper-layer common instruction sequence sets contact one lower-layer common instruction sequence set with respect to a plurality of upper-lower consecutive common instruction sequence sets, the upper-layer common instruction sequence The same basic block may be selected in the instruction sequence set and the lower common instruction sequence set.

【0018】前記選択手段は、最後尾が分岐命令でない
基本ブロックに含まれる命令列が共通命令列集合に属し
ている場合に、当該基本ブロックを選択してもよい。前
記選択手段は、抽出された各共通命令列集合において1
以上の基本ブロックを、他の共通命令列集合における基
本ブロックとの位置関係に応じて選択候補とする選択候
補抽出部と、各共通命令列集合において選択候補とされ
た基本ブロックを1づつ選ぶ組合せを全て列挙する組合
せ列挙部と、列挙された各々の組合せに従って基本ブロ
ックを選択して前記変換を行った場合に変更される分岐
命令のコードサイズをあらかじめ算出する分岐命令サイ
ズ算出部とを備え、算出されるコードサイズが最も小さ
い組合せに従って基本ブロックを選択してもよい。
[0018] The selecting means may select the basic block when an instruction sequence included in a basic block whose tail is not a branch instruction belongs to a common instruction sequence set. The selecting means selects 1 in each of the extracted common instruction sequence sets.
A combination of a selection candidate extracting unit that selects the above basic blocks as selection candidates according to the positional relationship with the basic blocks in another common instruction sequence set, and a combination that selects one basic block as a selection candidate in each common instruction sequence set And a branch instruction size calculation unit that calculates in advance the code size of a branch instruction that is changed when a basic block is selected according to each of the listed combinations and the conversion is performed, The basic block may be selected according to the combination having the smallest calculated code size.

【0019】前記プログラム変換装置は、さらに、前記
変換により削除される命令列および変更される分岐命令
についてコードサイズの変化量を算出し、変換によって
コードサイズが減少しない基本ブロックにおいて命令列
の削除および分岐命令の変更をしないようコード変換手
段に対して制御する制御手段を備えてもよい。本発明の
プログラム変換方法は、複数の基本ブロックの後尾にあ
る同一の命令列についてそのうちの1が共用されるよう
にプログラムを変換してコードサイズを削減するプログ
ラム変換装置において用いられるプログラム変換方法で
あって、特定の基本ブロックに無条件に後続する他の複
数の基本ブロックを対象として、それらの異なる基本ブ
ロック内に存在する同一の命令列の集合であって、それ
らの基本ブロックの後尾から先頭に向けて階層的に存在
する共通命令列集合を抽出する第1のステップと、第1
のステップで抽出された各共通命令列集合において何れ
か1の命令列を含む基本ブロックを、他の共通命令列集
合において選択した基本ブロックとの位置関係に応じて
選択する第2のステップと、第2のステップで選択され
た基本ブロック中の命令列が他の基本ブロックにおいて
共用されるようにプログラムを変換する第3のステップ
とを含む。
The program conversion device further calculates a code size change amount of the instruction sequence deleted by the conversion and the changed branch instruction, and deletes and deletes the instruction sequence in a basic block whose code size is not reduced by the conversion. Control means for controlling the code conversion means so as not to change the branch instruction may be provided. A program conversion method according to the present invention is a program conversion method used in a program conversion apparatus that converts a program so that one of the same instruction strings at the end of a plurality of basic blocks is shared and reduces the code size. A set of the same instruction sequence existing in different basic blocks, targeting a plurality of other basic blocks unconditionally following a specific basic block, and starting from the end of those basic blocks A first step of extracting a set of common instruction sequences existing hierarchically toward
A second step of selecting a basic block including any one of the instruction sequences in each of the common instruction sequence sets extracted in the step (b) in accordance with the positional relationship with the basic block selected in another common instruction sequence set; Converting the program so that the instruction sequence in the basic block selected in the second step is shared by other basic blocks.

【0020】本発明のプログラム記録媒体は、複数の基
本ブロックの後尾にある同一の命令列についてそのうち
の1が共用されるようにプログラムを変換してコードサ
イズを削減するプログラム変換装置において用いられる
プログラムを記憶しているコンピュータ読取り可能な記
録媒体であって、特定の基本ブロックに無条件に後続す
る他の複数の基本ブロックを対象として、それらの異な
る基本ブロック内に存在する同一の命令列の集合であっ
て、それらの基本ブロックの後尾から先頭に向けて階層
的に存在する共通命令列集合を抽出する第1のステップ
と、第1のステップで抽出された各共通命令列集合にお
いて何れか1の命令列を含む基本ブロックを、他の共通
命令列集合において選択した基本ブロックとの位置関係
に応じて選択する第2のステップと、第2のステップで
選択された基本ブロック中の命令列が他の基本ブロック
において共用されるようにプログラムを変換する第3の
ステップとを有するプログラムを記憶している。
A program recording medium according to the present invention is used in a program conversion apparatus for converting a program so that one of the same instruction sequence at the end of a plurality of basic blocks is shared, thereby reducing a code size. A plurality of other basic blocks unconditionally following a specific basic block, and a set of the same instruction sequences existing in the different basic blocks. A first step of extracting a set of common instruction strings that exist hierarchically from the tail to the beginning of the basic blocks, and any one of the common instruction string sets extracted in the first step. Is selected according to the positional relationship with the basic block selected in another common instruction sequence set. And second step, the instruction sequence in the selected basic block in the second step is storing the program and a third step of converting the program to be shared in other basic blocks.

【0021】[0021]

【発明の実施の形態】<第1実施形態>第1実施形態に
おける、本発明のプログラム変換装置について説明す
る。 <全体構成>本発明のプログラム変換装置100は、ソ
ースプログラムを目的プログラムに変換する装置であ
り、図1に示すように、字句解析部102、構文解析部
103、中間コード生成部104、中間コード最適化部
105、および、目的プログラム生成部107から構成
される。
DESCRIPTION OF THE PREFERRED EMBODIMENTS <First Embodiment> A program conversion device according to the present invention in a first embodiment will be described. <Overall Configuration> The program conversion device 100 of the present invention is a device for converting a source program into a target program. As shown in FIG. 1, a lexical analysis unit 102, a syntax analysis unit 103, an intermediate code generation unit 104, an intermediate code It comprises an optimization unit 105 and a target program generation unit 107.

【0022】プログラム変換装置100は、具体的に
は、プロセッサ、プログラムを記憶しているROM(R
ead Only Memory)、作業用のRAM
(Random Access Memory)等のハ
ードウェアにより実現される。前記各部の機能は、RO
Mに記憶されているプログラムをプロセッサが実行する
ことにより実現される。前記各部の間におけるデータの
受け渡しは、RAM等のハードウェアを介して行われ
る。
The program conversion device 100 is, specifically, a processor (ROM) storing a program.
read-only memory), work RAM
(Random Access Memory). The function of each part is RO
This is realized by the processor executing the program stored in M. The transfer of data between the units is performed via hardware such as a RAM.

【0023】字句解析部102は、入力されたソースプ
ログラム101を解析し、ソースプログラム101を構
成する字句を認識する。構文解析部103は、字句解析
部102が認識した字句に基づいてソースプログラム1
01の構文を解析する。中間コード生成部104は、構
文解析部103が解析した構文の意味を中間言語を用い
て表記した中間コードを生成する。中間コード最適化部
105は、中間コード生成部104が生成した中間コー
ドを以下に示すようにして最適化する。目的プログラム
生成部107は、中間コード最適化部105が最適化し
た中間コードに従って目的プログラム106を生成す
る。
The lexical analyzer 102 analyzes the input source program 101 and recognizes the lexical constituents of the source program 101. The syntax analysis unit 103 executes the source program 1 based on the lexical characters recognized by the lexical analysis unit 102.
Parse 01. The intermediate code generation unit 104 generates an intermediate code in which the meaning of the syntax analyzed by the syntax analysis unit 103 is described using an intermediate language. The intermediate code optimizing unit 105 optimizes the intermediate code generated by the intermediate code generating unit 104 as described below. The target program generator 107 generates the target program 106 according to the intermediate code optimized by the intermediate code optimizer 105.

【0024】中間コード最適化部105以外の構成は、
一般的なコンパイラにおいて広く実施されている公知技
術であるため、ここでは、詳細な説明を省略する。 <中間コード最適化部>図2は、中間コード最適化部1
05を示すブロック図である。同図に示すように、中間
コード最適化部105は、基本ブロック解析部111、
および、テールマージ最適化部112からなる。
The configuration other than the intermediate code optimization unit 105 is as follows.
Since this is a known technique widely implemented in a general compiler, a detailed description thereof is omitted here. <Intermediate code optimization unit> FIG.
It is a block diagram which shows 05. As shown in the figure, the intermediate code optimization unit 105 includes a basic block analysis unit 111,
And a tail merge optimization unit 112.

【0025】基本ブロック解析部111は、中間コード
生成部104が生成した中間コードを解析して、基本ブ
ロック、基本ブロック間の制御フロー、および、同一の
基本ブロックに無条件に制御を移すような複数の基本ブ
ロックを要素とする集合(以後、無条件先行ブロック集
合と称する)と後続の基本ブロックとの組を抽出する。
The basic block analysis unit 111 analyzes the intermediate code generated by the intermediate code generation unit 104 to control the basic blocks, the control flow between the basic blocks, and unconditionally transfer control to the same basic block. A set of a set including a plurality of basic blocks as elements (hereinafter referred to as an unconditional preceding block set) and a subsequent basic block is extracted.

【0026】図3(a)は基本ブロック解析部111に
よって抽出された基本ブロックおよび基本ブロック間の
制御フローの模式図、図3(b)は無条件先行ブロック
集合の一覧を示す一例であり、201〜207は基本ブ
ロック、211〜219は基本ブロック間の制御フロ
ー、220は無条件先行ブロック集合と後続の基本ブロ
ックとの組の一覧を表わしている。
FIG. 3A is a schematic diagram of a basic block extracted by the basic block analysis unit 111 and a control flow between the basic blocks, and FIG. 3B is an example showing a list of unconditionally preceding block sets. Reference numerals 201 to 207 denote basic blocks, reference numerals 211 to 219 denote control flows between the basic blocks, and reference numeral 220 denotes a list of sets of unconditional preceding block sets and succeeding basic blocks.

【0027】基本ブロック解析部111が行うこれらの
処理は、一般的なコンパイラにおいて広く実施されてい
る公知技術であるため、ここでは、詳細な説明を省略す
る。テールマージ最適化部112は、共通命令列集合抽
出部114、共用部分選択部115、および、コード変
換部116からなる。 <共通命令列集合抽出部>共通命令列集合抽出部114
は、基本ブロック解析部111によって抽出された基本
ブロック、制御フロー、および、無条件先行ブロック集
合に基づいて、再帰的な抽出処理を含む抽出準備処理を
行うことにより、無条件先行ブロック集合の後尾から先
頭に向けて階層的に存在する共通命令列集合を抽出す
る。 <抽出準備処理>図4は、抽出準備処理を示すフローチ
ャートである。図6は本処理の過程を示すために用いる
プログラム(中間コード)の一例であり、300は無条
件先行ブロック集合、301〜305は無条件先行ブロ
ック集合300に属する基本ブロック、306は後続の
基本ブロック、307〜309は共通命令列集合、31
1〜356は命令である。
The processing performed by the basic block analysis unit 111 is a well-known technique widely implemented in a general compiler, and a detailed description thereof will be omitted. The tail merge optimization unit 112 includes a common instruction sequence set extraction unit 114, a common part selection unit 115, and a code conversion unit 116. <Common instruction sequence set extractor> Common instruction sequence set extractor 114
Performs an extraction preparation process including a recursive extraction process based on the basic block, the control flow, and the unconditional preceding block set extracted by the basic block analysis unit 111, so that the tail of the unconditional preceding block set is obtained. , A set of common instruction strings existing hierarchically from the top to the top is extracted. <Extraction Preparation Processing> FIG. 4 is a flowchart showing the extraction preparation processing. FIG. 6 is an example of a program (intermediate code) used to show the process of this processing, where 300 is an unconditional preceding block set, 301 to 305 are basic blocks belonging to the unconditional preceding block set 300, and 306 is a subsequent basic block set. Block, 307 to 309 are a common instruction sequence set, 31
1 to 356 are instructions.

【0028】以下、図4のフローチャートおよび図6の
プログラム例を参照しながら、抽出準備処理について説
明する。共通命令列集合抽出部114は、ステップS1
0〜ステップS13の繰返し処理により、基本ブロック
解析部111によって抽出された無条件先行ブロック集
合ごとに、無条件先行ブロック集合に属する各基本ブロ
ックの分岐命令を除いた最後尾の命令を求め(ステップ
S11)、当該求めた命令を指定して抽出処理を呼び出
す(ステップS12)。
Hereinafter, the extraction preparation process will be described with reference to the flowchart of FIG. 4 and the program example of FIG. The common instruction sequence set extraction unit 114 determines in step S1
Through the repetition of steps 0 to S13, for each unconditional preceding block set extracted by the basic block analysis unit 111, the last instruction excluding the branch instruction of each basic block belonging to the unconditional preceding block set is determined (step S13). S11), the extraction process is called by designating the obtained command (step S12).

【0029】図6の例では、無条件先行ブロック集合3
00に属する基本ブロック301〜305の分岐命令を
除いた最後尾の命令である命令315、325、33
5、345、355を指定され、抽出処理が呼び出され
る。 <抽出処理>図5は、ステップS12の抽出処理の詳細
を示すフローチャートである。以下、図5のフローチャ
ートおよび図6のプログラム例を参照しながら、抽出処
理について説明する。
In the example of FIG. 6, the unconditional preceding block set 3
Instructions 315, 325, and 33 which are the last instructions excluding the branch instructions of the basic blocks 301 to 305 belonging to 00
5, 345 and 355 are designated, and the extraction process is called. <Extraction Process> FIG. 5 is a flowchart showing details of the extraction process in step S12. Hereinafter, the extraction processing will be described with reference to the flowchart in FIG. 5 and the example of the program in FIG.

【0030】初回の抽出処理において、共通命令列集合
抽出部114は、ステップS12の処理において指定さ
れた命令を同じ種類ごとに分類する(ステップS2
0)。本例では、全てmov R0,(_a)命令であ
る5個の命令が指定されており、1種類に分類される。
共通命令列集合抽出部114は、ステップS21〜ステ
ップS25の繰返し処理により、前記分類され、同じ命
令が2以上ある命令の種類ごとに、当該種類の命令から
基本ブロックの先頭に向かって命令の異同を順次比較
し、全ての基本ブロックにおいて同じ命令が連続する部
分を求め(ステップS22)、当該求めた部分を要素と
する共通命令列集合を作成する(ステップS23)。
In the first extraction processing, the common instruction sequence set extraction unit 114 classifies the instructions specified in the processing of step S12 into the same type (step S2).
0). In this example, five instructions, all of which are mov R0, (_a) instructions, are specified, and are classified into one type.
The common instruction sequence set extraction unit 114 determines, for each instruction type in which two or more identical instructions are classified by the repetition processing of steps S21 to S25, the instruction difference from the instruction of the type toward the beginning of the basic block. Are sequentially compared, a part where the same instruction is continuous in all the basic blocks is obtained (step S22), and a common instruction sequence set including the obtained part as an element is created (step S23).

【0031】図6の例では、mov R0,(_a)命
令について、命令315、325、335、345、3
55から基本ブロックの先頭に向かって命令の異同が順
次比較され、基本ブロック301〜305において同じ
命令が連続する部分である、命令314〜315、命令
324〜325、命令334〜335、命令344〜3
45、命令354〜355を要素とする共通命令列集合
307が作成される。
In the example shown in FIG. 6, instructions 315, 325, 335, 345, 3
Instruction differences are sequentially compared from 55 to the beginning of the basic block, and the same instruction is a continuous part in the basic blocks 301 to 305, ie, instructions 314 to 315, instructions 324 to 325, instructions 334 to 335, and instructions 344 to 344. 3
45, a common instruction sequence set 307 having instructions 354 to 355 as elements is created.

【0032】共通命令列集合抽出部114は、作成され
た共通命令列集合の各要素の直前に位置する命令を指定
して図5のフローチャートに示す抽出処理を再帰的に呼
び出し、基本ブロックの先頭に向かって階層的に存在す
る共通命令列集合を繰返し抽出する(ステップS2
4)。図6の例では、作成された共通命令列集合307
の各要素の直前に位置する命令313、323、33
3、343、353を指定され2回目の抽出処理が呼び
出される。
The common instruction sequence set extractor 114 recursively calls the extraction process shown in the flowchart of FIG. 5 by designating the instruction located immediately before each element of the created common instruction sequence set, and Is extracted repeatedly (step S2)
4). In the example of FIG. 6, the generated common instruction sequence set 307
Instructions 313, 323, 33 located immediately before each element of
3, 343 and 353 are designated and the second extraction process is called.

【0033】2回目の抽出処理において、共通命令列集
合抽出部114は、指定された命令313、323、3
33、343、353をmov (_d),R1命令で
ある命令313、323、および、mov (_c),
R1命令である命令333、343、353の2種類に
分類する(ステップS20)。mov (_d),R1
命令について、命令312〜313、命令322〜32
3を要素とする共通命令列集合308が作成され、当該
各要素の直前に位置する命令311、321を指定され
て3回目の抽出処理が呼び出される。
In the second extraction process, the common instruction sequence set extraction unit 114 extracts the specified instructions 313, 323, 3
33, 343, and 353 are mov (_d), instructions 313 and 323 that are R1 instructions, and mov (_c),
Instructions 333, 343, and 353, which are R1 instructions, are classified into two types (step S20). mov (_d), R1
For instructions, instructions 312 to 313, instructions 322 to 32
A common instruction sequence set 308 having 3 as an element is created, and instructions 311 and 321 located immediately before each of the elements are designated, and a third extraction process is called.

【0034】3回目の抽出処理において、共通命令列集
合抽出部114は、前記指定された命令311、312
をmov (_a),R1命令である命令311と、m
ov(_b),R1命令である命令312とに分類する
(ステップS20)。何れの種類の命令も1個であり、
ステップS21〜ステップS25の繰返し処理の条件を
満たさないため、命令311、321から基本ブロック
の先頭に向かう部分について共通命令列集合の抽出処理
は行われず、2回目の抽出処理の続きに戻る。
In the third extraction process, the common instruction sequence set extraction unit 114 extracts the specified instructions 311, 312
Mov (_a), an instruction 311 which is an R1 instruction, and m
ov (_b) and an instruction 312 which is an R1 instruction (step S20). Each type of instruction is one,
Since the conditions for the repetition processing of steps S21 to S25 are not satisfied, the common instruction string set extraction processing is not performed on the portion from the instructions 311 and 321 to the beginning of the basic block, and the processing returns to the continuation of the second extraction processing.

【0035】2回目の抽出処理の続きにおいて、mov
(_c),R1命令について、命令332〜333、
命令342〜343、命令352〜353を要素とする
共通命令列集合309が作成され、作成された共通命令
列集合309の直前に位置する命令331、341、3
51を指定されて4回目の抽出処理が呼び出される。4
回目の抽出処理においても、3回目と同様に、命令33
1、341、351から基本ブロックの先頭に向かう部
分について共通命令列集合の抽出処理は行われない。
In the continuation of the second extraction process, mov
(_C), for the R1 instruction, instructions 332 to 333;
A common instruction sequence set 309 having instructions 342 to 343 and instructions 352 to 353 as elements is created, and instructions 331, 341 and 3 located immediately before the created common instruction sequence set 309.
51 is designated and the fourth extraction process is called. 4
In the third extraction process, similarly to the third extraction process, the instruction 33
The extraction processing of the common instruction sequence set is not performed on the portion from 1, 341, 351 toward the beginning of the basic block.

【0036】この結果、無条件先行ブロック集合300
において、共通命令列集合307〜309が抽出され
る。 <共用部分選択部>共用部分選択部115は、再帰的な
選択処理を含む選択準備処理を行うことにより、共通命
令列集合抽出部114によって抽出された各共通命令列
集合において共用されるべき1の命令列を含む基本ブロ
ックを、他の共通命令列集合において選択された基本ブ
ロックとの位置関係に応じて選択する。 <選択準備処理>図7は、選択準備処理を示すフローチ
ャートである。以下、図7のフローチャートおよび図6
のプログラム例を参照しながら、選択準備処理について
説明する。
As a result, the unconditional preceding block set 300
, Common instruction sequence sets 307 to 309 are extracted. <Shared Part Selection Unit> The shared part selection unit 115 performs a selection preparation process including a recursive selection process, so that the common instruction sequence set extracted by the common instruction sequence set extraction unit 114 Is selected according to the positional relationship with the basic block selected in another common instruction sequence set. <Selection preparation processing> FIG. 7 is a flowchart showing the selection preparation processing. The flowchart of FIG. 7 and FIG.
The selection preparation process will be described with reference to the example program.

【0037】共用部分選択部115は、ステップS30
〜ステップS35の繰返し処理により、基本ブロック解
析部111によって抽出された無条件先行ブロック集合
ごとに、無条件先行ブロック集合の分岐命令を除いた最
後尾に位置する共通命令列集合を求め(ステップS3
1)、さらにステップS32〜ステップS34の繰返し
処理により、当該求めた共通命令列集合を順次指定して
選択処理を行う(ステップS33)。
The common part selecting unit 115 determines in step S30
Through the repetition of steps S35 to S35, for each unconditional preceding block set extracted by the basic block analysis unit 111, a common instruction sequence set located at the end of the unconditional preceding block set excluding the branch instruction is obtained (step S3).
1) Further, by repeating the processing of steps S32 to S34, the obtained common instruction sequence set is sequentially designated to perform the selection processing (step S33).

【0038】図6の例では、無条件先行ブロック集合3
00の最後尾の共通命令列集合307を指定され、選択
処理が呼び出される。 <選択処理>図8は、ステップS33の選択処理の詳細
を示すフローチャートである。以下、図8のフローチャ
ートおよび図6のプログラム例を参照しながら、選択処
理について説明する。
In the example of FIG. 6, the unconditional preceding block set 3
The common instruction sequence set 307 at the end of 00 is specified, and the selection process is called. <Selection Process> FIG. 8 is a flowchart showing details of the selection process in step S33. Hereinafter, the selection process will be described with reference to the flowchart of FIG. 8 and the example of the program of FIG.

【0039】選択処理の前半において、共用部分選択部
115は、指定された共通命令列集合の直前に別の共通
命令列集合が存在する場合(ステップS40)、ステッ
プS41〜ステップS43の繰返し処理により、当該直
前に存在する各共通命令列集合を順次指定して、図8の
フローチャートに示す選択処理を再帰的に呼び出す(ス
テップS42)。この呼び出しが再帰的に繰返されるこ
とにより、指定された共通命令列集合において基本ブロ
ックを選択するよりも前に、当該共通命令列集合から先
頭に向けて階層的に存在する全ての共通命令列集合にお
いて共用されるべき命令列を含む基本ブロックが予め選
択される。
In the first half of the selection processing, when another common instruction sequence set exists immediately before the designated common instruction sequence set (step S40), the common part selecting unit 115 performs the repetition processing of steps S41 to S43. Then, each common instruction sequence set existing immediately before is sequentially specified, and the selection process shown in the flowchart of FIG. 8 is recursively called (step S42). By repeating this call recursively, before selecting a basic block in the specified common instruction sequence set, all common instruction sequence sets hierarchically existing from the common instruction sequence set toward the beginning are selected. A basic block including an instruction sequence to be shared in is selected in advance.

【0040】選択処理の後半において、共用部分選択部
115は、指定された共通命令列集合において、以下の
条件判断に従って共用されるべき命令列を含む基本ブロ
ックを選択する。すなわち、指定された共通命令列集合
に最後尾が分岐命令でない基本ブロックが属している場
合は(ステップS44)当該基本ブロックを選択する
(ステップS45)。指定された共通命令列集合の直前
に複数の共通命令列集合が存在する場合は(ステップS
46)当該複数の共通命令列集合のうち要素数が最大の
ものにおいて選択した基本ブロックを選択する(ステッ
プS47)。指定された共通命令列集合の直前に1の共
通命令列集合が存在する場合は(ステップS48)当該
共通命令列集合において選択した基本ブロックを選択す
る(ステップS49)。何れの場合にも該当しない場合
は指定された共通命令列集合に属する任意の1の基本ブ
ロックを選択する(ステップS50)。
In the latter half of the selection process, the shared part selecting unit 115 selects a basic block including an instruction sequence to be shared in the designated common instruction sequence set according to the following condition judgment. That is, when a basic block whose tail is not a branch instruction belongs to the specified common instruction sequence set (step S44), the basic block is selected (step S45). If a plurality of common instruction sequence sets exist immediately before the designated common instruction sequence set (step S
46) The basic block selected from the plurality of common instruction sequence sets having the largest number of elements is selected (step S47). If one common instruction sequence set exists immediately before the designated common instruction sequence set (step S48), the basic block selected in the common instruction sequence set is selected (step S49). If none of the above cases applies, an arbitrary basic block belonging to the specified common instruction sequence set is selected (step S50).

【0041】図6の例では、初回の選択処理は共通命令
列集合307が指定されて呼び出され、当該処理の前半
において、共通命令列集合307の直前に位置する共通
命令列集合308、309を各々指定して、2回目、3
回目の選択処理が呼び出される。2回目の選択処理の前
半において、指定された共通命令列集合308の直前に
位置する共通命令列集合が存在しないため、選択処理の
再帰的な呼び出しは行われない。同処理の後半におい
て、共通命令列集合308において共用されるべき命令
列を含む基本ブロックが選択される。この場合はステッ
プS44、S46、S48の何れの条件にも該当せず、
ステップS50に従い任意の1の基本ブロックが選択さ
れる。ここでは、命令312〜313を含む基本ブロッ
ク301が選択されるものとする。
In the example of FIG. 6, the initial selection process is called by designating the common instruction sequence set 307 and calling the common instruction sequence sets 308 and 309 located immediately before the common instruction sequence set 307 in the first half of the process. 2nd, 3rd
The third selection process is called. In the first half of the second selection process, since there is no common instruction sequence set located immediately before the designated common instruction sequence set 308, the selection process is not recursively called. In the latter half of the process, a basic block including an instruction sequence to be shared in the common instruction sequence set 308 is selected. In this case, none of the conditions of steps S44, S46, and S48 is met,
According to step S50, any one basic block is selected. Here, it is assumed that the basic block 301 including the instructions 312 to 313 is selected.

【0042】3回目の選択処理においても、指定された
共通命令列集合309について、2回目と同様の処理お
よび条件判断が行われる。ここでは、命令332〜33
3を含む基本ブロック303が選択されるものとする。
2回目、3回目の選択処理が行われた後、初回の選択処
理の後半が実行される。共通命令列集合307の直前
に、共通命令列集合308、309が存在しステップS
46の条件を満たすため、ステップS47により共通命
令列集合309について選択した基本ブロック303を
選択する。
In the third selection processing, the same processing and condition determination as in the second processing are performed on the designated common instruction sequence set 309. Here, instructions 332 to 33
It is assumed that the basic block 303 including No. 3 is selected.
After the second and third selection processes are performed, the latter half of the first selection process is performed. Immediately before the common instruction sequence set 307, the common instruction sequence sets 308 and 309 exist, and step S
In order to satisfy the condition of 46, the basic block 303 selected for the common instruction sequence set 309 in step S47 is selected.

【0043】この結果、共通命令列集合307、30
8、309において共用すべき命令列を含む基本ブロッ
クとして、それぞれ、基本ブロック303、303、3
01が選択される。 <選択条件の根拠>以下、前記ステップS44〜S50
により選択された基本ブロックに含まれる命令列を共用
させると、最適化後のプログラムにおいて分岐命令の実
行回数を最小にできることを、図13〜図16の概念図
を用いて示す。
As a result, the common instruction sequence sets 307 and 30
8 and 309 as basic blocks including a sequence of instructions to be shared, respectively.
01 is selected. <Reason for selection condition> Hereinafter, steps S44 to S50 will be described.
13 to 16 that the number of executions of the branch instruction in the program after optimization can be minimized by sharing the instruction sequence included in the basic block selected by (1).

【0044】テールマージ最適化においてコンパイラ
は、各共通命令列集合において選択されなかった基本ブ
ロックの命令列を選択された基本ブロックの命令列の先
頭への分岐命令に置き換えることにより当該選択された
基本ブロックの命令列を共用させる。このため、選択さ
れなかった基本ブロックの命令列を元実行していた処理
において当該置き換えられた分岐命令が実行される。係
る分岐命令が実行される数は次のように求められる。
In the tail merge optimization, the compiler replaces the instruction sequence of the basic block which is not selected in each common instruction sequence set with a branch instruction to the head of the instruction sequence of the selected basic block, thereby obtaining the selected basic instruction sequence. The instruction sequence of the block is shared. Therefore, the replaced branch instruction is executed in the process in which the instruction sequence of the unselected basic block was originally executed. The number of executions of such a branch instruction is obtained as follows.

【0045】図13(a)は、共通命令列集合aの直前
に他の共通命令列集合が存在せず、共通命令列集合aが
m個の要素からなる場合を表わす概念図である。図13
(b)、(c)にそれぞれ示すように、基本ブロック1
の命令列を共用させると(m−1)個、基本ブロックm
の命令列を共用させると(m−1)個の処理において、
置き換えられた分岐命令jmp L1が実行される。分
岐命令が実行される数はどの基本ブロックに含まれる命
令列を選択しても(m−1)であり差異がない。ゆえ
に、ステップS50において、任意の1の基本ブロック
を選択する。
FIG. 13A is a conceptual diagram showing a case where no other common instruction sequence set exists immediately before the common instruction sequence set a, and the common instruction sequence set a is composed of m elements. FIG.
As shown in (b) and (c), the basic block 1
(M-1), the basic block m
When the instruction sequence is shared, in (m-1) processes,
The replaced branch instruction jmp L1 is executed. The number of executed branch instructions is (m-1) regardless of the instruction sequence included in any of the basic blocks, and there is no difference. Therefore, in step S50, any one basic block is selected.

【0046】図14(a)は、共通命令列集合aの直前
に1の共通命令列集合bが存在して、共通命令列集合a
がm個、共通命令列集合bがi個(1<i<m)の要素
からなる場合を表わす概念図である。図14(b)、
(c)にそれぞれ示すように、共通命令列集合aにおい
て共用させた命令列aと同一の基本ブロックに含まれる
命令列を共用させると(m−i)個、それ以外の命令列
を共用させると(m−1)個の処理において、置き換え
られた分岐命令jmp L1が実行される。ここで(m
−i)<(m−1)であり、直前の共通命令列集合にお
いて共用させた命令列と同一の基本ブロックに含まれる
命令列を共用させると、実行される分岐命令の数をより
少なくできる。ゆえに、ステップS48、S49におい
て、直前の共通命令列集合において選択した基本ブロッ
クを選択する。
FIG. 14A shows that one common instruction sequence set b exists immediately before the common instruction sequence set a, and the common instruction sequence set a
Is a conceptual diagram showing a case where m is a common instruction sequence set b and i (1 <i <m) elements. FIG. 14 (b),
As shown in (c), when the instruction sequence included in the same basic block as the instruction sequence a shared in the common instruction sequence set a is shared (mi), the other instruction sequences are shared. And (m-1) processes, the replaced branch instruction jmp L1 is executed. Where (m
-I) <(m-1), and the number of branch instructions to be executed can be reduced by sharing the instruction sequence included in the same basic block as the instruction sequence shared in the immediately preceding common instruction sequence set. . Therefore, in steps S48 and S49, the basic block selected in the immediately preceding common instruction sequence set is selected.

【0047】図15(a)は、共通命令列集合aの直前
に複数の共通命令列集合b、c、…が存在して、共通命
令列集合aがm個、共通命令列集合b、c、…がi、
j、…個(1<…<j<i<m)の要素からなる場合を
表わす概念図である。図15(b)、(c)、(d)に
それぞれ示すように、共通命令列集合bにおいて共用さ
せた命令列の直後の命令列を共用させると(m−i)
個、共通命令列集合cにおいて共用させた命令列の直後
の命令列を共用させると(m−j)個、それ以外の命令
列を共用させると(m−1)個の処理において、置き換
えられた分岐命令jmp L1が実行される。ここで
(m−i)<(m−j)<(m−1)であり、直前の共
通命令列集合のうち要素数が最も多いものにおいて共用
させた命令列と同一の基本ブロックに含まれる命令列を
共用させると、分岐命令の実行回数をより少なくでき
る。ゆえに、ステップS46、S47において、直前の
共通命令列集合のうち要素数が最大のものについて選択
した基本ブロックを選択する。
FIG. 15A shows that a plurality of common instruction sequence sets b, c,... Exist immediately before a common instruction sequence set a, and m common instruction sequence sets a and common instruction sequence sets b, c , ... is i,
It is a conceptual diagram showing the case where it consists of j, ... (1 <... <j <i <m) elements. As shown in FIGS. 15B, 15C, and 15D, when the instruction sequence immediately after the instruction sequence shared in the common instruction sequence set b is shared, (mi)
When the instruction sequence immediately after the instruction sequence shared in the common instruction sequence set c is shared, (mj) instructions are replaced, and when the other instruction sequences are shared, (m-1) processes are replaced. The executed branch instruction jmp L1 is executed. Here, (m−i) <(m−j) <(m−1), and is included in the same basic block as the instruction sequence shared in the immediately preceding common instruction sequence set having the largest number of elements. When the instruction sequence is shared, the number of executions of the branch instruction can be reduced. Therefore, in steps S46 and S47, the basic block selected with the largest number of elements in the immediately preceding common instruction sequence set is selected.

【0048】前記命令列を共用させるための分岐命令の
ほかに、後続の基本ブロックへ制御を移行させるための
分岐命令が実行される場合がある。係る分岐命令は、後
続の基本ブロックとメモリ領域が連続している高々1個
の基本ブロックを除いて全ての基本ブロックの最後尾に
存在する。図16(a)は、無条件先行ブロック集合に
m個の基本ブロックが属しており、基本ブロック1の最
後尾の命令が分岐命令でない場合を表わす概念図であ
る。図16(b)、(c)にそれぞれ示すように、基本
ブロック1に含まれる命令列を共用させると係る分岐命
令jmp L0は全く実行されず、その他の基本ブロッ
クに含まれる命令列を共用させるとm個の処理において
係る分岐命令jmpL0が実行される。
In addition to the branch instruction for sharing the instruction sequence, a branch instruction for transferring control to a subsequent basic block may be executed. Such a branch instruction exists at the end of all basic blocks except at most one basic block in which the subsequent basic block and the memory area are continuous. FIG. 16A is a conceptual diagram illustrating a case where m basic blocks belong to the unconditional preceding block set and the last instruction of the basic block 1 is not a branch instruction. As shown in FIGS. 16B and 16C, when the instruction sequence included in the basic block 1 is shared, the branch instruction jmp L0 is not executed at all, and the instruction sequence included in the other basic blocks is shared. And the m branch instructions jmpL0 are executed.

【0049】この個数mは、前記命令列を共用させるた
めに実行される分岐命令の個数の何れよりも大きいた
め、他の条件に優先してこの分岐命令を含まない命令列
を選択すると分岐命令の実行回数をより少なくできる。
ゆえに、ステップS44、S45において、最後尾が分
岐命令でない基本ブロックが共通命令列集合に属してい
る場合は、他の条件に優先して当該基本ブロックを選択
する。
Since the number m is larger than any of the number of branch instructions executed to share the instruction sequence, if an instruction sequence not including this branch instruction is selected in preference to other conditions, the branch instruction Can be performed less frequently.
Therefore, in steps S44 and S45, when the basic block whose tail is not a branch instruction belongs to the common instruction sequence set, the basic block is selected in preference to other conditions.

【0050】以上より、ステップS44〜S50で選択
された基本ブロックに含まれる命令列を共用させること
で、最適化後のプログラムにおいて分岐命令の実行回数
を最小にできる。 <コード変換部>コード変換部116は、再帰的なコー
ド変換処理を含むコード変換準備処理を実行して、共用
部分選択部115が選択した基本ブロックに含まれる命
令列が各共通命令列集合において共用されるよう、プロ
グラムを変換する。 <コード変換準備処理>図9は、コード変換準備処理を
示すフローチャート、図11および図12はコード変換
準備処理およびコード変換処理の過程を示すために用い
るプログラムの一例である。図11は図6のプログラム
に対して共通命令列集合308、309について共用部
分選択部115が選択した基本ブロックに含まれる命令
列を共用させた結果のプログラムを示しており、301
a、301b、302a、303a、303b、304
a、305a、306は基本ブロック、307、30
8、309は共通命令列集合、311〜325、326
a、331〜345、346a、351〜355、35
6aは命令およびラベルである。図12は図11のプロ
グラムに対して共通命令列集合307について共用部分
選択部115が選択した基本ブロックに含まれる命令列
を共用させた結果のプログラムを示しており、301
a、301c、302a、303a、303b、303
c、304a、305a、306は基本ブロック、30
7、308、309は共通命令列集合、311〜31
3、316a、317、321、326a、331〜3
41、346a、351、356aは命令およびラベル
である。
As described above, by sharing the instruction sequence included in the basic blocks selected in steps S44 to S50, the number of executions of the branch instruction in the optimized program can be minimized. <Code conversion unit> The code conversion unit 116 executes a code conversion preparation process including a recursive code conversion process, and the instruction sequence included in the basic block selected by the shared part selection unit 115 is included in each common instruction sequence set. Convert programs to be shared. <Code Conversion Preparation Processing> FIG. 9 is a flowchart showing the code conversion preparation processing, and FIGS. 11 and 12 are examples of programs used to show the steps of the code conversion preparation processing and the code conversion processing. FIG. 11 shows a program as a result of sharing the instruction sequence included in the basic block selected by the shared part selecting unit 115 with respect to the common instruction sequence sets 308 and 309 with respect to the program in FIG.
a, 301b, 302a, 303a, 303b, 304
a, 305a, 306 are basic blocks, 307, 30
8, 309 are a common instruction sequence set, 311 to 325, 326
a, 331 to 345, 346a, 351 to 355, 35
6a is an instruction and a label. FIG. 12 shows a program resulting from sharing the instruction sequence included in the basic block selected by the shared part selecting unit 115 with the common instruction sequence set 307 with respect to the program of FIG.
a, 301c, 302a, 303a, 303b, 303
c, 304a, 305a, 306 are basic blocks, 30
7, 308 and 309 are common instruction sequence sets, 311 to 31
3, 316a, 317, 321, 326a, 331 to 3
41, 346a, 351, 356a are instructions and labels.

【0051】以下、図9のフローチャートおよび図11
のプログラム例を参照しながら、コード変換準備処理に
ついて説明する。コード変換部116は、ステップS6
0からステップS65の繰返し処理により、基本ブロッ
ク解析部111によって抽出された無条件先行ブロック
集合ごとに、無条件先行ブロック集合の分岐命令を除い
た最後尾の共通命令列集合を求め(ステップS61)、
さらにステップS62〜ステップS64の繰返し処理に
より、当該求めた共通命令列集合を順次指定してコード
変換処理を行う(ステップS63)。
The flowchart of FIG. 9 and the flowchart of FIG.
The code conversion preparation process will be described with reference to the example program. The code conversion unit 116 determines in step S6
From 0, the last common instruction sequence set excluding the branch instruction of the unconditional preceding block set is obtained for each unconditional preceding block set extracted by the basic block analysis unit 111 (step S61). ,
Further, by repeating the steps S62 to S64, the obtained common instruction sequence set is sequentially designated to perform the code conversion process (step S63).

【0052】図11の例では、無条件先行ブロック集合
300の最後尾に位置する共通命令列集合307を指定
され、コード変換処理が呼び出される。 <コード変換処理>図10は、ステップS63のコード
変換処理の詳細を示すフローチャートである。以下、図
10のフローチャート並びに図11および図12のプロ
グラム例を参照しながら、コード変換処理について説明
する。
In the example of FIG. 11, the common instruction sequence set 307 located at the end of the unconditional preceding block set 300 is specified, and the code conversion process is called. <Code Conversion Processing> FIG. 10 is a flowchart showing details of the code conversion processing in step S63. Hereinafter, the code conversion processing will be described with reference to the flowchart of FIG. 10 and the program examples of FIGS. 11 and 12.

【0053】コード変換処理の前半において、コード変
換部116は、指定された共通命令列集合の直前に別の
共通命令列集合が存在する場合(ステップS70)、ス
テップS71〜ステップS73の繰返し処理により、当
該直前に存在する各共通命令列集合を順次指定して、図
10のフローチャートに示すコード変換処理を再帰的に
呼び出す(ステップS72)。この呼び出しが再帰的に
繰返されることによって、指定された共通命令列集合に
おいてコード変換を行うよりも前に、当該共通命令列集
合から先頭に向けて階層的に存在する全ての共通命令列
集合において共用部分選択部115によって選択された
基本ブロックに含まれる命令列が共用されるようにプロ
グラムが変換される。
In the first half of the code conversion process, when another common instruction sequence set exists immediately before the designated common instruction sequence set (step S70), the code conversion unit 116 performs the repetition of steps S71 to S73. The code conversion process shown in the flowchart of FIG. 10 is recursively called by sequentially designating each common instruction sequence set existing immediately before (step S72). By repeating this call recursively, before performing code conversion in the specified common instruction sequence set, in all the common instruction sequence sets that exist hierarchically from the common instruction sequence set to the beginning, The program is converted so that the instruction sequence included in the basic block selected by the common part selection unit 115 is shared.

【0054】コード変換処理の後半において、コード変
換部116は、共用部分選択部115によって選択され
た基本ブロックに含まれる命令列の直前にラベルがない
場合は(ステップS74)、当該場所に新たにラベルを
作成し(ステップS75)、その後ステップS76から
ステップS80の繰返し処理により、選択されなかった
各基本ブロックについて順次以下の処理を行う。すなわ
ち、当該基本ブロックの最後尾の分岐命令について分岐
先が更新されていなければ(ステップS77)前記選択
された基本ブロックの命令列の直前に変更し(ステップ
S78)、当該選択されなかった基本ブロックの命令列
を削除する(ステップS79)。
In the latter half of the code conversion process, if there is no label immediately before the instruction sequence included in the basic block selected by the common part selection unit 115 (step S74), the code conversion unit 116 newly adds the label to the location. A label is created (step S75), and the following processing is sequentially performed on each of the basic blocks that are not selected by repeating the processing from step S76 to step S80. That is, if the branch destination has not been updated for the last branch instruction of the basic block (step S77), the instruction is changed immediately before the instruction sequence of the selected basic block (step S78), and the unselected basic block is changed. Is deleted (step S79).

【0055】図11および図12の例では、初回のコー
ド変換処理は共通命令列集合307を指定して呼び出さ
れ、当該処理の前半において、共通命令列集合307の
直前に位置する共通命令列集合308、309を各々指
定して、2回目、3回目のコード変換処理が呼び出され
る。2回目のコード変換処理の前半において、指定され
た共通命令列集合308の直前に位置する他の共通命令
列集合が存在しないため、コード変換処理の再帰的な呼
び出しは行われない。同処理の後半において、共用部分
選択部115によって選択された基本ブロック301a
に含まれる命令312〜313からなる命令列の直前に
新たにラベル317が作成され、分岐命令326aの分
岐先がL2に変更され、選択されなかった基本ブロック
の命令列が削除される。
In the examples of FIGS. 11 and 12, the first code conversion process is called by designating the common instruction sequence set 307, and in the first half of the process, the common instruction sequence set located immediately before the common instruction sequence set 307 is called. The second and third code conversion processes are called by designating 308 and 309, respectively. In the first half of the second code conversion process, since there is no other common instruction sequence set located immediately before the designated common instruction sequence set 308, a recursive call of the code conversion process is not performed. In the latter half of the process, the basic block 301a selected by the shared portion selection unit 115
Is newly created just before the instruction sequence consisting of the instructions 312 to 313 included in the instruction, the branch destination of the branch instruction 326a is changed to L2, and the instruction sequence of the unselected basic block is deleted.

【0056】3回目のコード変換処理の前半において
も、2回目の処理と同様、コード変換処理の再帰的な呼
び出しは行われず、同処理の後半において、共用部分選
択部115によって選択された基本ブロック301bに
含まれる命令332〜333からなる命令列の直前に新
たにラベル337が作成され、分岐命令346a、35
6aの分岐先がL3に変更され、選択されなかった基本
ブロックの命令列が削除される。
In the first half of the third code conversion process, similar to the second process, the recursive call of the code conversion process is not performed, and in the second half of the process, the basic block selected by the shared portion selection unit 115 is used. A new label 337 is created immediately before the instruction sequence including the instructions 332 to 333 included in the instruction 301b, and the branch instructions 346a and 346 are generated.
The branch destination of 6a is changed to L3, and the instruction sequence of the unselected basic block is deleted.

【0057】この結果、図11に示したプログラムが得
られる。2回目、3回目のコード変換処理が行われた
後、初回のコード変換処理の後半が実行される。共用部
分選択部115によって選択された基本ブロック303
cに含まれる命令334〜335からなる命令列の直前
に新たにラベル338が作成され、まだ変更されていな
い分岐命令316aの分岐先がL4に変更され、選択さ
れなかった基本ブロックの命令列が削除される。
As a result, the program shown in FIG. 11 is obtained. After the second and third code conversion processes are performed, the latter half of the first code conversion process is executed. Basic block 303 selected by common part selecting section 115
A new label 338 is created immediately before the instruction sequence consisting of the instructions 334 to 335 included in the instruction c, the branch destination of the branch instruction 316a that has not been changed is changed to L4, and the instruction sequence of the unselected basic block is changed to L4. Deleted.

【0058】この結果、図12に示したプログラムが得
られる。この構成によれば、多段階テールマージ最適化
後のプログラムにおいて実行される分岐命令の数を最小
にすることができる。なお、前記共通命令列集合抽出部
114に共通命令列集合抽出手段および共通命令列集合
抽出制御手段を設け、抽出処理のステップS22〜S2
3を共通命令列集合抽出手段により実行し、抽出処理の
その他のステップと抽出準備処理の各ステップとを共通
命令列集合抽出制御手段により実行してもよい。
As a result, the program shown in FIG. 12 is obtained. According to this configuration, the number of branch instructions executed in the program after the multi-stage tail merge optimization can be minimized. The common instruction sequence set extraction unit 114 is provided with a common instruction sequence set extraction unit and a common instruction sequence set extraction control unit, and the steps S22 to S2 of the extraction process are performed.
3 may be executed by the common instruction sequence set extraction means, and the other steps of the extraction processing and each step of the extraction preparation processing may be executed by the common instruction sequence set extraction control means.

【0059】なお、前記共用部分選択部115の選択処
理において、任意に1の命令列を選択すべき共通命令列
集合、および、要素数が最大の共通命令列集合が直前に
複数存在する共通命令列集合においては、共用すべき命
令列の候補が複数存在する。係る共通命令列集合を含む
無条件先行ブロック集合では分岐命令の実行回数を最小
にする命令列の組合せが複数存在する。
In the selection process of the common part selecting unit 115, a common instruction sequence set in which one instruction sequence should be arbitrarily selected, and a common instruction sequence in which a plurality of common instruction sequence sets having the maximum number of elements exist immediately before. In the sequence set, there are a plurality of instruction sequence candidates to be shared. In the unconditional preceding block set including the common instruction string set, there are a plurality of instruction string combinations that minimize the number of executions of the branch instruction.

【0060】係る場合には、前記共用部分選択部115
は、各共通命令列集合において共用すべき命令列の候補
を1つずつ選ぶ組合せをあらかじめ列挙し、各々の組合
せに従って命令列を共用させた場合のプログラムについ
て分岐命令のサイズを算出し、サイズが最も小さくなる
組合せを選択してもよい。この構成によれば、多段階テ
ールマージ最適化後のプログラムにおいて実行される分
岐命令の数を最小にした上で、分岐命令のサイズを最小
にすることができる。
In such a case, the common part selecting unit 115
Enumerates in advance combinations that select one instruction sequence candidate to be shared in each common instruction sequence set, calculates the size of the branch instruction for the program in which the instruction sequence is shared according to each combination, and calculates the size of the branch instruction. The smallest combination may be selected. According to this configuration, it is possible to minimize the number of branch instructions executed in the program after the multi-stage tail merge optimization, and also to minimize the size of the branch instruction.

【0061】なお、目的プログラムによっては分岐命令
のコードサイズが分岐距離に応じて増減するという特性
を有するものがある。係る特性を有する目的プログラム
を生成する場合において、本プログラム変換装置は、コ
ード変換部116が前記変換を行った場合に削除される
命令列および変更される分岐命令についてコードサイズ
の変化量をあらかじめ算出し、変換によってコードサイ
ズが減少しない基本ブロックにおいて命令列の削除およ
び分岐命令の変更をしないようコード変換部116に対
して制御する制御手段を備えてもよい。
Some target programs have a characteristic that the code size of a branch instruction increases or decreases according to the branch distance. When generating a target program having such characteristics, the present program conversion apparatus calculates in advance the amount of change in code size for an instruction sequence to be deleted and a branch instruction to be changed when the code conversion unit 116 performs the conversion. Control means may be provided for controlling the code conversion unit 116 so as not to delete an instruction sequence and change a branch instruction in a basic block whose code size is not reduced by the conversion.

【0062】この構成によれば、例えば、図12の基本
ブロック301cの最後尾の分岐命令について分岐先が
変更されることによりコードサイズが増加する場合であ
って、当該増加するコードサイズが削除される命令列の
コードサイズと等しいかより大きい場合、基本ブロック
301cにおける命令列の削除と分岐命令の変更は行わ
れない。これにより、前記特性を有する目的プログラム
において、変換によりコードサイズが増加する可能性を
排除できる。
According to this configuration, for example, when the code size is increased by changing the branch destination for the last branch instruction of the basic block 301c in FIG. 12, the increased code size is deleted. If the code size is equal to or larger than the code size of the instruction sequence, the deletion of the instruction sequence and the change of the branch instruction in the basic block 301c are not performed. As a result, it is possible to eliminate the possibility that the code size increases due to the conversion in the target program having the above characteristics.

【0063】なお、コンパイラによっては、生成された
目的プログラムに対して最適化を行うものがある。係る
コンパイラにおいては、目的プログラムに対してテール
マージ最適化を行う構成としてもよい。図17は、係る
プログラム変換装置120の構成を示す図であり、目的
プログラム最適化部108は、基本ブロック解析部12
1、テールマージ最適化部122を含み、目的プログラ
ム生成部107が生成した目的プログラムを入力され、
前記中間コード最適化部105と同様の処理を行い、目
的プログラム106を出力する。
It should be noted that some compilers optimize the generated target program. Such a compiler may be configured to perform tail merge optimization on a target program. FIG. 17 is a diagram showing a configuration of such a program conversion device 120. The target program optimization unit 108 includes a basic block analysis unit 12
1. The target program including the tail merge optimizing unit 122 and the target program generated by the target program generating unit 107 is input,
The same processing as that of the intermediate code optimizing unit 105 is performed, and the target program 106 is output.

【0064】この構成によれば、目的プログラムに対し
て最適化を行うコンパイラにおいても、本発明を適用す
ることができる。 <第2実施形態>第2実施形態におけるプログラム変換
装置は、第1実施形態に対して、共用部分選択部115
の動作が異なる。第2実施形態において、共用部分選択
部115は、選択した命令列を共用させたプログラムに
おける分岐命令のサイズを算出する。当該分岐命令のサ
イズは共用させる命令列が含まれる基本ブロックの位置
関係に応じて異なり、共用部分選択部115はサイズが
最も小さくなる命令列を共用すべき命令列として選択す
る。 <選択処理>図18は、第2実施形態における選択処理
を示すフローチャートである。以下、図18のフローチ
ャートを参照しながら、第2実施形態における選択処理
について説明する。
According to this configuration, the present invention can be applied to a compiler that optimizes a target program. <Second Embodiment> The program conversion device according to the second embodiment is different from the first embodiment in that the shared part selection unit 115
Works differently. In the second embodiment, the shared part selection unit 115 calculates the size of a branch instruction in a program that shares the selected instruction sequence. The size of the branch instruction differs depending on the positional relationship of the basic block including the instruction sequence to be shared, and the shared portion selection unit 115 selects the instruction sequence with the smallest size as the instruction sequence to be shared. <Selection Processing> FIG. 18 is a flowchart showing the selection processing in the second embodiment. Hereinafter, the selection processing in the second embodiment will be described with reference to the flowchart in FIG.

【0065】共用部分選択部115は、ステップS90
〜ステップS94の繰返し処理により、基本ブロック解
析部111によって抽出された無条件先行ブロック集合
ごとに、共用させた場合に分岐命令のサイズが最小とな
る命令列の組合せを求める。具体的には、各共通命令列
集合から基本ブロックを1づつ選ぶ組合せを列挙し(ス
テップS91)、ステップS92〜S94の繰返し処理
により、列挙された組合せごとに、当該組合せに従って
選択された基本ブロックに含まれる命令列を共用させた
場合のプログラムにおける分岐命令のサイズを算出し、
分岐命令のサイズが最も小さくなる組合せを共用すべき
命令列が含まれる基本ブロックとして選択する(ステッ
プS95)。
The common part selection unit 115 determines in step S90
Through the repetition processing of step S94, for each unconditional preceding block set extracted by the basic block analysis unit 111, a combination of instruction sequences that minimizes the size of a branch instruction when shared is obtained. Specifically, a combination for selecting one basic block from each common instruction sequence set is enumerated (step S91), and by repeating the steps S92 to S94, for each of the enumerated combinations, the basic block selected according to the combination is selected. Calculate the size of the branch instruction in the program when the instruction sequence included in
The combination that minimizes the size of the branch instruction is selected as a basic block including an instruction sequence to be shared (step S95).

【0066】この構成によれば、多段階テールマージ最
適化後のプログラムにおいて分岐命令のサイズを最小に
することができる。なお、生成された目的プログラムに
対して最適化を行うコンパイラにおいては、目的プログ
ラムに対してテールマージ最適化を行う構成としてもよ
い。この構成によれば、目的プログラムに対して最適化
を行うコンパイラにおいても、本発明を適用することが
できる。
According to this configuration, the size of the branch instruction in the program after the multi-stage tail merge optimization can be minimized. Note that a compiler that performs optimization on the generated target program may be configured to perform tail merge optimization on the target program. According to this configuration, the present invention can be applied to a compiler that optimizes a target program.

【0067】[0067]

【発明の効果】本発明のプログラム変換装置は、複数の
基本ブロックの後尾にある同一の命令列についてそのう
ちの1が共用されるようにプログラムを変換してコード
サイズを削減するプログラム変換装置であって、特定の
基本ブロックに無条件に後続する他の複数の基本ブロッ
クを対象として、それらの異なる基本ブロック内に存在
する同一の命令列の集合であって、それらの基本ブロッ
クの後尾から先頭に向けて階層的に存在する共通命令列
集合を抽出する抽出手段と、抽出された各共通命令列集
合において何れか1の命令列を含む基本ブロックを、他
の共通命令列集合において選択した基本ブロックとの位
置関係に応じて選択する選択手段と、選択された基本ブ
ロック中の命令列が他の基本ブロックにおいて共用され
るようにプログラムを変換するコード変換手段とを備え
る。
The program conversion device of the present invention is a program conversion device for converting a program so that one of the same instruction sequence at the end of a plurality of basic blocks is shared, thereby reducing the code size. A set of the same instruction sequence existing in different basic blocks for a plurality of other basic blocks that unconditionally follow a specific basic block, and Extracting means for extracting a common instruction sequence set existing in a hierarchical manner, and selecting a basic block including any one instruction sequence in each extracted common instruction sequence set in another common instruction sequence set Selection means for selecting in accordance with the positional relationship between the program and the program so that the instruction sequence in the selected basic block is shared by other basic blocks. Converting a and a code converting means.

【0068】この構成によれば、あらかじめ、階層的に
存在する全ての共通命令列集合を抽出し、共用させる命
令列を含む基本ブロックの位置関係を複数の階層にわた
って検討し、最適化を行ったプログラムにおいて実行さ
れる分岐命令数の多寡を知った上で、共用すべき命令列
が含まれる基本ブロックを選択できるため、従来の多段
階テールマージ最適化に比べて、当該分岐命令数をより
低減することができる。
According to this configuration, all common instruction sequence sets existing in a hierarchy are extracted in advance, and the positional relationship of the basic block including the instruction sequence to be shared is examined over a plurality of hierarchies, and optimization is performed. Knowing the number of branch instructions to be executed in a program and selecting the basic block containing the instruction sequence to be shared, the number of branch instructions is reduced compared to the conventional multi-stage tail merge optimization can do.

【0069】前記抽出手段は、複数の基本ブロックを対
象として、それらの基本ブロックの後尾にある共通命令
列集合を抽出する共通命令列集合抽出手段と、初回は同
一の基本ブロックに無条件に後続する複数の基本ブロッ
クを対象として共通命令列集合抽出手段に共通命令列集
合を抽出させ、2回目以降は共通の命令列を有する複数
の基本ブロックから直前までに抽出された共通の命令列
を除外したプログラム部分を対象として共通命令列集合
抽出手段に共通命令列集合を抽出させる抽出制御手段と
を備えてもよい。
[0069] The extraction means is a common instruction string set extraction means for extracting a common instruction string set at the end of the basic blocks for a plurality of basic blocks. The common instruction sequence set extraction unit extracts a common instruction sequence set for a plurality of basic blocks, and excludes a common instruction sequence extracted immediately before from a plurality of basic blocks having a common instruction sequence for the second and subsequent times. Extraction control means for causing the common instruction sequence set extraction means to extract the common instruction sequence set with respect to the program part.

【0070】この構成によれば、前記階層的に存在する
共通命令列集合を効率よく抽出することができる。前記
選択手段は、上下に連続する複数の階層にわたる共通命
令列集合について、一対の共通命令列集合が上下に接す
る場合に、双方において同一の基本ブロックを選択して
もよい。
According to this configuration, the common instruction sequence set existing in the hierarchy can be efficiently extracted. The selection means may select the same basic block in a common instruction sequence set extending over a plurality of layers that are vertically continuous when a pair of common instruction sequence sets is vertically in contact with each other.

【0071】前記選択手段は、上下に連続する複数の階
層にわたる共通命令列集合について、下層の1の共通命
令列集合に対し上層の複数の共通命令列集合が接する場
合に、要素数が最も多い上層の共通命令列集合と下層の
共通命令列集合とにおいて同一の基本ブロックを選択し
てもよい。前記選択手段は、最後尾が分岐命令でない基
本ブロックに含まれる命令列が共通命令列集合に属して
いる場合に、当該基本ブロックを選択してもよい。
The selecting means has the largest number of elements when a plurality of upper-layer common instruction sequence sets contact one lower-layer common instruction sequence set with respect to a plurality of upper-lower-level common instruction sequence sets. The same basic block may be selected in the upper-layer common instruction sequence set and the lower-layer common instruction sequence set. The selecting means may select the basic block when the instruction sequence included in the basic block whose tail is not a branch instruction belongs to a common instruction sequence set.

【0072】これらの構成によれば、最適化を行ったプ
ログラムにおいて実行される分岐命令数を最小にするこ
とができる。前記選択手段は、抽出された各共通命令列
集合において1以上の基本ブロックを、他の共通命令列
集合における基本ブロックとの位置関係に応じて選択候
補とする選択候補抽出部と、各共通命令列集合において
選択候補とされた基本ブロックを1づつ選ぶ組合せを全
て列挙する組合せ列挙部と、列挙された各々の組合せに
従って基本ブロックを選択して前記変換を行った場合に
変更される分岐命令のコードサイズをあらかじめ算出す
る分岐命令サイズ算出部とを備え、算出されるコードサ
イズが最も小さい組合せに従って基本ブロックを選択し
てもよい。
According to these configurations, the number of branch instructions executed in the optimized program can be minimized. A selection candidate extraction unit that selects one or more basic blocks in each of the extracted common instruction sequence sets according to a positional relationship with a basic block in another common instruction sequence set; A combination enumeration unit for enumerating all combinations for selecting one basic block selected as a selection candidate in a column set, and a branch instruction changed when a basic block is selected according to each enumerated combination and the conversion is performed. A branch instruction size calculator for calculating a code size in advance may be provided, and the basic block may be selected according to a combination having the smallest calculated code size.

【0073】この構成によれば、最適化を行ったプログ
ラムにおいて実行される分岐命令数を最小にした上で、
分岐命令のサイズを最小にすることができる。前記プロ
グラム変換装置は、さらに、前記変換により削除される
命令列および変更される分岐命令についてコードサイズ
の変化量を算出し、変換によってコードサイズが減少し
ない基本ブロックにおいて命令列の削除および分岐命令
の変更をしないようコード変換手段に対して制御する制
御手段を備えてもよい。
According to this configuration, after minimizing the number of branch instructions executed in the optimized program,
The size of the branch instruction can be minimized. The program conversion device further calculates a code size change amount for the instruction sequence to be deleted by the conversion and the branch instruction to be changed, and deletes and deletes the instruction sequence and the branch instruction in the basic block whose code size is not reduced by the conversion. A control means for controlling the code conversion means so as not to make a change may be provided.

【0074】この構成によれば、生成する目的プログラ
ムの分岐命令のコードサイズが分岐距離に応じて増減す
るという特性を有する場合に、最適化を行うことにより
コードサイズが増加する可能性を排除できる。
According to this configuration, when the code size of the branch instruction of the target program to be generated has a characteristic of increasing or decreasing according to the branch distance, the possibility of increasing the code size by performing optimization can be eliminated. .

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

【図1】プログラム変換装置の機能ブロック図である。FIG. 1 is a functional block diagram of a program conversion device.

【図2】中間コード最適化部の機能ブロック図である。FIG. 2 is a functional block diagram of an intermediate code optimization unit.

【図3】基本ブロックおよび基本ブロック間の制御フロ
ーの模式図、並びに、無条件先行ブロック集合の一覧を
示す一例である。
FIG. 3 is an example showing a schematic diagram of a basic block and a control flow between the basic blocks, and a list of unconditionally preceding block sets.

【図4】抽出準備処理を示すフローチャートである。FIG. 4 is a flowchart showing extraction preparation processing.

【図5】抽出処理を示すフローチャートである。FIG. 5 is a flowchart illustrating an extraction process.

【図6】抽出処理の過程を示すために用いるプログラム
の一例である。
FIG. 6 is an example of a program used to show a process of an extraction process.

【図7】選択準備処理を示すフローチャートである。FIG. 7 is a flowchart illustrating a selection preparation process.

【図8】選択処理を示すフローチャートである。FIG. 8 is a flowchart showing a selection process.

【図9】コード変換準備処理を示すフローチャートであ
る。
FIG. 9 is a flowchart showing a code conversion preparation process.

【図10】コード変換処理を示すフローチャートであ
る。
FIG. 10 is a flowchart showing a code conversion process.

【図11】コード変換処理の過程を示すために用いるプ
ログラムの一例である。
FIG. 11 is an example of a program used to show a process of a code conversion process.

【図12】コード変換処理の過程を示すために用いるプ
ログラムの一例である。
FIG. 12 is an example of a program used to show a process of a code conversion process.

【図13】選択条件の根拠を示すために用いる概念図で
ある。
FIG. 13 is a conceptual diagram used to show the basis of a selection condition.

【図14】選択条件の根拠を示すために用いる概念図で
ある。
FIG. 14 is a conceptual diagram used to show the basis of a selection condition.

【図15】選択条件の根拠を示すために用いる概念図で
ある。
FIG. 15 is a conceptual diagram used to show the basis of a selection condition.

【図16】選択条件の根拠を示すために用いる概念図で
ある。
FIG. 16 is a conceptual diagram used to show the basis of a selection condition.

【図17】プログラム変換装置の機能ブロック図であ
る。
FIG. 17 is a functional block diagram of a program conversion device.

【図18】第2実施形態における選択処理を示すフロー
チャートである。
FIG. 18 is a flowchart illustrating a selection process according to the second embodiment.

【図19】テールマージ最適化前後のプログラムの例で
ある。
FIG. 19 is an example of a program before and after tail merge optimization.

【図20】テールマージ最適化を2回繰返し行った過程
を示すプログラム例である。
FIG. 20 is a program example showing a process in which tail merge optimization is repeated twice.

【図21】テールマージ最適化を2回繰返し行った過程
を示すプログラム例である。
FIG. 21 is a program example showing a process in which tail merge optimization is repeated twice.

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

100 プログラム変換装置 101 ソースプログラム 102 字句解析部 103 構文解析部 104 中間コード生成部 105 中間コード最適化部 106 目的プログラム 107 目的プログラム生成部 108 目的プログラム最適化部 111 基本ブロック解析部 112 テールマージ最適化部 114 共通命令列集合抽出部 115 共用部分選択部 116 コード変換部 120 プログラム変換装置 121 基本ブロック解析部 122 テールマージ最適化部 300 無条件先行ブロック集合 301〜305、301a〜305a、301b、30
1c、303c基本ブロック 307〜309 共通命令列集合 311〜356、316a、326a、346a、35
6a 命令 317、337、338 ラベル 1100a、1100b プログラム 1101a、1101b、1102a、1102b、1
103、1104基本ブロック 1105 共通命令列集合 1106 共用される命令列 1107〜1110 分岐命令 1200a、1200b、1200c プログラム 1201a、1201b、1202a、1202b、1
202c、1203a、1203b、1203c、12
04、1205、1206 基本ブロック 1207、1208 共通命令列集合 1209、1210 共用される命令列 1211〜1218 分岐命令 1300a、1300b、1300c プログラム 1301a、1301b、1302a、1302b、1
302c、1303a、1303b、1303c、13
04、1305、1306 基本ブロック 1307、1308 共通命令列集合 1309、1310 共用される命令列 1311〜1318 分岐命令
REFERENCE SIGNS LIST 100 program converter 101 source program 102 lexical analyzer 103 syntax analyzer 104 intermediate code generator 105 intermediate code optimizer 106 objective program 107 objective program generator 108 objective program optimizer 111 basic block analyzer 112 tail merge optimization Unit 114 common instruction sequence set extraction unit 115 common part selection unit 116 code conversion unit 120 program conversion device 121 basic block analysis unit 122 tail merge optimization unit 300 unconditional preceding block set 301-305, 301a-305a, 301b, 30
1c, 303c Basic blocks 307 to 309 Common instruction sequence set 311 to 356, 316a, 326a, 346a, 35
6a instruction 317, 337, 338 label 1100a, 1100b program 1101a, 1101b, 1102a, 1102b, 1
103, 1104 basic block 1105 common instruction sequence set 1106 shared instruction sequence 1107-1110 branch instruction 1200a, 1200b, 1200c program 1201a, 1201b, 1202a, 1202b, 1
202c, 1203a, 1203b, 1203c, 12
04, 1205, 1206 Basic block 1207, 1208 Common instruction sequence set 1209, 1210 Shared instruction sequence 1211-1218 Branch instruction 1300a, 1300b, 1300c Program 1301a, 1301b, 1302a, 1302b, 1
302c, 1303a, 1303b, 1303c, 13
04, 1305, 1306 Basic block 1307, 1308 Common instruction sequence set 1309, 1310 Shared instruction sequence 1311 to 1318 Branch instruction

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】 複数の基本ブロックの後尾にある同一の
命令列についてそのうちの1が共用されるようにプログ
ラムを変換してコードサイズを削減するプログラム変換
装置であって、 特定の基本ブロックに無条件に後続する他の複数の基本
ブロックを対象として、それらの異なる基本ブロック内
に存在する同一の命令列の集合であって、それらの基本
ブロックの後尾から先頭に向けて階層的に存在する共通
命令列集合を抽出する抽出手段と、 抽出された各共通命令列集合において何れか1の命令列
を含む基本ブロックを、他の共通命令列集合における基
本ブロックとの位置関係に応じて選択する選択手段と、 選択された基本ブロック中の命令列が他の基本ブロック
において共用されるようにプログラムを変換するコード
変換手段とを備えることを特徴とするプログラム変換装
置。
1. A program conversion apparatus for reducing a code size by converting a program so that one of the same instruction sequence at the end of a plurality of basic blocks is shared. A set of the same instruction sequence existing in different basic blocks for a plurality of other basic blocks following the condition, and a common set of hierarchically existing from the tail to the head of the basic blocks. Extracting means for extracting a set of instruction sequences; selection for selecting a basic block including any one of the instruction sequences in each of the extracted common instruction sequence sets according to a positional relationship with a basic block in another common instruction sequence set Means, and code conversion means for converting the program so that the instruction sequence in the selected basic block is shared by other basic blocks. And a program conversion device.
【請求項2】 前記抽出手段は、 複数の基本ブロックを対象として、それらの後尾にある
共通命令列集合を抽出する共通命令列集合抽出手段と、 初回は同一の基本ブロックに無条件に後続する複数の基
本ブロックを対象として共通命令列集合抽出手段に共通
命令列集合を抽出させ、2回目以降は共通の命令列を有
する複数の基本ブロックから直前までに抽出された共通
の命令列を除外したプログラム部分を対象として共通命
令列集合抽出手段に共通命令列集合を抽出させる抽出制
御手段とを備えることを特徴とする請求項1記載のプロ
グラム変換装置。
2. The extraction means, comprising: a common instruction string set extracting means for extracting a common instruction string set at a tail of a plurality of basic blocks; and an unconditionally following the same basic block for the first time. The common instruction sequence set extraction means extracts a common instruction sequence set for a plurality of basic blocks, and excludes a common instruction sequence extracted immediately before from a plurality of basic blocks having a common instruction sequence for the second and subsequent times. 2. The program conversion device according to claim 1, further comprising extraction control means for causing the common instruction sequence set extracting means to extract a common instruction sequence set for the program portion.
【請求項3】 前記選択手段は、 上下に連続する複数の階層にわたる共通命令列集合につ
いて、一対の共通命令列集合が上下に接する場合に、双
方において同一の基本ブロックを選択することを特徴と
する請求項1または2記載のプログラム変換装置。
3. The method according to claim 1, wherein the selecting means selects the same basic block for a common instruction sequence set extending over a plurality of layers that are vertically continuous when the pair of common instruction sequence sets is vertically adjacent to each other. 3. The program conversion device according to claim 1, wherein
【請求項4】 前記選択手段は、 上下に連続する複数の階層にわたる共通命令列集合につ
いて、下層の1の共通命令列集合に対し上層の複数の共
通命令列集合が接する場合に、要素数が最も多い上層の
共通命令列集合と下層の共通命令列集合とにおいて同一
の基本ブロックを選択することを特徴とする請求項1ま
たは2記載のプログラム変換装置。
4. The method according to claim 1, wherein the selecting means is configured such that, when the common instruction sequence set in the upper layer is in contact with the common instruction sequence set in the lower layer, the number of elements is equal to one common instruction sequence set in the lower layer. 3. The program conversion apparatus according to claim 1, wherein the same basic block is selected in the uppermost common instruction sequence set and the lowermost common instruction sequence set.
【請求項5】 前記選択手段は、 最後尾が分岐命令でない基本ブロックに含まれる命令列
が共通命令列集合に属している場合に、当該基本ブロッ
クを選択することを特徴とする請求項1または2記載の
プログラム変換装置。
5. An apparatus according to claim 1, wherein said selecting means selects said basic block when an instruction sequence included in a basic block whose tail is not a branch instruction belongs to a common instruction sequence set. 3. The program conversion device according to 2.
【請求項6】 前記選択手段は、 抽出された各共通命令列集合において1以上の基本ブロ
ックを、他の共通命令列集合における基本ブロックとの
位置関係に応じて選択候補とする選択候補抽出部と、各
共通命令列集合において選択候補とされた基本ブロック
を1づつ選ぶ組合せを全て列挙する組合せ列挙部と、列
挙された各々の組合せに従って基本ブロックを選択して
前記変換を行った場合に変更される分岐命令のコードサ
イズをあらかじめ算出する分岐命令サイズ算出部とを備
え、算出されるコードサイズが最も小さい組合せに従っ
て基本ブロックを選択することを特徴とする請求項1ま
たは2記載のプログラム変換装置。
6. A selection candidate extraction unit for selecting one or more basic blocks in each extracted common instruction sequence set as selection candidates according to a positional relationship with a basic block in another common instruction sequence set. And a combination enumeration unit that enumerates all combinations that select one basic block selected as a selection candidate in each common instruction sequence set, and changes when the conversion is performed by selecting a basic block according to each enumerated combination. 3. The program conversion device according to claim 1, further comprising: a branch instruction size calculator for calculating a code size of the branch instruction to be calculated in advance, wherein the basic block is selected according to a combination having the smallest calculated code size. .
【請求項7】 前記プログラム変換装置は、さらに、 前記変換により削除される命令列および変更される分岐
命令についてコードサイズの変化量を算出し、変換によ
ってコードサイズが減少しない基本ブロックにおいて命
令列の削除および分岐命令の変更をしないようコード変
換手段に対して制御する制御手段を備えることを特徴と
する請求項1または2記載のプログラム変換装置。
7. The program conversion device further calculates an amount of change in code size for an instruction sequence deleted by the conversion and a branch instruction to be changed, and converts the instruction sequence in a basic block whose code size does not decrease by the conversion. 3. The program conversion device according to claim 1, further comprising control means for controlling the code conversion means so as not to delete or change the branch instruction.
【請求項8】 複数の基本ブロックの後尾にある同一の
命令列についてそのうちの1が共用されるようにプログ
ラムを変換してコードサイズを削減するプログラム変換
装置において用いられるプログラム変換方法であって、 特定の基本ブロックに無条件に後続する他の複数の基本
ブロックを対象として、それらの異なる基本ブロック内
に存在する同一の命令列の集合であって、それらの基本
ブロックの後尾から先頭に向けて階層的に存在する共通
命令列集合を抽出する第1のステップと、 第1のステップで抽出された各共通命令列集合において
何れか1の命令列を含む基本ブロックを、他の共通命令
列集合において選択した基本ブロックとの位置関係に応
じて選択する第2のステップと、 第2のステップで選択された基本ブロック中の命令列が
他の基本ブロックにおいて共用されるようにプログラム
を変換する第3のステップとを含むことを特徴とするプ
ログラム変換方法。
8. A program conversion method used in a program conversion apparatus for reducing a code size by converting a program so that one of the same instruction sequences at the end of a plurality of basic blocks is shared, A set of identical instruction sequences existing in different basic blocks, targeting a plurality of other basic blocks that unconditionally follow a specific basic block. A first step of extracting a common instruction sequence set existing in a hierarchy, and a basic instruction block including any one instruction sequence in each of the common instruction sequence sets extracted in the first step is replaced with another common instruction sequence set. A second step of selecting in accordance with the positional relationship with the basic block selected in the above, and an instruction sequence in the basic block selected in the second step And a third step of converting the program so that the program is shared by other basic blocks.
【請求項9】 複数の基本ブロックの後尾にある同一の
命令列についてそのうちの1が共用されるようにプログ
ラムを変換してコードサイズを削減するプログラム変換
装置において用いられるプログラムを記憶しているコン
ピュータ読取り可能な記録媒体であって、 特定の基本ブロックに無条件に後続する他の複数の基本
ブロックを対象として、それらの異なる基本ブロック内
に存在する同一の命令列の集合であって、それらの基本
ブロックの後尾から先頭に向けて階層的に存在する共通
命令列集合を抽出する第1のステップと、 第1のステップで抽出された各共通命令列集合において
何れか1の命令列を含む基本ブロックを、他の共通命令
列集合において選択した基本ブロックとの位置関係に応
じて選択する第2のステップと、 第2のステップで選択された基本ブロック中の命令列が
他の基本ブロックにおいて共用されるようにプログラム
を変換する第3のステップとを有するプログラムを記憶
しているコンピュータ読取り可能な記憶媒体。
9. A computer storing a program used in a program conversion apparatus for reducing a code size by converting a program so that one of the same instruction sequence at the end of a plurality of basic blocks is shared. A readable recording medium, which is a set of identical instruction sequences existing in different basic blocks for a plurality of other basic blocks unconditionally following a specific basic block, and A first step of extracting a common instruction sequence set existing hierarchically from the tail to the beginning of the basic block, and a basic instruction sequence including any one instruction sequence in each of the common instruction sequence sets extracted in the first step A second step of selecting a block in accordance with a positional relationship with a basic block selected in another common instruction sequence set; And a third step of converting the program so that the instruction sequence in the basic block selected in the step is shared by other basic blocks.
JP2000028277A 2000-02-04 2000-02-04 Program conversion apparatus, program conversion method, and program storage medium Expired - Fee Related JP3650713B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000028277A JP3650713B2 (en) 2000-02-04 2000-02-04 Program conversion apparatus, program conversion method, and program storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000028277A JP3650713B2 (en) 2000-02-04 2000-02-04 Program conversion apparatus, program conversion method, and program storage medium

Publications (2)

Publication Number Publication Date
JP2001216168A true JP2001216168A (en) 2001-08-10
JP3650713B2 JP3650713B2 (en) 2005-05-25

Family

ID=18553708

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000028277A Expired - Fee Related JP3650713B2 (en) 2000-02-04 2000-02-04 Program conversion apparatus, program conversion method, and program storage medium

Country Status (1)

Country Link
JP (1) JP3650713B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005522772A (en) * 2002-04-15 2005-07-28 ギーゼッケ ウント デフリエント ゲーエムベーハー Optimizing compiler generated program code
JP2007531946A (en) * 2004-04-07 2007-11-08 ローベルト ボッシュ ゲゼルシャフト ミット ベシュレンクテル ハフツング Data integrity in data processing equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005522772A (en) * 2002-04-15 2005-07-28 ギーゼッケ ウント デフリエント ゲーエムベーハー Optimizing compiler generated program code
US7805718B2 (en) 2002-04-15 2010-09-28 Giesecke & Devrient Gmbh Optimisation of a compiler generated program code
JP2007531946A (en) * 2004-04-07 2007-11-08 ローベルト ボッシュ ゲゼルシャフト ミット ベシュレンクテル ハフツング Data integrity in data processing equipment
US8464236B2 (en) 2004-04-07 2013-06-11 Robert Bosch Gmbh Data consistency in data processing systems

Also Published As

Publication number Publication date
JP3650713B2 (en) 2005-05-25

Similar Documents

Publication Publication Date Title
EP1552437B1 (en) Information extraction using an object based semantic network
JP6267711B2 (en) Modernization of legacy software systems based on modeled dependencies
Jia et al. Path-relinking Tabu search for the multi-objective flexible job shop scheduling problem
JP3711206B2 (en) How to compile
Chiang et al. A memetic algorithm for minimizing total weighted tardiness on parallel batch machines with incompatible job families and dynamic job arrival
JP5022361B2 (en) RNA secondary structure prediction apparatus, prediction method, program, and recording medium
JP2011034457A (en) Data mining system, data mining method and data mining program
CN103488674A (en) Computing system and method for implementing and controlling thereof
JP2007264908A (en) Business analysis system
JP2001216168A (en) Program converter, program converting method and program storage medium
CN105740457A (en) Recent data stream frequent item set mining method based on CPU+MIC (Central Processing Unit+ Many Integrated Core) cooperative computing
Sree et al. Identification of Promoter Region in Genomic DNA Using Cellular Automata Based Text Clustering.
CN116541268A (en) Method and system for context-aware dependency-guided kernel fuzzy test case variation
CN103294468B (en) A kind of Notes of Key Data of data input item and the programmed method of data input
Lopes et al. ProGeRF: proteome and genome repeat finder utilizing a fast parallel hash function
KR102613367B1 (en) Method and apparatus for automatically reducing model weight for deep learning model serving optimization, and a method for providing cloud inference services usin the same
Sabet et al. A hybrid mutation-based artificial bee colony for traveling salesman problem
JP7400833B2 (en) Topology design device, topology design method, and program
JP6649584B2 (en) Parameterization method, information processing apparatus, and parameterization program
US9633160B2 (en) Method of placement and routing in a reconfiguration of a dynamically reconfigurable processor
Savic Global and evolutionary optimization for water management problems
Masri et al. Exact and approximate approaches for the Pareto front generation of the single path multicommodity flow problem
Sakellaridi Pangenomic QTL analysis
Landau et al. Further comparison between ATNoSFERES and XCSM
JP6701937B2 (en) Search processing optimization program, search processing optimization method, and search processing optimization device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041202

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041221

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050121

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050215

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050221

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080225

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090225

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100225

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100225

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110225

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120225

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130225

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees