JPH0425969A - Compiling system which is made into definition arrangement vector under if sentence - Google Patents

Compiling system which is made into definition arrangement vector under if sentence

Info

Publication number
JPH0425969A
JPH0425969A JP13205490A JP13205490A JPH0425969A JP H0425969 A JPH0425969 A JP H0425969A JP 13205490 A JP13205490 A JP 13205490A JP 13205490 A JP13205490 A JP 13205490A JP H0425969 A JPH0425969 A JP H0425969A
Authority
JP
Japan
Prior art keywords
definition
array
intermediate text
statement
vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP13205490A
Other languages
Japanese (ja)
Inventor
Takayuki Nakatomi
中富 孝幸
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Solution Innovators Ltd
Original Assignee
NEC Solution Innovators 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 NEC Solution Innovators Ltd filed Critical NEC Solution Innovators Ltd
Priority to JP13205490A priority Critical patent/JPH0425969A/en
Publication of JPH0425969A publication Critical patent/JPH0425969A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To decide the definition reference relation of an arrangement element and to shorten the execution time of a program by fetching information on a condition and quotation to the arrangement where the elements are defined in order under an IF sentence. CONSTITUTION:A compiler 2 reads a source program, and analyzes a syntax and a vector processing part 22 generating a first intermediate text 24 is constituted by containing a syntax analysis means 221 which reads the first intermediate text 24 and analyzes the flow of control in the loop of the source program 1, a definition arrangement analysis means under IF sentence 222 analyzing the definition quotation state of arrangement where the elements are defined in order under the IF sentence in the loop, a data depending relation judgement means 223 judging whether there is contradicted data depending relation which is contradicted as against parallel execution in the loop or not and a vector text generation means 224 generating a second intermediate text for vector processing 25 for a part which is judged to be executed in parallel by the definition arrangement analysis means under IF sentence 222 and the data depending relation judgement means 223.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明はIF文下定義配列ベクトル化コンパイル方式に
関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an IF statement definition array vectorization compilation method.

〔従来の技術〕[Conventional technology]

記憶域上に規則的に並んでいるデータに対して一度に演
算を行うベクトル命令をもつベクトル処理プロセッサに
おいては、一般的に目的プログラムのうちのベクトル命
令によって実行される部分の割合を大きくすればするほ
どプログラムの実行時間を短縮することができる。した
がって、このようなベクトル処理プロセッサに対するコ
ンパイラでは、与えられた原始プログラムを可能な限り
並列実行可能な形で目的プログラムに変換することが望
まれる。
In a vector processing processor that has vector instructions that perform operations on data arranged regularly in a storage area at once, it is generally possible to increase the proportion of the part of the target program that is executed by vector instructions. The more you do this, the more the program execution time can be reduced. Therefore, it is desirable for a compiler for such a vector processing processor to convert a given source program into a target program in a form that can be executed in parallel as much as possible.

ところで、ベクトル命令をもつベクトル処理プロセッサ
に対する従来のコンパイラは、高級言語で記述された原
始プログラムを読み込み構文解析を行って第1中間テキ
ストを生成する構文解析部と、第1中間テキストから原
始プログラム中のループ構造を検出してベクトル化可能
部分の認識を行いベクトル処理用の第2中間テキストを
生成するベクトル化処理部と、第2中間テキストから目
的プログラムを生成して出力するコード生成部とから、
その主要部が構成されていた。
By the way, conventional compilers for vector processing processors with vector instructions include a syntax analysis unit that reads a source program written in a high-level language, performs syntax analysis, and generates a first intermediate text, and a syntax analysis unit that reads a source program written in a high-level language and generates a first intermediate text. a vectorization processing unit that detects the loop structure of the vector and recognizes vectorizable portions and generates a second intermediate text for vector processing; and a code generation unit that generates and outputs a target program from the second intermediate text. ,
The main part was composed of

このような従来のこの種のコンパイラは、例えば第2図
に示すような原始プログラムが与えられた場合には、構
文解析部がこの原始プログラムを読み込んで第3図の流
れ図に示すような第1中間テキスト(ステップ31〜3
4)を生成し、ベクトル化処理部が第1中間テキストを
変更した第4図の流れ図に示すような第2中間テキスト
(ステップ41および42)を生成し、コード生成部が
第2中間テキストを読み込み並列実行可能部分をベクト
ル化した目的プログラムを生成していた。
For example, in a conventional compiler of this type, when a source program as shown in FIG. Intermediate text (steps 31-3
4), the vectorization processing unit generates a second intermediate text (steps 41 and 42) as shown in the flowchart of FIG. 4 in which the first intermediate text is changed, and the code generation unit changes the second intermediate text. The target program was generated by vectorizing the part that can be read and executed in parallel.

ところが、従来のこの種のコンパイラでは、第5図に示
すような原始プログラムが与えられた場合は、配列Cに
対する定義および参照が線形でないため、この範囲およ
びこの範囲が含まれるIF文配下全体をベクトル化不可
能な文群として処理していた。このため、ベクトル処理
プロセッサは、前記配列Cに対する定義および参照があ
る範囲およびこの範囲が含まれるIF文配下全体をスカ
ラ命令により順次実行することを余儀なくされていた。
However, with conventional compilers of this type, when a source program as shown in Figure 5 is given, the definition and reference to array C are not linear, so this range and the entire IF statement that includes this range are It was processed as a group of sentences that cannot be vectorized. For this reason, the vector processor is forced to sequentially execute the range in which the array C is defined and referenced, and the entire IF statement that includes this range, using scalar instructions.

[発明が解決しようとする課題] 上述した従来のコンパイラでは、DOループ内のIF文
配下において要素が順番に定義される配列に対しては、
同−IF文配下外で引用があると定義参照関係が確定で
きず、一般的には配列に対する定義および参照がある範
囲およびこの範囲が含まれるIF文配下全体をベクトル
化できず並列実行不可能として処理していたので、ベク
トル処理プロセッサにおいては定義参照関係が確定でき
ない配列要素の引用があるとして、スカラ命令で実行さ
れ、プログラムの実行時間を短縮することができないと
いう欠点がある。
[Problems to be Solved by the Invention] In the conventional compiler described above, for an array whose elements are defined in order under an IF statement in a DO loop,
- If there is a quotation outside the IF statement, the definition reference relationship cannot be determined, and generally the range in which the definition and reference to the array exists and the entire IF statement that includes this range cannot be vectorized, making parallel execution impossible. However, in a vector processing processor, there is a reference to an array element whose definition reference relationship cannot be determined, and it is executed using a scalar instruction, which has the disadvantage that the program execution time cannot be shortened.

本発明の目的は、配列要素の定義参照関係の確定を可能
とし、ベクトル化により並列実行可能として処理され、
ベクトル処理プロセッサにおけるプログラムの実行時間
を短縮できるIF文下定義配列ベクトル化コンパイル方
式を提供することにある。
An object of the present invention is to enable definition reference relationships of array elements to be determined, to be processed in a manner that can be executed in parallel through vectorization, and to
An object of the present invention is to provide a vectorization compilation method for an array defined under an IF statement that can shorten the execution time of a program in a vector processor.

[課題を解決するための手段] 本発明のIF文下定義配列ベクトル化コンパイル方式は
、 原始プログラムを読み込んで構文解析を行い第1中間テ
キストを生成する構文解析部と、第1中間テキストから
前記原始プログラム中のループ構造を検出してベクトル
化可能部分の認識を行い、ベクトル処理用の第2中間テ
キストを生成するベクトル化処理部と、 第2中間テキストから目的プログラムを生成して出力す
るコード生成部とを有し、 前記ベクトル化処理部は、 第1中間テキストを読み込んで原始プログラムのループ
中の制御の流れを解析する構造解析手段と、 ループ中のIF文で定義される配列を取り出し、取り出
した配列の添字を調べ、IF文下において添字の形が線
形であるか否かを調べ、線形とみなされた配列に対して
定義・引用類を調べ、出現順で定義後引用の配列のみを
ベクトル化の可能性ありとして、該配列に対して、定義
時の添字をキーとして定義引用関係を調べるIF文下定
義配列解析手段と、 ループ中に並列実行に矛盾するデータ依存関係があるか
否かを判定し、IF文下定義配列解析手段によって定義
引用関係に問題がないとされた配列に対しては、依存関
係なしとして処理するデータ依存関係判定手段と、 ベクトル長設定用の第2中間テキスト、並列実行可能部
分およびIF文下定義配列に対してベクトル処理用の第
2の中間テキスト、並列実行可能部分をベクトル処理す
るために必要な第2中間テキストをそれぞれ生成するベ
クトルテキスト生成手段を含む。
[Means for Solving the Problems] The IF statement below definition array vectorization compilation method of the present invention includes a syntax analysis unit that reads a source program, performs syntax analysis, and generates a first intermediate text; A vectorization processing unit that detects loop structures in the source program, recognizes vectorizable parts, and generates second intermediate text for vector processing; and code that generates and outputs the target program from the second intermediate text. a generation unit, and the vectorization processing unit includes a structure analysis unit that reads the first intermediate text and analyzes the control flow in the loop of the source program, and extracts an array defined by an IF statement in the loop. , check the subscript of the retrieved array, check whether the shape of the subscript is linear under the IF statement, check the definitions and citations for the array that is considered linear, and arrange the citations after definition in the order of appearance. An IF statement definition array analysis means that examines the definition citation relationship using the subscript at the time of definition as a key for the array, assuming that there is a possibility of vectorization, and a data dependency relationship that contradicts parallel execution in the loop. and a data dependency relationship determination unit that processes the array as having no dependency relationship for the array for which the IF statement below definition array analysis unit determines that there is no problem with the definition citation relationship, and a data dependency relationship determination unit that processes the array as having no dependency relationship. 2. Vector text generation that generates a second intermediate text for vector processing for the parallel executable part and the IF statement definition array, and a second intermediate text necessary for vector processing the parallel executable part. Including means.

[作   用] IF文下定義配列解析手段により検索された配列および
収集された情報に基づいてデータ依存関係判定手段によ
り定義参照関係か不明として判定されていた部分を明確
に判定できることにより、ヘクトル化可能な場合ベクト
ル命令を適用して並列実行可能となる。したがって、ベ
クトル処理プロセッサにおけるプログラムの実行時間を
短縮てきる。
[Function] Based on the sequence searched by the IF text below definition sequence analysis means and the information collected, it is possible to clearly determine the part that was determined to be a definition reference relationship by the data dependency relationship determination means, based on the sequence searched by the IF text below definition sequence analysis means and the information collected. Parallel execution is possible by applying vector instructions when possible. Therefore, the execution time of the program in the vector processing processor can be shortened.

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

第1図は本発明の一実施例のIF文丁定五配列ベクトル
化コンパイル方式が適用されたコンパイラ2をボす機能
ブロック図である。
FIG. 1 is a functional block diagram of a compiler 2 to which an IF statement fixed array vectorization compilation method according to an embodiment of the present invention is applied.

このコンパイラ2は、記憶域上に規則的に並んているデ
ータに対して一度に演算を行うヘクトル命令をもつベク
トル処理プロセッサに対して、与えられた高級言語で記
述された原始プログラム1から目的プログラム3を生成
して出力するコンパイラであり、原始プログラム1を読
み込んて構文解析を行い第1中間テキスト24を生成す
る構文解析部21と、第1中間テキスト24から原始プ
ログラム1中のループ構造を検出してベクトル化可能部
分の認識を行いベクトル処理用の第2中間テキスト25
を生成するベクトル化処理部22と、第2中間テキスト
25から目的プログラム3を生成して出力するコード生
成部23とから構成されている。
This compiler 2 converts a source program 1 written in a given high-level language into a target program for a vector processing processor with hector instructions that perform operations on data arranged regularly in a storage area at once. It is a compiler that generates and outputs the source program 1, a syntactic analysis unit 21 that reads the source program 1, performs syntax analysis, and generates the first intermediate text 24, and detects a loop structure in the source program 1 from the first intermediate text 24. to recognize vectorizable parts and generate second intermediate text 25 for vector processing.
, and a code generation section 23 that generates and outputs the target program 3 from the second intermediate text 25.

ベクトル化処理部22は、第1中間テキスト24を読み
込んで原始プログラム1のループ中の制御の流れを解析
する構造解析手段221と、ループ中のIF文下で要素
が順番に定義される配列の定義引用状態を解析するIF
文上下義配列解析手段222と、ループ中に並列実行に
矛盾するデータ依存関係があるか否かを判定するデータ
依存関係判定手段223と、IF文上下義配列解析手段
222およびデータ依存関係判定手段223により並列
実行可能と判定された部分のベクトル処理用の第2中間
テキスト25を生成するベクトルテキスト生成手段22
4とを含んで構成されている。
The vectorization processing unit 22 includes a structure analysis unit 221 that reads the first intermediate text 24 and analyzes the flow of control in the loop of the source program 1, and a structure analysis unit 221 that reads the first intermediate text 24 and analyzes the flow of control in the loop of the source program 1, and a structure analysis unit 221 that reads the first intermediate text 24 and analyzes the flow of control in the loop of the source program 1, and IF to analyze definition citation status
A statement upper/lower definition array analysis unit 222, a data dependency relationship determination unit 223 that determines whether or not there is a data dependency relationship inconsistent with parallel execution in a loop, an IF statement upper/lower definition array analysis unit 222, and a data dependency relationship determination unit. Vector text generation means 22 that generates second intermediate text 25 for vector processing of the portion determined to be executable in parallel by 223;
4.

第9図(1)を参照すると、1.F上下定義配列解析手
段222て作成されデータ依存関係判定手段223およ
びベクトルテキスト生成手段224て参照される配列テ
ーブル910は、次の配列デープルへのポインタ911
と、IF文上下定義配列フラグ912、定義参照スキッ
プフラグ913と、IF文]定義配列デープル920へ
のポインタ914と、添字式へのポインタ915と、要
素数916と、配列基917とを含んで構成されている
Referring to FIG. 9 (1), 1. The array table 910 created by the F upper and lower definition array analysis means 222 and referred to by the data dependency determination means 223 and the vector text generation means 224 has a pointer 911 to the next array daple.
, IF statement upper/lower definition array flag 912, definition reference skip flag 913, IF statement] Pointer 914 to definition array dataple 920, pointer 915 to subscript expression, number of elements 916, and array base 917. It is configured.

また、第9図(2)を参照すると、IF文上下義配列テ
ーブル920は、次のIF文上下定義配列デープルのポ
インタ921と、配列デープル910へのポインタ92
2と、作業用配列テーブルCW1のポインタ923と、
作業用配列テーブルCW2のポインタ924と、マスク
用配列テーブルへのポインタ925と、添字情報・各次
元の初期値926と、添字情報・各次元の増分値927
、・・・とを含んで構成されている。
Also, referring to FIG. 9(2), the IF statement upper and lower definition array table 920 contains a pointer 921 to the next IF statement upper and lower definition array diple, and a pointer 92 to the array daple 910.
2, a pointer 923 of the working array table CW1,
Pointer 924 of work array table CW2, pointer 925 to mask array table, subscript information/initial value of each dimension 926, subscript information/increment value of each dimension 927
It is composed of...

次に、このように構成された本実施例のIF文上下義配
列ベクトル化コンパイル方式の動作について説明する。
Next, the operation of the IF statement upper/lower definition array vectorization compilation method of this embodiment configured as described above will be described.

なお、ここでは、第5図に示すような配列要素の引用を
行っている原始プログラム1が与えられた場合に、原始
プログラム1のIF文上下要素が順番に定義される配列
Cを第6図に例示するように作業用の配列を利用するこ
とにより定義参照関係を解析でき、第7図に示すような
ループ群として処理することが可能となる。その結果、
ベクトル化可能となり、S11図の流れ図に示すような
第2中間テキスト25(ステップ1101〜1120)
を生成する例を参考にしなから説明する。
Furthermore, here, given a source program 1 that quotes array elements as shown in FIG. As illustrated in FIG. 7, by using a working array, definition reference relationships can be analyzed, and processing can be performed as a loop group as shown in FIG. the result,
The second intermediate text 25 (steps 1101 to 1120), which can be vectorized, as shown in the flowchart of Figure S11
This will be explained with reference to an example of generating .

原始プログラム1が与えられてコンパイラ2が起動され
ると、まず構文解析部21が原始プログラム1を読み込
んで第8図の流れ図に示すような第1中間テキスト24
(ステップ81〜89)を生成する。
When the source program 1 is given and the compiler 2 is started, the syntax analysis unit 21 first reads the source program 1 and generates the first intermediate text 24 as shown in the flowchart of FIG.
(Steps 81 to 89).

次に、ベクトル化処理部22が第1中間テキスト24を
入力すると、 (1)まず、構造解析手段221が起動され、以下の処
理■〜■を行う。
Next, when the vectorization processing unit 22 inputs the first intermediate text 24, (1) First, the structure analysis means 221 is activated and performs the following processes ① to ②.

■構造解析手段221は、まず第1中間テキスト24を
分岐を単位としたブロックに分割する。
(2) The structure analysis means 221 first divides the first intermediate text 24 into blocks with branches as units.

■次に、対象となるループ部分の文単位のブロックに分
割する。
■Next, divide the target loop into statement blocks.

■続いて、第1中間テキスト24がらブロクラム全体の
制御の流れを解析して各ブロックの関係を求める。
(2) Next, the flow of control of the entire blockram is analyzed using the first intermediate text 24 to determine the relationship between each block.

■最後に各々のブロックで定義参照されている配列およ
び変数に対して、その生死情報(ブロックの人口および
出口での生死状態(定義または弓用の状態)を表現した
もの)を収集する。
■Finally, collect life/death information (expressing the population of the block and life/death status (definition or bow status) at the exit) for the arrays and variables referenced by definition in each block.

(2)次に、IF文上下定義配列解析手段222起動さ
れ、以下の処理■〜■を行う。
(2) Next, the IF statement upper and lower definition array analysis means 222 is activated, and the following processes 1 to 2 are performed.

■IF文下足下定義配列解析手段222まずループ中の
IF文上下定義される配列を取り出す。
■IF statement bottom definition array analysis means 222 First, the arrays defined above and below the IF statement in the loop are taken out.

■次に、取り出した配列の添字を調へ、IF文上下おい
て、添字の値が線形であるか否かを調へる。
■Next, place the subscript of the extracted array in the key, place the IF statement above and below, and check whether the value of the subscript is linear.

■■において線形とみなされた配列に対して定義・引用
順を調べ、出現順で定義後引用のもののみをベクトル化
の可能性ありとして、配列テーブル910のIF文上下
定義配列フラグ912オンにする。
Check the order of definitions and citations for arrays that are considered linear in ■■, and only those that are cited after definition in the order of appearance may be vectorized, and the IF statement upper and lower definition array flag 912 of the array table 910 is turned on. do.

■■において配列テーブル910のIF文上下定義配列
フラグ912オンのものに対して、定義時の添字をキー
にして定義・引用関係を調へ、問題ないものに対して、
配列テーブル910の定義参照スキップフラグ913を
オンに′1−る。また、その他の情報(配列テーブル中
のIF文上下義配列テーブルへのポインタ、添字式のト
ライアット)もVtiし、同時にIF文)定義配列テー
ブル920も作成する。
In ■■, for the IF statement upper and lower definition array flags 912 of the array table 910 that are on, check the definition/citation relationship using the subscript at the time of definition as the key, and for those that have no problems,
The definition reference skip flag 913 of the array table 910 is turned on. In addition, other information (pointers to IF statement upper and lower definition array tables in the array table, triat of subscript expression) is also set to Vti, and an IF statement definition array table 920 is also created at the same time.

第8図に示す第1中間テキスト24の場合にはC(J)
 =A (1) +B (1)  (ステップ86)が
IF文上下義配列として登録される(第10図参照)。
In the case of the first intermediate text 24 shown in FIG. 8, C(J)
=A (1) +B (1) (step 86) is registered as the upper and lower definition array of the IF statement (see FIG. 10).

(3)次に、データ依存関係判定手段223が起動さね
、ループ中に並列実行に矛盾するデータ依存関係がある
か否かを判定する。このとき配列テーブル910の定義
参照スキップフラグ913かオンの配列は、依存関係な
しとして処理する。
(3) Next, the data dependency determining means 223 is activated and determines whether there is a data dependency in the loop that is inconsistent with parallel execution. At this time, an array for which the definition reference skip flag 913 of the array table 910 is on is processed as having no dependency relationship.

第8図の第1中間テキスト24の場合には、配列Cかボ
1記条件を満たしているので、依存関係なしとして処理
する。
In the case of the first intermediate text 24 in FIG. 8, since array C satisfies the condition in box 1, it is processed as having no dependency relationship.

(4)続いて、ベクトルデギスト生成手段224が起動
され、以下の処理■〜■を行う。
(4) Subsequently, the vector degist generating means 224 is activated and performs the following processes ① to ②.

■ヘクトルテキス]・生成手段224は、まず、並列実
行可能部分をベクトル処理するために、必要となるヘク
]・ル長設定用の第2中間テキスト25を生成する。第
11図に示す第2中間テキスト25の場合に、ループの
綬り返し数をベクトル長として設定するvl=100 
(ステップ1102、.1113)が生成される。
(1) The hector text generation means 224 first generates the second intermediate text 25 for setting the hector text length, which is necessary for vector processing of the parallel executable portion. In the case of the second intermediate text 25 shown in FIG. 11, the number of loop turns is set as the vector length vl = 100
(Steps 1102, .1113) are generated.

■次に、並列実行可能部分に対してヘク]・ル処理用の
”52中間テキスト25を生成する。第11図の第2中
間テキストの場合にはステップ1105〜1107.1
114か生成される。この時、IF文下定義配列に対し
ては、作業用配列2を使用する(第11図の場合、配列
Cの代わりにCWWを使用する)6 ステップ1105はA(I)の値が00より大きければ
マスク情報M1の1番目をオンにし、等しいか小さけれ
ばオフにする、これを配列の要素分行う。ステップ11
06はB(1)の値が00より大きければマスク情報M
2の1番目をオンにし、等しいか小さければオフにする
。これを配列の要素分行う。ステップ1107はマスク
情報M1の1番目とマスク情報M2の1番目の論理積を
とり、その結果をマスク情報M3の1番目に設定する。
■Next, "52 intermediate text 25 for parallel processing is generated for the part that can be executed in parallel. In the case of the second intermediate text in FIG. 11, steps 1105 to 1107.1
114 is generated. At this time, work array 2 is used for the array defined under the IF statement (in the case of Figure 11, CWW is used instead of array C).6 In step 1105, the value of A(I) is less than 00. If it is larger, the first mask information M1 is turned on, and if it is equal or smaller, it is turned off. This is done for each element of the array. Step 11
06 is mask information M if the value of B(1) is greater than 00
Turn on the first of 2 and turn it off if they are equal or smaller. Do this for each element of the array. Step 1107 performs a logical product of the first mask information M1 and the first mask information M2, and sets the result as the first mask information M3.

これを要素分行う。ステップ1108.1109はマス
ク情報M3がオンになっている要素番目の配列要素の演
算だけを行う。
Do this for each element. Steps 1108 and 1109 perform calculations only on the array element whose mask information M3 is on.

ここで、マスク情報の設定とは、個々の配列要素に対し
条件を判定し、条件を満足すれば、要素に対応している
マスクをオンにし、満足していなければオフに設定する
ことをいう。ベクトル演算実行においてはマスクがオン
の場合、対応する配列要素の演算が行われる。
Here, setting mask information means determining conditions for each array element, and if the conditions are satisfied, the mask corresponding to the element is turned on, and if not, it is set to off. . When a vector operation is executed, if the mask is on, the operation is performed on the corresponding array element.

■ 次に、IF文下定義配列に対してベクトル処理用の
第2中間テキスト25を生成する。第11図の第2中間
テキストの場合には、(a)〜(e)の処理を行う。
(2) Next, a second intermediate text 25 for vector processing is generated for the IF statement definition array. In the case of the second intermediate text in FIG. 11, processes (a) to (e) are performed.

(a)マスク用配列CWMに対して1.0を代入するC
WM (I)=1.0 (ステップ]、1.03)が生
成される。
(a) C assigning 1.0 to mask array CWM
WM (I)=1.0 (step], 1.03) is generated.

(b)作業用配列CWIに対してIF文下定義配列のル
ープにおける先頭要素を代入するCWl(I)=C(1
)(ステップ1104.)が生成される。
(b) Assign the first element in the loop of the IF statement definition array to the work array CWI CWl (I) = C (1
) (step 1104.) is generated.

(c)マスク用配列CWMに対してIF文下定義配列と
同一条件のもとでOlOを代入するCWM (I)=0
.0 (ステップ1108)が生成される。
(c) CWM that assigns OlO to the mask array CWM under the same conditions as the IF statement definition array (I) = 0
.. 0 (step 1108) is generated.

(d)作業用配列CW1に対してIF文下定義配列の代
入処理CWT、(I)=A(I)+B(I)(ステップ
1109)が生成される。
(d) Assignment process CWT of the IF statement definition array to the work array CW1, (I)=A(I)+B(I) (step 1109) is generated.

(e)作業用配列CW2に対して各々のループ同次に設
定される値を登録する(ステップ1111〜1112)
(e) Register the values to be set for each loop in the work array CW2 (steps 1111 to 1112)
.

ここで、マスク用配列は、個々の配列要素に対して条件
を満足する場合は、同じ要素番号の配列要素に埴0.0
を持ち、満足しない場合は、値1.0を持ち、この配列
を第6図の一時潮化式に適用することで、条件を満足し
なかった要素は前の状態を保持できる。この結果、第5
図のようなりoループをベクトル化することができる。
Here, when the masking array satisfies the conditions for each array element, the array element with the same element number has a value of 0.0.
If the condition is not satisfied, the value is 1.0, and by applying this array to the temporary tidalization formula shown in FIG. 6, the elements that do not satisfy the condition can maintain their previous state. As a result, the fifth
As shown in the figure, the o-loop can be vectorized.

■ 並列実行可能部分をベクトル処理するために必要と
なる後処理用の第2中間テキストを生成する。この時、
IF文下定義配列に対しては、第11図の第2中間テキ
スト25の場合にはステップ1115〜1120が生成
される。
■ Generate second intermediate text for post-processing required to vector process the parallel executable portion. At this time,
For the IF statement definition array, steps 1115 to 1120 are generated in the case of the second intermediate text 25 in FIG. 11.

ベクトル化処理部22のベクトルテキスト生成手段22
4における処理が終了すると、コート生成部23か起動
され第2中間テキスト25に基づいて目的プログラム3
が生成される。
Vector text generation means 22 of vectorization processing section 22
When the process in step 4 is completed, the code generation unit 23 is started and the target program 3 is started based on the second intermediate text 25.
is generated.

この結果、ベクトル処理プロセッサは、従来定義参照関
係が確定できずにスカラ命令で実行していた部分をベク
トル命令で実行することができ、プログラムの実行時間
が短縮される。
As a result, the vector processor can use vector instructions to execute portions that were conventionally executed using scalar instructions because defined reference relationships could not be determined, and the program execution time is shortened.

[発明の効果] 以上説明したように本発明は、IF文下で要素が順番に
定義されている配列に対して、条件の情報や引用の情報
を取り込むことにより、配列要素の定義参照関係の確定
を可能とし、ベクトル処理プロセッサにおけるプログラ
ムの実行時間を短縮できるという効果がある。
[Effects of the Invention] As explained above, the present invention incorporates condition information and citation information for an array in which elements are defined in order under an IF statement, thereby improving definition reference relationships of array elements. This has the effect of enabling determination and shortening the program execution time in the vector processing processor.

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

第1図は本発明の一実施例のIF文上下定義配列ベクト
ル化コンパイル方式適用されたコンパイラの機能ブロッ
ク図、第2図は第1図中の原始プログラム1の一例を示
す図、第3図は第2図中に例示した第1中間テキストの
一例を示す流れ図、第4図は第3図に例示した第1中間
テキストから生成される第2中間テキストの一例を示す
流れ図、第5図は第1図中の原始プログラム1の他の例
を示す図、第6図は本実施例のIF文下定義配列ベクト
ル化コンパイル方式において、IF文下定義配列と解釈
した配列に対してコンパイラが第2中間テキスト・作成
時に行う変形原始プログラムの形式で例示した図、第7
図は第5図に例示した原始プログラムを並列実行可能と
して処理する場合のコンパイラが行う変形を原始プログ
ラムの形式で例示した図、第8図は第5図に例示した原
始プログラムから生成される第1中間テキストの一例を
示す流れ図、第9図は本実施例のIF文上下義配列ベク
トル化コンパイル方式において用いられる配列テーブル
910およびIF文上下定義配列テーブル920構成を
示す図、第10図は本実施例のIF文上下義配列ベクト
ル化コンパイル方式で第5図に例示した原始プログラム
を処理したときの配列テーブルおよびIF文上下定義配
列テーブル内容を例示する図、第11図は第8図に例示
した第1中間テキストから生成される第2中間テキスト
を示す流れ図。 1・・・原始プログラム、2・・・コンパイラ、3・・
・目的プログラム、 21 ・ 22 ・ 23 ・ 24 ・ 25 ・ 221 ・ 222 ・ 223 ・ 224 ・ 910 φ 911 ・ 912 ・ ・ 913 ・ ・ 914 ・ ・ 915 ・ ・ 916 ・ ・ 920 ・ ・ 921 ・ ・ ・構文解析部、 ・ベクトル化処理部、 ・コード生成部、 ・第1中間テキスト、 ・第2中間テキスト、 ・構造解析手段、 ・IF文上下義配列解析手段、 ・データ依存関係判定手段、 ・ベクトルテキスト生成手段、 ・配列テーブル、 ・次の配列テーブル910へのポイン タ、 ・IF文F定義配列フラグ、 ・定義参照スキップフラグ、 ・IF文上下定義配列テーブル920 のポインタ、 ・添字式トライアット、 ・要素数、917・・・配列名、 ・IF文上下定義配列テーブル ・次のIF文上下定義配列テーブ ル20へのポインタ、 922・・・配列テーブル910へのポインタ、923
・・・作業用配列テーブルCWIへのポインタ、 924・・・作業用配列テーブルCW2へのポインタ、 925・・・マスク用配列テーブルCWMへのポインタ
、 926・・・添字情報・各次元の初期値、927・・・
添字情報・各次元の増分値。
Fig. 1 is a functional block diagram of a compiler to which the IF statement upper and lower definition array vectorization compilation method is applied according to an embodiment of the present invention, Fig. 2 is a diagram showing an example of the source program 1 in Fig. 1, and Fig. 3 is a flowchart showing an example of the first intermediate text illustrated in FIG. 2, FIG. 4 is a flowchart showing an example of the second intermediate text generated from the first intermediate text illustrated in FIG. 3, and FIG. FIG. 6 is a diagram showing another example of the source program 1 in FIG. 1. In the IF statement definition array vectorization compilation method of this embodiment, the compiler performs a 2. Diagram illustrating the format of the transformation source program performed at the time of intermediate text/creation, Part 7
The figure shows an example of the transformation performed by the compiler in the form of a source program when processing the source program illustrated in Figure 5 as being able to be executed in parallel. 1 is a flowchart showing an example of intermediate text. FIG. 9 is a diagram showing the structure of an array table 910 and an IF statement upper and lower definition array table 920 used in the IF statement upper and lower definition array vectorization compilation method of this embodiment. A diagram illustrating the contents of an array table and an IF statement upper and lower definition array table when the source program illustrated in FIG. 5 is processed using the IF statement upper and lower definition array vectorization compilation method of the embodiment, and FIG. 11 is illustrated in FIG. 8. 3 is a flowchart showing second intermediate text generated from the first intermediate text. 1... Source program, 2... Compiler, 3...
・Target program, 21 ・ 22 ・ 23 ・ 24 ・ 25 ・ 221 ・ 222 ・ 223 ・ 224 ・ 910 φ 911 ・ 912 ・ ・ 913 ・ ・ 914 ・ ・ 915 ・ ・ 916 ・ ・ 920 ・ ・ 921 ・ ・ ・parsing・Vectorization processing unit, ・Code generation unit, ・First intermediate text, ・Second intermediate text, ・Structure analysis means, ・IF statement upper and lower definition array analysis means, ・Data dependency relationship determination means, ・Vector text generation Means, ・Array table, ・Pointer to the next array table 910, ・IF statement F definition array flag, ・Definition reference skip flag, ・Pointer to IF statement upper and lower definition array tables 920, ・Subscript triat, ・Number of elements , 917... Array name, - IF statement upper and lower definition array table - Pointer to the next IF statement upper and lower definition array table 20, 922... Pointer to array table 910, 923
...Pointer to the working array table CWI, 924... Pointer to the working array table CW2, 925... Pointer to the masking array table CWM, 926... Subscript information/initial value of each dimension , 927...
Subscript information/incremental value of each dimension.

Claims (1)

【特許請求の範囲】 1、記憶域上に規則的に並んでいるデータに対して一度
に演算を行うベクトル命令をもつベクトル処理プロセッ
サに対して、与えられた原始プログラムから目的プログ
ラムを生成し出力するコンパイラにおいて、 原始プログラムを読み込んで構文解析を行い第1中間テ
キストを生成する構文解析部と、 第1中間テキストから前記原始プログラム中のループ構
造を検出してベクトル化可能部分の認識を行い、ベクト
ル処理用の第2中間テキストを生成するベクトル化処理
部と、 第2中間テキストから目的プログラムを生成して出力す
るコード生成部とを有し、 前記ベクトル化処理部は、 第1中間テキストを読み込んで原始プログラムのループ
中の制御の流れを解析する構造解析手段と、 ループ中のIF文で定義される配列を取り出し、取り出
した配列の添字を調べ、IF文下において添字の形が線
形であるか否かを調べ、線形とみなされた配列に対して
定義・引用順を調べ、出現順で定義後引用の配列のみを
ベクトル化の可能性ありとして、該配列に対して、定義
時の添字をキーとして定義引用関係を調べるIF文下定
義配列解析手段と、 ループ中に並列実行に矛盾するデータ依存関係があるか
否かを判定し、IF文下定義配列解析手段によって定義
引用関係に問題がないとされた配列に対しては、依存関
係なしとして処理するデータ依存関係判定手段と、 ベクトル長設定用の第2中間テキスト、並列実行可能部
分およびIF文下定義配列に対してベクトル処理用の第
2の中間テキスト、並列実行可能部分をベクトル処理す
るために必要な第2中間テキストをそれぞれ生成するベ
クトルテキスト生成手段を含むIF文下定義配列ベクト
ル化コンパイル方式。
[Claims] 1. Generates and outputs a target program from a given source program to a vector processing processor having vector instructions that perform operations on data regularly arranged in a storage area at once. A compiler that reads a source program, performs syntax analysis, and generates a first intermediate text; a syntax analysis unit that reads a source program, performs syntax analysis, and generates a first intermediate text; detects a loop structure in the source program from the first intermediate text and recognizes a vectorizable portion; It has a vectorization processing unit that generates a second intermediate text for vector processing, and a code generation unit that generates and outputs a target program from the second intermediate text, and the vectorization processing unit generates a first intermediate text. A structure analysis means that reads and analyzes the flow of control in a source program loop, extracts the array defined by the IF statement in the loop, examines the subscripts of the extracted array, and determines whether the subscript shape is linear under the IF statement. Check the order of definition and citation for arrays that are considered linear, and consider only the arrays that are cited after definition in the order of appearance as having the possibility of vectorization. The IF statement below definition array analysis means examines the definition citation relationship using the subscript as a key, and the IF statement below definition array analysis means determines whether there is a data dependency relationship that contradicts parallel execution in the loop, and the IF statement below definition array analysis means examines the definition citation relationship. For arrays that are found to have no problems, there is a data dependency determination means that processes them as having no dependencies, and for vector processing for second intermediate text for setting vector length, parallel executable parts, and arrays defined under IF statements. An IF statement definition array vectorization compilation method including a vector text generation means for generating second intermediate text for vector processing and a second intermediate text necessary for vector processing a parallel executable part.
JP13205490A 1990-05-22 1990-05-22 Compiling system which is made into definition arrangement vector under if sentence Pending JPH0425969A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13205490A JPH0425969A (en) 1990-05-22 1990-05-22 Compiling system which is made into definition arrangement vector under if sentence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13205490A JPH0425969A (en) 1990-05-22 1990-05-22 Compiling system which is made into definition arrangement vector under if sentence

Publications (1)

Publication Number Publication Date
JPH0425969A true JPH0425969A (en) 1992-01-29

Family

ID=15072446

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13205490A Pending JPH0425969A (en) 1990-05-22 1990-05-22 Compiling system which is made into definition arrangement vector under if sentence

Country Status (1)

Country Link
JP (1) JPH0425969A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102275264A (en) * 2011-07-29 2011-12-14 宁波如强模塑有限公司 Oblique core-pulling compound slider device of injection mold for oblique Y-opening outer margin products

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102275264A (en) * 2011-07-29 2011-12-14 宁波如强模塑有限公司 Oblique core-pulling compound slider device of injection mold for oblique Y-opening outer margin products

Similar Documents

Publication Publication Date Title
US5230053A (en) Processor scheduling method for iterative loops
JP2003323463A5 (en)
JPH05508494A (en) Integrated hierarchical representation of computer programs for software development
JP2002259134A (en) Method and device for optimizing post link code
Fauth et al. Automated generation of DSP program development tools using a machine description formalism
JPH0425969A (en) Compiling system which is made into definition arrangement vector under if sentence
Danilewski et al. Specialization through dynamic staging
Marker Design by transformation: from domain knowledge to optimized program generation
JPH03220669A (en) Multiple loop vectorization compiling system
Nguyen-Viet Transformation in HaRe
JP3305767B2 (en) Sort processing method and compilation method
JPH06290159A (en) Process assigning method for parallel computers
JP2638278B2 (en) Compile processing method
Nguyen-Viet Computer Science at Kent
JPS63186333A (en) Scheduling processing system for instruction to local branching instruction
JPH0795272B2 (en) Compile method
Suchocki et al. A functional language and compiler for the Arduino micro-controller
JP2533938B2 (en) Vector arithmetic processing method
JPH05120323A (en) System for optimizing vector calculation under if sentence
JPH0950429A (en) Pointer vectorization system in compiler
JPH02214974A (en) Vectorization processing system
JPH0468664B2 (en)
JP2002140198A (en) Inline development method
Barry et al. Extracting parallelism in Fortran by translation to a single assignment intermediate form
JPH04184540A (en) Parallelized compilation systems