JPH06214800A - Optimum processing system of object program - Google Patents

Optimum processing system of object program

Info

Publication number
JPH06214800A
JPH06214800A JP821593A JP821593A JPH06214800A JP H06214800 A JPH06214800 A JP H06214800A JP 821593 A JP821593 A JP 821593A JP 821593 A JP821593 A JP 821593A JP H06214800 A JPH06214800 A JP H06214800A
Authority
JP
Japan
Prior art keywords
procedure
program
call
vector
unit
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
JP821593A
Other languages
Japanese (ja)
Inventor
Toru Moriya
亨 守谷
Tadahiro Asai
唯宏 浅井
Yasushi Senba
保志 仙波
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP821593A priority Critical patent/JPH06214800A/en
Publication of JPH06214800A publication Critical patent/JPH06214800A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To improve the performance of the compiler of a computer with a vector arithmetic function. CONSTITUTION:A system is the optimum processing system of an object program for executing optimization by in-line expansion at the time of compiling so as to generate the object program for the computer with the vector arithmetic function and it is constituted by providing a procedure call analyzing part 9 detecting that calling out of procedure appeared in the unit of translation at the time of in-line expansion is the call of character operation procedure which the system offers and an object selecting part 10 selecting one of a scholor instruction for minimizing execution time of character operation procedure or the vector instruction as an object which detected by the procedure calling-out analyzing part 9 offers and used for the in-line expansion of character operation procedure.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、FORTRANやC言
語などの高級プログラミング言語で書かれたソースプロ
グラムを、機械語などの機械向き言語の目的プログラム
に翻訳するコンパイル技術に係わり、特に、スーパコン
ピュータと呼ばれる科学技術計算用超高速計算機など、
ベクトル計算を行なう計算機において、文字列操作手続
きが効率良く最適化された目的プログラムを生成するの
に好適な目的プログラムの最適化処理システムに関する
ものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compilation technique for translating a source program written in a high-level programming language such as FORTRAN or C into a target program in a machine-oriented language such as a machine language, and more particularly to a supercomputer. An ultra-high-speed computer for scientific and technological calculations called
The present invention relates to a target program optimization processing system suitable for generating a target program in which a character string operation procedure is efficiently optimized in a computer that performs vector calculation.

【0002】[0002]

【従来の技術】従来、コンパイラに関しては、ソースプ
ログラムを効率の良い目的プログラムに翻訳するため
に、「最適化」が行なわれている。この最適化には、プ
ログラムの実行時間を短くする最適化と、所要記憶容量
を小さくする最適化とがある。特に、実行時間を短くす
る最適化は、計算機の処理速度を高速化させるための重
要な技術となる。実行時間を短くするための従来技術と
して、例えば、中田育男著「コンパイラ」(1985
年、産業図書(株)発行)の第220頁に記載のような
インライン展開を用いるものがある。これは、中間言語
における手続きを呼び出す箇所に、当該手続きの本体を
展開することにより、手続き呼出しの実行に必要とする
多くの処理を省略し、計算の回数を減らすものであり、
手続き呼出しの実行を高速化することができる。
2. Description of the Related Art Conventionally, a compiler has been "optimized" in order to translate a source program into an efficient target program. This optimization includes optimization that shortens the program execution time and optimization that reduces the required storage capacity. In particular, optimization for shortening the execution time is an important technique for increasing the processing speed of the computer. As a conventional technique for reducing the execution time, for example, Ikuo Nakata, "Compiler" (1985)
In some cases, inline expansion as described on page 220 of Sangyo Tosho Co., Ltd. is used. This is to reduce the number of calculations by expanding the main body of the procedure in the place where the procedure is called in the intermediate language, omitting many processes required to execute the procedure call.
The execution of procedure calls can be sped up.

【0003】しかし、この技術は、ベクトルプロセッサ
を有するシステムについての考慮がなされておらず、ス
ーパコンピュータと呼ばれる科学技術計算用超高速計算
機など、ベクトル計算を行なう計算機においては、スカ
ラ命令のみを使用した場合、文字列読み出し手続きに対
するインライン展開オブジェクトの実行時間が、ベクト
ル命令を使用した場合よりも長くなることがあるという
問題があった。
However, this technique does not consider a system having a vector processor, and only a scalar instruction is used in a computer for vector calculation such as a super-high-speed computer for scientific and technological calculation called a super computer. In this case, there is a problem that the execution time of the inline expansion object for the character string reading procedure may be longer than that when the vector instruction is used.

【0004】以下に示すC言語ソースプログラム(3)
の例を用いて、従来技術によるコンパイル動作の説明を
行なう。
C language source program (3) shown below
The compiling operation according to the conventional technique will be described with reference to the example of FIG.

【0005】このC言語ソースプログラム(3)をコン
パイルする場合で、関数「memcpy」を、スカラ命令のみ
を使用してインライン展開することを例に取る。この関
数「memcpy」は、第2引数(source)で指定される記憶
域から、第1引数(dest)で指定される記憶域に、第3
引数(1000)で指定されたバイト数だけコピーするもの
である。この関数「memcpy」を、スカラ命令のみを使用
してインライン展開すると、記憶域間でのバイト転送機
能を持つスカラ命令では、一度に転送できるバイト数に
制限があるため、該当するマシン命令をループで繰り返
すか、または、該当するマシン命令を列挙するオブジェ
クトにしなければならない。そのために、目的プログラ
ムの実行を高速化する最適化が十分ではなかった。
In the case of compiling the C language source program (3), the function "memcpy" is inline expanded using only scalar instructions. This function “memcpy” changes the storage area specified by the second argument (source) from the storage area specified by the first argument (dest) to the third storage area.
The number of bytes specified by the argument (1000) is copied. If this function "memcpy" is expanded inline using only scalar instructions, the scalar machine instruction that transfers bytes between storage areas has a limit on the number of bytes that can be transferred at one time. It must either be repeated with, or it must be an object that enumerates the relevant machine instructions. Therefore, the optimization for speeding up the execution of the target program was not sufficient.

【0006】[0006]

【発明が解決しようとする課題】解決しようとする問題
点は、従来の技術では、ソースプログラムのコンパイル
時のインライン展開において、ベクトル命令の使用が考
慮されておらず、科学技術用計算機などのように、ベク
トルプロセッサを有するシステムにおけるプログラムの
最適化を効率良く行なうことができない点である。本発
明の目的は、これら従来技術の課題を解決し、ベクトル
演算機能を有する計算機で用いる目的プログラムを高速
化し、コンパイラの性能を向上させることを可能とする
目的プログラムの最適化処理システムを提供することで
ある。
The problem to be solved by the prior art is that the prior art does not consider the use of vector instructions in the inline expansion at the time of compiling a source program. In addition, it is not possible to efficiently optimize a program in a system having a vector processor. An object of the present invention is to solve these problems of the prior art and to provide an optimization processing system for a target program which makes it possible to speed up a target program used in a computer having a vector operation function and improve the performance of a compiler. That is.

【0007】[0007]

【課題を解決するための手段】上記目的を達成するた
め、本発明の目的プログラムの最適化処理システムは、
ソースプログラムからベクトル演算機能を有する計算機
向けの目的プログラムへのコンパイル時に、ソースプロ
グラムから生成した中間言語に対して、インライン展開
による最適化を行なう目的プログラムの最適化処理シス
テムにおいて、インライン展開時に、翻訳単位に出現す
る手続きの呼出しが、システムが提供する文字操作手続
きの呼出しであることを検出する手続き呼出し解析部
と、この手続き呼出し解析部で検出したシステムが提供
する文字操作手続きのインライン展開に用いるオブジェ
クトとして、文字操作手続きの実行時間を最小にするス
カラ命令もしくはベクトル命令のいずれか一方を選択す
るオブジェクト選択部とを設けることを特徴とする。
In order to achieve the above object, an optimization processing system for an object program according to the present invention comprises:
When compiling a source program into a target program for a computer having a vector operation function, the intermediate language generated from the source program is optimized by inline expansion. Used for inline expansion of a procedure call analysis unit that detects that a procedure call that appears in a unit is a call of a system-provided character manipulation procedure, and the system-provided character manipulation procedure that is detected by this procedure call analysis unit. As an object, an object selection unit for selecting either a scalar instruction or a vector instruction that minimizes the execution time of the character operation procedure is provided.

【0008】[0008]

【作用】本発明においては、文字操作手続きをインライ
ン展開する際、対応する手続きで操作する文字数を考慮
し、スカラ命令のみを使用する場合、または、ベクトル
命令を使用する場合のうち、実行時間が短いオブジェク
トの生成を選択する。例えば、大量の文字を扱う文字操
作関数を、ベクトル命令を用いてインライン展開する。
このように、ベクトル命令を用いて文字操作手続きをイ
ンライン展開することにより、ベクトル演算機能を有す
る計算機の目的プログラムの実行を高速化できる。
In the present invention, when the character operation procedure is expanded inline, the number of characters to be operated by the corresponding procedure is taken into consideration, and the execution time is increased when only the scalar instruction is used or when the vector instruction is used. Choose to create short objects. For example, a character manipulation function that handles a large number of characters is expanded inline using vector instructions.
In this way, by inline expanding the character operation procedure using the vector instruction, it is possible to speed up the execution of the object program of the computer having the vector operation function.

【0009】[0009]

【実施例】以下、本発明の実施例を、図面により詳細に
説明する。図1は、本発明の目的プログラムの最適化処
理システムの本発明に係わる構成の一実施例を示すブロ
ック図である。本図において、1は、コンパイル対象の
C言語ソースプログラム、2は、このC言語ソースプロ
グラム1をコンパイルするコンパイラ、3は、コンパイ
ラ2でコンパイルされたC言語ソースプログラム1の目
的プログラムである。コンパイラ2は、C言語ソースプ
ログラム1から中間言語を生成するソース解析部4と、
このソース解析部4で生成した中間言語の本発明に係わ
る最適化等を行なう中間言語最適化部5と、この中間言
語最適化部5で最適化された中間言語内に出現する各種
のデータに対して、記憶域内番地を割り当てる記憶域割
付け部6と、最適化された中間言語に現われたデータ
に、実際の資源を割り当てるレジスタ割付け部7と、最
適化された中間言語から目的プログラム3を生成する目
的プログラム出力部8により構成されている。
Embodiments of the present invention will now be described in detail with reference to the drawings. FIG. 1 is a block diagram showing an embodiment of a configuration relating to the present invention of an optimization processing system for an object program of the present invention. In the figure, 1 is a C language source program to be compiled, 2 is a compiler for compiling the C language source program 1, and 3 is a target program of the C language source program 1 compiled by the compiler 2. The compiler 2 includes a source analysis unit 4 that generates an intermediate language from the C language source program 1,
An intermediate language optimizing unit 5 that performs optimization according to the present invention of the intermediate language generated by the source analyzing unit 4 and various data appearing in the intermediate language optimized by the intermediate language optimizing unit 5 On the other hand, a storage area allocating section 6 for allocating addresses in the storage area, a register allocating section 7 for allocating actual resources to data appearing in the optimized intermediate language, and a target program 3 generated from the optimized intermediate language. It is configured by the target program output unit 8.

【0010】また、中間言語最適化部5は、翻訳単位に
出現する手続きについて、その呼出しがシステムで予め
提供している文字操作手続きの呼出しであることを調べ
る本発明に係わる手続き呼出し解析部9と、文字操作手
続きの実行時間が最小になるようにオブジェクトとして
出力するスカラ命令、もしくは、ベクトル命令を選択す
る本発明に係わるオブジェクト選択部10と、種々の最
適化を行なう最適化処理部11とにより構成されてい
る。
Further, the intermediate language optimizing section 5 checks the procedure appearing in the translation unit to be a call of a character operation procedure provided in advance by the system, and a procedure call analyzing section 9 according to the present invention. An object selecting unit 10 according to the present invention for selecting a scalar instruction or a vector instruction to be output as an object so as to minimize the execution time of the character operation procedure, and an optimization processing unit 11 for performing various optimizations. It is composed by.

【0011】このような構成の本実施例の目的プログラ
ムの最適化処理システムにおいて、コンパイラ2は、記
憶装置からC言語ソースプログラム1を読み込んで、所
定の目的プログラム3を記憶装置上に生成する。このと
き、図1に示された各部は次の処理を行う。すなわち、
ソース解析部4は、読み込んだC言語ソースプログラム
1を文解析し中間言語に展開する。そして、中間言語最
適化部5は、効率の良い目的プログラム3を生成するた
めに、中間言語に対して各種の最適化を施し、中間言語
の変更を行う。また、記憶域割付け部6では、中間言語
内に出現する各種データに対して、記憶域内番地を割り
当てる。レジスタ割付け部7は、中間言語内に現われた
データに対してレジスタを割り当てる。目的プログラム
出力部8は、機械命令を生成し、命令語レベルで最適化
を行った後に記憶装置に出力する。
In the object program optimizing system of this embodiment having such a configuration, the compiler 2 reads the C language source program 1 from the storage device and generates a predetermined object program 3 on the storage device. At this time, each unit shown in FIG. 1 performs the following processing. That is,
The source analysis unit 4 analyzes a sentence of the read C language source program 1 and develops it into an intermediate language. Then, the intermediate language optimization unit 5 performs various optimizations on the intermediate language and changes the intermediate language in order to generate the efficient target program 3. Further, the storage area allocating unit 6 allocates addresses in the storage area to various data appearing in the intermediate language. The register allocating unit 7 allocates a register to the data appearing in the intermediate language. The target program output unit 8 generates a machine instruction, optimizes it at the instruction word level, and then outputs it to the storage device.

【0012】ベクトルプロセッサを備えたハードウエア
では、ベクトルプロセッサの使用率を向上することがプ
ログラムの実行速度を向上させるキーとなる。例えば、
本実施例のように、C言語等の手続き型言語では、文字
操作手続きを、システムがライブラリとして提供するこ
とが多いが、ベクトル命令を使用したインライン展開を
行うことで、より一層の実行速度の向上が可能となる。
In hardware equipped with a vector processor, improving the utilization rate of the vector processor is the key to improving the program execution speed. For example,
In a procedural language such as the C language as in this embodiment, the system often provides a character operation procedure as a library. However, by performing inline expansion using vector instructions, the execution speed is further increased. It is possible to improve.

【0013】すなわち、本実施例の目的プログラムの最
適化処理システムにおいては、翻訳単位内で文字操作手
続きを呼び出している場合、その呼出しを、ユーザが定
義した手続きとは異なるシステムが提供する文字操作手
続きであることを認識する機能を、手続き呼出し解析部
9として装備する。また、操作する文字数から、スカラ
命令、もしくは、ベクトル命令のいずれで実行する方が
実行時間が短くなるかを判定する機能を、オブジェクト
選択部10としてコンパイラ2に装備する。このことに
より、本実施例の目的プログラムの最適化処理システム
は、文字操作手続きのインライン展開を、スカラ命令の
みを使用して行なうよりも、ベクトル命令を使用して行
なう方が、目的プログラムの実行時間が短くなる場合、
このベクトル命令を使用して文字操作手続きをインライ
ン展開する。
That is, in the object program optimization processing system of the present embodiment, when a character operation procedure is called in a translation unit, the call is provided by a system different from the user-defined procedure. A function for recognizing a procedure is provided as the procedure call analysis unit 9. In addition, the compiler 2 is equipped as the object selection unit 10 with a function of determining whether the execution time is shorter with the scalar instruction or the vector instruction, based on the number of operated characters. As a result, the object program optimization processing system according to the present embodiment executes the object program execution by using vector instructions for inline expansion of the character manipulation procedure rather than using only scalar instructions. If the time gets shorter,
Inline expansion of character manipulation procedures using this vector instruction.

【0014】本実施例においては、手続き呼出し解析部
9は、翻訳単位内に該当する手続きの定義がない場合、
該当する手続き呼出しの引数の型と個数、および、返却
値の型と、システムが提供する文字操作手続きの引数の
型と個数、および、返却値の型とのそれぞれを比較する
ことにより、手続き呼出しを、システムが提供する文字
操作手続きの呼出しであるか否かに分類する。このこと
により、同じ手続き名称の場合でも、ユーザ定義の手続
きの呼出しか、あるいは、システムが提供する手続きの
呼出しかを分類することができる。また、オブジェクト
選択部10は、スカラ命令、もしくは、ベクトル命令の
いずれかを、インライン展開の実行時間の短い方として
選択する場合、操作する文字数を基にして行なう。この
ことにより、誤って、実行時間の長い方を選択すること
を回避できる。以下、このような手続き呼出し解析部
9、および、オブジェクト選択部10に関する説明を、
次の図2、および、図3を用いて行なう。
In this embodiment, the procedure call analysis unit 9 determines that the corresponding procedure is not defined in the translation unit.
The procedure call is performed by comparing the type and number of arguments of the corresponding procedure call, the type of return value, and the type and number of arguments of the character operation procedure provided by the system, and the type of return value, respectively. Is classified as a call to a character manipulation procedure provided by the system. As a result, even in the case of the same procedure name, it is possible to classify only the call of the user-defined procedure or the call of the procedure provided by the system. Further, when selecting either the scalar instruction or the vector instruction as the one having the shorter execution time of the inline expansion, the object selecting unit 10 performs it based on the number of characters to be operated. This makes it possible to avoid erroneously selecting the one with a longer execution time. Hereinafter, the procedure call analysis unit 9 and the object selection unit 10 will be described.
This will be performed using FIGS. 2 and 3 below.

【0015】図2は、図1における目的プログラムの最
適化処理システムの本発明に係わるインライン展開動作
の一実施例を示す説明図である。本実施例は、図1にお
ける中間言語最適化部5で行なわれる各種の最適化処理
の一つである本発明に係わる手続き呼出しのインライン
展開処理動作を示すものであり、本図において、21〜
23は、それぞれ、データを次の処理に引き継ぐために
使用する中間ファイルである。中間ファイル21は、図
1のソース解析部4によりC言語ソースプログラム1か
ら変換された中間言語からなり、手続き呼出し解析部9
は、この中間ファイル21を用いて、呼び出している手
続きの引数と返却値をチェックし、中間ファイル22を
作成する。
FIG. 2 is an explanatory diagram showing an embodiment of the inline expansion operation according to the present invention of the optimization processing system for the object program in FIG. This embodiment shows an inline expansion processing operation of a procedure call according to the present invention, which is one of various kinds of optimization processing performed by the intermediate language optimization unit 5 in FIG.
Each of the reference numerals 23 is an intermediate file used to carry over the data to the next process. The intermediate file 21 consists of an intermediate language converted from the C language source program 1 by the source analysis unit 4 of FIG.
Uses the intermediate file 21 to check the argument and return value of the procedure being called and create the intermediate file 22.

【0016】そして、オブジェクト選択部10は、手続
き呼出し解析部9のチェックが完了した中間ファイル2
2を用いて、インライン展開を、スカラ命令、もしく
は、ベクトル命令のいずれで行うかを選択し、中間ファ
イル23を作成する。この時点で、手続き呼出しに対す
る本発明に係わるインライン展開における最適化が完了
する。このようにして作成された中間ファイル23を用
いて、図1における最適化処理部11は、さらに、種々
の最適化を行なう。本図2で示す図1における中間言語
最適化部5の本発明に係わる処理動作を、次の図3を用
いて説明する。
The object selecting unit 10 then outputs the intermediate file 2 that has been checked by the procedure call analyzing unit 9.
2 is used to select whether the inline expansion is performed by a scalar instruction or a vector instruction, and the intermediate file 23 is created. At this point, the optimization of the inline expansion according to the present invention for the procedure call is completed. Using the intermediate file 23 created in this way, the optimization processing unit 11 in FIG. 1 further performs various optimizations. The processing operation of the intermediate language optimizing unit 5 in FIG. 1 shown in FIG. 2 according to the present invention will be described with reference to FIG.

【0017】図3は、図1における中間言語最適化部の
本発明に係わるインライン展開動作の一実施例を示すフ
ローチャートである。本実施例を、次のC言語ソースプ
ログラム(1)、(2)の例を用いて説明する。尚、C
言語では、手続きを関数と呼ぶので以下の説明では関数
を手続きと同じ意味で使用する。 C言語ソースプログラム(1): extern char source[1000]; extern char dest[1000]; extern int memcpy(int n) { int i; for(i=0; i<n; i++) { *(dest+i) = *(source+i); } return(0); } /*以上、翻訳単位(1)*/ /*以下、翻訳単位(2)*/ char source[1000]="This is a C program"; char dest[1000]; main(void) { memcpy(10); /*呼出し(1)*/ memcpy(900); /*呼出し(2)*/ } 尚、このC言語ソースプログラム(1)は、「return
(0); }」までが翻訳単位(1)、それ以降が翻訳単位
(2)となり、別個の単位で翻訳される。 C言語ソースプログラム(2): include <string.h> char source[1000]="This is a C program"; char dest[1000]; main(void) { memcpy(dest,source,10); /*呼出し(3)*/ memcpy(dest+10,source+10,900); /*呼出し(4)*/ } このC言語ソースプログラム(2)は、同一翻訳単位と
して翻訳される。
FIG. 3 is a flow chart showing an embodiment of the inline expansion operation according to the present invention of the intermediate language optimizing unit in FIG. This embodiment will be described with reference to the following C language source programs (1) and (2). Incidentally, C
In the language, a procedure is called a function, so in the following description, a function is used with the same meaning as a procedure. C language source program (1): extern char source [1000]; extern char dest [1000]; extern int memcpy (int n) {int i; for (i = 0; i <n; i ++) {* (dest + i) = * (source + i);} return (0);} / * or more, translation unit (1) * / / * or less, translation unit (2) * / char source [1000] = "This is a C program "; char dest [1000]; main (void) {memcpy (10); / * call (1) * / memcpy (900); / * call (2) * /} This C language source program (1 ) Is "return
(0);} "is the translation unit (1), and the subsequent units are the translation units (2), which are translated in separate units. C language source program (2): include <string.h> char source [1000] = "This is a C program"; char dest [1000]; main (void) {memcpy (dest, source, 10); / * Call (3) * / memcpy (dest + 10, source + 10,900); / * Call (4) * /} This C language source program (2) is translated as the same translation unit.

【0018】まず、図1の手続き呼出し解析部9によ
り、手続きの引数のチェックを行なう(ステップ30
1)。例えば、C言語ソースプログラム(1)の翻訳単
位中で呼出される関数「memcpy」は、ユーザが、翻訳単
位(1)と翻訳単位(2)の別翻訳単位で定義した関数
である。この場合、翻訳単位中の関数呼出しのインライ
ン展開可否を判定するためには、処理対象の関数呼出し
の引数をインライン展開できるシステム提供関数の引数
と比較する(ステップ302)。ここで、C言語ソース
プログラム(1)において、「呼出し(1)」、「呼出
し(2)」とも、システム提供の関数「memcpy」とは異
なるので、インライン展開不可能と判定し、これらの関
数呼出しから、通常の関数呼出しのオブジェクトを生成
する(ステップ307)。
First, the procedure call analysis unit 9 in FIG. 1 checks the arguments of the procedure (step 30).
1). For example, the function “memcpy” that is called in the translation unit of the C language source program (1) is a function defined by the user in another translation unit of the translation unit (1) and the translation unit (2). In this case, in order to determine whether the function call in the translation unit can be expanded inline, the argument of the function call to be processed is compared with the argument of the system-provided function that can be expanded inline (step 302). Here, in the C language source program (1), since "call (1)" and "call (2)" are different from the system-provided function "memcpy", it is determined that inline expansion is not possible, and these functions An object for a normal function call is generated from the call (step 307).

【0019】また、C言語ソースプログラム(2)の翻
訳単位中で呼び出される関数「memcpy」は、システムが
提供する関数である。このようなシステムが提供する関
数「memcpy」をインライン展開するにあたり、コピーす
るデータの量により、スカラ命令でインライン展開した
方が良いか、あるいは、ベクトル命令でインライン展開
した方が良いかが変わってくる。その境界値は、個々の
システムで決めることができる。この境界値と、扱うデ
ータ量を、図1のオブジェクト選択部10により、比較
する(ステップ303、304)。
The function "memcpy" called in the translation unit of the C language source program (2) is a system-provided function. When inlining the function "memcpy" provided by such a system, depending on the amount of data to be copied, it is better to inline with a scalar instruction or to inline with a vector instruction. come. The boundary value can be determined by the individual system. The boundary value and the amount of data to be handled are compared by the object selection unit 10 in FIG. 1 (steps 303 and 304).

【0020】例えば、C言語ソースプログラム(2)に
おいて、「呼出し(4)」では、コピーするデータのバ
イト数が多いため、ベクトル命令を用いてインライン展
開すると、スカラ命令だけのインライン展開よりも実行
速度が速いので、ベクトル命令を用いてインライン展開
する(ステップ305)。一方、「呼出し(3)」は、
コピーするデータのバイト数が少ないため、ベクトル命
令を用いてインライン展開をするよりも、スカラ命令だ
けでインライン展開した方が実行速度が速くなるので、
スカラ命令でインライン展開する(ステップ306)。
このように、関数(手続き)呼出し時に、スカラ命令の
みならず、ベクトル命令を使用してインライン展開を行
うことで、スカラ命令だけのインライン展開より実行速
度の速い目的プログラムを生成することができる。
For example, in the C language source program (2), since "call (4)" has a large number of bytes of data to be copied, inline expansion using a vector instruction is executed more than inline expansion using only a scalar instruction. Since the speed is high, inline expansion is performed using vector instructions (step 305). On the other hand, "call (3)"
Since the number of bytes of data to be copied is small, inline expansion using only scalar instructions will result in faster execution speed than inline expansion using vector instructions.
Inline expansion is performed with a scalar instruction (step 306).
In this way, when a function (procedure) is called, not only the scalar instruction but also the vector instruction is used to perform the inline expansion, so that it is possible to generate a target program having a higher execution speed than the inline expansion using only the scalar instruction.

【0021】以上、図1〜図3を用いて説明したよう
に、本実施例の目的プログラムの最適化処理システムで
は、ベクトルプロセッサを装備するハードウエアにおい
て、文字操作手続きをインライン展開する際、対応する
手続きで操作する文字数を考慮し、スカラ命令のみを使
用する場合、または、ベクトル命令を使用する場合のう
ち、実行時間が短いオブジェクトの生成を選択する。例
えば、大量の文字を扱う文字操作関数を、ベクトル命令
を用いてインライン展開する。このことにより、ベクト
ル演算機能を有するシステムでの文字操作手続きのイン
ライン展開において、ベクトル命令を使用した高速な目
的プログラムを生成することができる。
As described above with reference to FIGS. 1 to 3, in the object program optimizing system of this embodiment, when the character operation procedure is inline expanded in the hardware equipped with the vector processor, Considering the number of characters to be operated in the procedure, select the generation of an object with a short execution time when using only scalar instructions or when using vector instructions. For example, a character manipulation function that handles a large number of characters is expanded inline using vector instructions. As a result, it is possible to generate a high-speed target program using vector instructions in the inline expansion of a character manipulation procedure in a system having a vector operation function.

【0022】尚、本発明は、図1〜図3を用いて説明し
た実施例に限定されるものではなく、その要旨を逸脱し
ない範囲において種々変更可能である。例えば、本実施
例では、C言語のソースプログラムを用いて説明した
が、FORTRANやCOBOLなど、他の高級言語を
用いたソースプログラムに対しても適用できる。
The present invention is not limited to the embodiments described with reference to FIGS. 1 to 3, and various modifications can be made without departing from the scope of the invention. For example, although the present embodiment has been described using a C language source program, the present invention can be applied to a source program using another high-level language such as FORTRAN or COBOL.

【0023】[0023]

【発明の効果】本発明によれば、ベクトル演算機能を有
する計算機向けのオブジェクトプログラムを生成するた
めのコンパイル時において、文字操作手続きのインライ
ン展開を、ベクトル命令を用いて行なうことにより、高
速な目的プログラムを生成することができ、コンパイラ
の性能を向上させることが可能である。
According to the present invention, at the time of compiling to generate an object program for a computer having a vector operation function, inline expansion of a character operation procedure is performed by using a vector instruction, thereby achieving a high speed object. A program can be generated and the performance of the compiler can be improved.

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

【図1】本発明の目的プログラムの最適化処理システム
の本発明に係わる構成の一実施例を示すブロック図であ
る。
FIG. 1 is a block diagram showing an embodiment of a configuration relating to the present invention of an optimization processing system for an object program of the present invention.

【図2】図1における目的プログラムの最適化処理シス
テムの本発明に係わるインライン展開動作の一実施例を
示す説明図である。
FIG. 2 is an explanatory diagram showing an example of an inline expansion operation according to the present invention of the optimization processing system for the object program in FIG.

【図3】図1における中間言語最適化部の本発明に係わ
るインライン展開動作の一実施例を示すフローチャート
である。
3 is a flowchart showing an embodiment of an inline expansion operation according to the present invention of the intermediate language optimizing unit in FIG.

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

1 C言語ソースプログラム 2 コンパイラ 3 目的プログラム 4 ソース解析部 5 中間言語最適化部 6 記憶域割付け部 7 レジスタ割付け部 8 目的プログラム出力部 9 手続き呼出し解析部 10 オブジェクト選択部 11 最適化処理部 21〜23 中間ファイル 1 C language source program 2 compiler 3 target program 4 source analysis unit 5 intermediate language optimization unit 6 storage allocation unit 7 register allocation unit 8 target program output unit 9 procedure call analysis unit 10 object selection unit 11 optimization processing unit 21 to 21 23 Intermediate file

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 ソースプログラムからベクトル演算機能
を有する計算機向けの目的プログラムへのコンパイル時
に、上記ソースプログラムから生成した中間言語に対し
て、インライン展開による最適化を行なう目的プログラ
ムの最適化処理システムにおいて、上記インライン展開
時に、翻訳単位に出現する手続きの呼出しが、システム
が提供する文字操作手続きの呼出しであることを検出す
る手続き呼出し解析手段と、該手続き呼出し解析手段で
検出した上記システムが提供する文字操作手続きのイン
ライン展開に用いるオブジェクトとして、上記文字操作
手続きの実行時間を最小にするスカラ命令もしくはベク
トル命令のいずれか一方を選択するオブジェクト選択手
段とを設けることを特徴とする目的プログラムの最適化
処理システム。
1. An optimization processing system for a target program, which optimizes an intermediate language generated from the source program by inline expansion when compiling the source program into a target program for a computer having a vector operation function. Provided by the procedure call analysis means for detecting that the procedure call appearing in the translation unit at the time of the inline expansion is the call of the character operation procedure provided by the system, and the system detected by the procedure call analysis means. As an object used for inline expansion of a character manipulation procedure, an object selection means for selecting either a scalar instruction or a vector instruction that minimizes the execution time of the character manipulation procedure is provided, and the object program is optimized. Processing system.
JP821593A 1993-01-21 1993-01-21 Optimum processing system of object program Pending JPH06214800A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP821593A JPH06214800A (en) 1993-01-21 1993-01-21 Optimum processing system of object program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP821593A JPH06214800A (en) 1993-01-21 1993-01-21 Optimum processing system of object program

Publications (1)

Publication Number Publication Date
JPH06214800A true JPH06214800A (en) 1994-08-05

Family

ID=11687008

Family Applications (1)

Application Number Title Priority Date Filing Date
JP821593A Pending JPH06214800A (en) 1993-01-21 1993-01-21 Optimum processing system of object program

Country Status (1)

Country Link
JP (1) JPH06214800A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10169008B2 (en) 2016-05-10 2019-01-01 Fujitsu Limited Information processing device and compilation method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10169008B2 (en) 2016-05-10 2019-01-01 Fujitsu Limited Information processing device and compilation method

Similar Documents

Publication Publication Date Title
US7725883B1 (en) Program interpreter
US6292939B1 (en) Method of reducing unnecessary barrier instructions
US6931635B2 (en) Program optimization
US5778212A (en) Interprocedural analysis user interface
EP0806725B1 (en) Method and apparatus for early insertion of assembler code for optimization
US7493610B1 (en) Versioning optimization for dynamically-typed languages
JP3337174B2 (en) Compilation method
US7784039B2 (en) Compiler, compilation method, and compilation program
US6202204B1 (en) Comprehensive redundant load elimination for architectures supporting control and data speculation
US7917899B2 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
US5812854A (en) Mechanism for integrating user-defined instructions with compiler-generated instructions and for optimizing the integrated instruction stream
JP2001166949A (en) Method and device for compiling source code by using symbolic execution
US7373641B2 (en) Method, computer unit and program for converting a program
US6301652B1 (en) Instruction cache alignment mechanism for branch targets based on predicted execution frequencies
US10013244B2 (en) Apparatus and method to compile a variadic template function
CN109901840B (en) Heterogeneous compilation optimization method for inter-thread redundancy deletion
US6665864B1 (en) Method and apparatus for generating code for array range check and method and apparatus for versioning
US20020062478A1 (en) Compiler for compiling source programs in an object-oriented programming language
JP2856663B2 (en) Optimization method and apparatus for defining visible boundaries in compiled code
JP3606654B2 (en) Compiler device
JPH06214800A (en) Optimum processing system of object program
CN112416313B (en) Compiling method supporting large integer data type and operator
EP0883060A2 (en) Compiler capable of carrying out both size optimization and speed optimization
Sassa et al. Static single assignment form in the COINS compiler infrastructure
US5319784A (en) System for automatic and selective compile-time installation of fastpath into program for calculation of function/procedure without executing the function/procedure