JPH0251739A - Loop structure compiling system - Google Patents

Loop structure compiling system

Info

Publication number
JPH0251739A
JPH0251739A JP20286888A JP20286888A JPH0251739A JP H0251739 A JPH0251739 A JP H0251739A JP 20286888 A JP20286888 A JP 20286888A JP 20286888 A JP20286888 A JP 20286888A JP H0251739 A JPH0251739 A JP H0251739A
Authority
JP
Japan
Prior art keywords
common block
loop structure
loop
object program
program
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
JP20286888A
Other languages
Japanese (ja)
Inventor
Midori Fujimaki
藤巻 緑
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 Corp
Original Assignee
NEC Corp
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 Corp filed Critical NEC Corp
Priority to JP20286888A priority Critical patent/JPH0251739A/en
Publication of JPH0251739A publication Critical patent/JPH0251739A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To reduce an object program to be produced and to shorten the executing time required for a compiling job by unifying and simplifying the loop structure including the definition of the continuous common block areas. CONSTITUTION:When a source program 1 is inputted, a compiler 2 analyzes the elements included in the common block areas via a common block analyzing means 21 and produces a common block information table 21a. A loop structure detecting/analyzing means 22 detects a loop structure out of the program 1 and checks based on the information registered in the table 21a whether the common block area continuous to the loop structure is defined or not. Then an object program generating means 23 extracts the elements defined in the continuous common block areas to all loop structure decided by the means 22. Then the loop length is decided based on the size of each element and the loop structure is unified.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は共通ブロック領域の定義を含むループ構造を有
したソースプログラムから処理上最適なオブジェクトプ
ログラムを生成し出力するループ構造のコンパイル方式
に関するものである。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a loop structure compilation method for generating and outputting an optimal object program for processing from a source program having a loop structure including the definition of a common block area. It is.

〔従来の技術〕[Conventional technology]

第5図は共通ブロック領域の定義を含むループ構造を有
したソースプログラムの例を示したものである。すなわ
ち、CoMMoN文により共通ブロック名Xの中に配列
A (100) 、 B (100)をとるように宣言
し、続<00文で配列A (100)の要素A (1)
に対する値の設定、すなわち定義を行い、続<00文で
配列B (100)の要素B(I)に対する定義を行っ
ている。
FIG. 5 shows an example of a source program having a loop structure including the definition of a common block area. In other words, use the CoMMoN statement to declare arrays A (100) and B (100) in the common block name
Then, in the continuation <00 statement, element B(I) of array B (100) is defined.

しかして、従来、第5図に示されるような、共通ブロッ
ク領域の定義を含むループ構造を有したソースプログラ
ムが与えられた場合、コンパイラはループ構造中に含ま
れる要素が共通ブロックに属しているか否かのItsは
行わず、そのため、共通ブロンク領域の定義を含むルー
プ構造であっても通常のループ構造と同様な処理を行い
、ループ構造に忠実なオブジェクトプログラムを生成し
出力していた。第6図は第5図のソースプログラムに対
するオブジェクトプログラムの構造をフローチャートで
示したものであり、配列A (100)の要素に対して
定義を行うループR1と配列B (100)の要素に対
して定義を行うループR2とをそのまま有している。
Conventionally, when a source program is given that has a loop structure including the definition of a common block area, as shown in FIG. Its judgment is not performed, and therefore, even for a loop structure including the definition of a common bronc area, the same processing as for a normal loop structure is performed, and an object program faithful to the loop structure is generated and output. Figure 6 is a flowchart showing the structure of the object program for the source program in Figure 5, with loop R1 defining elements of array A (100) and elements of array B (100). It has the loop R2 that performs the definition as it is.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

上述したように、従来のコンパイラにあっては、共通ブ
ロック領域の定義を含むループ構造に対しても、通常の
ループ構造と特に区別することなく、ループ構造に忠実
なオブジェクトプログラムを生成していたため、共通ブ
ロック領域の定義を含むループ構造がソースプログラム
中に多数存在すればするほどオブジェクトプログラムが
大きくなり、オブジェクトプログラムを格納するメモリ
を多く必要とすると共に、オブジェクトプログラムの生
成および出力に要する実行時間も増加するという欠点が
あった。
As mentioned above, conventional compilers generate object programs that are faithful to loop structures even for loop structures that include the definition of a common block area, without distinguishing them from normal loop structures. The more loop structures that include common block area definitions exist in a source program, the larger the object program becomes, requiring more memory to store the object program, and the execution time required to generate and output the object program. The disadvantage was that it also increased.

本発明は上記の点に鑑み提案されたものであり、その目
的とするところは、共通ブロック領域の定義を含むルー
プ構造を有するソースプログラムに対して簡略化したオ
ブジェクトプログラムを出力して、メモリ量の削減およ
び処理実行時間の短縮を図ることのできるループ構造の
コンパイル方式を提供することにある。
The present invention has been proposed in view of the above points, and its purpose is to output a simplified object program for a source program having a loop structure including the definition of a common block area, thereby reducing the amount of memory. An object of the present invention is to provide a method for compiling a loop structure, which can reduce the amount of time required for processing and the processing execution time.

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

本発明は上記の目的を達成するため、ソースプログラム
を入力しオブジェクトプログラムを生成し出力するコン
パイル方式において、 入力したソースプログラム中の共通ブロック領域にかか
るデータ処理の際に共通ブロック名、並び番号、共通ブ
ロック割り付け位置等を解析し、共通ブロック情報テー
ブルを生成する共通ブロック解析手段と、 前記共通ブロック情報テーブルに登録された情報を基に
連続した共通ブロック領域の定義を含むループ構造を検
出するループ構造検出解析手段と、連続した共通ブロッ
ク領域の定義を含むループ構造が検出された場合にルー
プ構造を単一ループ化し、共通ブロック領域の定義を連
続処理するオブジェクトプログラムを生成し出力するオ
ブジェクトプログラム生成手段とを備えるようにしてい
る。
In order to achieve the above object, the present invention uses a compilation method that inputs a source program, generates and outputs an object program, and when processing data related to the common block area in the input source program, the common block name, sequence number, a common block analysis means that analyzes common block allocation positions, etc. and generates a common block information table; and a loop that detects a loop structure including definitions of continuous common block areas based on information registered in the common block information table. Structure detection analysis means and object program generation that converts the loop structure into a single loop when a loop structure including continuous common block area definitions is detected, and generates and outputs an object program that continuously processes common block area definitions. I try to have the means.

〔作用] 本発明のループ構造のコンパイル方式にあっては、共通
ブロック解析手段が入力したソースプログラム中の共通
ブロックにかかるデータ処理の際に共通ブロック名、並
び番号、共通ブロック割り付け位置等を解析して共通ブ
ロック情報テーブルを生成し、ループ構造検出解析手段
が前記共通ブロック情報テーブルに登録された情報を基
に連続した共通ブロック領域の定義を含むループ構造を
検出し、連続した共通ブロック領域の定義を含むループ
構造が検出された場合にオブジェクトプログラム生成手
段がループ構造を単一ループ化して共通ブロック領域の
定義を連続処理するオブジェクトプログラムを出力する
[Operation] In the loop structure compilation method of the present invention, the common block analysis means analyzes common block names, sequence numbers, common block allocation positions, etc. when processing data related to common blocks in the input source program. A common block information table is generated, and a loop structure detection and analysis means detects a loop structure including definitions of continuous common block areas based on the information registered in the common block information table. When a loop structure including a definition is detected, the object program generation means converts the loop structure into a single loop and outputs an object program that continuously processes definitions of the common block area.

〔実施例〕〔Example〕

以下、本発明の実施例につき図面を参照して説明する。 Embodiments of the present invention will be described below with reference to the drawings.

第1図は本発明のループ構造のコンパイル方式の一実施
例であるコンパイラの構成図である。第1図において、
コンパイラ2はソースプログラム1を入力し、オブジェ
クトプログラム3を出力する機能を有している。コンパ
イラ2の内部は本発明に関係する部分のみを示してあり
、共通ブロック解析手段21とループ構造検出解析手段
22とオブジェクトプログラム生成手段23とを含んで
いる。なお、各部の機能は次のようになっている。
FIG. 1 is a block diagram of a compiler which is an embodiment of the loop structure compilation method of the present invention. In Figure 1,
The compiler 2 has a function of inputting a source program 1 and outputting an object program 3. Only the parts related to the present invention are shown inside the compiler 2, which includes a common block analysis means 21, a loop structure detection and analysis means 22, and an object program generation means 23. The functions of each part are as follows.

共通ブロック解析手段21;入力したソースプログラム
1中の共通ブロック領域にかかるデータ処理の際に共通
ブロック名、並び番号、共通ブロック割り付け位置等を
解析し、第2図に示すような共通ブロック情報テーブル
21aを生成する機能。
Common block analysis means 21: Analyzes common block names, sequence numbers, common block allocation positions, etc. when processing data related to the common block area in the input source program 1, and creates a common block information table as shown in FIG. Function to generate 21a.

ループ構造検出解析手段22;共通ブロック情報テーブ
ル21aに登録された情報を基に連続した共通ブロック
領域の定義を含むループ構造を検出する機能。
Loop structure detection and analysis means 22: A function to detect a loop structure including definitions of continuous common block areas based on information registered in the common block information table 21a.

オブジェクトプログラム生成手段23;ループ構造検出
解析手段22によって連続した共通ブロック領域の定義
を含むループ構造が検出された場合にループ構造を単一
ループ化し、共通ブロック領域の定義を連続処理するオ
ブジェクトプログラム3を出力する機能。
Object program generation means 23; object program 3 that converts the loop structure into a single loop when the loop structure detection and analysis means 22 detects a loop structure including definitions of continuous common block areas, and continuously processes the definitions of the common block areas. A function to output.

次に、上記の実施例につき具体例を用いて動作を説明す
る。
Next, the operation of the above embodiment will be explained using a specific example.

ソースプログラム1として、従来例の説明で使用した第
5図のソースプログラムが入力されたとすると、コンパ
イラ2は、共通ブロック解析手段21において、共通ブ
ロック領域にかかるデータ処理の際に1つの共通ブロッ
ク領域に含まれる各要素、すなわち配列要素A(1) 
、 B(1)に対し、共通ブロック名、並び番号、共通
ブロック割り付け位置1割り付けサイズを解析し、第2
図の如く共通ブロック名へのポインタ、並び番号、共通
ブロック割り付け位置2割り付けサイズから構成される
共通ブロック情報テーブル2.1 aを生成する。
Assuming that the source program shown in FIG. 5 used in the explanation of the conventional example is input as the source program 1, the compiler 2 uses one common block area when processing data related to the common block area in the common block analysis means 21. Each element contained in , that is, array element A(1)
, For B(1), analyze the common block name, sequence number, common block allocation position 1 allocation size, and
As shown in the figure, a common block information table 2.1a consisting of a pointer to a common block name, a sequence number, a common block allocation position 2 and an allocation size is generated.

次いで、ループ構造検出解析手段22において、ソース
プログラム1中からループ構造を検出し、検出されたル
ープ構造に連続した共通ブロック領域の定義があるか否
かを共通ブロック解析手段21で生成された共通ブロッ
ク情報テーブル21aの登録情報を基に解析する。第5
図のソースプログラムの場合は、rDo  IOJによ
るループおよびrDo  20Jによるループとも、1
つの共通ブロック領域(共通ブロック名X)の定義を含
むループ構造と判定される。
Next, the loop structure detection and analysis means 22 detects a loop structure in the source program 1, and determines whether or not the detected loop structure has a definition of a continuous common block area. The analysis is performed based on the registered information in the block information table 21a. Fifth
In the case of the source program shown in the figure, both the loop by rDo IOJ and the loop by rDo 20J are 1
It is determined that the loop structure includes the definition of two common block areas (common block name X).

次いで、オブジェクトプログラム生成手段23において
、ループ構造検出解析手段22で判定した連続する共通
ブロック領域の定義を含むループ構造の全てに対して、
連続した共通ブロック領域において定義されている要素
を抽出し、それぞれの要素のサイズを基にループ長(個
々のサイズの総和)を決定し、ループ構造を単一化する
。ここで、第3図はループ構造の単一化を概念的に示す
ために第5図のソースプログラムと同様にFORTRA
N言語で表現したものであり、DIMENSION文に
より連続した共通ブロック領域のルブ長に対応する配列
X A (200)を確保し、EQU I VALEN
CE文で配列A (100)と配列XA(200)との
対応をとり(要素の1つについて対応をとれば他の連続
する要素についても対応がとられる。、)、00文でル
ープ長に相当する回数だけXA(1)=O,Oなる定義
を繰り返すものである。
Next, in the object program generation means 23, for all the loop structures including the definition of continuous common block areas determined by the loop structure detection and analysis means 22,
Elements defined in a continuous common block area are extracted, a loop length (sum of individual sizes) is determined based on the size of each element, and the loop structure is unified. Here, in order to conceptually show the unification of the loop structure, FIG. 3 uses FORTRA similar to the source program in FIG.
It is expressed in the N language, and an array X A (200) corresponding to the rub length of the continuous common block area is secured using the DIMENSION statement, and the EQU I VALEN
The CE statement makes a correspondence between the array A (100) and the array XA (200) (if a correspondence is established for one element, correspondence is established for the other consecutive elements as well.), and the 00 statement corresponds to the loop length. The definition that XA(1)=O, O is repeated a corresponding number of times.

そして、オブジェクトプログラム生成手段23は第3図
の如き単一ループ化した中間状態のプログラムからオブ
ジェクトプログラム3を生成し、出力する。なお、第4
図は上記の例によるオブジェクトプログラム3の構造を
示したフローチャートであり、単一のループRにより構
成され、連続した共通ブロック領域の定義を含むループ
構造の最適化が行われる。
Then, the object program generating means 23 generates an object program 3 from the intermediate state program formed into a single loop as shown in FIG. 3, and outputs it. In addition, the fourth
The figure is a flowchart showing the structure of the object program 3 according to the above example, which is composed of a single loop R, and the loop structure including the definition of a continuous common block area is optimized.

〔発明の効果) 以上説明したように、本発明のループ構造のコンパイル
方式にあっては、連続した共通ブロック領域の定義を含
むループ構造の単一化を可能とし、簡略化することがで
きるため、生成するオブジェクトプログラムが小さくな
り、オブジェクトプログラムを格納するメモリを少なく
できると共に、コンパイルに要する実行時間を短縮する
ことができる効果がある。
[Effects of the Invention] As explained above, in the loop structure compilation method of the present invention, the loop structure including the definition of a continuous common block area can be unified and simplified. , the generated object program becomes smaller, the memory for storing the object program can be reduced, and the execution time required for compilation can be shortened.

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

第1図は本発明のループ構造のコンパイル方式の一実施
例であるコンパイラの構成図、第2図は第1図の共通ブ
ロック解析手段で生成される共通ブロック情報テーブル
の論理的構成図、第3図は第1図のオブジェクトプログ
ラム生成手段におけるループ構造の単一ループ化の概念
図、第4図はオブジェクトプログラムの構造図、第5図
はソースプログラムの例を示す図および、第6図は従来
例によるオブジェクトプログラムの構造図である。 図において、1・・・ソースプログラム、2・・・コン
パイラ、21・・・共通ブロック解析手段、21a・・
・共通ブロック情報テーブル、22・・・ループ構造検
出解析手段、23・・・オブジェクトプログラム生成手
段、3・・・オブジェクトプログラム、R・・・ループ
1 is a block diagram of a compiler which is an embodiment of the loop structure compilation method of the present invention; FIG. 2 is a logical block diagram of a common block information table generated by the common block analysis means of FIG. 1; 3 is a conceptual diagram of the loop structure converted into a single loop in the object program generation means of FIG. 1, FIG. 4 is a structural diagram of the object program, FIG. 5 is a diagram showing an example of a source program, and FIG. FIG. 2 is a structural diagram of an object program according to a conventional example. In the figure, 1... source program, 2... compiler, 21... common block analysis means, 21a...
- Common block information table, 22... Loop structure detection and analysis means, 23... Object program generation means, 3... Object program, R... Loop.

Claims (1)

【特許請求の範囲】 ソースプログラムを入力しオブジェクトプログラムを生
成し出力するコンパイル方式において、入力したソース
プログラム中の共通ブロック領域にかかるデータ処理の
際に共通ブロック名、並び番号、共通ブロック割り付け
位置等を解析し、共通ブロック情報テーブルを生成する
共通ブロック解析手段と、 前記共通ブロック情報テーブルに登録された情報を基に
連続した共通ブロック領域の定義を含むループ構造を検
出するループ構造検出解析手段と、連続した共通ブロッ
ク領域の定義を含むループ構造が検出された場合にルー
プ構造を単一ループ化し、共通ブロック領域の定義を連
続処理するオブジェクトプログラムを生成し出力するオ
ブジェクトプログラム生成手段とを備えたことを特徴と
するループ構造のコンパイル方式。
[Claims] In a compilation method that inputs a source program and generates and outputs an object program, common block names, sequence numbers, common block allocation positions, etc. are processed when processing data related to common block areas in the input source program. a common block analysis means for analyzing a common block information table and generating a common block information table; and a loop structure detection analysis means for detecting a loop structure including a definition of a continuous common block area based on the information registered in the common block information table. , object program generation means for converting the loop structure into a single loop when a loop structure including continuous common block area definitions is detected, and generating and outputting an object program for sequentially processing the common block area definitions. A compilation method for loop structures characterized by:
JP20286888A 1988-08-15 1988-08-15 Loop structure compiling system Pending JPH0251739A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP20286888A JPH0251739A (en) 1988-08-15 1988-08-15 Loop structure compiling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20286888A JPH0251739A (en) 1988-08-15 1988-08-15 Loop structure compiling system

Publications (1)

Publication Number Publication Date
JPH0251739A true JPH0251739A (en) 1990-02-21

Family

ID=16464527

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20286888A Pending JPH0251739A (en) 1988-08-15 1988-08-15 Loop structure compiling system

Country Status (1)

Country Link
JP (1) JPH0251739A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5606698A (en) * 1993-04-26 1997-02-25 Cadence Design Systems, Inc. Method for deriving optimal code schedule sequences from synchronous dataflow graphs

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5606698A (en) * 1993-04-26 1997-02-25 Cadence Design Systems, Inc. Method for deriving optimal code schedule sequences from synchronous dataflow graphs

Similar Documents

Publication Publication Date Title
JPH0251739A (en) Loop structure compiling system
DONGEN Compiling distributed loops onto SPMD code
JP3367438B2 (en) Conditional execution processing device
JPH036622A (en) Compile list output device
JPS62274433A (en) Partial compiling system for relational data base control system
JPS63120367A (en) Program transformation device
Collins et al. Supporting Formal Reasoning about Standard ML
JPH0421030A (en) Detection object generating system for reference of outside of declaration range of array
JP2564904B2 (en) Program optimization processing method
JPH0239241A (en) Compiler
JPH04182833A (en) Cross reference list output system
JPH0612259A (en) Compiler processing system
JPH0580998A (en) Translation processing system
JPH02165339A (en) Compile device
JPH0425942A (en) Optimizing processing system for loop
JPH07192034A (en) Interpreter type simulation method
JPH027130A (en) Line number range designating compile system for high rank language source program
JPH04148337A (en) Compile processing system
JPH02105224A (en) Data allocation system in compiler
JPS62271024A (en) Optimization processing system
JPH0831091B2 (en) Compile processing method
JPH05324344A (en) Argument processing optimization method at the time of calling function
JPH023830A (en) Selection system for precision/performance on mathematics built-in function execution time
JPH04135250A (en) File damp system
JPH03260836A (en) Pointer optimization processing method