JPH09128245A - Compiling processing system - Google Patents

Compiling processing system

Info

Publication number
JPH09128245A
JPH09128245A JP28207395A JP28207395A JPH09128245A JP H09128245 A JPH09128245 A JP H09128245A JP 28207395 A JP28207395 A JP 28207395A JP 28207395 A JP28207395 A JP 28207395A JP H09128245 A JPH09128245 A JP H09128245A
Authority
JP
Japan
Prior art keywords
loop
program
processing
processing system
value
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
JP28207395A
Other languages
Japanese (ja)
Other versions
JP3195211B2 (en
Inventor
Kazuhisa Ishida
和久 石田
Satomi Hasegawa
里美 長谷川
Shinya Sakamoto
慎哉 坂本
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP28207395A priority Critical patent/JP3195211B2/en
Publication of JPH09128245A publication Critical patent/JPH09128245A/en
Application granted granted Critical
Publication of JP3195211B2 publication Critical patent/JP3195211B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To generate an object while compiling time is suppressed to within a range corresponding to the reference situation of arraying data in a loop processing by providing a loop conversion processing part rewriting a description on a multiplex loop in a program into that corresponding to judgment by means of a loop inversion judgment means. SOLUTION: A source program analysis part 10 inputs the given source program 1 and generates an intermediate language program 1a expressed by an intermediate language for compiler based on the program. Then, the loop inversion judgment means in the loop conversion processing part 20 judges whether the circulating directions of inner loops belonging to outer loops are alternately inverted or not is judged at every repetition of the outer loops in the multiplex loops in the intermediate language program 1a. Then, a judgedresult is rewritten. Thus, the object can be generated while compiling time in the loop processing is suppressed.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明はコンパイル処理シス
テムに係り、特に、コンパイル時間の増加をできるだけ
抑制しながら、より高い実行性能を有するオブジェクト
を生成するためのコンパイル処理システムに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compilation processing system, and more particularly to a compilation processing system for generating an object having higher execution performance while suppressing an increase in compilation time as much as possible.

【0002】[0002]

【従来の技術】従来、コンパイラが生成したオブジェク
トの実行制御の際に生ずるキャッシュ競合の削減を目的
とするコンパイル処理のひとつとして、「数値計算プロ
グラミングにおけるデータ移動制御のためのブロック化
アルゴリズム」(by 寒川 光/情報処理学会論文誌Vo
l.33, No.10, Oct.1992 )が知られている。このコンパ
イル処理は、ソースプログラム中に記述されたループを
多重ループに変換して、内側ループでの配列データアク
セス範囲をできるだけ局所化することにより、キャッシ
ュ競合を削減してオブジェクトの実行性能を向上させて
いる。
2. Description of the Related Art Conventionally, "blocking algorithm for controlling data movement in numerical computation programming" has been used as one of the compiling processes for reducing cache contention that occurs when controlling the execution of objects generated by a compiler. Hikaru Samukawa / IPSJ Journal Vo
l.33, No.10, Oct.1992) are known. This compile process converts the loop described in the source program into multiple loops and localizes the array data access range in the inner loop as much as possible to reduce cache contention and improve the execution performance of objects. ing.

【0003】[0003]

【発明が解決しようとする課題】上記従来技術のコンパ
イル処理は、配列の乗算や内積計算などあらかじめ特殊
な配列計算の実行が想定されている場合に有効な処理で
ある。すなわち、一般的な配列を用いた計算が記述され
たソースプログラムに対して上記コンパイル処理を適用
する場合、多数のアルゴリズム変換パターンを事前に想
定し、各パターンに基づいて生成されるオブジェクトに
よる実行性能の向上効果を算定し、最大の向上効果が予
想されるアルゴリズム変換パターンをひとつだけ抽出し
ておかなくてはならないので、コンパイル処理の実行に
要するコンパイル時間が組合わせ的に増大してしまうと
いう問題点があった。
The compilation process of the prior art described above is a process effective when a special array calculation such as array multiplication or inner product calculation is assumed to be executed in advance. That is, when applying the above-mentioned compilation processing to a source program in which calculation using a general array is described, a large number of algorithm conversion patterns are assumed in advance, and the execution performance by the objects generated based on each pattern is assumed. The problem is that the compile time required to execute the compile process increases in combination because it is necessary to calculate the improvement effect of the above and extract only one algorithm conversion pattern that is expected to have the maximum improvement effect. There was a point.

【0004】本発明の目的は、上記の問題点を解決し
て、一般的な配列を用いた計算が記述されたソースプロ
グラムについても、ループ処理における配列データの参
照状況に応じた範囲内にコンパイル時間を抑えながら、
従来より高い実行性能を有するオブジェクトを生成する
ことのできるコンパイル処理システムを提供することに
ある。
An object of the present invention is to solve the above problems and compile a source program in which a calculation using a general array is described within a range according to the reference status of array data in loop processing. While saving time
An object of the present invention is to provide a compile processing system capable of generating an object having higher execution performance than before.

【0005】[0005]

【課題を解決するための手段】上記の目的を達成するた
め、本発明のコンパイル処理システムは、所望のアルゴ
リズムが記述されたプログラムを解析し、前記アルゴリ
ズムの実現に必要な各種処理動作の統括制御を行うため
のオブジェクトを生成するコンパイル処理システムにお
いて、ループ変換処理部を設ける構成としたものであ
る。
In order to achieve the above object, a compilation processing system of the present invention analyzes a program in which a desired algorithm is described, and performs overall control of various processing operations necessary for realizing the algorithm. In the compile processing system for generating an object for performing the above, a loop conversion processing unit is provided.

【0006】ループ変換処理部は、ループ逆転判定手段
とループ逆転書き換え手段とを有している。そして、ル
ープ逆転判定手段は、プログラム中に記述された少なく
とも二重のネスト構造を有する多重ループの各々につい
て、その多重ループにおける外側ループの反復ごとに外
側ループに属する内側ループの巡回方向を交互に逆転さ
せるか否かを判定する。また、ループ逆転書き換え手段
は、プログラム中の多重ループに関する記述をループ逆
転判定手段による判定に応じたものに書き換える。な
お、ループ逆転判定手段による判定に代えて、外側ルー
プの反復ごとに外側ループに属する内側ループの巡回方
向を交互に逆転させるか否かをユーザなどに指定させる
ようにすることも可能である。
The loop conversion processing section has a loop reverse rotation judging means and a loop reverse rotation rewriting means. Then, the loop reversal determination means alternates the circulation direction of the inner loop belonging to the outer loop for each iteration of the outer loop in the multiple loop having at least a double nest structure described in the program. Determine whether to reverse. Further, the loop reverse rewriting means rewrites the description regarding the multiple loops in the program to that according to the judgment by the loop reverse judging means. Instead of the determination by the loop inversion determination means, it is possible to allow the user to specify whether or not the circulation direction of the inner loop belonging to the outer loop is alternately inverted for each iteration of the outer loop.

【0007】ここで、“ループの巡回方向を逆転させ
る”とは、該当するループの本来の処理が、ループ制御
変数の値を増分値〔K〕で初期値〔M〕から最終値
〔N〕まで変化させながら実行させるものである場合
に、ループ制御変数の値を増分値〔−K〕で初期値〔M
+K×[(N−M)÷K]〕から最終値〔M〕まで変化
させながら実行させることを意味する。また、
“[x]”は、実数値〔x〕を越えない最大の整数値を
表す。例えば、初期値〔M:5〕,最終値〔N:2
5〕,増分値〔K:4〕とすると、本来の処理では、ル
ープ制御変数の値を(5→9→13→17→21→2
5)のように変化させながら必要な処理が行われる。こ
れに対して、“ループの巡回方向を逆転させる”と、ル
ープ制御変数の値を(25→21→17→13→9→
5)のように変化させながら必要な処理が行われる。
Here, "reverse the circulation direction of the loop" means that the original process of the corresponding loop is to increment the value of the loop control variable by the increment value [K] from the initial value [M] to the final value [N]. Up to the initial value [M
+ K × [(N−M) ÷ K]] is changed to the final value [M] to be executed. Also,
"[X]" represents the maximum integer value that does not exceed the real value [x]. For example, initial value [M: 5], final value [N: 2]
5] and the increment value [K: 4], the value of the loop control variable is (5 → 9 → 13 → 17 → 21 → 2) in the original process.
Necessary processing is performed while changing as in 5). On the other hand, if "the loop circulation direction is reversed," the value of the loop control variable is changed to (25 → 21 → 17 → 13 → 9 →
Necessary processing is performed while changing as in 5).

【0008】以下、上述した構成に基づく作用について
概略的に説明する。
The operation based on the above configuration will be briefly described below.

【0009】本発明のコンパイル処理システムを構成す
るループ変換処理部において、ループ逆転判定手段は、
内側ループLを含む指定された多重ループについて、そ
の内側ループL中に記述されている変数および配列デー
タのループの枠を越えた定義参照関係に基づいて、内側
ループLの巡回方向が逆転可能であるか否かを最初に判
定する。そして、逆転可能であるという判定結果が得ら
れると、さらに、内側ループL中における配列データの
参照状況の解析を行うことにより、外側ループの反復実
行が一回進んだ後に内側ループLの巡回方向を逆転させ
た場合、直前に実行された内側ループLの最終巡回時に
キャッシュ上に格納されたデータのうちのいくつが再利
用され得るのかを求め、これに基づいて内側ループLの
巡回方向を逆転させて得られる効果の大きさを判定す
る。すなわち、ループ逆転判定手段は、内側ループLの
巡回方向が逆転可能であり、かつ、内側ループLの巡回
方向を逆転させて得られる効果が十分に大きい、という
判定結果が得られた場合に、外側ループの反復ごとに内
側ループLの巡回方向を交互に逆転させる旨の判定を行
う。
In the loop conversion processing section that constitutes the compilation processing system of the present invention, the loop inversion determination means is
Regarding the specified multiple loop including the inner loop L, the circulation direction of the inner loop L can be reversed based on the definition reference relation beyond the loop of the variables and array data described in the inner loop L. First, it is determined whether or not there is. When the determination result indicating that the inner loop L is reversible is obtained, the reference situation of the array data in the inner loop L is further analyzed, so that the iteration direction of the outer loop advances once and then the circulation direction of the inner loop L advances. , The number of data stored in the cache can be reused at the last round of the inner loop L executed immediately before, and the round direction of the inner loop L is reversed based on this. The magnitude of the effect obtained by this is determined. That is, when the loop reversal determination means obtains the determination result that the circulation direction of the inner loop L can be reversed and the effect obtained by reversing the circulation direction of the inner loop L is sufficiently large, It is determined that the circulation direction of the inner loop L is alternately reversed for each iteration of the outer loop.

【0010】なお、ソースプログラム上における指示文
の挿入やコンパイル時のオプション指定などにより、該
当する内側ループLの巡回方向を交互に逆転させる旨が
ユーザなどから指示された場合、ループ逆転判定手段
は、上述したループ逆転判定手段による判定処理を省略
して、外側ループの反復ごとに内側ループLの巡回方向
を交互に逆転させる旨の判定結果のみを出力する。
When the user or the like instructs that the circulation direction of the corresponding inner loop L is alternately reversed by inserting a directive statement in the source program or by specifying an option at the time of compilation, the loop reversal determination means is The determination processing by the loop reverse rotation determination means described above is omitted, and only the determination result indicating that the circulation direction of the inner loop L is alternately reversed for each iteration of the outer loop is output.

【0011】以上のように本発明のコンパイル処理シス
テムでは、多重ループにおける外側ループの反復ごとに
外側ループに属する内側ループの巡回方向を交互に逆転
させることによって、一般的な配列を用いた計算が記述
されたソースプログラムについても、ループ処理におけ
る配列データの参照状況に応じた範囲内にコンパイル時
間の増加を抑えながら、従来多発していたキャッシュ競
合の削減を図り、高い実行性能を有するオブジェクトを
生成することができる。また、コンパイル処理の実行に
際して上述した内側ループ反復時の巡回方向の逆転を指
定させ、これに基づいてコンパイル処理を行うことによ
り、さらにコンパイル時間の増加を抑えながら、高い実
行性能を有するオブジェクトを生成することができる。
As described above, in the compilation processing system of the present invention, the calculation using a general array is performed by alternately reversing the circulation direction of the inner loop belonging to the outer loop for each iteration of the outer loop in the multiple loop. Also for the described source program, while suppressing the increase in compile time within the range according to the reference status of array data in loop processing, cache conflicts that frequently occurred in the past are reduced, and objects with high execution performance are generated. can do. In addition, when executing the compile process, by specifying the inversion of the cyclic direction at the time of iterating the inner loop described above, and performing the compile process based on this, an object with high execution performance is generated while further suppressing the increase in compile time. can do.

【0012】[0012]

【発明の実施の形態】以下、本発明のコンパイル処理シ
ステムの実施の一形態例を図面を用いて詳細に説明す
る。
BEST MODE FOR CARRYING OUT THE INVENTION An embodiment of a compilation processing system according to the present invention will be described in detail below with reference to the drawings.

【0013】図1は、本発明のコンパイル処理システム
の実施の一形態例の構成を示すブロック図である。同図
中、1はプログラミング言語で所望のアルゴリズムが具
体的に記述されたソースプログラム、1aはコンパイラ
用の中間言語で上記ソースプログラム1と同一内容のア
ルゴリズムが記述された中間語プログラム、2は後述す
る書き換えによって中間語プログラム1aから生成され
た別の中間語プログラム、1bはソースプログラム1に
おけるループ情報、1cはソースプログラム1における
データフロー情報、3は中間語プログラム2から生成さ
れたオブジェクト、10はソースプログラム解析部、2
0はループ変換処理部、30はオブジェクト生成処理部
である。
FIG. 1 is a block diagram showing the configuration of an embodiment of a compilation processing system according to the present invention. In the figure, 1 is a source program in which a desired algorithm is specifically described in a programming language, 1a is an intermediate language for a compiler, and an intermediate language program in which an algorithm having the same contents as in the source program 1 is described, 2 is described later. Another intermediate language program generated from the intermediate language program 1a by rewriting is 1b, loop information in the source program 1, 1c is data flow information in the source program 1, 3 is an object generated from the intermediate language program 2, 10 is Source program analysis part, 2
Reference numeral 0 is a loop conversion processing unit, and 30 is an object generation processing unit.

【0014】図1において、ソースプログラム解析部1
0は、与えられたソースプログラム1を入力し、これに
基づいてコンパイラ用の中間言語で表現された中間語プ
ログラム1aを生成する。また、得られた中間語プログ
ラム1aを解析して、ソースプログラム1中に記述され
たすべてのループのネスト構造と、各ループにおけるル
ープ制御変数の初期値,最終値,増分値に関するループ
情報1bと、個々のループ中に記述されている変数およ
び配列データの各々のループの枠を越えた定義参照関係
に関するデータフロー情報1cとを収集する。なお、ソ
ースプログラム解析部10における処理については多数
の公知例が知られているので、上記以上に詳細な説明は
省略することとする。続いて、ループ変換処理部20
は、上記によって得られた中間語プログラム1a,ルー
プ情報1b,データフロー情報1cを入力データとし
て、後述によりキャッシュ競合が削減されるようにルー
プ構造が変換された中間語プログラム2を生成する。最
後に、オブジェクト生成処理部30は、上記中間語プロ
グラム2を入力データとする最適化処理や命令語生成処
理などを行って、オブジェクト3を生成する。
In FIG. 1, the source program analysis unit 1
0 inputs the given source program 1 and generates an intermediate language program 1a expressed in an intermediate language for a compiler based on the input source program 1. Further, the obtained intermediate language program 1a is analyzed, and the nest structure of all the loops described in the source program 1 and the loop information 1b regarding the initial value, the final value and the increment value of the loop control variable in each loop are obtained. , Data flow information 1c relating to the definition reference relationship that crosses the loop of each variable and array data described in each loop. Since many known examples of the processing in the source program analysis unit 10 are known, detailed description thereof will be omitted. Then, the loop conversion processing unit 20
Uses the intermediate language program 1a, loop information 1b, and data flow information 1c obtained as described above as input data to generate an intermediate language program 2 whose loop structure has been converted so as to reduce cache contention as described later. Finally, the object generation processing unit 30 performs the optimization process and the command word generation process using the intermediate language program 2 as input data to generate the object 3.

【0015】図2は、図1中のループ変換処理部20に
おける具体的な処理の流れを示す図である。同図中、破
線21内が“ループ逆転判定手段”の処理に、破線22
内が“ループ逆転書き換え手段”の処理に、それぞれ相
当する。ループ変換処理部20では、中間語プログラム
1a中の多重ループの各々について、ループ逆転判定手
段21およびループ逆転書き換え手段22の処理を順次
実行して、キャッシュ競合が削減されるようにループ構
造の変換を行う。
FIG. 2 is a diagram showing a specific processing flow in the loop conversion processing section 20 in FIG. In the figure, the inside of the broken line 21 indicates the processing of the “loop reverse rotation determination means” and the broken line 22.
The inside corresponds to the processing of the "loop reverse rewriting means". The loop conversion processing unit 20 sequentially executes the processes of the loop inversion determining unit 21 and the loop inversion rewriting unit 22 for each of the multiple loops in the intermediate language program 1a to convert the loop structure so that cache contention is reduced. I do.

【0016】ループ逆転判定手段21は、内側ループL
を含んでいる指定された多重ループについて、下記の
〔可否判定A〕(図2中の一点鎖線で囲んだステップ2
10a〜216)および〔効果判定B〕(図2中のステ
ップ219)を実行する。そして、〔可否判定A〕で内
側ループLの巡回方向が逆転可能であると判定され、さ
らに、〔効果判定B〕で内側ループLの巡回方向を逆転
させて得られる効果が十分に大きいと判定された場合に
限り、外側ループの反復ごとに内側ループLの巡回方向
を交互に逆転させる旨の判定を行う。
The loop reverse rotation judging means 21 is an inner loop L.
For the designated multiple loop including the following, the following [possibility determination A] (Step 2 surrounded by the one-dot chain line in FIG. 2)
10a to 216) and [Effect determination B] (step 219 in FIG. 2) are executed. Then, in [possibility determination A], it is determined that the traveling direction of the inner loop L can be reversed, and in [effect determination B], it is determined that the effect obtained by reversing the traveling direction of the inner loop L is sufficiently large. Only when this is done, it is determined that the circulation direction of the inner loop L is alternately reversed for each iteration of the outer loop.

【0017】〔可否判定A〕:ステップ210a〜21
6 内側ループL中に記述されたあらゆる変数と配列データ
について、ループLの枠を越えたフロー依存,出力依
存,逆依存などの定義参照関係がいずれも存在していな
い場合には、ループLの巡回方向を逆転させることが可
能であると判定する。また、ひとつでも上述した依存関
係がある場合には、ループLの巡回方向を逆転させるこ
とは不可能であると判定する。
[Acceptability determination A]: Steps 210a to 21
6 For all variables and array data described in the inner loop L, if there is no definition reference relationship such as flow dependency, output dependency, or inverse dependency that exceeds the frame of loop L, It is determined that the traveling direction can be reversed. If even one of the above-mentioned dependencies exists, it is determined that it is impossible to reverse the circulation direction of the loop L.

【0018】すなわち、最初に作業変数の初期化とし
て、ステップ210aでループL中のすべての変数およ
び配列データに対応する参照フラグに“未判定”を設定
するとともに、ステップ210bで各々の変数および配
列データについての再利用計数カウンタおよび非再利用
計数カウンタに数値“0”を設定する。ステップ211
は、ループL中に記述された変数および配列データに対
応する参照フラグに設定値が“未判定”のものが存在す
るか否かを判定する〔可否判定A〕の終了判定部であ
り、“未判定”のものが存在しない場合(ステップ21
1=NO)にはステップ219の〔効果判定B〕に、
“未判定”のものが存在する場合(ステップ211=Y
ES)にはステップ212以降に、それぞれ処理を分岐
させる。
That is, first, as initialization of work variables, "unjudged" is set in the reference flags corresponding to all the variables and array data in the loop L in step 210a, and each variable and array is initialized in step 210b. Set the number "0" to the reuse count counter and the non-reuse count counter for the data. Step 211
Is an end determination unit for determining whether or not there is a reference flag corresponding to the variable and the array data described in the loop L with a setting value of “undetermined” [possibility determination A]. If there is no “undetermined” (step 21)
1 = NO), in [Effect determination B] of step 219,
If there is an "undetermined" item (step 211 = Y)
ES) branches the processing from step 212 onward.

【0019】ステップ212では、ループL中に記述さ
れている変数および配列データのうち、上述した参照フ
ラグの設定値が“未判定”のもの(x)をひとつ取り出
す。そしてステップ213で、内側ループLの1レベル
上位に記述された外側ループ(Outer_L)の反復実行が
1回進んだとき、ステップ212で取り出された変数ま
たは配列データxが再利用されるか否かを判定する。こ
の判定の結果、再利用されると判定された場合(ステッ
プ213=YES)には、ステップ214aに分岐して
再利用計数カウンタの値をインクリメント(+1)させ
る。また、再利用されないと判定された場合(ステップ
213=NO)には、ステップ214bに分岐して非再
利用計数カウンタの値をインクリメント(+1)させ
る。ステップ214aまたは214bの処理後、ステッ
プ215において、上記変数または配列データxについ
て、他の変数または配列データとの間でループLの枠を
越えた相互依存関係があるか否か判定する。そして、ル
ープLの枠を越えた相互依存関係があると判定された場
合(ステップ215=YES)には、ループLの巡回方
向を逆転させることが不可能なので、ステップ219の
〔効果判定B〕およびループ逆転書き換え手段の処理2
2をいずれもスキップして、ループLの逆転に関する処
理を終了する。また、ループLの枠を越えた相互依存関
係がないと判定された場合(ステップ215=NO)に
は、ステップ216で、上記変数または配列データxに
対応する参照フラグに“判定済”を設定してから再びス
テップ211に戻り、別の変数または配列データxを対
象として上述した〔可否判定A〕を繰り返す。
In step 212, one of the variables and array data described in the loop L, whose reference flag setting value is "undetermined" (x), is taken out. Then, in step 213, when the iterative execution of the outer loop (Outer_L) described one level higher than the inner loop L proceeds once, whether the variable or array data x extracted in step 212 is reused or not. To judge. If the result of this determination is that it will be reused (step 213 = YES), the flow branches to step 214a to increment (+1) the value of the reuse count counter. If it is determined that the non-reuse counter is not reused (step 213 = NO), the process branches to step 214b to increment (+1) the value of the non-reuse counting counter. After the processing in step 214a or 214b, in step 215, it is determined whether or not the variable or array data x has an interdependence relationship with another variable or array data beyond the frame of the loop L. Then, when it is determined that there is an interdependence relationship that exceeds the frame of the loop L (step 215 = YES), it is impossible to reverse the circulation direction of the loop L, so [effect determination B] of step 219. And processing of loop reverse rewriting means 2
2 is skipped, and the process related to the reverse rotation of loop L is completed. Further, when it is determined that there is no interdependence beyond the frame of the loop L (step 215 = NO), “determined” is set in the reference flag corresponding to the variable or the array data x in step 216. Then, the process returns to step 211 again, and the above [possibility determination A] is repeated for another variable or array data x.

【0020】〔効果判定B〕:ステップ219 内側ループL中における変数および配列データの参照状
況を解析し、外側ループOuter_Lの反復実行が一回進ん
だ後に内側ループLの巡回方向を逆転させることで、直
前に実行された内側ループLの最終ループ時にキャッシ
ュ上に格納されたデータを再利用する可能性のある実行
パターンの個数と、再利用する可能性のない実行パター
ンの個数とを求める。そして、前者の実行パターン数が
後者の実行パターン数より多い場合には、内側ループL
の巡回方向を逆転させて得られる効果が十分に大きいも
のと判定する。また、前者の実行パターン数が後者の実
行パターン数より少ない場合には、内側ループLの巡回
方向を逆転させて得られる効果がないものと判定する。
[Effect Judgment B]: Step 219 By analyzing the reference situation of the variable and array data in the inner loop L, the circulation direction of the inner loop L is reversed after the outer loop Outer_L has been executed once. , The number of execution patterns that may reuse the data stored in the cache during the final loop of the inner loop L executed immediately before, and the number of execution patterns that are not likely to be reused. If the number of execution patterns of the former is larger than the number of execution patterns of the latter, the inner loop L
It is determined that the effect obtained by reversing the traveling direction of is sufficiently large. When the number of execution patterns of the former is smaller than the number of execution patterns of the latter, it is determined that there is no effect obtained by reversing the circulation direction of the inner loop L.

【0021】すなわち、この実施の形態では、上述した
ステップ210a〜216の〔可否判定A〕の実行によ
って上述した再利用計数カウンタに最終的に設定された
数値がキャッシュ上に格納されたデータを再利用する可
能性のある実行パターンの個数に、上述した非再利用計
数カウンタに最終的に設定された数値がキャッシュ上に
格納されたデータを再利用する可能性のない実行パター
ンの個数に、それぞれ相当する。したがって、ステップ
219では、再利用計数カウンタの設定値が非再利用計
数カウンタの設定値より大きいか否かを判定し、再利用
計数カウンタの設定値が非再利用計数カウンタの設定値
より大きい場合(ステップ219=YES)には、ルー
プ逆転書き換え手段の処理22に分岐する。また、再利
用計数カウンタの設定値が非再利用計数カウンタの設定
値より小さいか等しい場合(ステップ219=NO)に
は、ループ逆転書き換え手段の処理22をスキップし
て、ループLの逆転に関する処理を終了する。
In other words, in this embodiment, the data finally stored in the cache is set to the numerical value finally set in the above-mentioned reuse counter by the execution of [possibility determination A] in steps 210a to 216 described above. To the number of execution patterns that may be used, to the number of execution patterns where the numerical value finally set in the above-mentioned non-reuse counting counter is not likely to reuse the data stored in the cache, Equivalent to. Therefore, in step 219, it is determined whether the set value of the reuse count counter is larger than the set value of the non-reuse count counter, and if the set value of the reuse count counter is larger than the set value of the non-reuse count counter. At (step 219 = YES), the process branches to the process 22 of the loop reverse rewriting means. If the set value of the reuse counting counter is smaller than or equal to the set value of the non-reusing counting counter (step 219 = NO), the process 22 of the loop reverse rewriting unit is skipped and the process related to the reverse of the loop L is performed. To finish.

【0022】ただし、ソースプログラム上における指示
文の挿入やコンパイル時のオプション指定などにより、
該当する内側ループLの巡回方向を逆転させる旨があら
かじめユーザから指示されていた場合、ループ逆転判定
手段21は〔可否判定A〕および〔効果判定B〕を省略
し、外側ループの反復ごとに内側ループLの巡回方向を
交互に逆転させる旨の判定結果のみを出力する。
However, due to the insertion of directives in the source program or the specification of options during compilation,
When the user has previously instructed to reverse the circulation direction of the corresponding inner loop L, the loop reversal determination means 21 omits the [approvability determination A] and [effect determination B], and the inner loop is repeated for each iteration of the outer loop. Only the determination result indicating that the circulation direction of the loop L is alternately reversed is output.

【0023】ループ逆転書き換え手段22は、ループ逆
転判定手段21による判定結果に応じて、外側ループOu
ter_Lの反復ごとにその外側ループに属する内側ループ
Lの巡回方向を交互に逆転させるべき多重ループの各々
について、内側ループLの巡回方向を逆転させた新たな
ループ(Rev_L)を作成する(ステップ221)。そし
て、元の内側ループLを第1の内側ループL1,新たなル
ープRev_Lを第2の内側ループL2とするとともに外側ル
ープOuter_Lの反復回数をカウントするためのループ制
御変数j(初期値:1)を新たに生成した上で、jの値
が奇数のときに第1の内側ループL1が実行され、jの値
が偶数のときに第2の内側ループL2が実行されるよう
に、外側ループOuter_L中に記述されている元の内側ル
ープLを第1の内側ループL1および第2の内側ループL2
に置き換える。
The loop reverse rotation rewriting means 22 determines the outer loop Ou according to the determination result of the loop reverse rotation determining means 21.
A new loop (Rev_L) in which the traveling direction of the inner loop L is reversed is created for each of the multiple loops in which the traveling direction of the inner loop L belonging to the outer loop is to be alternately reversed for each iteration of ter_L (step 221). ). Then, the original inner loop L is set as the first inner loop L 1 , the new loop Rev_L is set as the second inner loop L 2, and the loop control variable j for counting the number of iterations of the outer loop Outer_L (initial value: 1) is newly generated, and the first inner loop L 1 is executed when the value of j is an odd number, and the second inner loop L 2 is executed when the value of j is an even number. , The original inner loop L described in the outer loop Outer_L is the first inner loop L 1 and the second inner loop L 2
Replace with

【0024】図3は、図1中のループ変換処理部20に
よる書き換え前後のプログラムの一例を示す図であり、
図3(a)は書き換えられる前の元のプログラム(変換
前プログラム),図3(b)は書き換えられた後のプロ
グラム(変換後プログラム)を、それぞれ示す。なお、
図3では説明のためにソースプログラムで記述している
が、この実施の形態で行われる実際の処理では、ソース
プログラム解析部10によって図3(a)のソースプロ
グラムから生成された中間語プログラム1aに基づき、
ループ変換処理部20が、図3(b)のソースプログラ
ムに相当する中間語プログラム2を生成するものとす
る。
FIG. 3 is a diagram showing an example of a program before and after rewriting by the loop conversion processing unit 20 in FIG.
3A shows the original program before rewriting (pre-conversion program), and FIG. 3B shows the program after rewriting (post-conversion program). In addition,
Although the source program is described in FIG. 3 for the sake of explanation, in the actual processing performed in this embodiment, the intermediate program 1a generated from the source program in FIG. Based on
The loop conversion processing unit 20 is assumed to generate the intermediate language program 2 corresponding to the source program of FIG.

【0025】図3(a)において、変換前プログラムは
3重のネスト構造を有する多重ループによって構成され
ている。最上位のネストに位置するループ処理(上位ル
ープOuter_L)は、ループ制御変数K31にしたがって
反復実行される破線枠32内の処理である。中位のネス
トに位置するループ処理(中位ループL)は、ループ制
御変数J33にしたがって反復実行される破線枠34内
の処理である。最下位のネストに位置するループ処理
(下位ループInner_L)は、ループ制御変数I35にし
たがって反復実行される破線枠36内の処理である。ま
た、上述した上位ループOuter_L,中位ループL,下位
ループInner_Lのいずれについても、そのループ制御変
数は、 初期値:1 最終値:1000 増分値:1 となっている。
In FIG. 3A, the pre-conversion program is composed of multiple loops having a triple nest structure. The loop process (upper loop Outer_L) located at the highest nest is the process within the broken line frame 32 that is repeatedly executed according to the loop control variable K31. The loop process (middle loop L) located in the middle nest is the process within the broken line frame 34 that is repeatedly executed according to the loop control variable J33. The loop process (lower loop Inner_L) located in the lowest nest is the process within the broken line frame 36 that is repeatedly executed according to the loop control variable I35. Further, the loop control variables of all of the above-mentioned upper loop Outer_L, middle loop L, and lower loop Inner_L are initial value: 1 final value: 1000 and increment value: 1.

【0026】変換前プログラムにおける上述した各ルー
プ処理のうち、下位ループInner_Lでは、参照または更
新の対象となる配列データXについて、ループの枠を越
えた相互依存関係が明らかに存在する。したがって、上
述した〔可否判定A〕の結果、ループ変換処理部20に
よる書き換えの対象外とされる。一方、中位ループLで
は、上述した各配列データに加えて変数(B)の参照お
よび更新が行われるが、いずれもループの枠内における
定義参照関係のみである。したがって、上記〔可否判定
A〕の結果、巡回方向の逆転が可能であると判定され
る。さらにまた、上位ループOuter_L(外側ループ)の
反復実行が一回進んだ後に中位ループL(内側ループ)
の巡回方向を逆転させると、直前に実行された中位ルー
プLの最終ループ時にキャッシュメモリ上に格納された
データが必ず再利用されることが予想される。したがっ
て、上述した〔効果判定B〕の結果、中位ループLの巡
回方向を逆転させて得られる効果が十分に大きいものと
判定され、ループ変換処理部20による書き換えの対象
となる。以上のように、図3(a)の変換前プログラム
では、中位ループLの部分がループ変換処理部20によ
る書き換えの対象となる。
Among the above-described loop processes in the pre-conversion program, in the lower loop Inner_L, the array data X to be referenced or updated clearly has an interdependence relationship beyond the loop frame. Therefore, as a result of the above [possibility determination A], it is excluded from the target of rewriting by the loop conversion processing unit 20. On the other hand, in the middle loop L, the variable (B) is referred to and updated in addition to the above-mentioned array data, but all of them have only the definition reference relation within the frame of the loop. Therefore, as a result of the above [possibility determination A], it is determined that it is possible to reverse the traveling direction. Furthermore, after the iteration of the upper loop Outer_L (outer loop) advances once, the middle loop L (inner loop)
It is expected that the data stored in the cache memory will be reused at the last loop of the intermediate loop L executed immediately before by reversing the circulating direction of. Therefore, as a result of the above-mentioned [effect determination B], it is determined that the effect obtained by reversing the circulation direction of the middle loop L is sufficiently large, and it is a target of rewriting by the loop conversion processing unit 20. As described above, in the pre-conversion program of FIG. 3A, the part of the middle loop L is the target of rewriting by the loop conversion processing unit 20.

【0027】図3(b)において、変換後プログラムは
3重のネスト構造を有する多重ループによって構成され
ている。同図中、最上位のネストに位置するループ処理
(上位ループOuter_L)は、ループ制御変数K31a
(初期値:1,最終値:1000,増分値:2)にしたがっ
て反復実行される破線枠32aおよび32b内の処理で
ある。中位のネストに位置するループ処理は、破線枠3
2a内で実行される第1の中位ループL1における処理
と、破線枠32b内で実行される第2の中位ループL2
おける処理である。最下位のネストに位置するループ処
理は、破線枠34a内で実行される第1の下位ループIn
ner_L1における処理と、破線枠34b内で実行される第
2の下位ループInner_L2における処理である。
In FIG. 3B, the converted program is composed of multiple loops having a triple nest structure. In the figure, the loop process (upper loop Outer_L) located in the highest nest is the loop control variable K31a.
This is the processing within the broken line frames 32a and 32b that is repeatedly executed according to (initial value: 1, final value: 1000, increment value: 2). The loop processing located in the middle nest is the broken line frame 3
The process in the first middle loop L 1 executed in 2a and the process in the second middle loop L 2 executed in the broken line frame 32b. The loop process located in the lowest nest is the first lower loop In executed within the broken line frame 34a.
The process in ner_L 1 and the process in the second lower loop Inner_L 2 executed in the broken line frame 34b.

【0028】ここで、第1の中位ループL1による処理は
図3(a)に示した中位ループLによる処理と同一内容
であり、ループ制御変数J33a(初期値:1,最終
値:1000,増分値:1)にしたがって破線枠34a内の
処理を反復実行する。第2の中位ループL2による処理は
図3(a)に示した中位ループLの巡回方向を逆転させ
たループRev_Lによる処理に相当する処理であり、ルー
プ制御変数J33b(初期値:1000,最終値:1,増分
値:−1)にしたがって破線枠34b内の処理を反復実
行する。また、第1の下位ループInner_L1および第2の
下位ループInner_L2による処理は、いずれも図3(a)
に示した下位ループInner_Lによる処理と同一内容であ
る。すなわち、第1の下位ループInner_L1による処理は
ループ制御変数I35a(初期値:1,最終値:1000,
増分値:1)にしたがって破線枠36a内の処理を反復
実行し、第2の下位ループInner_L2よる処理はループ制
御変数I35b(初期値:1,最終値:1000,増分値:
1)にしたがって破線枠36b内の処理を反復実行す
る。
Here, the processing by the first middle loop L 1 has the same contents as the processing by the middle loop L shown in FIG. 3A, and the loop control variable J33a (initial value: 1, final value: The processing in the broken line frame 34a is repeatedly executed according to 1000, increment value: 1). The process by the second middle loop L 2 is a process corresponding to the process by the loop Rev_L in which the circulation direction of the middle loop L shown in FIG. 3A is reversed, and the loop control variable J33b (initial value: 1000 , The final value: 1, and the increment value: -1), the processing in the broken line frame 34b is repeatedly executed. Further, the processing by the first lower loop Inner_L 1 and the second lower loop Inner_L 2 are both shown in FIG.
The contents are the same as the processing by the lower loop Inner_L shown in FIG. That is, the processing by the first lower loop Inner_L 1 is performed by the loop control variable I35a (initial value: 1, final value: 1000,
The processing in the broken line frame 36a is repeatedly executed according to the increment value: 1), and the processing by the second lower loop Inner_L 2 is the loop control variable I35b (initial value: 1, final value: 1000, increment value:
According to 1), the processing within the broken line frame 36b is repeatedly executed.

【0029】図3(a)の変換前プログラムによって求
められる計算結果と、図3(b)の変換後プログラムに
よって求められる計算結果は同一である。両者のプログ
ラムで異なっているのは、ループ制御変数Jにしたがっ
て反復実行される中位ループによる処理である。すなわ
ち、図3(a)の変換前プログラムの場合、中位ループ
Lおよび下位ループInner_Lの実行に伴ってループ制御
変数JおよびIの値が順次インクリメントされ、それぞ
れ最終値:1000まで達すると、下位ループInner_Lで
は、以下の配列データ群を用いた演算が行われる。
The calculation result obtained by the pre-conversion program shown in FIG. 3A and the calculation result obtained by the post-conversion program shown in FIG. 3B are the same. The difference between the two programs is the processing by the intermediate loop that is repeatedly executed according to the loop control variable J. That is, in the case of the pre-conversion program of FIG. 3A, the values of the loop control variables J and I are sequentially incremented as the middle loop L and the lower loop Inner_L are executed, and when the final values reach 1000 respectively, In the loop Inner_L, the calculation using the following array data group is performed.

【0030】〔配列データ群〕 G(1000) A1(1000,1000) X( 999,1000) A2(1000,1000) X(1001,1000) A3(1000,1000) X(1000,1000) A4(1000,1000) X(1000,1000) X(1000,1000) 以上。[Sequence data group] G (1000) A1 (1000,1000) X (999,1000) A2 (1000,1000) X (1001,1000) A3 (1000,1000) X (1000,1000) A4 ( 1000,1000) X (1000,1000) X (1000,1000) or more.

【0031】続いて、上位ループOuter_Lにおけるルー
プ制御変数Kがインクリメントされると、ループ制御変
数IおよびJの値は再び初期値:1に設定される。そこ
で、下位ループInner_Lによるループ処理の冒頭では、
以下の配列データ群を用いた演算が行われる。
Subsequently, when the loop control variable K in the upper loop Outer_L is incremented, the values of the loop control variables I and J are set to the initial value: 1 again. Therefore, at the beginning of the loop processing by the lower loop Inner_L,
The calculation using the following array data group is performed.

【0032】〔配列データ群〕 G(1) A1(1,1) X(0,1) A2(1,1) X(2,1) A3(1,1) X(1,1) A4(1,1) X(1,1) X(1,1) 以上。[Sequence Data Group] G (1) A1 (1,1) X (0,1) A2 (1,1) X (2,1) A3 (1,1) X (1,1) A4 ( 1,1) X (1,1) X (1,1) or more.

【0033】以上の例では、最近まで参照されていなか
った配列データ群の各値がキャッシュメモリ上に読み
出されているケースは極めて少ないと考えられ、ほとん
どのケースではキャッシュミスの後、ハードディスク装
置などの補助記憶装置中に設けられたスワップファイル
などから新たに読み出されることとなる。
In the above example, it is considered that there are very few cases where each value of the array data group that has not been referenced until recently is read out to the cache memory, and in most cases, after a cache miss, the hard disk device It will be newly read from a swap file or the like provided in the auxiliary storage device such as.

【0034】これに対して、図3(b)の変換後プログ
ラムの場合、破線枠32a内における第1の中位ループ
L1および第1の下位ループInner_L1の実行に伴ってルー
プ制御変数JおよびIの値がインクリメントされ、それ
ぞれ最終値:1000まで達して、上記と同様に第1の下位
ループInner_L1で配列データ群を用いた演算が行われ
た後、破線枠32a内における第1の中位ループL1およ
び第1の下位ループInner_L1の処理は終了し、破線枠3
2b内における第2の中位ループL2および第2の下位ル
ープInner_L2の処理が開始される。このとき、第2の下
位ループInner_L2のループ制御変数Iの値は、変換前プ
ログラムと同様に初期値:1に設定されるが、第2の中
位ループL2のループ制御変数Jの値は、破線枠32a内
の処理を終了するときの最終値と等しい初期値:1000に
設定される。したがって、第2の下位ループInner_L2
よるループ処理の冒頭では、以下の配列データ群を用
いた演算が行われる。
On the other hand, in the case of the program after conversion shown in FIG. 3B, the first middle loop in the broken line frame 32a.
With the execution of L 1 and the first lower loop Inner_L 1 , the values of the loop control variables J and I are incremented, reaching the final values of 1000, respectively, and the array data is output in the first lower loop Inner_L 1 as described above. After the calculation using the group is performed, the processing of the first middle loop L 1 and the first lower loop Inner_L 1 in the broken line frame 32a ends, and the broken line frame 3
The processing of the second middle loop L 2 and the second lower loop Inner_L 2 in 2b is started. At this time, the value of the loop control variable I of the second lower loop Inner_L 2 is set to the initial value: 1 as in the pre-conversion program, but the value of the loop control variable J of the second middle loop L 2 is set. Is set to an initial value: 1000, which is equal to the final value when the processing in the broken line frame 32a ends. Therefore, at the beginning of the loop processing by the second lower loop Inner_L 2, the calculation using the following array data group is performed.

【0035】〔配列データ群〕 G(1000) A1(1,1000) X(0,1000) A2(1,1000) X(2,1000) A3(1,1000) X(1,1000) A4(1,1000) X(1,1000) X(1,1000) 以上。[Sequence data group] G (1000) A1 (1,1000) X (0,1000) A2 (1,1000) X (2,1000) A3 (1,1000) X (1,1000) A4 ( 1,1000) X (1,1000) X (1,1000) or more.

【0036】上記の配列データ群のうち、G(1000)は
直前に実行された第1の下位ループInner_L1における演
算で用いられているので、キャッシュメモリ上に読み出
されていることは確実である。また、一般的な2次元の
配列変数では、 X( 0,1000) X( 1,1000) X( 2,1000) : X( 998,1000) X( 999,1000) X(1000,1000) などのように2次元目の添字が同一値である一群の配列
データは補助記憶装置上で連続した領域に確保されてい
る。このため、例えば配列データ群中のA1(1,1000)
は、直前に実行された第1の下位ループInner_L1で用い
られている A1(1000,1000)とともにキャッシュメモリ上
に読み出されている確率が高い。したがって、第2の下
位ループInner_L2によるループ処理の冒頭での配列デー
タの参照に際し、所望のデータをキャッシュメモリ上か
ら得られるキャッシュヒットの可能性が向上する。
Of the above array data group, G (1000) is used in the operation in the first lower loop Inner_L 1 executed immediately before, so it is certain that it is read in the cache memory. is there. Also, in a general two-dimensional array variable, X (0,1000) X (1,1000) X (2,1000): X (998,1000) X (999,1000) X (1000,1000), etc. As described above, a group of array data whose second-dimensional subscripts have the same value are secured in continuous areas on the auxiliary storage device. Therefore, for example, A1 (1,1000) in the sequence data group
Has a high probability of being read on the cache memory together with A1 (1000,1000) used in the first lower loop Inner_L 1 executed immediately before. Therefore, when referring to the array data at the beginning of the loop processing by the second lower loop Inner_L 2 , the possibility of a cache hit in which desired data is obtained from the cache memory is improved.

【0037】また、破線枠32b内における第2の中位
ループL2および第2の下位ループInner_L2の処理が終了
し、破線枠32a内における第1の中位ループL1および
第1の下位ループInner_L1の処理が開始されるときも同
様である。すなわち、第2の中位ループL2および第2の
下位ループInner_L2の実行に伴ってループ制御変数Jの
値がデクリメント,ループ制御変数Iの値がインクリメ
ントされ、それぞれ最終値:1および1000まで達する
と、第2の下位ループInner_L2では、以下の配列データ
群を用いた演算が行われる。そして、破線枠32b内
における第2の中位ループL2および第2の下位ループIn
ner_L2の処理が終了する。
The processing of the second middle loop L 2 and the second lower loop Inner_L 2 in the broken line frame 32b is completed, and the first middle loop L 1 and the first lower loop in the broken line frame 32a are completed. The same applies when the processing of the loop Inner_L 1 is started. That is, the value of the loop control variable J is decremented and the value of the loop control variable I is incremented with the execution of the second middle loop L 2 and the second lower loop Inner_L 2 , and the final values are up to 1 and 1000, respectively. When it reaches, in the second lower loop Inner_L 2 , the operation using the following array data group is performed. Then, the second middle loop L 2 and the second lower loop In in the broken line frame 32b.
The processing of ner_L 2 ends.

【0038】〔配列データ群〕 G(1) A1(1000,1) X( 999,1) A2(1000,1) X(1001,1) A3(1000,1) X(1000,1) A4(1000,1) X(1000,1) X(1000,1) 以上。[Sequence Data Group] G (1) A1 (1000,1) X (999,1) A2 (1000,1) X (1001,1) A3 (1000,1) X (1000,1) A4 ( 1000,1) X (1000,1) X (1000,1) or more.

【0039】続いて、上位ループOuter_Lにおけるルー
プ制御変数Kが2回インクリメントされるた後、再び破
線枠32a内における第1の中位ループL1および第1の
下位ループInner_L1の処理が開始されたときには、第1
の中位ループL1のループ制御変数Iおよび第1の下位ル
ープInner_L1のループ制御変数Jの値はいずれも初期
値:1に設定される。そこで、第1の下位ループInner_
L1によるループ処理の冒頭では、前述した配列データ群
を用いた演算が行われる。したがって、破線枠32a
内における第1の中位ループL1および第1の下位ループ
Inner_L1の処理が終了し、破線枠32b内における第2
の中位ループL2および第2の下位ループInner_L2の処理
が開始されるときと同様の理由で、所望のデータをキャ
ッシュメモリ上から得られるキャッシュヒットの可能性
が向上する。
Then, after the loop control variable K in the upper loop Outer_L is incremented twice, the processing of the first middle loop L 1 and the first lower loop Inner_L 1 in the broken line frame 32a is started again. When it comes to the first
The values of the loop control variable I of the middle loop L 1 and the loop control variable J of the first lower loop Inner_L 1 are both set to an initial value: 1. Therefore, the first lower loop Inner_
At the beginning of the loop processing by L 1, the operation using the above-mentioned array data group is performed. Therefore, the broken line frame 32a
First middle loop L 1 and first lower loop in
The process of Inner_L 1 is completed, and the second line in the broken line frame 32b
For the same reason as when the processing of the middle loop L 2 and the second lower loop Inner_L 2 is started, the possibility of a cache hit in which desired data is obtained from the cache memory is improved.

【0040】上述した実施の形態によれば、多重ループ
における外側ループの反復ごとに外側ループに属する内
側ループの巡回方向を交互に逆転させることによって、
一般的な配列を用いた計算が記述されたソースプログラ
ムについても、ループ処理における配列データの参照状
況に応じた範囲内にコンパイル時間の増加を抑えなが
ら、従来多発していたキャッシュ競合の削減を図り、高
い実行性能を有するオブジェクトを生成することができ
る。また、コンパイル処理の実行に際して上述した内側
ループ反復時の巡回方向の逆転を指定させ、これに基づ
いてコンパイル処理を行うことにより、さらにコンパイ
ル時間の増加を抑えながら、高い実行性能を有するオブ
ジェクトを生成することができる。
According to the above-described embodiment, by alternately reversing the circulation direction of the inner loop belonging to the outer loop for each iteration of the outer loop in the multiple loop,
Even for a source program in which calculation using a general array is described, the cache contention that frequently occurred in the past has been reduced while suppressing the increase in compile time within the range according to the reference status of array data in loop processing. , It is possible to generate an object having high execution performance. In addition, when executing the compile process, by specifying the inversion of the cyclic direction at the time of iterating the inner loop described above, and performing the compile process based on this, an object with high execution performance is generated while further suppressing the increase in compile time. can do.

【0041】[0041]

【発明の効果】以上詳しく説明したように、本発明のコ
ンパイル処理システムによれば、多重ループにおける外
側ループの反復ごとに外側ループに属する内側ループの
巡回方向を交互に逆転させることによって、一般的な配
列を用いた計算が記述されたソースプログラムについて
も、ループ処理における配列データの参照状況に応じた
範囲内にコンパイル時間の増加を抑えながら、従来多発
していたキャッシュ競合の削減を図り、高い実行性能を
有するオブジェクトを生成することができるという効果
が得られる。また、コンパイル処理の実行に際して上述
した内側ループ反復時の巡回方向の逆転を指定させ、こ
れに基づいてコンパイル処理を行うことにより、さらに
コンパイル時間の増加を抑えながら、高い実行性能を有
するオブジェクトを生成することができるという効果が
得られる。
As described in detail above, according to the compile processing system of the present invention, the cyclic direction of the inner loop belonging to the outer loop is alternately reversed for each iteration of the outer loop in the multiple loop, and thus the general Even for source programs in which calculations using various arrays are described, cache contention, which has frequently occurred in the past, is reduced while suppressing increase in compile time within the range depending on the reference status of array data in loop processing. An effect that an object having execution performance can be generated is obtained. In addition, when executing the compile process, by specifying the inversion of the cyclic direction at the time of iterating the inner loop described above, and performing the compile process based on this, an object with high execution performance is generated while further suppressing the increase in compile time. The effect of being able to do is obtained.

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

【図1】本発明のコンパイル処理システムの実施の一形
態例の構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of an exemplary embodiment of a compilation processing system of the present invention.

【図2】図1中のループ変換処理部における具体的な処
理の流れを示す図である。
FIG. 2 is a diagram showing a specific processing flow in a loop conversion processing unit in FIG.

【図3】図1中のループ変換処理部による書き換え前後
のプログラムの一例を示す図である。
3 is a diagram showing an example of a program before and after rewriting by a loop conversion processing unit in FIG.

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

1 ソースプログラム 1a,2 中間語プログラム 1b ループ情報 1c データフロー情報 3 オブジェクト 10 ソースプログラム解析部 20 ループ変換処理部 21 ループ逆転判定手段 22 ループ逆転書き換え手段 30 オブジェクト生成処理部 DESCRIPTION OF SYMBOLS 1 source program 1a, 2 intermediate language program 1b loop information 1c data flow information 3 object 10 source program analysis unit 20 loop conversion processing unit 21 loop reversal determination unit 22 loop reverse rewriting unit 30 object generation processing unit

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 所望のアルゴリズムが記述されたプログ
ラムを解析し、前記アルゴリズムの実現に必要な各種処
理動作の統括制御を行うためのオブジェクトを生成する
コンパイル処理システムにおいて、 プログラム中に記述された少なくとも二重のネスト構造
を有する多重ループの各々について、前記多重ループに
おける外側ループの反復ごとに前記外側ループに属する
内側ループの巡回方向を交互に逆転させるか否かを判定
するループ逆転判定手段と、前記プログラム中の前記多
重ループに関する記述を前記ループ逆転判定手段による
判定に応じたものに書き換えるループ逆転書き換え手段
と、を有するループ変換処理部を設ける構成としたこと
を特徴とするコンパイル処理システム。
1. A compile processing system that analyzes a program in which a desired algorithm is described and generates an object for performing overall control of various processing operations required to realize the algorithm, and at least a program described in the program. For each of the multiple loops having a double nest structure, loop reversal determination means for determining whether to alternately reverse the circulation direction of the inner loop belonging to the outer loop for each iteration of the outer loop in the multiple loop, A compile processing system characterized in that a loop conversion processing unit having a loop reversal rewriting means for rewriting the description relating to the multiple loops in the program to the one according to the judgment by the loop reversal judging means is provided.
【請求項2】 前記プログラム中に記述された多重ルー
プの各々について、前記ループ逆転判定手段による判定
に代えて、外側ループの反復ごとに前記外側ループに属
する内側ループの巡回方向を交互に逆転させるか否かを
指定させるようにしたことを特徴とする請求項1記載の
コンパイル処理システム。
2. For each of the multiple loops described in the program, instead of the determination by the loop reversal determination means, the circulation direction of the inner loop belonging to the outer loop is alternately reversed for each iteration of the outer loop. The compile processing system according to claim 1, wherein whether or not to specify is specified.
【請求項3】 外側ループの反復ごとに前記外側ループ
に属する内側ループの巡回方向を交互に逆転させるべき
多重ループの各々について、 前記ループ逆転書き換え手段は、前記外側ループの巡回
数が奇数回のとき実行される第1の内側ループと、前記
外側ループの巡回数が偶数回のとき実行される巡回方向
が前記第1の内側ループに対して逆向きな第2の内側ル
ープと、に場合分けして前記多重ループに関する記述を
書き換えることを特徴とする請求項1または2記載のコ
ンパイル処理システム。
3. For each of the multiple loops in which the circulation direction of the inner loop belonging to the outer loop is to be alternately reversed for each iteration of the outer loop, the loop reversal rewriting unit is configured such that the number of cycles of the outer loop is an odd number. And a second inner loop whose traveling direction is opposite to that of the first inner loop, which is executed when the number of cycles of the outer loop is an even number. 3. The compilation processing system according to claim 1, wherein the description regarding the multiple loop is rewritten.
JP28207395A 1995-10-30 1995-10-30 Compilation method Expired - Fee Related JP3195211B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP28207395A JP3195211B2 (en) 1995-10-30 1995-10-30 Compilation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP28207395A JP3195211B2 (en) 1995-10-30 1995-10-30 Compilation method

Publications (2)

Publication Number Publication Date
JPH09128245A true JPH09128245A (en) 1997-05-16
JP3195211B2 JP3195211B2 (en) 2001-08-06

Family

ID=17647785

Family Applications (1)

Application Number Title Priority Date Filing Date
JP28207395A Expired - Fee Related JP3195211B2 (en) 1995-10-30 1995-10-30 Compilation method

Country Status (1)

Country Link
JP (1) JP3195211B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010244204A (en) * 2009-04-02 2010-10-28 Fujitsu Ltd Compiler program and compiler device
JP2011197876A (en) * 2010-03-18 2011-10-06 Fujitsu Ltd Program, apparatus and method for optimization processing

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010244204A (en) * 2009-04-02 2010-10-28 Fujitsu Ltd Compiler program and compiler device
JP2011197876A (en) * 2010-03-18 2011-10-06 Fujitsu Ltd Program, apparatus and method for optimization processing

Also Published As

Publication number Publication date
JP3195211B2 (en) 2001-08-06

Similar Documents

Publication Publication Date Title
JPH04307625A (en) Loop optimization system
US7131119B2 (en) Code optimization
JP2019517060A (en) Apparatus and method for managing address conflicts in performing vector operations
EP3152658B1 (en) Data-dependent control flow reduction
Valero-Lara et al. A fast solver for large tridiagonal systems on multi-core processors (lass library)
US20240201968A1 (en) Program compilation method and apparatus
KR20230017212A (en) Job graph scheduling to handle workloads
US6571386B1 (en) Apparatus and method for program optimizing
JPH09128245A (en) Compiling processing system
US5768172A (en) Graphic software functions without branch instructions
JPH04293150A (en) Compiling method
Kirchhoff et al. Optimizing compiler for a specialized real-time floating point softcore processor
Foley et al. Efficient partitioning of fragment shaders for multiple-output hardware
Kuang et al. Paradigm-oriented distributed computing using mobile agents
WO2006074576A1 (en) Method and apparatus for generating execution equivalence information
Araujo et al. A DVND local search implemented on a dataflow architecture for the minimum latency problem
Goossens et al. Quasar, a high-level programming language and development environment for designing smart vision systems on embedded platforms
Kelley Source-to-Source Transformations for Parallel Optimizations in STAPL
US20230342118A1 (en) Multi-level graph programming interfaces for controlling image processing flow on ai processing unit
JP2006524859A (en) Parallel processing system
Matos et al. Data Flow Analysis applied to optimize generic workflow problems
Kolpakov et al. Software for heterogeneous computer systems and structures of data processing systems with increased performance
Fernández et al. A software pipelining method based on a hierarchical social algorithm
CN116954577A (en) Method and system for controlling image processing flow
Rudy Turing machine approach to runtime software adaptation

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees