JPH06274351A - Optimizing system for compiler - Google Patents

Optimizing system for compiler

Info

Publication number
JPH06274351A
JPH06274351A JP5811493A JP5811493A JPH06274351A JP H06274351 A JPH06274351 A JP H06274351A JP 5811493 A JP5811493 A JP 5811493A JP 5811493 A JP5811493 A JP 5811493A JP H06274351 A JPH06274351 A JP H06274351A
Authority
JP
Japan
Prior art keywords
array
value
information table
translation
subscript
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.)
Withdrawn
Application number
JP5811493A
Other languages
Japanese (ja)
Inventor
Katsumi Yamamoto
克己 山本
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 JP5811493A priority Critical patent/JPH06274351A/en
Publication of JPH06274351A publication Critical patent/JPH06274351A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To generate an efficient target program when an array where the values of respective elements are judged to be known at the time of translation is monadic-operated in a source program at a compiler. CONSTITUTION:The compiler 10 is provided with a means 131 generating an array value information table 555 holding the known value of the array as against the monadic operation of the array where the values of respective elements in the middle of execution in the translated source program is known at the time of translation and a means 132 preparing the array value information table 555 of the work array having the same size as an operation object. Furthermore, a means 133 obtaining the value of the execution result of the monadic operation and storing it in the array value information table 555 of the work array, and a means 134 changing an intermediate code in such a way that it becomes a target program for referring to the work array where the value of the execution result of the monadic operation of the array is stored instead of the monadic operation of the array.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はコンパイラの最適化方
式、特に単項演算,二項演算,および配列添字を有する
高級言語で記述された原始プログラムを入力して、目的
プログラムを生成するコンパイラの最適化方式に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an optimization method of a compiler, and more particularly, to the optimization of a compiler for inputting a source program written in a high-level language having unary operation, binary operation, and array subscript to generate an object program. Regarding the conversion method.

【0002】[0002]

【従来の技術】従来、コンパイラは、原始プログラム中
にその文の実行時の値が翻訳時に分かっていると判断さ
れたスカラ変数の単項演算またはスカラ変数同士の二項
演算に対しては、翻訳時にその単項演算または二項演算
を計算し、その計算結果を参照する目的プログラムを生
成している。しかし、原始プログラム中に、配列の各要
素の値が翻訳に分かっていると判断された配列の単項演
算または配列同士および配列と定数との二項演算があっ
た場合には各配列要素の値を取出して演算をしていく目
的プログラムを生成している。また、実行中の添字が配
列の配列参照をする場合において、添字として使用され
ている配列の値が翻訳時に分かっており、かつ、その配
列の添字により参照される配列の値も翻訳時に分かって
いても、配列の添字を介して配列値を取出す命令列を生
成した目的プログラムを生成している。
2. Description of the Related Art Conventionally, a compiler translates a unary operation of a scalar variable or a binary operation between scalar variables whose execution-time value is known to be known at the time of translation in a source program. Occasionally, the unary operation or the binary operation is calculated, and an object program that refers to the calculation result is generated. However, in the source program, if there is a unary operation on the array for which the value of each element of the array is known to be translated, or a binary operation between the arrays and between the array and a constant, the value of each array element A target program is created that takes out and performs calculations. In addition, when the subscript under execution refers to an array of an array, the value of the array used as the subscript is known at the time of translation, and the value of the array referenced by the subscript of the array is also known at the time of translation. Even so, the target program that generates the instruction sequence for fetching the array value via the array subscript is generated.

【0003】[0003]

【発明が解決しようとする課題】上述した従来のコンパ
イラは、翻訳時に配列の各要素の値が分かっていると判
断された配列の単項演算、または配列同士あるいは配列
と定数との二項演算においても、各配列要素の値を取出
して単項演算、または二項演算を行ない、また翻訳時に
添字として使用されている配列の値が分かっており、か
つ、その配列の添字により参照される配列の値も分かっ
ている場合にも、配列の添字を介して配列値を取出す目
的プログラムを生成しているので、目的プログラムの実
行において、単項演算,二項演算,および配列の参照に
長い時間を要するという問題点がある。
SUMMARY OF THE INVENTION The conventional compiler described above is used for unary operation of arrays in which it is determined that the value of each element of the array is known during translation, or for binary operation of arrays or between arrays and constants. Also, the value of each array element is extracted, the unary operation or binary operation is performed, and the value of the array used as a subscript at the time of translation is known, and the value of the array referred to by the subscript of the array. Even if it is known, since it generates an object program that retrieves array values via array subscripts, it takes a long time to execute unary operations, binary operations, and array references when executing the object program. There is a problem.

【0004】[0004]

【課題を解決するための手段】本発明のコンパイラの最
適化方式は、原始プログラムを入力して目的プログラム
に翻訳するコンパイラにおいて、翻訳している原始プロ
グラムの中の実行中の配列の各要素の値が翻訳時に分か
っているか否かを判断して、分かっているならその配列
要素の値は分かっているという情報とその配列要素の値
とを翻訳時に用意した配列値情報テーブルに保持し、分
かっていないならその配列要素の値は分かっていないと
いう情報を配列値情報テーブルに保持する配列値保持手
段と、翻訳している原始プログラム中の実行中の配列の
単項演算に対して、演算対象の配列要素の値が翻訳時に
分かっているなら、演算対象の配列と同じ大きさの作業
用配列の配列値情報テーブルを準備する作業用配列準備
手段と、配列の各要素の値が翻訳時に分かっていると判
断された配列の単項演算に対して、前記配列値保持手段
によって配列値情報テーブル中に保持された配列の値を
用いて演算を実行し、前記作業用配列準備手段で準備さ
れた作業用配列の配列値情報テーブルにその配列要素の
値は分かっているという情報とその配列要素の値として
の演算結果の値とを保持しておく配列演算手段と、配列
の各要素の値が翻訳時に分かっていると判断された配列
の単項演算の代りに前記配列演算手段で配列演算の演算
結果の値を格納した作業用配列の配列値情報テーブルの
値を参照する目的プログラムとなるように中間コードを
変更する中間コード変更手段とを有することにより構成
され、また以上の構成において、作業用配列準備手段
が、翻訳している原始プログラム中の実行中の配列同士
あるいは配列と定数との二項演算に対して、演算対象の
配列要素の値が前記配列値保持手段によって分かってい
るとされたならば、演算対象の配列と同じ大きさの作業
用配列の配列値情報テーブルを準備する作業用配列準備
手段であり、配列演算実行手段が、配列の各要素が翻訳
時に分かっていると判断された配列同士あるいは配列と
定数との二項演算に対して、前記配列値保持手段によっ
て配列値情報テーブル中に保持された配列の値を用いて
演算を実行し、前記作業用配列準備手段で準備された作
業用配列の配列値情報テーブルにその配列要素の値は分
かっているという情報とその配列要素の値としての演算
結果の値とを保持しておく配列演算手段であり、中間コ
ード変更手段が、配列の各要素の値が翻訳時に分かって
いると判断された配列同士あるいは配列と定数との二項
演算の代わりに前記配列演算手段で配列演算の演算結果
値が格納された作業用配列の配列値情報テーブルの値を
参照する目的プログラムとなるように中間コードを変更
する中間コード変更手段であることにより構成され、さ
らにまた前記構成において、作業用配列準備手段が、翻
訳している原始プログラム中の実行中の配列添字の配列
値の参照に対して、添字として使用されている配列の値
が翻訳時に分かっており、かつ、その配列の添字により
参照される配列の値も翻訳時に分かっているならば、参
照される配列と同じ大きさの作業用配列の配列値情報テ
ーブルを準備する作業用配列準備手段であり、配列演算
実行手段の代りに、配列添字の配列値の参照において、
添字として使用されている配列の値が翻訳時に分かって
おり、かつ、その配列の値も翻訳時に分かっている場合
の参照される配列に対して、前記配列値保持手段により
配列値情報テーブル中に保持された添字として使用され
ている配列の値を用いて配列の参照を行なった結果の値
を、前記作業用配列準備手段で準備した作業用配列の配
列値情報テーブルにその配列要素の値は分かっていると
いう情報と共に保持しておく配列添字配列値取出し手段
であり、中間コード変更手段が、配列添字の配列値の参
照において、添字として使用される配列の値が翻訳時に
分かっており、かつ、その配列の添字により参照される
配列の値も分かっている場合に参照される配列に対し
て、配列の添字を介して配列を参照せず、前記配列添字
配列値取出し手段で取出された配列添字の配列値が格納
された作業用配列の配列値情報テーブルの値を参照する
目的プログラムとなるように中間コードを変更する中間
コード変更手段であることにより構成される。
The compiler optimization method of the present invention is a compiler for inputting a source program and translating it into a target program, in which each element of the array being executed in the source program being translated is Judge whether the value is known at the time of translation, and if it is known, hold the information that the value of that array element is known and the value of that array element in the array value information table prepared at the time of translation, If not, the array value holding means that holds the information that the value of the array element is unknown in the array value information table and the unary operation of the array being executed in the source program being translated If the array element values are known at the time of translation, work array preparation means for preparing an array value information table of a work array of the same size as the operation target array, and each array For the unary operation of the array whose prime value is determined to be known at the time of translation, the operation is performed using the array value held in the array value information table by the array value holding unit, and Array operation means for holding the information that the value of the array element is known in the array value information table of the work array prepared by the array preparation means and the value of the operation result as the value of the array element, Refer to the value of the array value information table of the working array that stores the value of the operation result of the array operation by the array operation means instead of the unary operation of the array that the value of each element of the array is determined to be known at the time of translation And an intermediate code changing means for changing the intermediate code so as to become a target program. For the binary operation between arrays in a row or between an array and a constant, if the value of the array element of the operation target is known by the array value holding means, the array of the same size as the operation target array It is a working array preparing means for preparing an array value information table of a working array, and the array operation executing means performs a binary operation between arrays or arrays and constants judged to have each element of the array known at the time of translation. , The array value holding means performs an operation using the values of the array held in the array value information table, and the array value information table of the working array prepared by the working array preparing means It is an array operation means that holds the information that the value of the array element is known and the value of the operation result as the value of the array element, and the intermediate code changing means knows the value of each element of the array at the time of translation. The And a target program for referencing the value of the array value information table of the working array in which the operation result value of the array operation is stored by the array operation means instead of the binary operation of the arrays or the array and the constants. In this configuration, the working array preparation means refers to the array value of the array subscript being executed in the source program being translated. , If the value of the array used as a subscript is known at translation time, and the value of the array referenced by the subscript of that array is known at the time of translation, it has the same size as the referenced array. Is a work array preparation means for preparing the array value information table of the work array of, and instead of the array operation execution means, in the reference of the array value of the array subscript,
For the referenced array when the value of the array used as a subscript is known at the time of translation, and the value of that array is also known at the time of translation, in the array value information table by the array value holding means. The value of the result of the array reference using the value of the array used as the retained subscript, the value of the array element in the array value information table of the working array prepared by the working array preparing means is An array subscript array value fetching unit that holds together with the information that is known, and the intermediate code changing unit, in referring to the array subscript of the array subscript, knows the value of the array used as the subscript at the time of translation, and , If the value of the array referred to by the subscript of that array is also known, the array subscript array value retrieval means does not refer to the array via the subscript of the array It constituted by an intermediate code changing means for changing the intermediate code so that the object program sequence value of the issued array subscript refers to the value of array value information table work array stored.

【0005】[0005]

【実施例】次に、本発明について図面を参照して説明す
る。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be described with reference to the drawings.

【0006】図1は本発明の第1の実施例の構成図で、
原始プログラム中に単項演算を含む場合を示している。
図1の実施例ではコンパイラ10は、構文解析手段1
1,意味解析手段12,最適化手段13,およびコード
生成手段14を含む。また、最適化手段13は、配列値
保持手段131,作業用配列準備手段132,配列演算
実行手段133,および中間コード変更手段134を含
んで構成される。
FIG. 1 is a block diagram of the first embodiment of the present invention.
The case where the unary operation is included in the source program is shown.
In the embodiment shown in FIG. 1, the compiler 10 uses the syntax analysis means 1
1, a semantic analysis unit 12, an optimization unit 13, and a code generation unit 14 are included. Further, the optimizing unit 13 is configured to include an array value holding unit 131, a work array preparing unit 132, an array operation executing unit 133, and an intermediate code changing unit 134.

【0007】構文解析手段11は、原始プログラム11
1を入力し、その構文解析を行い、構文解析情報222
を生成する。意味解析手段12は、構文解析手段11で
生成された構文解析情報222を入力し、その意味を解
析し、中間コード333を生成する。最適化手段13
は、意味解析手段12で生成された中間コード333を
入力し、最適化された中間コード333を生成する。コ
ード生成手段14は、中間コード333を入力し、目的
プログラム444を生成する。
The syntax analysis means 11 is a source program 11
1 is input, the syntactic analysis is performed, and the syntactic analysis information 222
To generate. The semantic analysis unit 12 inputs the syntax analysis information 222 generated by the syntax analysis unit 11, analyzes the meaning thereof, and generates an intermediate code 333. Optimizing means 13
Inputs the intermediate code 333 generated by the semantic analysis means 12 and generates an optimized intermediate code 333. The code generation means 14 inputs the intermediate code 333 and generates the object program 444.

【0008】配列値保持手段131は、構文解析情報2
22および中間コード333を解析し、原始プログラム
111の実行中の配列の各要素の値が翻訳時に分かって
いるか否かを判断し、分かっているなら、その配列要素
の値は分かっているという情報と、その配列要素の値と
を翻訳時に用意した配列値情報テーブル555に保持
し、分かっていないなら、その配列要素の値は分かって
いないという情報を配列値情報テーブル555に保す
る。作業用配列準備手段132は、構文解析情報222
および中間コード333を解析し、原始プログラム11
1の実行中の配列の単項演算に対して、演算対象の全て
の配列要素の値が翻訳時に分かっているなら、演算対象
の配列と同じ大きさの作業用配列の配列値情報テーブル
555を準備する。また、配列演算実行手段133は、
原始プログラム111の実行中の配列の各要素の値が翻
訳時に分かっていると判断された配列の単項演算に対し
て、配列値情報テーブル555中に保持された配列の値
を用いて、翻訳時に単項演算を計算し、その単項演算の
計算結果を得て、作業用配列準備手段132で準備され
た作業用配列の配列値情報テーブル555中に、その配
列要素の値は分かっているという情報と、その配列要素
の値としての計算結果の値とを保持する。中間コード変
更手段134は、原始プログラム111の実行中の配列
の各要素の値が翻訳時に分かっていると判断された配列
の単項演算の代わりに、配列演算実行手段133で計算
された配列の値が格納された作業用配列の配列値情報テ
ーブル555の値を参照する目的プログラムとなるよう
に中間コード333を変更する。
The array value holding means 131 uses the syntax analysis information 2
22 and the intermediate code 333 are analyzed to determine whether the value of each element of the array being executed by the source program 111 is known at the time of translation, and if it is known, the value of the array element is known. And the value of the array element are held in the array value information table 555 prepared at the time of translation, and if they are not known, the information that the value of the array element is unknown is held in the array value information table 555. The work array preparation means 132 uses the syntax analysis information 222.
And the intermediate code 333 is analyzed, and the source program 11
For the unary operation of the array under execution of 1, if the values of all array elements of the operation target are known at the time of translation, prepare the array value information table 555 of the work array of the same size as the operation target array. To do. Further, the array operation executing means 133
For the unary operation of the array for which the value of each element of the array being executed by the source program 111 is known at the time of translation, the value of the array retained in the array value information table 555 is used at the time of translation. Information that the value of the array element is known in the array value information table 555 of the work array prepared by the work array preparation means 132 after the unary operation is calculated and the calculation result of the unary operation is obtained. , And the value of the calculation result as the value of the array element. The intermediate code changing unit 134 replaces the unary operation of the array in which the value of each element of the array being executed by the source program 111 is known at the time of translation, instead of the array value calculated by the array operation executing unit 133. The intermediate code 333 is changed so that it becomes a target program that refers to the value of the array value information table 555 of the working array in which is stored.

【0009】図2は単項演算を含む原始プログラムの一
例を示す図で、図1の実施例において、図2に示すFO
RTRAN原始プログラムを入力した場合の処理につい
て説明を進める。配列値保持手段131は構文解析情報
から、配列Aの値がプログラムの実行開始時には1,
2,…,10の値を保持していることが分かるので、そ
れを配列値情報テーブル555に格納し、配列Bはグロ
ーバルデータでプログラムの実行開始時には値が不明な
ので、不明という情報を配列値情報テーブル555に格
納する。作業用配列準備手段132は、プログラム中の
(1),(2)および(3)の文で実行される配列Aの
単項演算は、Aの全ての配列要素の値が翻訳時に分かっ
ているので、演算対象の配列と同じ要素数の作業用配列
の配列値情報テーブル555を準備する。また、配列演
算実行手段133は、(1),(2),および(3)の
文で実行される配列Aの単項演算では、Aの全ての配列
要素の値が翻訳時に分かっているので、配列値情報テー
ブル555中に保持された配列の値を用いて、配列Aの
単項演算の演算結果である−1,−2,…,−10を得
て、それらが作業用配列WORKの初期値となるように
作業用配列の配列値情報テーブル555に格納する。中
間コード変更手段134は、(1),(2)および
(3)の文に対して生成された配列Aの単項演算の結果
の値を参照する中間コードの代わりに作業用配列の配列
値情報テーブル555の値を参照する中間コードに変更
する。(1),(2)および(3)の文で実行される配
列Aの単項演算の結果と配列Bとの乗算に関しては、配
列Aの単項演算は作業用配列WORKの配列の参照にな
っているので翻訳時に値は分かっているが、Bの配列要
素の値が翻訳時に分からないので最適化の対象外とな
る。
FIG. 2 is a diagram showing an example of a source program including unary operations. In the embodiment shown in FIG. 1, the FO shown in FIG.
The processing when the RTRAN source program is input will be described. The array value holding unit 131 determines from the syntax analysis information that the value of the array A is 1, when the program execution starts.
Since it is found that the values of 2, ..., 10 are held, they are stored in the array value information table 555. Since the array B is global data and the value is unknown at the start of execution of the program, the information "unknown" is set to the array value. Stored in the information table 555. The work array preparation means 132 performs the unary operation of the array A executed by the statements (1), (2) and (3) in the program because the values of all array elements of A are known at the time of translation. The array value information table 555 of the working array having the same number of elements as the operation target array is prepared. In the unary operation of the array A executed by the statements (1), (2), and (3), the array operation executing means 133 knows the values of all array elements of A at the time of translation. Using the array values held in the array value information table 555, the unary operation results of the array A, -1, -2, ..., -10, are obtained, and these are the initial values of the working array WORK. Is stored in the array value information table 555 of the work array. The intermediate code changing unit 134 refers to the value of the result of the unary operation of the array A generated for the statements (1), (2), and (3), and instead of the intermediate code, the array value information of the working array. The value in the table 555 is changed to an intermediate code for reference. Regarding multiplication of the result of the unary operation of the array A and the array B executed in the statements (1), (2) and (3), the unary operation of the array A becomes a reference to the array of the working array WORK. Since the value is known at the time of translation because it exists, the value of the array element of B is not known at the time of translation, so it is excluded from optimization.

【0010】図3は図2のFORTRAN原始プログラ
ムを翻訳した結果の目的プログラムとして生成された命
令列のFORTRAN原始プログラムのイメージであ
る。図3では、(4)の文で配列WORKの宣言と
(5)の文でその配列初期値−1,−2,…,−10と
が宣言されている。また、図2の(2)の文が作業用配
列WORKの値を参照する文(6)に変更されている。
FIG. 3 is an image of the FORTRAN source program of the instruction sequence generated as the object program as a result of translating the FORTRAN source program of FIG. In FIG. 3, the statement (4) declares the array WORK and the statement (5) declares the array initial values -1, -2, ..., -10. The sentence (2) in FIG. 2 is changed to a sentence (6) that refers to the value of the work array WORK.

【0011】図4は図2のFORTRAN原始プログラ
ムの実行開始時の配列値情報テーブル555の具体例を
示す図である。図4(a),(b),および(c)はそ
れぞれ配列A,BおよびCの配列値情報テーブル555
を示す図で、それぞれA,B,およびCの名前テーブル
から参照できるようになっている。また、配列値情報テ
ーブルには、情報として配列の要素数と、その要素数だ
けのその値が翻訳時に分かっているか否かの情報(ここ
では、分かっているなら○で示し、分かっていないなら
×で示す)と、分かっているならその配列要素の値とが
格納されている。
FIG. 4 is a diagram showing a concrete example of the array value information table 555 at the start of execution of the FORTRAN source program of FIG. 4A, 4B, and 4C are array value information tables 555 of arrays A, B, and C, respectively.
In the figure, which can be referred to from the name tables of A, B, and C, respectively. In the array value information table, as information, the number of elements of the array and information about whether or not the value of the number of elements is known at the time of translation (here, if it is known, it is indicated by ○, if it is not known, (Indicated by x) and the value of the array element, if known.

【0012】図5は本発明の第2の実施例の構成図で、
原始プログラム中に二項演算を含む場合を示している。
図5の実施例のコンパイラ20は構文解析手段11,意
味解析手段12,最適化手段15,およびコード生成手
段14を含む。また最適化手段15は、配列保持手段1
31,作業用配列準備手段135,配列演算実行手段1
36,および中間コード変更手段137を含んで構成さ
れる。
FIG. 5 is a block diagram of the second embodiment of the present invention.
The case where a binary operation is included in the source program is shown.
The compiler 20 of the embodiment shown in FIG. 5 includes a syntax analysis unit 11, a semantic analysis unit 12, an optimization unit 15, and a code generation unit 14. The optimizing means 15 is the array holding means 1
31, work array preparation means 135, array operation execution means 1
36, and intermediate code changing means 137.

【0013】構文解析手段11,意味解析手段12,コ
ード生成手段14,および配列値保持手段131は図1
の実施例の同じ符号の手段と全く同じ処理を行ない、最
適化手段15も意味解析手段12で生成された中間コー
ド333を入力し、最適化された中間コード333を生
成する点では図1の最適化手段13と同じである。
The syntax analysis means 11, the semantic analysis means 12, the code generation means 14, and the array value holding means 131 are shown in FIG.
1 in that the same processing as the means of the same code in the embodiment of FIG. 3 is performed, and the optimization means 15 also inputs the intermediate code 333 generated by the semantic analysis means 12 to generate the optimized intermediate code 333. This is the same as the optimizing means 13.

【0014】作業用配列準備手段135は、構文解析情
報222および中間コード333を解析し、原始プログ
ラム111の実行中の配列同士あるいは配列と定数との
二項演算に対して、演算対象の全ての配列要素の値が翻
訳時に分かっているなら、演算対象の配列と同じ大きさ
の作業用配列の配列値情報テーブル555を準備する。
また、配列演算実行手段136は、原始プログラム11
1の実行中の配列の各要素の値が翻訳時に分かっている
と判断された配列同士あるいは配列と定数との二項演算
に対して、配列値情報テーブル555中に保持された配
列の値を用いて、翻訳時に演算結果を算出し、その演算
の計算結果を得て、作業用配列準備手段135で準備さ
れた作業用配列の配列値情報テーブル555中に、その
配列要素の値は分かっているという情報と、その配列要
素の値としての計算結果の値とを保持する。中間コード
変更手段137は、原始プログラム111の実行中の配
列の各要素の値が翻訳時に分かっていると判断された配
列同士あるいは配列と定数との二項演算の代わりに、配
列演算実行手段136で計算された配列の値が格納され
た作業用配列の配列値情報テーブル555の値を参照す
るような目的プログラムとなるように中間コード333
を変更する。
The work array preparation means 135 analyzes the syntax analysis information 222 and the intermediate code 333, and performs all binary operations on the arrays being executed by the source program 111 or binary operations on arrays and constants. If the value of the array element is known at the time of translation, the array value information table 555 of the working array having the same size as the operation target array is prepared.
Further, the array operation executing means 136 uses the source program 11
The value of the array held in the array value information table 555 is set for the binary operation between the arrays or the array and the constants for which the value of each element of the array under execution of 1 is determined at the time of translation. The operation result is calculated at the time of translation by using the calculation result of the operation, and the value of the array element is known in the array value information table 555 of the working array prepared by the working array preparation means 135. It holds the information that it is present and the value of the calculation result as the value of the array element. The intermediate code changing means 137, instead of the binary operation of the arrays or the array and the constants of which the values of the elements of the array being executed by the source program 111 are known at the time of translation, instead of the array operation executing means 136. The intermediate code 333 is set so as to be a target program that refers to the value of the array value information table 555 of the working array in which the array value calculated in
To change.

【0015】図6は二項演算を含む原始プログラムの一
例を示す図で、図5の実施例において、図6に示すFO
RTRAN原始プログラムを入力した場合の処理につい
て説明を進める。配列値保持手段131は構文解析情報
から、配列Aの値はプログラムの実行開始時には1,
2,…,10の値を保持していることが分かるので、そ
れを配列値情報テーブル555に格納し、配列Dはグロ
ーバルデータでプログラムの実行開始時には値が不明な
ので、不明という情報を配列値情報テーブル555に格
納する。また、(11),(12),および(13)の
文の中間コードから、配列Bの値はプログラムの(1
1),(12)および(13)の文の実行完了時に、全
て2の値を保持していることが分かるので、その値を配
列値情報テーブル555に格納する。作業用配列準備手
段135は、(14),(15)および(16)の文で
実行される配列AとBとの乗算では、AおよびBの全て
の配列要素の値が翻訳時に分かっているので、演算対象
の配列と同じ要素数の作業用配列の配列値情報テーブル
555を準備する。中間コード変更手段137は、(1
4),(15)および(16)の文に対して生成された
配列AとBとの乗算結果の値を参照する中間コードの代
わりに作業用配列の配列値情報テーブル555の値を参
照する中間コードに変更する。(14),(15)およ
び(16)の文で実行される配列AとBとの乗算結果と
配列Dとの加算に関しては、配列AとBとの乗算はWO
RK配列の参照になっているので翻訳時に値は分かって
いるが、Dの配列要素の値が翻訳時に分からないので最
適化の対象外となる。
FIG. 6 is a diagram showing an example of a source program including a binary operation. In the embodiment shown in FIG. 5, the FO shown in FIG.
The processing when the RTRAN source program is input will be described. The array value holding unit 131 determines from the syntax analysis information that the value of the array A is 1, when the execution of the program is started.
Since it is found that the values of 2, ..., 10 are held, they are stored in the array value information table 555. Since the array D is global data and the value is unknown at the start of execution of the program, the information "unknown" is set to the array value. Stored in the information table 555. From the intermediate code of the statements (11), (12), and (13), the value of array B is (1
At the completion of execution of the statements 1), (12), and (13), it is found that all the values of 2 are held, and therefore the values are stored in the array value information table 555. The work array preparation means 135 knows the values of all the array elements of A and B at the time of translation in the multiplication of the arrays A and B executed in the statements (14), (15) and (16). Therefore, the array value information table 555 of the working array having the same number of elements as the operation target array is prepared. The intermediate code changing means 137 uses (1
4), (15) and (16) The values of the array value information table 555 of the working array are referenced instead of the intermediate code that references the value of the multiplication result of the arrays A and B generated for the statements. Change to intermediate code. Regarding the addition result of the array A and B and the array D executed by the statements (14), (15) and (16), the multiplication of the arrays A and B is WO.
Since it is a reference to the RK array, its value is known at the time of translation, but the value of the array element of D is not known at the time of translation, so it is excluded from optimization.

【0016】図7は図6のFORTRAN原始プログラ
ムを翻訳した結果の目的プログラムとして生成された命
令列のFORTRAN原始プログラムのイメージであ
る。図7では、(17)の文で配列WORKの宣言と
(18)の文でその配列初期値2,4,…,20とが宣
言されている。また、図6の(15)の文が作業用配列
WORKの値を参照する文(19)に変更されている。
FIG. 7 is an image of the FORTRAN source program of the instruction sequence generated as the object program as a result of translating the FORTRAN source program of FIG. In FIG. 7, the statement (17) declares the array WORK and the statement (18) declares the array initial values 2, 4, ..., 20. Further, the sentence (15) in FIG. 6 is changed to a sentence (19) that refers to the value of the work array WORK.

【0017】図8は図6のFORTRAN原始プログラ
ムの(11),(12)および(13)の文の実行完了
時の配列値情報テーブル555の具体例を示す図であ
る。図8(a),(b),(c)および(d)は配列
A,B,C,およびDの配列値情報テーブル555を示
す図で、それぞれA,B,C,およびDの名前テーブル
から参照できるようになっている。また、配列値情報テ
ーブル555には、情報として配列の要素数と、その要
素数だけのその値が翻訳時に分かっているか否かの情報
と、分かっているならその配列要素の値とが格納されて
いる。
FIG. 8 is a diagram showing a concrete example of the array value information table 555 upon completion of execution of the statements (11), (12) and (13) of the FORTRAN source program of FIG. 8 (a), (b), (c) and (d) are diagrams showing the array value information table 555 of the arrays A, B, C and D, and the name tables of A, B, C and D, respectively. Can be referred to from. Further, the array value information table 555 stores, as information, the number of elements of the array, information as to whether or not the value corresponding to the number of elements is known at the time of translation, and the value of the array element if known. ing.

【0018】図9は本発明の第3の実施例の構成図で、
原始プログラム中に配列添字を含む場合を示している。
図9の実施例のコンパイラ30は構文解析手段11,意
味解析手段12,最適化手段16およびコード生成手段
14を含む。また最適化手段16は、配列値保持手段1
31,作業用配列準備手段138,配列添字配列値取出
し手段139,および中間コード変換手段140を含ん
で構成される。
FIG. 9 is a block diagram of the third embodiment of the present invention.
The case where the source program includes an array subscript is shown.
The compiler 30 of the embodiment shown in FIG. 9 includes a syntax analysis unit 11, a semantic analysis unit 12, an optimization unit 16 and a code generation unit 14. The optimizing means 16 is the array value holding means 1
31, a work array preparation unit 138, an array subscript array value extraction unit 139, and an intermediate code conversion unit 140.

【0019】構文解析手段11,意味解析手段12,コ
ード生成手段14,および配列値保持手段は図1の実施
例の同じ符号の手段と全く同じ処理を行ない、最適化手
段16も意味解析手段12で生成された中間コード33
3を入力し、最適化された中間コード333を生成する
点では図1の最適化手段13と同じである。
The syntax analyzing means 11, the semantic analyzing means 12, the code generating means 14, and the array value holding means perform exactly the same processing as the means having the same reference numerals in the embodiment of FIG. 1, and the optimizing means 16 and the semantic analyzing means 12 as well. Intermediate code 33 generated by
This is the same as the optimizing means 13 of FIG. 1 in that 3 is input and an optimized intermediate code 333 is generated.

【0020】作業用配列準備手段138は、構文解析情
報222および中間コード333を解析し、原始プログ
ラム111中の実行中の添字が配列の配列参照におい
て、添字として使用されている配列の値が翻訳時に分か
っており、かつ、その配列の添字により参照される配列
の値も翻訳時に分かっているなら、参照される配列と同
じ大きさの作業用配列の配列値情報テーブル555を準
備する。また、配列添字配列値取出し手段139は、原
始プログラム111中の実行中の添字が配列の配列参照
において、添字として使用されている配列の値が翻訳時
に分かっており、かつ、その配列の添字により参照され
る配列の値も翻訳時に分かっている場合の参照される配
列に対して、配列値保持手段131により保持された配
列値情報テーブル555中の添字として使用されている
配列の値を用いて、配列の参照を行った結果の値を得
て、作業用配列準備手段138で準備された作業用配列
の配列値情報テーブル555に、その配列要素の値は分
かっているという情報と、その配列要素の値として得た
結果の値とを保持する。中間コード変更手段140は、
原始プログラム111中の配列添字の配列値の参照にお
いて、添字として使用されている配列の値が翻訳時に分
かっており、かつ、その配列の添字により参照される配
列の値も翻訳時に分かっている場合の参照される配列に
対して、配列の添字を介して配列を参照する中間コード
ではなく、配列添字配列値取出し手段140で取出され
た配列添字の配列値が格納された作業用配列の配列値情
報テーブル555の値を参照するような目的プログラム
となるように中間コード333を変更する。
The work array preparation means 138 analyzes the syntax analysis information 222 and the intermediate code 333, and translates the array value used as a subscript in the array reference of the subscript being executed in the source program 111. If it is known at the time and the value of the array referred to by the subscript of the array is also known at the time of translation, the array value information table 555 of the working array having the same size as the referenced array is prepared. Further, the array subscript array value extracting means 139 knows the value of the array used as the subscript at the time of translation in the array reference of the subscript being executed in the source program 111, and by the subscript of the array. By using the value of the array used as a subscript in the array value information table 555 held by the array value holding unit 131 for the referenced array when the value of the referenced array is also known at the time of translation. , The value of the result of referring to the array is obtained, and the array value information table 555 of the working array prepared by the working array preparation unit 138 has the information that the value of the array element is known, and the array. The result value obtained as the element value is retained. The intermediate code changing unit 140,
When referring to the array value of the array subscript in the source program 111, the value of the array used as the subscript is known at the time of translation, and the value of the array referenced by the subscript of the array is also known at the time of translation. The array value of the working array in which the array value of the array subscript fetched by the array subscript array value fetching unit 140 is stored, not the intermediate code for referencing the array via the subscript of the array The intermediate code 333 is changed so that the target program refers to the value of the information table 555.

【0021】図10は配列添字を含む原始プログラムの
一例を示す図で、図9の実施例において、図10に示す
FORTRAN原始プログラムを入力した場合の処理に
ついて説明を進める。配列値保持手段131は構文解析
情報から、配列Aの値はプログラムの実行開始時には1
0,9,8,…,1の値を保持していることが分かるの
で、それを配列値情報テーブル555に格納し、配列D
はグローバルデータでプログラムの実行開始時には値が
不明なので、不明という情報を配列値情報テーブル55
5に格納する。作業用配列準備手段138は、(2
1),(22)および(23)の文で実行される配列A
(B)の参照は、配列AおよびBの全ての配列要素の値
が翻訳時に分かっているので、配列Aと同じ要素数の作
業用配列の配列値情報テーブル555を準備する。ま
た、配列添字配列値取出し手段139は、(21),
(22),および(23)の文で実行される配列A
(B)の参照は、配列AおよびBの全ての配列要素の値
が翻訳時に分かっているので、配列値情報テーブル55
5中の配列Bの値を添字として、配列値情報テーブル5
55中の配列Aの値を得て、それらが作業用配列WOR
Kの初期値となるように作業用配列の配列値情報テーブ
ル555に格納する。すなわち、配列WORKの値とし
て下記の値を配列値情報テーブル555に格納する。
FIG. 10 is a diagram showing an example of a source program including array subscripts. In the embodiment of FIG. 9, the processing when the FORTRAN source program shown in FIG. 10 is input will be described. The array value holding unit 131 determines that the value of the array A is 1 at the start of program execution based on the syntax analysis information.
Since it is understood that the values 0, 9, 8, ..., 1 are held, they are stored in the array value information table 555, and the array D
Is global data, and the value is unknown at the start of program execution.
Store in 5. The work arrangement preparing means 138 uses (2
Array A executed by statements 1), (22) and (23)
As for the reference (B), since the values of all the array elements of the arrays A and B are known at the time of translation, the array value information table 555 of the working array having the same number of elements as the array A is prepared. Further, the array subscript array value extraction means 139 uses (21),
Array A executed by statements (22) and (23)
In the reference of (B), since the values of all the array elements of the arrays A and B are known at the time of translation, the array value information table 55
Array value information table 5 with the value of array B in 5 as a subscript
Get the values of array A in 55 and use them as the working array WOR
It is stored in the array value information table 555 of the working array so that it becomes the initial value of K. That is, the following values are stored in the array value information table 555 as the values of the array WORK.

【0022】 第1要素:A(B(1))=A(1)の値10 第2要素:A(B(2))=A(2)の値9 第3要素:A(B(3))=A(3)の値8 第4要素:A(B(4))=A(4)の値7 第5要素:A(B(5))=A(5)の値6 第6要素:A(B(6))=A(1)の値10 第7要素:A(B(7))=A(2)の値9 第8要素:A(B(8))=A(3)の値8 第9要素:A(B(9))=A(4)の値7 第10要素:A(B(10))=A(5)の値6 中間コード変更手段140は、(21),(22),お
よび(23)の文で実行される配列A(B)の参照は、
配列AおよびBの全ての配列要素の値が翻訳時に分かっ
ているので、配列添字Bを用いた配列Aの値を参照する
中間コードの代わりに作業用配列の配列値情報テーブル
555の値を参照する中間コードに変更する。
First element: A (B (1)) = value of A (1) 10 Second element: A (B (2)) = value of A (2) 9 Third element: A (B (3) )) = A (3) value 8 4th element: A (B (4)) = A (4) value 7 5th element: A (B (5)) = A (5) value 6 6th Element: A (B (6)) = value of A (1) 10 7th element: A (B (7)) = value of A (2) 9th element: A (B (8)) = A ( 3) value 8 9th element: A (B (9)) = A (4) value 7 10th element: A (B (10)) = A (5) value 6 The intermediate code changing means 140 The reference to the array A (B) executed in the statements (21), (22), and (23) is
Since the values of all array elements of arrays A and B are known at the time of translation, refer to the value of the array value information table 555 of the working array instead of the intermediate code that refers to the value of array A using array subscript B. Change to intermediate code.

【0023】図11は図10のFORTRAN原始プロ
グラムを翻訳した結果の目的プログラムとして生成され
た命令列のFORTRAN原始プログラムのイメージで
ある。図11では、(24)の文で配列WORKの宣言
と(25)の文でその配列初期値10,9,8,7,
6,10,9,8,7,6とが宣言されている。また、
図10の(22)の文が作業用配列WORKの値を参照
する文(26)に変更されている。
FIG. 11 is an image of the FORTRAN source program of the instruction sequence generated as the object program as a result of translating the FORTRAN source program of FIG. In FIG. 11, the statement (24) declares the array WORK, and the statement (25) initializes the array 10, 9, 8, 7,
6, 10, 9, 8, 7, 6 are declared. Also,
The sentence (22) in FIG. 10 is changed to a sentence (26) that refers to the value of the work array WORK.

【0024】図12は図10のFORTRAN原始プロ
グラムの実行開始時の配列値情報テーブル555の具体
例を示す図である。図12(a),(b),(c),お
よび(d)は配列A,B,C,およびDの配列値情報テ
ーブル555を示す図で、それぞれA,B,C,および
Dの名前テーブルから参照できるようになっている。ま
た、配列値情報テーブル555には、情報として配列の
要素数と、その要素数だけのその値が翻訳時に分かって
いるか否かの情報と、分かっているならその配列要素の
値とが格納されている。
FIG. 12 is a diagram showing a specific example of the array value information table 555 at the start of execution of the FORTRAN source program of FIG. 12 (a), (b), (c), and (d) are diagrams showing the array value information table 555 of the arrays A, B, C, and D, and the names of A, B, C, and D, respectively. Can be referenced from the table. Further, the array value information table 555 stores, as information, the number of elements of the array, information as to whether or not the value corresponding to the number of elements is known at the time of translation, and the value of the array element if known. ing.

【0025】[0025]

【発明の効果】以上説明したように本発明は、原始プロ
グラムの実行中の配列の各要素の値が翻訳時に分かって
いると判断された配列の単項演算、および配列同士ある
いは配列と定数との二項演算に対して、その配列の単項
演算の計算結果、および配列同士あるいは配列と定数と
の二項演算の計算結果を作業用配列に格納して、この作
業用配列を参照する命令列を生成し、また原始プログラ
ム中の、配列添字の配列参照において、添字として使用
されている配列の値が翻訳時に分かっており、かつ、そ
の配列の添字により参照される配列の値も翻訳時に分か
っている場合に、翻訳時に分かっている配列の添字を介
して翻訳時に分かっている配列の値を取出した作業用配
列を参照する命令列を生成することにより、効率の良い
目的プログラムの生成ができるという効果がある。
As described above, according to the present invention, the unary operation of arrays in which it is determined that the value of each element of the array during execution of the source program is known at the time of translation, and between arrays or between arrays and constants. For a binary operation, the calculation result of the unary operation of the array and the calculation result of the binary operation of the arrays or the array and the constant are stored in the working array, and the instruction sequence that references this working array is stored. In the array reference of the array subscript generated in the source program, the value of the array used as the subscript is known at the time of translation, and the value of the array referenced by the subscript of the array is also known at the time of translation. In case that the target sequence of the efficient target program is generated by generating the instruction sequence that refers to the working sequence that takes out the value of the sequence known at the time of translation through the subscript of the sequence known at the time of translation, There is an advantage in that it is formed.

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

【図1】本発明の第1の実施例の構成図である。FIG. 1 is a configuration diagram of a first embodiment of the present invention.

【図2】図1の実施例を説明するための単項演算を含む
原始プログラムの一例を示す図である。
FIG. 2 is a diagram showing an example of a source program including a unary operation for explaining the embodiment of FIG.

【図3】図2に示す原始プログラムを図1の実施例の処
理により翻訳した結果の目的プログラムとして生成され
た命令列の原始プログラムのイメージである。
FIG. 3 is an image of a source program of an instruction sequence generated as a target program as a result of translating the source program shown in FIG. 2 by the processing of the embodiment of FIG.

【図4】図2に示す原始プログラムを図1の実施例によ
り処理するときの配列値情報テーブルの具体例を示す図
である。
4 is a diagram showing a specific example of an array value information table when the source program shown in FIG. 2 is processed by the embodiment shown in FIG.

【図5】本発明の第2の実施例の構成図である。FIG. 5 is a configuration diagram of a second embodiment of the present invention.

【図6】図5の実施例を説明するための二項演算を含む
原始プログラムの一例を示す図である。
FIG. 6 is a diagram showing an example of a source program including a binary operation for explaining the embodiment of FIG.

【図7】図6に示す原始プログラムを図5の実施例の処
理により翻訳した結果の目的プログラムとして生成され
た命令列の原始プログラムのイメージである。
FIG. 7 is an image of a source program of an instruction sequence generated as a target program as a result of translating the source program shown in FIG. 6 by the processing of the embodiment of FIG.

【図8】図6に示す原始プログラムを図5の実施例によ
り処理するときの配列値情報テーブルの具体例を示す図
である。
8 is a diagram showing a specific example of an array value information table when the source program shown in FIG. 6 is processed by the embodiment of FIG.

【図9】本発明の第3の実施例の構成図である。FIG. 9 is a configuration diagram of a third embodiment of the present invention.

【図10】図9の実施例を説明するための配列添字を含
む原始プログラムの一例を示す図である。
FIG. 10 is a diagram showing an example of a source program including array subscripts for explaining the embodiment of FIG. 9;

【図11】図10に示す原始プログラムを図9の実施例
の処理により翻訳した結果の目的プログラムとして生成
された命令列の原始プログラムのイメージである。
11 is an image of a source program of an instruction sequence generated as a target program as a result of translating the source program shown in FIG. 10 by the processing of the embodiment of FIG.

【図12】図10に示す原始プログラムを図9の実施例
により処理するときの配列値情報テーブルの具体例を示
す図である。
12 is a diagram showing a specific example of an array value information table when the source program shown in FIG. 10 is processed by the embodiment of FIG.

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

10,20,30 コンパイラ 11 構文解析手段 12 意味解析手段 13,15,16 最適化手段 14 コード生成手段 111 原始プログラム 131 配列値保持手段 132,135,138 作業用配列準備手段 133,136 配列演算手段 134,137,140 中間コード変更手段 139 配列添字配列値取出し手段 222 構文解析情報 333 中間コード 444 目的プログラム 555 配列値情報テーブル 10, 20, 30 compiler 11 syntax analysis means 12 semantic analysis means 13, 15, 16 optimization means 14 code generation means 111 source program 131 array value holding means 132, 135, 138 work array preparation means 133, 136 array operation means 134, 137, 140 Intermediate code changing means 139 Array subscript array value extracting means 222 Syntax analysis information 333 Intermediate code 444 Object program 555 Array value information table

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 原始プログラムを入力して目的プログラ
ムに翻訳するコンパイラにおいて、翻訳している原始プ
ログラムの中の実行中の配列の各要素の値が翻訳時に分
かっているか否かを判断して、分かっているならその配
列要素の値は分かっているという情報とその配列要素の
値とを翻訳時に用意した配列値情報テーブルに保持し、
分かっていないならその配列要素の値は分かっていない
という情報を配列値情報テーブルに保持する配列値保持
手段と、翻訳している原始プログラム中の実行中の配列
の単項演算に対して、演算対象の配列要素の値が翻訳時
に分かっているなら、演算対象の配列と同じ大きさの作
業用配列の配列値情報テーブルを準備する作業用配列準
備手段と、配列の各要素の値が翻訳時に分かっていると
判断された配列の単項演算に対して、前記配列値保持手
段によって配列値情報テーブル中に保持された配列の値
を用いて演算を実行し、前記作業用配列準備手段で準備
された作業用配列の配列値情報テーブルにその配列要素
の値は分かっているという情報とその配列要素の値とし
ての演算結果の値とを保持しておく配列演算手段と、配
列の各要素の値が翻訳時に分かっていると判断された配
列の単項演算の代りに前記配列演算手段で配列演算の演
算結果の値を格納した作業用配列の配列値情報テーブル
の値を参照する目的プログラムとなるように中間コード
を変更する中間コード変更手段とを有することを特徴と
するコンパイラの最適化方式。
1. A compiler that inputs a source program and translates it into a target program, judges whether or not the value of each element of the array being executed in the source program being translated is known at the time of translation, If you know, hold the information that the value of the array element is known and the value of that array element in the array value information table prepared at the time of translation,
If you do not know, the array value holding means that holds the information that the value of the array element is not known in the array value information table, and the operation target for the unary operation of the array being executed in the source program being translated If the value of the array element of is known at the time of translation, the work array preparation means for preparing the array value information table of the work array of the same size as the operation target array, and the value of each element of the array are known at the time of translation. For the unary operation of the array determined to have been performed, the operation is performed using the array value held in the array value information table by the array value holding means, and prepared by the working array preparing means. Array operation means that holds the information that the value of the array element is known in the array value information table of the working array and the value of the operation result as the value of the array element, and the value of each element of the array Instead of the unary operation of the array determined to be known at the time of translation, it becomes a target program that refers to the value of the array value information table of the working array that stores the value of the operation result of the array operation by the array operation means. And an intermediate code changing unit for changing the intermediate code.
【請求項2】 請求項1のコパイラの最適化方式におい
て、作業用配列準備手段が、翻訳している原始プログラ
ム中の実行中の配列同士あるいは配列と定数との二項演
算に対して、演算対象の配列要素の値が前記配列値保持
手段によって分かっているとされたならば、演算対象の
配列と同じ大きさの作業用配列の配列値情報テーブルを
準備する作業用配列準備手段であり、配列演算実行手段
が、配列の各要素が翻訳時に分かっていると判断された
配列同士あるいは配列と定数との二項演算に対して、前
記配列値保持手段によって配列値情報テーブル中に保持
された配列の値を用いて演算を実行し、前記作業用配列
準備手段で準備された作業用配列の配列値情報テーブル
にその配列要素の値は分かっているという情報とその配
列要素の値としての演算結果の値とを保持しておく配列
演算手段であり、中間コード変更手段が、配列の各要素
の値が翻訳時に分かっていると判断された配列同士ある
いは配列と定数との二項演算の代わりに前記配列演算手
段で配列演算の演算結果値が格納された作業用配列の配
列値情報テーブルの値を参照する目的プログラムとなる
ように中間コードを変更する中間コード変更手段である
ことを特徴とするコンパイラの最適化方式。
2. The optimizing method for a copiler according to claim 1, wherein the working array preparation means performs an arithmetic operation for binary operations between the active arrays in the source program being translated or between arrays and constants. If the value of the target array element is known by the array value holding means, it is a working array preparation means for preparing an array value information table of a working array of the same size as the operation target array, The array operation execution means holds the array value information holding means in the array value information table for the binary operation between the arrays or the array and the constant which are determined to be known at the time of translation. The operation is performed using the array value, and the information that the value of the array element is known in the array value information table of the working array prepared by the working array preparing means and the value of the array element It is an array operation means for holding the value of the operation result, and the intermediate code changing means performs the binary operation of the arrays or the array and the constants for which it is determined that the value of each element of the array is known at the time of translation. Instead, it is an intermediate code changing means for changing the intermediate code so as to be a target program that refers to the value of the array value information table of the working array in which the operation result value of the array operation is stored by the array operation means. Optimization method of the compiler.
【請求項3】 請求項1のコンパイラの最適化方式にお
いて、作業用配列準備手段が、翻訳している原始プログ
ラム中の実行中の配列添字の配列値の参照に対して、添
字として使用されている配列の値が翻訳時に分かってお
り、かつ、その配列の添字により参照される配列の値も
翻訳時に分かっているならば、参照される配列と同じ大
きさの作業用配列の配列値情報テーブルを準備する作業
用配列準備手段であり、配列演算実行手段の代りに、配
列添字の配列値の参照において、添字として使用されて
いる配列の値が翻訳時に分かっており、かつ、その配列
の値も翻訳時に分かっている場合の参照される配列に対
して、前記配列値保持手段により配列値情報テーブル中
に保持された添字として使用されている配列の値を用い
て配列の参照を行なった結果の値を、前記作業用配列準
備手段で準備した作業用配列の配列値情報テーブルにそ
の配列要素の値は分かっているという情報と共に保持し
ておく配列添字配列値取出し手段であり、中間コード変
更手段が、配列添字の配列値の参照において、添字とし
て使用される配列の値が翻訳時に分かっており、かつ、
その配列の添字により参照される配列の値も分かってい
る場合に参照される配列に対して、配列の添字を介して
配列を参照せず、前記配列添字配列値取出し手段で取出
された配列添字の配列値が格納された作業用配列の配列
値情報テーブルの値を参照する目的プログラムとなるよ
うに中間コードを変更する中間コード変更手段であるこ
とを特徴とするコンパイラの最適化方式。
3. The compiler optimization method according to claim 1, wherein the working array preparation means is used as a subscript for the reference of the array value of the array subscript being executed in the source program being translated. If the value of the existing array is known at the time of translation and the value of the array referenced by the subscript of that array is also known at the time of translation, the array value information table of the working array of the same size as the referenced array Is a work array preparation means for preparing, and instead of the array operation execution means, the value of the array used as a subscript is known at the time of translation in the reference of the array value of the array subscript, and the value of the array Also, with respect to the referenced array when it is known at the time of translation, the array value is referred to by using the value of the array used as a subscript held in the array value information table by the array value holding means. The value of the result is an array subscript array value extracting means for holding together with the information that the value of the array element is known in the array value information table of the working array prepared by the working array preparing means, When the intermediate code changing means refers to the array value of the array subscript, the value of the array used as the subscript is known at the time of translation, and
When the value of the array referred to by the subscript of the array is also known, the array subscript retrieved by the array subscript array value retrieval means without referring to the array via the subscript of the array A method for optimizing a compiler, which is an intermediate code changing means for changing an intermediate code so as to be a target program that refers to a value in an array value information table of a work array in which the array value of is stored.
JP5811493A 1993-03-18 1993-03-18 Optimizing system for compiler Withdrawn JPH06274351A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5811493A JPH06274351A (en) 1993-03-18 1993-03-18 Optimizing system for compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5811493A JPH06274351A (en) 1993-03-18 1993-03-18 Optimizing system for compiler

Publications (1)

Publication Number Publication Date
JPH06274351A true JPH06274351A (en) 1994-09-30

Family

ID=13074958

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5811493A Withdrawn JPH06274351A (en) 1993-03-18 1993-03-18 Optimizing system for compiler

Country Status (1)

Country Link
JP (1) JPH06274351A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998018084A1 (en) * 1996-10-18 1998-04-30 Fujitsu Limited Device and method for accelerating memory access speed

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998018084A1 (en) * 1996-10-18 1998-04-30 Fujitsu Limited Device and method for accelerating memory access speed
US6279152B1 (en) * 1996-10-18 2001-08-21 Fujitsu Limited Apparatus and method for high-speed memory access

Similar Documents

Publication Publication Date Title
US20040230957A1 (en) Methods for comparing versions of a program
EP0646864A1 (en) Optimising compiler
JPH1097430A (en) Method and system for inserting assembly code routine into source code routine for optimization
US6425124B1 (en) Resource allocation device for reducing the size and run time of a machine language program
JPH1173326A (en) Program converter and debugging device
JP3318051B2 (en) Translation processing method
JPH06274351A (en) Optimizing system for compiler
JP3328056B2 (en) Information extraction device from parse tree
JPH0695890A (en) Name replacement system in compiler
JPH0667871A (en) Automatic program updating system
JPS58112127A (en) Forming system of data input means
JPS61213935A (en) Step execution system for high-level language program
JP4327533B2 (en) Arithmetic processing program, arithmetic processing method, and arithmetic processing apparatus
JPH11154093A (en) Program compiler and storage medium recording compiler program
JPH03240837A (en) Debug information generating device
JPH09274570A (en) Compile method and compiler system
JPH0795275B2 (en) Compile processor
JPH10207738A (en) Language processing system
JP2501394B2 (en) Procedure call translation device
JPH04287230A (en) Method for linking argument of in-line expansion
JPS63632A (en) Optimization processing system for source program
JPH05204705A (en) Processing method for detecting undefined parameter
JPH0561687A (en) Processing system for compiler
JPH0573335A (en) Automatic in-line development system for program
JPH05241798A (en) Lm generating process sytem under library information control

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20000530