JPH0250257A - Program optimizing processing method - Google Patents

Program optimizing processing method

Info

Publication number
JPH0250257A
JPH0250257A JP20074188A JP20074188A JPH0250257A JP H0250257 A JPH0250257 A JP H0250257A JP 20074188 A JP20074188 A JP 20074188A JP 20074188 A JP20074188 A JP 20074188A JP H0250257 A JPH0250257 A JP H0250257A
Authority
JP
Japan
Prior art keywords
block
program
blocks
processing
register
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
JP20074188A
Other languages
Japanese (ja)
Other versions
JP2564904B2 (en
Inventor
Morie Sagawa
佐川 守江
Minoru Sano
実 佐野
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP63200741A priority Critical patent/JP2564904B2/en
Publication of JPH0250257A publication Critical patent/JPH0250257A/en
Application granted granted Critical
Publication of JP2564904B2 publication Critical patent/JP2564904B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To improve the execution efficiency, etc., of an object program in an optimizing processing for generating a vectoring object program from a source program of a computer by enabling the apply of a vector instruction, which obtains maximum and minimum values, to be applicable and increasing objects of vectrization. CONSTITUTION:A first block, for which definition concerning arrangement data and the reference of the definition continue in a processing step, is detected, and when there is such a block, a second block, which is a block to continue to the block and refers again the arrangement data in the processing step, is detected. When there is the first and second blocks, a register to hold the defining contents of these arrangement data over the first and second blocks is induced in the processing step and optimization is executed to replace the reference of the arrangement data to the reference of the register. After that, vectoring processing is started. Thus, a relation between the two blocks is related by the register, which is common for the blocks, and the vectrization can be executed to apply the vector instruction, with which the maximum and minimum values are obtained.

Description

【発明の詳細な説明】 〔概 要〕 計算機における、原始プログラムからベクトル化目的プ
ログラムを生成するための、最適化処理に関し、 最大/最小値を求めるベクトル命令の適用を可能にして
、ベクトル化の対象を拡大することのできるプログラム
最適化処理方法を目的とし、計算機の原始プログラムを
解析して、該原始プログラムの配列データの添字を制御
変数とする最内ループについて生成され、複数のブロッ
クに分割された中間テキストから、ベクトル化した目的
プログラムを生成するための処理において、該配列デー
タに関する定義、参照を行う第1の該ブロックと、該第
1のブロックに続くブロックであって該配列データを再
び参照する第2のブロックを検出し、該第1及び第2の
ブロックにわたって該配列データの該定義内容を保持す
るレジスタを導入して、該配列データの参照処理を最適
化するように構成する。
[Detailed Description of the Invention] [Summary] Regarding optimization processing for generating a vectorized target program from a source program in a computer, it is possible to apply vector instructions to obtain maximum/minimum values, and to improve vectorization. Aiming at a program optimization processing method that can expand the target, a computer source program is analyzed, the innermost loop is generated with the subscript of the array data of the source program as a control variable, and it is divided into multiple blocks. In the process of generating a vectorized target program from the intermediate text, a first block that defines and references the array data, and a block following the first block that defines and references the array data. A second block to be referenced again is detected, a register is introduced to hold the definition contents of the array data across the first and second blocks, and the reference processing of the array data is optimized. .

〔産業上の利用分野〕[Industrial application field]

本発明は、計算機における、原始プログラムからベクト
ル化目的プログラムを生成するために、プログラムを最
適化する処理方法に関する。
The present invention relates to a processing method for optimizing a program in a computer in order to generate a vectorization target program from a source program.

ベクトル処理装置は、配列データに関する演算をいわゆ
るパイプライン制御方式によって連続的に処理すること
により高速化される処理装置であり、ベクトル処理装置
を利用するシステムでは、コンパイラによる原始プログ
ラムの翻訳処理において、所要の部分のプログラムをベ
クトル処理装置で実行するように、ベクトル命令で構成
した目的プログラムにするベクトル化を行う。
A vector processing device is a processing device that speeds up operations by sequentially processing operations on array data using a so-called pipeline control method. Vectorization is performed to create a target program composed of vector instructions so that a required portion of the program can be executed by a vector processing device.

〔従来の技術と発明が解決しようとする課題〕ベクトル
処理装置で処理されるべきプログラムは、例えばFOR
TRANプログラミング言語で記述された原始プログラ
ムにおいて、公知のいわゆるり。
[Prior art and problems to be solved by the invention] A program to be processed by a vector processing device is, for example, a FOR
In the source program written in the TRAN programming language, the well-known so-called ri.

ループとして示される部分であり、このループの繰り返
しを制御する制御変数であるDo変数によって識別され
るループ内の配列データを、各要素とするようにベクト
ルデータを構成することによりベクトル化を行う。又、
このようなりOループの中に更にDOループが入れ子に
なっている構成の、いわゆる多重DOループのプログラ
ムの場合には、必要な場合には最内側のループの中のみ
にプログラムのベクトルデータに関する実行文があるよ
うに多重ループを構成して、その最内ループのDO変数
によってベクトル化する。
Vectorization is performed by configuring vector data such that each element is array data in a loop identified by a Do variable, which is a control variable that controls repetition of this loop. or,
In the case of a program with a so-called multiple DO loop, in which a DO loop is further nested inside an O loop, if necessary, execution of vector data of the program is performed only in the innermost loop. Construct multiple loops so that there is a statement, and vectorize using the DO variable of the innermost loop.

原始プログラムの翻訳処理を行うコンパイラは、先ず原
始プログラムを通常のいわゆるスカシデータのプログラ
ムとして処理し、原始プログラムを解析して中間テキス
ト形式のプログラムを生成し、このプログラムについて
最適化処理等を行った後、スカシ又はベクトル化した目
的プログラムを生成する。こ\で中間テキストはプログ
ラムの構造に基づいてブロックに分けられ、ベクトル化
の処理も原則としてブロック単位に行われる。
A compiler that performs translation processing on a source program first processes the source program as a normal so-called scan data program, analyzes the source program to generate an intermediate text format program, and performs optimization processing on this program. After that, a blank or vectorized target program is generated. Here, the intermediate text is divided into blocks based on the structure of the program, and vectorization processing is also performed in principle on a block-by-block basis.

第2図はFORTRANで記述されたDOループの原始
プログラムの一°例であり、公知のように00文からラ
ベル「10」の文までをループの範囲として、D。
FIG. 2 is an example of a primitive program for a DO loop written in FORTRAN, and as is well known, the range of the loop is D.

文の制御変数として指定されている変数1の4Mを1か
らNまで1づつ増加させて、ループの範囲の実行を繰り
返す。ループの中は配列データ^(1)に「式」の結果
を代入し、判定文rlF・−・−」により、変数へM(
ループの外で初期値を設定されてJ、zるものとする)
とA (I)を比較してAMが^(1)より小さければ
、静にA(I)を代入し、小さくなければ何もしないで
次の繰り返しに進むプログラムであり、最初の実行文(
本例は代入文rA(1)=式」)で定義される値の最大
値を求めるための典型的なプログラムである。最小値を
求める場合も、判定条件が異なる他は同様の構成になる
4M of variable 1 specified as a control variable of the statement is increased by 1 from 1 to N, and execution of the loop range is repeated. Inside the loop, the result of the "expression" is assigned to the array data ^(1), and the decision statement rlF・-・-" is used to transfer the result to the variable M(
The initial value is set outside the loop)
and A(I), and if AM is smaller than ^(1), it silently assigns A(I), and if it is smaller, it does nothing and proceeds to the next iteration, and the first executable statement (
This example is a typical program for finding the maximum value of the values defined by the assignment statement rA(1)=expression. When determining the minimum value, the configuration is the same except that the determination conditions are different.

このような判定文を含むプログラムは、中間テキストの
生成において、第3図に示すように判定文による判定処
理のブロックとその判定結果によって選択される処理の
ブロックとに分割される。
In generating intermediate text, a program including such a judgment sentence is divided into a block of judgment processing based on the judgment sentence and a block of processing selected according to the judgment result, as shown in FIG.

第3図は説明のために、中間テキストの慨念的な内容と
ブロック構成を示す図であり、第3図(alのブロック
1に判定文までの処理のテキストカ生成され、このプロ
・ツクに作業用に導入されたレジスタTRIに設定した
式の結果をA(1)にセントすることにより、A(T)
を定義し、その内容を参照して所要の判定を行い、判定
結果の一方は例えば処理の無いブロック3への分岐とな
り、判定結果の他方は続くブロック2に進む。
FIG. 3 is a diagram showing the conceptual content and block structure of the intermediate text for the purpose of explanation. By placing the result of the expression set in the register TRI introduced for work in A(1), A(T)
is defined, and necessary judgments are made with reference to its contents. One of the judgment results results in a branch to block 3, which has no processing, for example, and the other judgment result proceeds to the subsequent block 2.

このブロック1は第3図中)のブロック4に示すように
、A (1)の参照をレジスタ↑R1の参照に置き換え
る最適化力に行われ、各ブロックについて可能な範囲の
ベクトル化が行われる。しかしブロックが分割されてい
るので、ブロックにまたがる処理は行われず、従って最
大値又は最小値を求めるプログラムであることを検出で
きないので、ベクトル処理装置に装備されているベクト
ルデータの最大値又は最小値を求めるベクトル命令を通
用してベクトル化することができない。
As shown in block 4 in Figure 3, this block 1 is optimized by replacing the reference to A (1) with the reference to register ↑R1, and vectorization of the possible range is performed for each block. . However, since the blocks are divided, processing that spans blocks is not performed, and therefore it is not possible to detect that the program seeks the maximum or minimum value. It is not possible to vectorize the vector by using the vector instruction to find the vector.

本発明は、前記の場合に最大値又は最小値を求めるベク
トル命令の適用を可能にして、ベクトル化の対象を拡大
す゛ることのできるプログラム最適化処理方法を目的と
する。
An object of the present invention is to provide a program optimization processing method that can expand the scope of vectorization by making it possible to apply a vector instruction for determining the maximum value or minimum value in the above-mentioned cases.

〔課題を解決するための手段〕[Means to solve the problem]

第1図は、本発明の構成を示す処理の流れ図である。 FIG. 1 is a process flowchart showing the configuration of the present invention.

図はベクトル化した目的プログラムを生成するためのコ
ンパイラ等における最内ループ内の中間テキストのベク
トル化処理前の最適化処理を示し、IQ〜12は処理ス
テップである。
The figure shows optimization processing before vectorization processing of intermediate text in the innermost loop in a compiler or the like for generating a vectorized target program, and IQ~12 is a processing step.

〔作 用〕[For production]

計算機の原始プログラムを解析して、原始プログラムの
配列データの添字を制御変数とする最内ループについて
生成され、複数のブロックに分割された中間テキストか
ら、ベクトル化した目的プログラムを生成する場合に、
コンパイラは第1図の処理ステップ10で配列データに
関する定義と、それの参照とが続いている第1のブロッ
クを検出し、そのようなブロックがある場合に処理ステ
ップ11でそのブロックに続くブロックであって同じ配
列データを再び参照する第2のブロックを検出する。
When analyzing a computer source program and generating a vectorized target program from intermediate text generated for the innermost loop with the subscript of the source program's array data as a control variable and divided into multiple blocks,
In processing step 10 of FIG. 1, the compiler detects the first block in which a definition related to array data and its reference continues, and if such a block exists, in processing step 11, the compiler detects the first block in which the definition regarding array data and its reference continues. A second block that exists and references the same array data again is detected.

前記第1、第2のブロックがあった場合には、処理ステ
ップ12で第1及び第2のブロックにわたって前記の配
列データの定義内容を保持するレジスタを導入して、配
列データの参照をそのレジスタの参照に置換する最適化
を行い、その後そのベクトル化処理に入る。
If there are the first and second blocks, a register that holds the definition of the array data across the first and second blocks is introduced in processing step 12, and the array data is referenced in that register. Optimization is performed to replace the reference with , and then the vectorization process begins.

以上の処理方法により、ブロックに共通のレジスタによ
って2ブロック間が関係付けられ、最大値又は最小値を
求めるベクトル命令を適用したベクトル化が可能になる
With the above processing method, two blocks are associated with each other by a register common to the blocks, and vectorization can be performed using a vector instruction to obtain a maximum value or a minimum value.

〔実施例〕〔Example〕

コンパイラはベクトル化のための最適化処理において、
例えば第3図(b)の中間テキストを走査して、第1図
の処理ステップ10で、最内ループの制御変数を添字変
数とするベクトル化の対象となる配列データについて、
定義とそれに続いて参照のステップのあるブロックを検
出し、もしそのようなブロックが無ければ、この処理を
終わる。
In the optimization process for vectorization, the compiler
For example, by scanning the intermediate text in FIG. 3(b), in processing step 10 in FIG. 1, the array data to be vectorized with the control variable of the innermost loop as the index variable is
Find a block with a definition followed by a reference step, and if there is no such block, terminate the process.

第3図(blのブロック4のように、定義、参照のステ
ップが続くブロックがあった場合には、処理ステップ1
1で次のブロック2を走査し、前ブロックで定義し、参
照する同じ配列データについて参照が再び行われること
を検出し、もしそのような参照が無ければ、この処理を
終わる。
Figure 3 (If there is a block that has consecutive definition and reference steps, such as block 4 in bl, processing step 1
1 scans the next block 2, detects that the same array data defined and referenced in the previous block is referenced again, and if there is no such reference, this process ends.

前記のような再参照がある場合には、処理ステップ12
で、ブロック4、ブロック2にまたがって共通に使用さ
れるレジスタ(共通レジスタとする)を導入し、第3図
(C1に例示するブロック5のように、共通レジスタN
R2によってブロック4に局部的なレジスタTRIを置
換すると共に、ブロック6のようにブロック2の配列デ
ータA(1)参照もレジスタNR2の参照に置き換えて
処理を終わる。
If there is a re-reference as described above, processing step 12
Then, a register (referred to as a common register) that is commonly used across blocks 4 and 2 is introduced, and a common register N is introduced, as in block 5 illustrated in FIG. 3 (C1).
By R2, the local register TRI is replaced in block 4, and as in block 6, the reference to the array data A(1) of block 2 is also replaced with the reference to register NR2, and the process ends.

ベクトル化処理においては、NR2によって関係付けら
れたブロック5、ブロック6を通して、ベクトル化を行
い、同じベクトルデータについて定義・参照・参照のパ
ターンがあることにより、2番目の参照における判定条
件に従って、この部分を最大値又は最小値を求めるベク
トル命令に対応させるように処理する。
In the vectorization process, vectorization is performed through blocks 5 and 6 that are related by NR2, and since there is a definition/reference/reference pattern for the same vector data, this The portion is processed to correspond to a vector instruction for finding the maximum or minimum value.

〔発明の効果〕〔Effect of the invention〕

以上の説明から明らかなように本発明によれば、計算機
における、原始プログラムからベクトル化目的プログラ
ムを生成するための、最適化処理に′おいて、最大/最
小値を求めるベクトル命令の適用を可能にして、ベクト
ル化の対象を拡大することができるので、目的プログラ
ムの実行効率等を改善するという著しい工業的効果があ
る。
As is clear from the above description, according to the present invention, it is possible to apply vector instructions to obtain maximum/minimum values in optimization processing for generating a vectorized target program from a source program in a computer. As a result, the targets of vectorization can be expanded, which has a significant industrial effect of improving the execution efficiency of the target program.

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

第1図は本発明の構成を示す処理の流れ図、第2図は原
始プログラム例を示す図、 第3図は中間テキストの説明図 である。 図において、 1〜6はブロック、  10〜12は処理ステップを示
す。 ・に ・代理人 弁理士  井桁 貞−1( 本発明の構成を示す処理の流れ図 第 図 CONTI NUE 原始プログラム例を示す図 第 図 中間テキストの説明図 第 図
FIG. 1 is a process flowchart showing the configuration of the present invention, FIG. 2 is a diagram showing an example of a source program, and FIG. 3 is an explanatory diagram of intermediate text. In the figure, 1 to 6 indicate blocks, and 10 to 12 indicate processing steps.・Representative Patent Attorney Sada Igeta-1 (Processing flowchart showing the configuration of the present invention.

Claims (1)

【特許請求の範囲】 計算機の原始プログラムを解析して、該原始プログラム
の配列データの添字を制御変数とする最内ループについ
て生成され、複数のブロックに分割された中間テキスト
から、ベクトル化した目的プログラムを生成するための
処理において、該配列データに関する定義、参照を行う
第1の該ブロックと(10)、該第1のブロックに続く
ブロックであって該配列データを再び参照する第2のブ
ロックを検出し(11)、 該第1及び第2のブロックにわたって該配列データの該
定義内容を保持するレジスタを導入して、該配列データ
の参照処理を最適化する(12)ように構成されている
ことを特徴とするプログラム最適化処理方法。
[Scope of Claims] An object that is vectorized from intermediate text that is generated by analyzing a computer source program and is divided into a plurality of blocks for the innermost loop in which the subscripts of the array data of the source program are used as control variables. In the process for generating a program, a first block that defines and references the array data; and a second block that follows the first block and that references the array data again. (11), and introduces a register that holds the defined contents of the array data across the first and second blocks to optimize reference processing of the array data (12). A program optimization processing method characterized by:
JP63200741A 1988-08-11 1988-08-11 Program optimization processing method Expired - Fee Related JP2564904B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63200741A JP2564904B2 (en) 1988-08-11 1988-08-11 Program optimization processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63200741A JP2564904B2 (en) 1988-08-11 1988-08-11 Program optimization processing method

Publications (2)

Publication Number Publication Date
JPH0250257A true JPH0250257A (en) 1990-02-20
JP2564904B2 JP2564904B2 (en) 1996-12-18

Family

ID=16429398

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63200741A Expired - Fee Related JP2564904B2 (en) 1988-08-11 1988-08-11 Program optimization processing method

Country Status (1)

Country Link
JP (1) JP2564904B2 (en)

Also Published As

Publication number Publication date
JP2564904B2 (en) 1996-12-18

Similar Documents

Publication Publication Date Title
JPH06103463B2 (en) Code generation method
US5522074A (en) Vectorization system for vectorizing loop containing condition induction variables
JPH0250257A (en) Program optimizing processing method
JPH0764766A (en) Maximum and minimum value calculating method for parallel computer
JP2748582B2 (en) Compile processing unit
JPH0235349B2 (en) RUUPUNAIHAIRETSUSHORIBEKUTORUKASHORIHOSHIKI
JP2539070B2 (en) Compiler processor
JPH0527986A (en) Method and device for optimizing compiler
JPH0659905A (en) Parallel processing system for compiler
JPS6297031A (en) Matching system for bit number of mantissa part
JPH0256065A (en) Multiple loop optimization processing method
JPH056227B2 (en)
JPH03110670A (en) Vector computer
JPH0713962A (en) Compiler device
JPH08263298A (en) Compiler
JPH0594470A (en) Vectrization system
JPH08171554A (en) Optimizing compiler for vector operation
JPH0417031A (en) System for optimizing propagation of constant value
JPS63155265A (en) Optimization processing system for vector arithmetic
JPS62187940A (en) Loop processing control system
JPH0831091B2 (en) Compile processing method
JPS61216085A (en) Vector processing program producing system
JPH0573607A (en) Vector instruction generation processing method
JP2005293080A (en) Information processor, method for processing program, and compiling program
JPH04308936A (en) Text optimizing system

Legal Events

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