JPH05120323A - System for optimizing vector calculation under if sentence - Google Patents

System for optimizing vector calculation under if sentence

Info

Publication number
JPH05120323A
JPH05120323A JP3308376A JP30837691A JPH05120323A JP H05120323 A JPH05120323 A JP H05120323A JP 3308376 A JP3308376 A JP 3308376A JP 30837691 A JP30837691 A JP 30837691A JP H05120323 A JPH05120323 A JP H05120323A
Authority
JP
Japan
Prior art keywords
vector
text
intermediate text
condition
loop
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
JP3308376A
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 JP3308376A priority Critical patent/JPH05120323A/en
Publication of JPH05120323A publication Critical patent/JPH05120323A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To replace the same calculation, which is executed in a THEN phrase and an ELSE phrase under an IF sentence in a DO loop, with one time of calculation without mask. CONSTITUTION:A syntax analysis part 21 generates a first intermediate text 24 by analyzing the syntax of a source program 1. A construction analyzing means 211 analyzes the flow of the control of the loop of the source program 1 from the first intermediate text 24, and an under-IF sentence condition analyzing means 222 analyzes the condition of the IF sentence in the loop. Then, a data-depending relation deciding means 223 decides whether there is data- depending relation conflict to parallel execution in the loop, or not, a vector text generating means 224 generates a second intermediate text 25 for a vector processing of a part for which the parallel execution is decided to be possible, and a vector calculation optimization processing means 225 executes the common expression erase processing of a vector text with mask. A code generation part 23 generates an objective program 3 from the second intermediate text 25 and outputs the program.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は記憶域上に規則的に並ん
でいるデータに対して一度に演算を行うベクトル命令を
もち、ベクトル命令にマスクのオンまたはオフにより対
応する要素の処理を行うか否かを制御する機能をもつベ
クトル処理プロセッサに対するコンパイラにおけるプロ
グラムの並列実行可能部分の最適化方式に関し、特にI
F文下ベクトル演算最適化方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention has a vector instruction for performing an operation on data regularly arranged in a storage area at a time, and processes a corresponding element by turning a mask on or off. A method for optimizing parallel executable parts of a program in a compiler for a vector processor having a function of controlling whether or not
The present invention relates to a method for optimizing an F-under sentence vector operation.

【0002】[0002]

【従来の技術】記憶域上に規則的に並んでいるデータに
対して一度に演算を行うベクトル命令をもつベクトル処
理プロセッサにおいては、一般的に目的プログラムのう
ちのベクトル命令によって実行される部分の割合を大き
くすればするほどプログラムの実行時間を短縮すること
ができる。したがって、このようなベクトル処理プロセ
ッサに対するコンパイラでは、与えられた原始プログラ
ムを可能な限り並列実行可能な形で目的プログラムに変
換することが望まれる。
2. Description of the Related Art In a vector processor having a vector instruction for performing an operation on data regularly arranged in a storage area at a time, generally, a portion of a target program executed by the vector instruction is processed. The larger the ratio, the shorter the program execution time. Therefore, a compiler for such a vector processor is desired to convert a given source program into a target program in a form that can be executed in parallel as much as possible.

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

【0004】このような従来のコンパイラは、例えば図
2に示すような原始プログラムが与えられた場合に、構
文解析部がこの原始プログラムを読み込んで図3の流れ
図に示すような第1中間テキスト(ステップ31〜3
4)を生成し、ベクトル化処理部が第1中間テキストを
変更した図4の流れ図に示すような第2中間テキスト
(ステップ41および42)を生成し、コード生成部が
第2中間テキストを読み込み並列実行可能部分をベクト
ル化した目的プログラムを生成していた。
In such a conventional compiler, for example, when a source program as shown in FIG. 2 is given, the syntactic analysis unit reads the source program and outputs the first intermediate text (as shown in the flow chart of FIG. 3). Steps 31 to 3
4) is generated, the vectorization processing unit generates the 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 reads the second intermediate text. A target program was created by vectorizing parallel executable parts.

【0005】ところが、従来のコンパイラでは、図5に
示すような原始プログラムが与えられた場合には、DO
ループ内のIF文下にTHEN節とELSE節とが存在
するので、その演算は図6に示すように別々のIF文下
の演算としてベクトル化を行っていた。このため、TH
EN節およびELSE節の両方にある演算は常に2回演
算が行われ、ベクトル化による実行時間の短縮が十分で
はなかった。
However, in the conventional compiler, when a source program as shown in FIG.
Since the THEN clause and the ELSE clause exist under the IF statement in the loop, the operation is vectorized as an operation under separate IF statements as shown in FIG. Therefore, TH
The operations in both the EN clause and the ELSE clause are always performed twice, and the reduction in execution time due to vectorization was not sufficient.

【0006】[0006]

【発明が解決しようとする課題】上述した従来のコンパ
イラでは、DOループ内のIF文下にTHEN節とEL
SE節とが存在する場合、その演算は別々のIF文下の
演算としてベクトル化を行っていたので、THEN節お
よびELSE節の両方にある演算は常に2回演算が行わ
れ、ベクトル処理プロセッサにおいてはプログラムの実
行時間を十分に短縮することができないという欠点があ
る。
In the conventional compiler described above, the THEN clause and EL are placed under the IF statement in the DO loop.
If there is an SE clause, the operation is vectorized as an operation under a separate IF statement, so the operations in both the THEN and ELSE clauses are always performed twice, and in the vector processor Has the drawback that the program execution time cannot be shortened sufficiently.

【0007】本発明の目的は、上述の点に鑑み、DOル
ープ内のIF文下においてTHEN節およびELSE節
の両方に現れる同一の演算は条件に関係なしに演算され
るとしてマスクなしで一度演算しその結果をマスク付き
(条件を満足する部分のみ)で引用することにより、ベ
クトル処理プロセッサにおけるプログラムの実行時間を
短縮できるようにしたIF文下ベクトル演算最適化方式
を提供することにある。
In view of the above points, an object of the present invention is that once the same operation that appears in both the THEN clause and the ELSE clause under the IF statement in the DO loop is operated regardless of the condition, it is operated once without a mask. Then, by quoting the result with a mask (only the part that satisfies the condition), it is an object of the present invention to provide an IF sentence under-vector operation optimizing method capable of shortening the program execution time in the vector processor.

【0008】[0008]

【課題を解決するための手段】本発明のIF文下ベクト
ル演算最適化方式は、記憶域上に規則的に並んでいるデ
ータに対して一度に演算を行うベクトル命令をもち、そ
の命令にマスクのオンまたはオフにより対応する要素の
処理を行うか否かを制御する機能をもつベクトル処理プ
ロセッサに対して、与えられた原始プログラムから目的
プログラムを生成し出力するコンパイラにおいて、前記
原始プログラムを読み込み構文解析を行って第1中間テ
キストを生成する構文解析部と、この構文解析部により
生成された前記第1中間テキストから前記原始プログラ
ムのループ中の制御の流れを解析する構造解析手段と、
ループ中のIF文の条件を解析するIF文下条件解析手
段と、ループ中に並列実行に矛盾するデータ依存関係が
あるか否かを判定するデータ依存関係判定手段と、前記
IF文下条件解析手段および前記データ依存関係判定手
段により並列実行可能と判定された部分のベクトル処理
用の第2中間テキストを生成するベクトルテキスト生成
手段と、前記IF文下条件解析手段による解析結果に基
づいてマスク付きベクトルテキストの共通式削除処理を
行うベクトル演算最適化処理手段とを備え、前記ベクト
ル演算最適化処理手段によりIF文のTHEN節とEL
SE節とが別々の条件としてマスク付きでベクトル演算
を2回行っていた部分を条件なしとしてベクトル演算を
1回行うように前記第2中間テキストを変形することで
並列実行可能部分を最適化するベクトル化処理部と、こ
のベクトル化処理部により生成された前記第2中間テキ
ストから目的プログラムを生成して出力するコード生成
部とを有する。
The IF statement vector operation optimization method of the present invention has a vector instruction for performing an operation on data regularly arranged in a storage area at a time, and masks the instruction. A compiler for generating and outputting a target program from a given source program to a vector processor having a function of controlling whether to process the corresponding element by turning on or off A syntax analysis unit for performing analysis to generate a first intermediate text; a structure analysis unit for analyzing a control flow in a loop of the source program from the first intermediate text generated by the syntax analysis unit;
IF statement under-condition analysis means for analyzing the conditions of the IF statement in the loop, data dependency relationship determination means for determining whether there is a conflicting data dependence relationship in parallel execution in the loop, and the IF statement under-condition analysis Means and a vector text generating means for generating a second intermediate text for vector processing of a portion determined to be executable in parallel by the data dependency determining means, and a mask based on an analysis result by the IF sentence under condition analyzing means. And a vector operation optimization processing means for performing common expression deletion processing of vector text, and the vector operation optimization processing means performs the THEN clause and EL of an IF statement.
By optimizing the parallel-executable part, the second intermediate text is modified so that the vector operation is performed once under the condition that the part where the vector operation is performed twice with a mask as a separate condition from the SE clause is not performed. It has a vectorization processing unit and a code generation unit that generates and outputs a target program from the second intermediate text generated by the vectorization processing unit.

【0009】[0009]

【作用】本発明のIF文下ベクトル演算最適化方式で
は、構文解析部が原始プログラムを読み込み構文解析を
行って第1中間テキストを生成し、ベクトル化処理部が
構文解析部により生成された第1中間テキストから原始
プログラムのループ中の制御の流れを解析する構造解析
手段と、ループ中のIF文の条件を解析するIF文下条
件解析手段と、ループ中に並列実行に矛盾するデータ依
存関係があるか否かを判定するデータ依存関係判定手段
と、IF文下条件解析手段およびデータ依存関係判定手
段により並列実行可能と判定された部分のベクトル処理
用の第2中間テキストを生成するベクトルテキスト生成
手段と、IF文下条件解析手段による解析結果に基づい
てマスク付きベクトルテキストの共通式削除処理を行う
ベクトル演算最適化処理手段とを備え、ベクトル演算最
適化処理手段によりIF文のTHEN節とELSE節と
が別々の条件としてマスク付きでベクトル演算を2回行
っていた部分を条件なしとしてベクトル演算を1回行う
ように第2中間テキストを変形することで並列実行可能
部分を最適化し、コード生成部がベクトル化処理部によ
り生成された第2中間テキストから目的プログラムを生
成して出力する。
In the IF sentence vector operation optimization method of the present invention, the syntactic analysis unit reads the source program and performs syntactic analysis to generate the first intermediate text, and the vectorization processing unit generates the first intermediate text. 1 Structure analysis means for analyzing the flow of control in the loop of the source program from the intermediate text, IF statement under-condition analysis means for analyzing the conditions of the IF statement in the loop, and data dependency relationship inconsistent with parallel execution in the loop Data dependency relationship determining means for determining whether or not there is a vector text for generating a second intermediate text for vector processing of a portion determined to be parallel executable by the IF sentence lower condition analyzing means and the data dependency relationship determining means. Vector operation optimization for performing common expression deletion processing of masked vector text based on the analysis result by the generation means and the IF sentence condition analysis means And the vector operation optimizing means performs the vector operation once with the condition where the THEN clause and the ELSE clause of the IF statement perform the vector operation twice with a mask as separate conditions. The second executable text is modified to optimize the parallel executable part, and the code generator generates and outputs the target program from the second intermediate text generated by the vectorization processor.

【0010】[0010]

【実施例】次に、本発明について図面を参照して詳細に
説明する。
The present invention will be described in detail with reference to the drawings.

【0011】図1は、本発明の一実施例に係るIF文下
ベクトル演算最適化方式が適用されたコンパイラ2の構
成を示す機能ブロック図である。このコンパイラ2は、
記憶域上に規則的に並んでいるデータに対して一度に演
算を行うベクトル命令を持つベクトル処理プロセッサに
対して、与えられた高級言語で記述された原始プログラ
ム1から目的プログラム3を生成して出力するコンパイ
ラであり、原始プログラム1を読み込んで構文解析を行
い第1中間テキスト24を生成する構文解析部21と、
第1中間テキスト24から原始プログラム1中のループ
構造を検出して並列実行可能部分の認識を行いベクトル
処理用の第2中間テキスト25を生成するベクトル化処
理部22と、第2中間テキスト25から目的プログラム
3を生成して出力するコード生成部23とから、その主
要部が構成されている。
FIG. 1 is a functional block diagram showing a configuration of a compiler 2 to which an IF sentence under-vector operation optimizing method according to an embodiment of the present invention is applied. This compiler 2
A target processor 3 is generated from a source program 1 written in a given high-level language to a vector processor having a vector instruction that operates on data regularly arranged in a storage area at a time. A compiler that outputs, a syntax analysis unit 21 that reads the source program 1 and performs syntax analysis to generate a first intermediate text 24;
From the second intermediate text 25, the vectorization processing unit 22 that detects the loop structure in the source program 1 from the first intermediate text 24, recognizes the parallel executable portion, and generates the second intermediate text 25 for vector processing. The main part is composed of a code generator 23 that generates and outputs the object program 3.

【0012】ベクトル化処理部22は、第1中間テキス
ト24を読み込んで原始プログラム1のループ中の制御
の流れを解析する構造解析手段221と、ループ中のI
F文の条件を解析するIF文下条件解析手段222と、
ループ中に並列実行に矛盾するデータ依存関係があるか
否かを判定するデータ依存関係判定手段223と、IF
文下条件解析手段222およびデータ依存関係判定手段
223により並列実行可能と判定された部分のベクトル
処理用の第2中間テキスト25を生成するベクトルテキ
スト生成手段224と、IF文下条件解析手段222に
よる解析結果に基づいてマスク付きベクトルテキストの
共通式削除処理を行うベクトル演算最適化処理手段22
5とを含んで構成されている。
The vectorization processing unit 22 reads the first intermediate text 24 and analyzes the control flow in the loop of the source program 1, and the structure analysis means 221 and I in the loop.
IF sentence under condition analysis means 222 for analyzing the condition of the F sentence,
A data dependency relationship determining means 223 for determining whether or not there is a conflicting data dependency relationship in parallel execution in the loop;
By the textual condition analyzing means 222 and the data dependency relationship determining means 223, the vector text generating means 224 for generating the second intermediate text 25 for the vector processing of the part determined to be executable in parallel, and the IF textual condition analyzing means 222. Vector operation optimization processing means 22 for performing common expression deletion processing of masked vector text based on the analysis result.
5 is included.

【0013】図9(a)を参照すると、IF文下条件解
析手段222で作成されデータ依存関係判定手段223
およびベクトルテキスト生成手段224で参照される条
件テーブル910は、次の条件テーブルへのポインタ9
11と、IF文下THEN節のマスク情報テーブルへの
ポインタ912と、IF文下ELSE節のマスク情報テ
ーブルへのポインタ913と、条件式のトライァド91
4とから構成されている。
Referring to FIG. 9A, the data dependency relationship determining means 223 created by the IF statement condition analyzing means 222.
The condition table 910 referred to by the vector text generation means 224 is a pointer 9 to the next condition table.
11, a pointer 912 to the mask information table of the IF clause under the IF statement, a pointer 913 to a mask information table of the ELSE clause under the IF statement, and a triad 91 of the conditional expression.
4 and.

【0014】また、図9(b)を参照すると、マスク情
報テーブル920は、次のマスク情報テーブルへのポイ
ンタ921と、条件テーブルへのポインタ922と、マ
スクテーブルへのポインタ923とから構成されてい
る。
Further, referring to FIG. 9B, the mask information table 920 includes a pointer 921 to the next mask information table, a pointer 922 to the condition table, and a pointer 923 to the mask table. There is.

【0015】次に、このように構成された本実施例のI
F文下ベクトル演算最適化方式の動作について説明す
る。なお、ここでは、図5に示すような配列要素の引用
を行っている原始プログラム1が与えられた場合に、通
常は図11に示されるような第2中間テキストを作成す
ることでベクトル化処理部22を終了するが、原始プロ
グラム1のIF文下のTHEN節およびELSE節の両
方で演算される式の部分を共通式として処理でき、図7
に示すようなループ群として処理することが可能とな
り、その結果、マスクなしのベクトル演算1回で処理を
行うことができ、図12の流れ図に示すような第2中間
テキスト25(ステップ1201〜1208)が生成さ
れる例を参考にしながら説明する。
Next, the I of this embodiment constructed as described above.
The operation of the F sentence lower vector operation optimization method will be described. Note that, here, when the source program 1 that cites the array elements as shown in FIG. 5 is given, normally the vectorization processing is performed by creating the second intermediate text as shown in FIG. Although the part 22 is ended, the part of the expression calculated by both the THEN clause and the ELSE clause under the IF statement of the source program 1 can be processed as a common expression, and
12 can be processed as a loop group, and as a result, the processing can be performed by one vector operation without a mask, and the second intermediate text 25 (steps 1201 to 1208) as shown in the flowchart of FIG. ) Will be described with reference to an example.

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

【0017】次に、ベクトル化処理部22が第1中間テ
キスト24を入力すると、
Next, when the vectorization processing unit 22 inputs the first intermediate text 24,

【0018】(1) まず、構造解析手段221が起動
され、以下の処理〜を行う。
(1) First, the structural analysis means 221 is activated and the following processes 1 to 5 are performed.

【0019】 構造解析手段221は、まず第1中間
テキスト24を分岐を単位としたブロックに分割する。
The structure analysis unit 221 first divides the first intermediate text 24 into blocks in units of branches.

【0020】 次に、構造解析手段221は、対象と
なるループ部分を文単位のブロックに分割する。
Next, the structure analysis unit 221 divides the target loop portion into sentence-based blocks.

【0021】 続いて、構造解析手段221は、第1
中間テキスト24からプログラム全体の制御の流れを解
析して各ブロックの関係を求める。
Subsequently, the structure analysis means 221 uses the first
The control flow of the entire program is analyzed from the intermediate text 24 to find the relationship between the blocks.

【0022】 最後に、構造解析手段221は、各々
のブロックで定義参照されている配列および変数に対し
て、その生死情報を収集する。
Finally, the structural analysis unit 221 collects the life and death information of the arrays and variables defined and referenced in each block.

【0023】(2) 次に、IF文下条件解析手段22
2が起動され、以下の処理−を行う。
(2) Next, IF sentence condition analysis means 22
2 is started, and the following processing is performed.

【0024】 IF文下条件解析手段222は、まず
ループ中のIF文を検索し、条件テーブル910を作成
する。
The IF statement under-condition analysis unit 222 first searches the IF statement in the loop and creates the condition table 910.

【0025】 次に、IF文下条件解析手段222
は、THEN節のみが存在する場合にはTHEN節のマ
スク情報テーブル920を作成し、THEN節およびE
LSE節が存在する場合にはTHEN節のマスク情報テ
ーブル920およびELSE節のマスク情報テーブル9
20を作成する。また、それぞれのマスク情報テーブル
920と条件テーブル910との間のチェーンを張る。
Next, IF sentence condition analysis means 222
Creates a THEN clause mask information table 920 when only a THEN clause exists, and the THEN clause and E
If the LSE clause exists, the THEN clause mask information table 920 and the ELSE clause mask information table 9
Create 20. Also, a chain is set up between each mask information table 920 and condition table 910.

【0026】(3) 次に、データ依存関係判定手段2
23が起動され、ループ中に並列実行に矛盾するデータ
依存関係があるか否かを判定する。
(3) Next, the data dependence determining means 2
23 is activated and it is determined whether or not there is a conflicting data dependency in parallel execution in the loop.

【0027】(4) 続いて、ベクトルテキスト生成手
段224が起動され、以下の処理〜を行う。
(4) Then, the vector text generating means 224 is activated to perform the following processes (1) to (4).

【0028】 ベクトルテキスト生成手段224は、
まず並列実行可能部分をベクトル処理するために必要と
なるベクトル長設定用の第2中間テキスト25を生成す
る。図11に示す第2中間テキスト25の場合には、ル
ープの繰返し数をベクトル長として設定するステップ1
101が生成される。
The vector text generation means 224 is
First, the second intermediate text 25 for setting the vector length, which is necessary for performing vector processing on the parallel executable part, is generated. In the case of the second intermediate text 25 shown in FIG. 11, step 1 in which the number of loop iterations is set as the vector length
101 is generated.

【0029】 次に、ベクトルテキスト生成手段22
4は、並列実行可能部分に対してベクトル処理用の第2
中間テキスト25を生成する。図11の第2中間テキス
ト25の場合には、ステップ1102〜1107が生成
される。
Next, the vector text generating means 22
4 is a second for vector processing for the parallel executable part.
The intermediate text 25 is generated. In the case of the second intermediate text 25 in FIG. 11, steps 1102-1107 are generated.

【0030】 最後に、ベクトルテキスト生成手段2
24は、並列実行可能部分をベクトル処理するために必
要となる後処理用の第2中間テキスト25を生成する。
図11の第2中間テキスト25の場合には、ステップ1
108が生成される。
Finally, the vector text generating means 2
24 generates the second intermediate text 25 for post-processing required for vector processing the parallel executable part.
In the case of the second intermediate text 25 in FIG. 11, step 1
108 is generated.

【0031】(5) 続いて、ベクトル演算最適化処理
手段225が起動され、以下の処理〜を行う。
(5) Then, the vector operation optimization processing means 225 is activated to perform the following processes (1) to (3).

【0032】 まず、ベクトル演算最適化処理手段2
25は、通常の演算テキストの共通式削除処理と同様
に、第2中間テキスト25から共通式を捜す。このと
き、マスク部分が異なっているものを取り出す。図11
の第2中間テキスト25の場合には、ステップ1103
および1106が取り出される。
First, the vector operation optimization processing means 2
25 searches for a common expression from the second intermediate text 25, similar to the common expression deletion processing for normal operation text. At this time, those having different mask portions are taken out. 11
In the case of the second intermediate text 25 of, step 1103
And 1106 are retrieved.

【0033】 次に、ベクトル演算最適化処理手段2
25は、マスク情報テーブル920より条件テーブル9
10を取り出し、対応するマスク情報テーブル920
(先のマスク情報テーブル920がTHEN節のもので
あればELSE節のマスク情報テーブル920、ELS
E節のものあればTHEN節のマスク情報テーブル92
0)からマスクテーブルへのポインタ923を取り出
し、これをたどってマスク情報を取り出す。図11の第
2中間テキスト25の場合には、ステップ1106より
マスク情報M2が取り出され、対応するマスク情報テー
ブル920から図10に示すようにマスク情報M1が取
り出される。
Next, the vector operation optimization processing means 2
25 is the condition table 9 from the mask information table 920.
10 is extracted and the corresponding mask information table 920
(If the previous mask information table 920 is for the THEN clause, the mask information table 920 for the ELSE clause, ELS
If there is an E section, then the THEN section mask information table 92
A pointer 923 to the mask table is fetched from 0), and the mask information is fetched by tracing the pointer 923. In the case of the second intermediate text 25 in FIG. 11, the mask information M2 is extracted from step 1106, and the mask information M1 is extracted from the corresponding mask information table 920 as shown in FIG.

【0034】 続いて、ベクトル演算最適化処理手段
225は、共通式の相手方のマスク情報テーブル920
がで取り出したものと同一であれば、共通式処理可能
として、相手方のテキストをマスクなしの演算に変更す
る。また、検索したテキストは削除する。図11の第2
中間テキスト25の場合、ステップ1103および11
06は条件を満足するため、変換が行われる。この結
果、図12に示すような第2中間テキスト25が生成さ
れる。
Subsequently, the vector operation optimization processing means 225 causes the mask information table 920 of the opponent of the common expression.
If it is the same as the one extracted in, the common expression can be processed and the text of the other party is changed to the operation without a mask. Also, the searched text is deleted. Second of FIG.
For intermediate text 25, steps 1103 and 11
Since 06 satisfies the condition, conversion is performed. As a result, the second intermediate text 25 as shown in FIG. 12 is generated.

【0035】ベクトル化処理部22のベクトル演算最適
化処理手段225における処理が終了すると、コード生
成部23が起動され、第2中間テキスト25に基づいて
目的プログラム3が生成される。
When the processing in the vector operation optimization processing means 225 of the vectorization processing unit 22 is completed, the code generation unit 23 is activated and the object program 3 is generated based on the second intermediate text 25.

【0036】この結果、ベクトル処理プロセッサは、従
来マスク付きの状態でベクトル演算を2回行っていたも
のが、マスクなしでベクトル演算を1回行えばよくな
り、プログラムの実行時間が短縮される。
As a result, the vector processor, which has conventionally performed the vector operation twice with the mask, only needs to perform the vector operation once without the mask, and the program execution time is shortened.

【0037】[0037]

【発明の効果】以上説明したように本発明は、コンパイ
ラのベクトル化処理部に構造解析手段,IF文下条件解
析手段,データ依存関係判定手段,ベクトルテキスト生
成手段およびベクトル演算最適化処理手段を設け、IF
文の条件下で2回(IF文のTHEN節およびELSE
節)行われていたベクトル演算を1回のベクトル演算に
まとめることにより、ベクトル処理プロセッサにおける
プログラムの実行時間を短縮できるという効果がある。
As described above, according to the present invention, the vectorizing processing unit of the compiler is provided with the structure analyzing means, the IF sentence condition analyzing means, the data dependency determining means, the vector text generating means and the vector operation optimizing processing means. Provided, IF
Twice under the condition of the sentence (THEN clause of EL sentence and ELSE
By combining the vector operations that have been performed into one vector operation, it is possible to reduce the program execution time in the vector processor.

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

【図1】本発明の一実施例に係るIF文下ベクトル演算
最適化方式が適用されたコンパイラの機能ブロック図で
ある。
FIG. 1 is a functional block diagram of a compiler to which an IF statement under-vector operation optimizing method according to an embodiment of the present invention is applied.

【図2】図1中の原始プログラムの一例を示す図であ
る。
FIG. 2 is a diagram showing an example of a source program in FIG.

【図3】図2に例示した原始プログラムから生成される
第1中間テキストの一例を示す流れ図である。
FIG. 3 is a flow chart showing an example of a first intermediate text generated from the source program illustrated in FIG.

【図4】図3に例示した第1中間テキストから生成され
る第2中間テキストの一例を示す流れ図である。
4 is a flowchart showing an example of second intermediate text generated from the first intermediate text illustrated in FIG. 3. FIG.

【図5】本実施例のIF文下ベクトル演算最適化方式が
適用される原始プログラムの具体例を示す図である。
FIG. 5 is a diagram showing a specific example of a source program to which the IF sentence under-vector operation optimizing method of the present embodiment is applied.

【図6】図5に例示した原始プログラムを並列実行可能
として処理する場合に従来のコンパイラが第2中間テキ
ストの作成時に行う変形を原始プログラムの形式で例示
した図である。
FIG. 6 is a diagram illustrating, in the form of a source program, a modification performed by a conventional compiler when creating the second intermediate text when processing the source program illustrated in FIG. 5 as being executable in parallel.

【図7】図5に例示した原始プログラムを並列実行可能
として処理する場合に本実施例のIF文ベクトル演算最
適化方式が適用されたコンパイラが第2中間テキストの
作成時に行う変形を原始プログラムの形式で例示した図
である。
7 is a diagram showing a modification of the source program illustrated in FIG. 5, which is performed by the compiler to which the IF statement vector operation optimizing method according to the present embodiment is applied when the source program is processed in parallel when creating the second intermediate text. It is the figure illustrated by the format.

【図8】図5に例示した原始プログラムから生成される
第1中間テキストの一例を示す流れ図である。
8 is a flow chart showing an example of a first intermediate text generated from the source program illustrated in FIG. 5. FIG.

【図9】本実施例のIF文下ベクトル演算最適化方式に
おいて用いられる条件テーブルおよびマスク情報テーブ
ルの構成を示す図である。
FIG. 9 is a diagram showing configurations of a condition table and a mask information table used in the IF sentence under-vector calculation optimizing method of the present embodiment.

【図10】本実施例のIF文下ベクトル演算最適化方式
で図5に例示した原始プログラムを処理したときの条件
テーブルおよびマスク情報テーブルの内容を例示する図
である。
FIG. 10 is a diagram exemplifying the contents of a condition table and a mask information table when the source program exemplified in FIG. 5 is processed by the IF statement vector operation optimization method of the present embodiment.

【図11】図8に例示した第1中間テキストから生成さ
れる第2中間テキストを示す流れ図である。
FIG. 11 is a flowchart showing second intermediate text generated from the first intermediate text illustrated in FIG. 8.

【図12】図11に例示した第2中間テキストから本実
施例のIF文下ベクトル演算最適化方式により変形を行
った第2中間テキストを示す流れ図である。
FIG. 12 is a flowchart showing a second intermediate text obtained by modifying the second intermediate text illustrated in FIG. 11 by the IF sentence under-vector operation optimizing method of the present embodiment.

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

1 原始プログラム 2 コンパイラ 3 目的プログラム 21 構文解析部 22 ベクトル化処理部 23 コード生成部 24 第1中間テキスト 25 第2中間テキスト 221 構造解析手段 222 IF文下条件解析手段 223 データ依存関係判定手段 224 ベクトルテキスト生成手段 225 ベクトル演算最適化処理手段 910 条件テーブル 911 次の条件テーブルへのポインタ 912 IF文下THEN節のマスク情報テーブルへの
ポインタ 913 IF文下ELSE節のマスク情報テーブルへの
ポインタ 914 条件式のトライァド 920 マスク情報テーブル 921 次のマスク情報テーブルへのポインタ 922 条件テーブルへのポインタ 923 マスクテーブルへのポインタ
DESCRIPTION OF SYMBOLS 1 source program 2 compiler 3 object program 21 syntax analysis unit 22 vectorization processing unit 23 code generation unit 24 first intermediate text 25 second intermediate text 221 structure analysis unit 222 IF sentence condition analysis unit 223 data dependency determination unit 224 vector Text generation unit 225 Vector operation optimization processing unit 910 Condition table 911 Pointer to the next condition table 912 Pointer to the mask information table in the IF sentence THEN clause 913 Pointer to the mask information table in the IF sentence ELSE clause 914 Conditional expression Triad 920 Mask information table 921 Pointer to next mask information table 922 Pointer to condition table 923 Pointer to mask table

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 記憶域上に規則的に並んでいるデータに
対して一度に演算を行うベクトル命令をもち、ベクトル
命令にマスクのオンまたはオフにより対応する要素の処
理を行うか否かを制御する機能をもつベクトル処理プロ
セッサに対して、与えられた原始プログラムから目的プ
ログラムを生成し出力するコンパイラにおいて、 前記原始プログラムを読み込み構文解析を行って第1中
間テキストを生成する構文解析部と、 この構文解析部により生成された前記第1中間テキスト
から前記原始プログラムのループ中の制御の流れを解析
する構造解析手段と、ループ中のIF文の条件を解析す
るIF文下条件解析手段と、ループ中に並列実行に矛盾
するデータ依存関係があるか否かを判定するデータ依存
関係判定手段と、前記IF文下条件解析手段および前記
データ依存関係判定手段により並列実行可能と判定され
た部分のベクトル処理用の第2中間テキストを生成する
ベクトルテキスト生成手段と、前記IF文下条件解析手
段による解析結果に基づいてマスク付きベクトルテキス
トの共通式削除処理を行うベクトル演算最適化処理手段
とを備え、前記ベクトル演算最適化処理手段によりIF
文のTHEN節とELSE節とが別々の条件としてマス
ク付きでベクトル演算を2回行っていた部分を条件なし
としてベクトル演算を1回行うように前記第2中間テキ
ストを変形することで並列実行可能部分を最適化するベ
クトル化処理部と、 このベクトル化処理部により生成された前記第2中間テ
キストから目的プログラムを生成して出力するコード生
成部とを有することを特徴とするIF文下ベクトル演算
最適化方式。
1. A vector instruction for performing an operation on data arranged regularly in a storage area at a time, and controlling whether or not to process a corresponding element by turning a mask on or off for the vector instruction. A compiler for generating and outputting an object program from a given source program to a vector processor having a function of: a syntax analysis unit that reads the source program and performs syntax analysis to generate a first intermediate text; Structure analysis means for analyzing the control flow in the loop of the source program from the first intermediate text generated by the syntax analysis section, IF statement under-condition analysis means for analyzing the condition of the IF statement in the loop, and loop Data dependency relationship determining means for determining whether or not there is a conflicting data dependency relationship in parallel execution, and the IF statement condition analysis processor And a vector text generating means for generating a second intermediate text for vector processing of the portion determined to be parallel executable by the data dependency determining means, and a vector with a mask based on the analysis result by the IF sentence condition analyzing means. And a vector operation optimization processing means for performing common expression deletion processing of the text.
Parallel execution can be performed by transforming the second intermediate text so that the THEN clause and ELSE clause of the statement are vector-operated once with no condition for the part where vector operation is performed twice with a mask as separate conditions. An IF sentence vector operation comprising a vectorization processing unit for optimizing a part and a code generation unit for generating and outputting a target program from the second intermediate text generated by the vectorization processing unit Optimization method.
JP3308376A 1991-10-28 1991-10-28 System for optimizing vector calculation under if sentence Pending JPH05120323A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3308376A JPH05120323A (en) 1991-10-28 1991-10-28 System for optimizing vector calculation under if sentence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3308376A JPH05120323A (en) 1991-10-28 1991-10-28 System for optimizing vector calculation under if sentence

Publications (1)

Publication Number Publication Date
JPH05120323A true JPH05120323A (en) 1993-05-18

Family

ID=17980326

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3308376A Pending JPH05120323A (en) 1991-10-28 1991-10-28 System for optimizing vector calculation under if sentence

Country Status (1)

Country Link
JP (1) JPH05120323A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11120166A (en) * 1997-10-20 1999-04-30 Fujitsu Ltd Vectorization device and storage medium
JP2018049461A (en) * 2016-09-21 2018-03-29 日本電気株式会社 Compilation device, compilation method and compilation program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11120166A (en) * 1997-10-20 1999-04-30 Fujitsu Ltd Vectorization device and storage medium
JP2018049461A (en) * 2016-09-21 2018-03-29 日本電気株式会社 Compilation device, compilation method and compilation program

Similar Documents

Publication Publication Date Title
US4860203A (en) Apparatus and method for extracting documentation text from a source code program
JP4448881B2 (en) Method and system for generating a computer program
US7917899B2 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
JPH06103463B2 (en) Code generation method
KR20020070809A (en) Optimizing Post-Link Code
JP2007511834A (en) Method and system for reversible design tree transformation
JPH05120323A (en) System for optimizing vector calculation under if sentence
JPH06251054A (en) Method for optimizing vector operation in if sentence
JPH0756745A (en) Compiler processing system for language processing program
JPH05134882A (en) Device and method for language translation processing
JP2008015665A (en) Program analysis method and program analyzer
JPH11195011A (en) Language translation processor, language translation processing method and record medium recording language translation processing program
JP3417960B2 (en) Sentence correction support method and device
JPH11242598A (en) Compiling method and device, object program executing method and device and program storage medium
JP2827724B2 (en) Program debug processing method
JPS59231649A (en) Output processing system for compiled program list
JPH0425969A (en) Compiling system which is made into definition arrangement vector under if sentence
JPH03220669A (en) Multiple loop vectorization compiling system
JP3226172B2 (en) Inline expansion system
JPH04343140A (en) Parallelized processing system
JPH06208470A (en) Objective code optimizing device
CN117851101A (en) Warehouse level code defect automatic repairing method based on large language model
JPH0950429A (en) Pointer vectorization system in compiler
JPS63187365A (en) Under-if text stipulated variable vectorizing compilation system
JPH0546370A (en) Program generating device