JP3726992B2 - Batch function call method - Google Patents

Batch function call method Download PDF

Info

Publication number
JP3726992B2
JP3726992B2 JP03441798A JP3441798A JP3726992B2 JP 3726992 B2 JP3726992 B2 JP 3726992B2 JP 03441798 A JP03441798 A JP 03441798A JP 3441798 A JP3441798 A JP 3441798A JP 3726992 B2 JP3726992 B2 JP 3726992B2
Authority
JP
Japan
Prior art keywords
call
function
batch
collective
information
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.)
Expired - Lifetime
Application number
JP03441798A
Other languages
Japanese (ja)
Other versions
JPH11232118A (en
Inventor
教安 森
純男 菊池
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 JP03441798A priority Critical patent/JP3726992B2/en
Publication of JPH11232118A publication Critical patent/JPH11232118A/en
Application granted granted Critical
Publication of JP3726992B2 publication Critical patent/JP3726992B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【0001】
【発明の属する技術分野】
本発明はコンパイラなどのプログラム変換技術に係わり、特に、関数呼出機構を持つ言語に対して、関数および関数呼出の関係を解析して関数情報および呼出情報として生成するプログラム変換の際の一括関数呼出化方法に関する。
【0002】
【従来の技術】
高級言語によるプログラミングでは、関数(手続きとも呼ばれるが、以降では関数で統一する)による構造化を行うのが一般的である。関数は、一連の処理をまとめてパラメータ化して記述したもの(以下、これを関数定義と呼ぶ)で、それを呼出す(以下単に呼出と呼ぶ)ことにより関数定義内の処理を実現できる。関数定義側のパラメータには、仮引数、返却変数(以下、仮返数と呼ぶ)があり、関数定義内の記述では、仮引数・仮返数(以下、仮パラメータと呼ぶ)を使って処理を記述する。呼出側のパラメータには、実引数、返却変数(以下、実返数と呼ぶ)があり、呼出側の変数/式を使ってパラメータの指定を行う(この呼出インタフェースとなる変数/式を実パラメータと呼ぶ)。尚、以下では、仮パラメータと実パラメータを総称して、インタフェース変数/式と呼ぶ。実パラメータには様々な値を指定することが可能で、これにより同様の処理(=関数定義)を繰り返し実行することができる。
【0003】
このように、関数はプログラミング上便利な機構である一方で、呼出時にオーバヘッドがかかるという問題点を抱えている。即ち、引数の受け渡しや、呼出時のスタックポインタの更新/退避回復、命令ジャンプに伴うキャッシュミスの可能性の増大といったことにより、処理性能の低下を招く。特に、処理内容が簡単な関数を反復呼出する場合には、呼出オーバヘッドは性能上無視できないものとなる。
【0004】
このような状況に対処するため、高級言語では、インライン展開の機能を備えている場合が多い。インライン展開は、関数呼出を関数の定義本体の内容で置き換え、呼出を抑止するものである。具体的には、各呼出点で、関数定義の内容を展開し、仮パラメータを実パラメータで置き換えることにより実現する。インライン展開に関しては、佐々 政孝著岩波講座ソフトウェア科学5「プログラミング言語処理系」( 岩波書店、1989)のpp.450―451に詳しい。
【0005】
【発明が解決しようとする課題】
インライン展開は、高級言語における呼出オーバヘッド削減のほとんど唯一の手段である。しかし、インライン展開の適用によりコードサイズが大きくなり過ぎると、キャッシュミスの機会が増え、かえって性能が低下する場合もある。そのため、大きな関数の呼出や、呼出個所が多い場合には、インライン展開を制限するのが普通である。即ち、コード量の極端な増加を伴う場合には、インライン展開による呼出オーバヘッドの削減は行うことができない。すなわち、従来技術においては、インライン展開が適用できない場合に、呼出オーバヘッドの削減を行う手段がないという課題があった。
本発明の目的は、インライン展開によらない呼出オーバヘッドの削減手段を設けることにより、インライン展開が適用できない場合にも、呼出オーバヘッドの削減を行い、オブジェクトプログラムの処理性能の向上を図ることが可能な一括関数呼出化方法を提供することにある。
【0006】
【課題を解決するための手段】
インライン展開は、各呼出点で関数定義の処理内容を展開し、(その呼出点での)呼出を除去する。従って、インライン展開の適用の有無は、各呼出点の呼出回数を0とするか否かを判断することになる。複数回の同一関数の呼出の場合、インライン展開が適用できない場合でも、関数定義側に複数呼出分の処理を展開すれば、コードサイズを極端に増大させることなく、呼出回数を削減することが可能である。即ち、複数回の同一関数の処理を一度に実行する一括関数を生成し、複数回の同一関数の呼出を、1回の一括関数の呼出に置き換える一括化呼出生成手段を設けることで、インライン展開によらない呼出オーバヘッドの削減手段を設けることができる。
これにより、インライン展開が適用できない場合にも、呼出オーバヘッドの削減を行うことが可能となり、オブジェクトプログラムの処理性能の向上に寄与する。
【0007】
【発明の実施の形態】
本発明は、同一関数の複数呼び出しを、一括処理する一括関数の呼び出しに変換する方式に関するものである。
以下では、本発明の1実施例を図面を用いて説明する。
尚、本発明は、ソースプログラムから変換後のソースプログラムを生成する場合にも、コンパイラが中間語から変換後の中間語に変換する場合にも、同様に適用可能であるが、実施例としてコンパイラに適用した場合(但し、中間語は同等なソースプログラムの形式で示す)を説明することにする。
【0008】
図1は、本発明のコンパイル方法を実施するコンパイラが動作する計算機システムの構成図である。計算機システムは、CPU101、ディスプレイ装置102、キーボード103、主記憶装置104、外部記憶装置105より構成されている。
キーボード103より、ユーザからのコンパイラ起動命令を受け付ける。コンパイラ終了メッセージや、エラーメッセージは、ディスプレイ装置102に表示される。外部記憶装置105には、ソースプログラム106とオブジェクトプログラム107が格納される。
主記憶装置104には、コンパイラ108があり、コンパイル過程で必要となる中間語3、関数情報テーブル4、呼出情報テーブル5、一括呼出情報テーブル6、一括関数情報テーブル7が格納される。
コンパイル処理は、CPU101によって、制御される。
【0009】
図2に本実施例のコンパイラの処理手順を示す。
構文解析201では、ソースプログラム106を入力として字句構文解析を行ない、中間語3を出力する。
ループ展開処理202は中間後3を入力とし、反復処理を展開して反復回数を低減するループ展開を行い、中間語3を出力する。
一括関数化処理2は、中間語3を入力とし、複数の関数呼び出しを一括命令関数呼び出しに変換する一括関数化処理を行ない、中間語3を出力する。
コード生成処理203は、中間語を最終的なオブジェクトプログラム107の形式に変換する。
尚、ループ展開202は、本発明の適用機会を増やすため望ましい処理であるが、必須の処理ではない。
【0010】
図3は、本発明における関数呼出一括化方法の1実施例を示すフローチャート図であり、図2の関数呼出一括化処理2の手順を表している。
先ず、関数情報テーブル生成処理21により、ソースプログラム中の関数定義の各種情報を抽出し、関数情報テーブル4を作成する。同様に、呼出情報テーブル生成処理22により、関数呼出に関する情報を抽出し、呼出情報テーブル5を生成する。
【0011】
次に、一括呼出情報テーブル生成処理23により、呼出情報テーブル5から複数の同一関数呼出を一括処理する一括関数に関する情報を抽出し、一括関数情報テーブル6を生成する。この一括呼出情報テーブル生成処理23は、同一関数呼出に関する情報を抽出する同型呼出抽出処理230と、同型呼出集合から一括呼出化可能な呼出を抽出する一括呼出抽出処理231、抽出した一括呼出を一括呼出情報テーブルに登録する一括呼出情報テーブル登録処理232からなる。各処理に関しては図17から図23で詳しく述べる。
【0012】
次に、一括関数生成処理24により、一括関数情報テーブル7に基づき、中間後3に一括関数を生成する。
最後に、一括呼出化変換処理25により、一括呼出情報テーブル6に基づき、中間語3中の関数呼出を一括関数呼出に変換する。
【0013】
図4は、図3で示した関数呼出一括化関連処理と、入出力となる中間語やテーブル類の関係を示した処理構成図である。但し、中間語3は全般的に参照するため入出力関係は、主要なもののみを示した。
関数情報テーブル生成処理21は、一括関数呼出化前中間語31を入力とし、関数定義の情報を格納した関数情報テーブル4を生成する。関数情報テーブル4は、関数の一覧を格納する関数テーブル41と、関数のインタフェースとなる仮引数および仮返数の情報を格納する仮パラメータテーブル42から成る。
呼出情報テーブル生成処理22は、一括呼出化前中間語31を入力とし、関数呼出の情報を格納した呼出情報テーブル5を生成する。呼出情報テーブル5は、関数呼出の一覧を格納する呼出テーブル51と、関数呼出のインタフェースとなる実引数および実返数の情報を格納する実パラメータテーブル52から成る。
【0014】
一括呼出化情報テーブル生成処理23は、呼出情報テーブル5を入力とし、一括呼出化可能な関数呼出の情報を格納した一括呼出情報テーブル6と、一括呼出される関数定義の情報を格納した一括関数情報テーブル7を生成する。一括呼出情報テーブル6は、一括呼出化可能な呼出の一覧を格納する一括呼出テーブル61と、一括呼出のインタフェースとなる実引数および実返数の情報を格納する実パラメータテーブル62から成る。同様に、一括関数情報テーブル7は、一括呼出化される関数定義の一覧を格納する一括関数テーブル71と、一括関数のインタフェースとなる仮引数および仮返数の情報を格納する仮パラメータテーブル72から成る。
【0015】
一括関数生成処理24は、一括呼出化前中間語31と一括関数情報テーブル7を入力とし、一括呼出化後中間語32に一括関数を生成する。
一括呼出化変換処理25は、一括呼出化前中間語31と一括呼出情報テーブル6を入力とし、一括呼出化前中間語31の関数呼出を一括関数呼出に変換し、一括呼出化後中間語32に生成する。
【0016】
次に、具体的な適用例の説明のため、処理対象たるソースプログラムの例を挙げておく。
図5は、本発明の一実施例の説明のためのソースプログラム例(C言語で書かれたプログラム例)である。
本実施例において、中間語3はソースプログラムと同等の情報を有しており特別に中間語の形式である必要はない。そこで、中間語3の例示に当たっては、ソースプログラムの形式で記述するものとする。従って、図5はソースプログラム例であるとともに、(一括呼出化前の)中間語31の例ともなっている。
また、図2の説明でも述べたとおり、本実施例では(本質的には不要な)ループ展開を行っている。図5では、ループ展開は適用されていないが、ループ展開後に同一関数の呼出が生成される場合にも、一般性を失うことなく適用できる。
図5のプログラム例では、関数f、g、mainの3関数があり、関数mainが関数gを1回、関数gが関数fを2回呼び出している。17行と20行の関数fの呼出が、一括呼出可能な関数である。
【0017】
図6は、図5のソースプログラム例に対する一括関数呼出化後のソースプログラム例であり、一括関数呼出化後中間語32に対応している。図6では、図5にはなかった一括関数Fが新たに生成されている(30行から36行)。また、図5では関数gは関数fを2回呼び出していたが、図6では関数fの2回の呼出と同等の処理を行う一括関数Fの呼出1回(16行)となっている。即ち、関数fの2回の呼出を一括関数Fの一回の呼出に変換しており、一括呼出化変換を行った結果の例である。
【0018】
以降では、一括関数呼出化処理2の細部の説明を行なう。
説明にあたっては、図5の中間語を入力例とし、各種テーブルの出力例を逐次示していく。そこで、先ず、各種テーブルの構成例を説明してから、処理手順の説明を行なう。
以下、関数情報テーブル4、呼出情報テーブル5、一括呼出情報テーブル6、一括関数情報テーブル7の順にその構成例を述べる。
【0019】
図7は、図5の例に対して求めた関数テーブル41の構成例である。
関数テーブルは、プログラム中に出現する関数定義毎に、エントリが作成される。各関数には、一意な関数番号が付与されており、その関数番号により各エントリがアクセス可能となっている。各エントリは、関数番号欄411、関数名称欄412、定義行番号欄413、仮返数欄414、仮引数集合欄415、呼出集合欄416で構成される。
【0020】
関数番号欄411には、関数テーブルのエントリ番号、関数名称欄412には、対応する関数の名称が格納される。
定義行番号欄413には、当該関数の中間語3での関数定義情報が格納される。この定義行番号欄により、対応する関数定義の全ての情報を得ることができる。例えば、関数の各種インタフェース情報の取得や、関数定義本体の読み出し/複写等も可能である。本実施例では、図7で示したように、ソースプログラムの行番号の形式で示してある。
仮返数欄414および仮引数集合欄415は、当該関数の仮返数および仮引数の情報が、仮パラメータテーブル42のエントリ番号の形式で格納される。
呼出集合欄416は、当該関数中に存在する関数呼出の情報が、呼出テーブル51のエントリ番号の形式で格納される。
【0021】
図8は、図5の例に対して求めた仮パラメータテーブル42の構成例である。
仮パラメータテーブルは、関数テーブル41の関数インタフェース情報を格納するための補助テーブルである。仮返数や仮引数毎に、エントリが作成され、そのエントリ番号が関数テーブル41の仮返数欄や仮引数集合欄に格納される。
各エントリは、仮パラメータ番号欄421、仮パラメータ位置番号欄422、仮パラメータ型欄423、仮パラメータ変数欄424で構成される。
【0022】
仮パラメータ番号欄421には、仮パラメータテーブルのエントリ番号が格納される。
仮パラメータ位置番号欄422には、当該仮パラメータの出現位置が番号で示してある。仮返数の位置番号は0、i番めの仮引数は位置番号iとなる。
仮パラメータ型欄423には、仮パラメータの型情報が格納される。
仮パラメータ変数欄424には、対応する仮パラメータの名称が格納される。
【0023】
図9は、図5の例に対して求めた呼出テーブル51の構成例である。
呼出テーブルは、プログラム中に出現する関数呼出毎に、エントリが作成される。各エントリは、呼出番号欄511、呼出行番号欄512、呼出関数番号欄513、実返数欄514、実引数集合欄515で構成される。
【0024】
呼出番号欄511には、呼出テーブルのエントリ番号、呼出行番号欄512には、対応する関数呼出の行番号が格納される。
呼出関数番号欄513には、当該呼出が呼び出す関数が、関数テーブル41の関数番号が格納される。
実返数欄514および実引数集合欄515は、当該呼出の実返数および実引数の情報が、実パラメータテーブル52のエントリ番号の形式で格納される。
【0025】
図10は、図5の例に対して求めた実パラメータテーブル52の構成例である。
実パラメータテーブルは、呼出テーブル51の呼出インタフェース情報を格納するための補助テーブルである。実返数や実引数毎に、エントリが作成され、そのエントリ番号が呼出テーブル51の実返数欄や実引数集合欄に格納される。各エントリは、実パラメータ番号欄521、実パラメータ位置番号欄522、実パラメータ式欄522で構成される。
【0026】
実パラメータ番号欄521には、実パラメータテーブルのエントリ番号が格納される。
実パラメータ位置番号欄522には、当該実パラメータの出現位置が番号で示してある。実返数の位置番号は、(仮パラメータテーブル42の仮パラメータ位置番号欄422と同様に)0、i番めの実引数は位置番号iとなっている。
実パラメータ式欄523には、対応する実パラメータの名称が格納される。
【0027】
図11は、図5の例に対して求めた一括呼出テーブル61の構成例である。
一括呼出テーブルは、一括関数の(一括)呼出毎に、エントリが作成される。各エントリは、一括呼出番号欄611、生成元呼出集合欄612、一括関数番号欄613、実返数名称欄614、実返数型欄615、実返数集合欄616、実引数集合欄617で構成される。
【0028】
一括呼出番号欄611には、一括呼出テーブルのエントリ番号が格納される。
生成元呼出集合欄612には、一括呼出化する呼出の集合が、呼出テーブル51のエントリ番号の形式で格納される。
一括関数番号欄613には、当該一括呼出が呼び出す一括関数が、一括関数テーブル71のエントリ番号(一括関数関数番号)で格納される。
実返数名称欄614および実返数型欄615には、返数の名称および返数の型が格納される。
実返数集合欄616および実引数集合欄617は、当該一括呼出の実返数および実引数の情報が、一括実パラメータテーブル62のエントリ番号の形式で格納される。
【0029】
図12は、図5の例に対して求めた一括実パラメータテーブル62の構成例である。
一括実パラメータテーブルは、一括呼出テーブル61の呼出インタフェース情報を格納するための補助テーブルである。実返数や実引数毎に、エントリが作成され、そのエントリ番号が一括呼出テーブル61の実返数欄や実引数集合欄に格納される。各エントリは、一括実パラメータ番号欄621、一括実パラメータ位置番号欄622、生成元実パラメータ番号欄623、変換前名称欄624、変換後名称欄625で構成される。
【0030】
一括実パラメータ番号欄621には、一括呼出実パラメータテーブルのエントリ番号が格納される。
一括実パラメータ位置番号欄622には、当該実パラメータの出現位置が番号で示してある。
生成元呼出集合欄623には、一括化する呼出が、呼出テーブル51のエントリ番号の集合形式で格納される。
変換前名称欄724には、生成元呼出における実パラメータ名称、変換後名称欄725には、一括呼出化後の(一括)実パラメータ名称がそれぞれ格納される。尚、変換前名称欄724と変換後名称欄725は、実返数に対してのみ有効な欄である(実引数に関しては、常に空白となる)。
【0031】
図13は、図5の例に対して求めた一括関数テーブル71の構成例である。
一括関数テーブルは、一括化関数生成を行う関数毎に、エントリが作成される。各関数には、一意な一括関数番号が付与されており、その一括関数番号により各エントリがアクセス可能となっている。各エントリは、一括関数番号欄711、一括関数名称欄712、一括化係数欄713、生成元関数番号欄714、仮返数型欄715、仮返数名称欄716、仮返数集合欄717、仮引数数集合欄718で構成される。
【0032】
一括関数番号欄711には、一括関数テーブルのエントリ番号、
一括関数名称欄712には、生成する一括関数の名称が格納される。
一括化係数欄713には、何回の呼出を一括化するかの個数が格納される。
生成元関数番号欄714には、一括化する関数が関数テーブル41の関数番号の形式で格納される。
仮返数型欄715および仮返数名称欄716には、返数の型および返数の名称が格納される。
仮返数集合欄717および仮引数集合欄718は、当該一括関数の仮返数および仮引数の情報が、一括仮パラメータテーブル72のエントリ番号の形式で格納される。
【0033】
図14は、図5の例に対して求めた一括仮パラメータテーブル72の構成例である。
一括仮パラメータテーブルは、一括関数テーブル71の関数インタフェース情報を格納するための補助テーブルである。仮返数や仮引数毎に、エントリが作成され、そのエントリ番号が一括関数テーブル71の仮返数集合欄や仮引数集合欄に格納される。各エントリは、一括仮パラメータ番号欄721、生成元仮パラメータ番号欄722、一括仮パラメータ位置番号欄723、反復番号欄724、変換前名称欄725、変換後名称欄726で構成される。
【0034】
一括仮パラメータ番号欄721には、一括仮パラメータテーブルのエントリ番号が格納される。
生成元仮パラメータ番号欄722には、生成元関数の対応する仮パラメータが、仮パラメータテーブル42の仮パラメータ番号の形式で格納される。
一括仮パラメータ位置番号欄723には、当該仮パラメータの出現位置が番号で示してある。一括仮パラメータ位置番号は、仮返数と仮引数は独立に数えられ、i番めの仮返数/仮引数は位置番号iとなる。
【0035】
反復番号欄724には、一括化の際に何番めの関数の仮パラメータであったかが格納される。この反復番号は0から数え始め、一括化係数がnのときn−1までの番号が付与されることになる。
変換前名称欄725には、生成元関数における仮パラメータ名称、変換後名称欄726には、一括関数化後の(一括)仮パラメータ名称がそれぞれ格納される。
以上で、本実施例で用いる各種テーブル構成の説明を終る。
【0036】
以下、これらのテーブルを生成/参照する各種処理の説明を順に行なう。
図15は、関数情報テーブル生成処理21のフローチャート図である。関数情報テーブル生成処理は、中間語3を逐次走査し、関数定義を検出したらその関数定義情報を収集・登録した関数情報テーブル4を生成する。以下、その手順を説明する。
【0037】
先ず、関数番号fi、仮パラメータ番号fpiを0で初期化する(ステップ1501)。
次に、未処理関数があるか否かを判定(ステップ1502)し、未処理関数がなくなるまで、ステップ1503以下の処理を行なう。
未処理関数fがある場合には、先ず、関数エントリFを生成し、関数番号fiをインクリメントする(ステップ1503)。以下、ステップ1504以降でこの関数エントリFに関数fの関数情報を格納する。
【0038】
先ず、fの定義行番号をfl、関数名をfnとする(ステップ1504)。次に、仮パラメータ集合FPSを求めるため、FPSを空集合で初期化する(ステップ1505)。そして、未処理仮パラメータがあるか否かを判定(ステップ1506)し、未処理仮パラメータがなくなるまで、ステップ1507以下の処理を行なう。
未処理仮パラメータfpがある場合には、仮パラメータエントリFPを生成し、仮パラメータ番号fpiをインクリメントする(ステップ1507)。
【0039】
次に、fpの仮パラメータ情報を仮パラメータテーブル42に格納(ステップ1508)し、そのエントリ番号fpiを仮パラメータ集合FPSに加える(ステップ1509)。以下、未処理仮パラメータがなくなるまで、ステップ1506からステップ1509を反復実行する。尚、ステップ1508は仮パラメータ情報である、仮パラメータ番号、仮パラメータ位置、仮パラメータ種別、仮パラメータ型、仮パラメータ名称をエントリFPに格納するが、詳細は略す(図8の仮パラメータテーブル42の説明を参照)。
【0040】
ステップ1506の判定がnoとなった時点で、仮パラメータ集合FPSの収集が終わるので、Fに全ての関数情報を格納(ステップ1510)して、次の未処理関数判定(ステップ1502)を行う。全ての関数を処理し終わった時点で処理を終了する。
【0041】
図7および図8は、図5で示されたソースプログラムに対し、上記の処理を行なった結果を示す関数情報テーブルの例となっている。
例えば、エントリ417は、図5の003行から008行までで定義されている関数fの情報が格納されている。また、仮返数欄により、名称rで仮パラメータ位置0(=仮返数)、仮パラメータ型がintである仮返数があることが分かる。
【0042】
図16は、呼出情報テーブル生成処理22のフローチャート図である。
呼出情報テーブル生成処理は、中間語3を逐次走査し、関数呼出を検出したらその呼出情報を収集・登録した呼出情報テーブル5を生成する。以下、その手順を説明する。
【0043】
先ず、呼出番号ci、実パラメータ番号apiを0で初期化する(ステップ1601)。
次に、未処理関数があるか否かを判定(ステップ1602)し、未処理関数がなくなるまで、ステップ1603以下の処理を行なう。
未処理関数fがある場合には、先ず、その関数エントリをFとし(ステップ1603)、呼出集合CSを空集合で初期化する(ステップ1604)。
次に、fに未処理の関数呼出があるか否かを判定(ステップ1605)し、存在する場合には、ステップ1606以降で呼出情報の登録を行う。
呼出情報の登録に当たっては、先ず、呼出エントリCを生成し、呼出番号ciをインクリメントする(ステップ1606)。
次に、呼出行番号cl、呼出関数番号fiを求める(ステップ1607)。尚、呼出関数番号fiの取得は、関数情報テーブル41を検索することで容易に実現できる(関数情報テーブルに存在しない場合には空欄としておき、一括化対象から外す)。
【0044】
次に、実パラメータ集合APSを求めるため、APSを空集合で初期化する(ステップ1608)。そして、未処理実パラメータがあるか否かを判定(ステップ1609)し、未処理実パラメータがなくなるまで、ステップ1610以下の処理を行なう。
即ち、未処理実パラメータapがある場合には、実パラメータエントリAPを生成し、実パラメータ番号apiをインクリメント(ステップ1610)後、apの実パラメータ情報を実パラメータテーブル52に格納(ステップ1611)し、そのエントリ番号apiを実パラメータ集合APSに加える(ステップ1612)。尚、ステップ1611は、実パラメータ情報である、実パラメータ番号、実パラメータ位置番号、実パラメータ式をエントリAPに格納するが、詳細は略す(図14の実パラメータテーブル52の説明を参照)。
【0045】
ステップ1609の判定がnoとなった時点で、実パラメータ集合APSの収集が終わるので、Cに全ての呼出情報を格納(ステップ1613)する (実パラメータ集合APSは、実返数と実引数を合わせたもので、呼出情報テーブルの実返数欄と実引数欄に格納する)。その後、 CSにciを加え(ステップ1614)、次の未処理呼出判定(ステップ1605)を行う。ステップ1605の判定がnoとなった段階で、関数fにおける全ての呼出を処理し終わるので、Fの呼出集合欄にCSを格納(ステップ1615)し、次の未処理関数の判定(ステップ1602)に進む。全ての関数を処理し終わった時点で処理を終了する。
【0046】
図9および図10は、図5のソースプログラムの例に対し、上記の処理を行なった結果を示す呼出情報テーブル5の例となっている。例えば、図9のエントリ516は、17行目の関数fの呼出情報を格納したものである。この呼出では、実引数として(p*p,q*q)を渡し、実返数r1に返却値が格納されることが分かる。
【0047】
図17は、一括呼出化情報テーブル生成処理23のフローチャート図である。
一括呼出化情報テーブル生成処理は、呼出情報テーブル51を逐次走査し、一括呼出化可能な呼出を検出したら、その一括呼出情報を収集・登録した一括呼出情報テーブル6および一括関数情報テーブル7を生成する。以下、その手順を説明する。
【0048】
先ず、一括呼出番号aci、一括実パラメータ番号aapi、一括関数番号afi、一括実パラメータ番号afpiを0で初期化する(ステップ1701)。次に、未処理関数エントリがあるか否かを判定(ステップ1702)し、未処理関数エントリがなくなるまで、ステップ1703以下の処理を行なう。
未処理関数エントリFがある場合には、先ず、その呼出集合をCSとする(ステップ1703)。
【0049】
次に、CSから同一関数の呼出の集合である同型呼出集合SCSの抽出処理(ステップ1704からステップ1711)に移る。この同型呼出集合SCSの抽出処理は、図3のステップ230に相当する。
先ず、CSをワーク集合WCSに格納し、SCSを空集合で初期化する(ステップ1704)。
次に、CSに未処理の呼出エントリCがあるか否かを判定(ステップ1705)し、存在する場合には、Cの呼出番号ciと呼出関数番号fiを取得(ステップ1706)し、WCSからciを除く(ステップ1707) 。
次に、WCSに未処理エントリWCがあるかどうかを判定(ステップ1708)し、存在する場合には、WCの呼出番号wciと呼出関数番号wfiを取得(ステップ1709)する。
そして、fiとwfiの一致判定(ステップ1710)により、同一関数の呼出であるかを調べる。同一関数である場合には、SCSにwciを加えて(ステップ1711)からステップ1708に進む。
【0050】
ステップ1708で全てのワーク呼出集合の要素を判定した時点で、同型呼出集合SCSの抽出が完了する。
ここで、SCSが複数要素を持つか否かを判定(ステップ1712)し、複数存在する場合にのみ、一括呼出化情報抽出処理(ステップ231。詳細は図18を参照)を実行し、ステップ1705以降で次の同型呼出集合SCSの処理に進む。
ステップ1705で全エントリを処理したら、ステップ1702に進み、次の関数エントリを処理する。
全ての関数エントリを処理しおわった時点で、一括呼出化情報テーブル生成処理を終了する。
【0051】
図18は、一括呼出化情報抽出処理231のフローチャート図である。一括呼出化情報抽出処理は、与えられた同型呼出集合SCSから、一括呼出化可能な呼出を集めた一括呼出集合ASCSを抽出し、一括呼出情報テーブル6および一括関数情報テーブル7を生成する。以下、その手順を説明する。
先ず、SCSに未処理の呼出エントリSCがあるか否かを判定(ステップ1801)し、存在する場合には、Cの呼出番号sciを取得(ステップ1802)する。
次に、SCSをワーク集合WSCSに格納し、ASCSを空集合で初期化(ステップ1803)後、WSCSからsciを除く(ステップ1804) 。
次に、WSCSに未処理エントリWSCがあるかどうかを判定(ステップ1805)し、存在する場合には、WSCの呼出番号wsciを取得(ステップ1806)する。
【0052】
そして、sciとwsciが一括呼出化可能であるかを判定(ステップ1807)し、可能である場合には、ASCSにwsciを加える(ステップ1808)。尚、この一括呼出化の可能性判定は、wsciの呼出が、sciの呼出行番号の位置に移動可能か等により判定するが、本発明には直接関係しないので詳細は略す。
その後、ステップ1805に進み、次のWSCの要素を調べる。
ステップ1805で全てのワーク呼出集合WSCSの要素を判定した時点で、一括化呼出集合ASCSの抽出が完了する。
ここで、ASCSが複数要素を持つか否かを判定(ステップ1809)し、複数存在する場合にのみ、一括呼出化情報登録処理(ステップ232。詳細は図19を参照)を実行する。
次に、SCSからASCSを除き(ステップ1810)、ステップ1801以降で次の同型呼出集合SCSの要素の処理に進む。
ステップ1801で全エントリを処理しおわった時点で、一括呼出化情報抽出処理を終了する。
【0053】
図19は、一括呼出化情報登録処理232のフローチャート図である。一括呼出化情報登録処理は、与えられた一括呼出集合ASCSから、一括呼出情報テーブル6および一括関数情報テーブル7を生成する。以下、その手順を説明する。
先ず、一括呼出エントリACを作成して、aciをインクリメント(ステップ1901)後、ASCSをACの生成元呼出集合欄に格納する(ステップ1902)。
次に、ASCSの(任意の要素の)呼出関数番号をci、要素数をafkとする(ステップ1903)。
そして、 ASCSから変数となる型artを生成(ステップ1904)し、ACの返数型欄に格納(ステップ1905)する。尚、 artは、本実施例では配列型としたが、生成元呼出集合の全ての返数が表現できる型であれば何でもよい。 その生成方法は、本発明にとって本質的ではないので詳細は略す。
【0054】
次に、一意な名称acnを生成し、ACの実返数名称欄に格納(ステップ1906)後、一括呼出実引数登録処理(ステップ233。詳細は図20)、一括呼出実返数登録処理(ステップ234。詳細は図21)を行って、一括呼出情報テーブルへの登録を完了する。
【0055】
次に、一括関数情報テーブルへの登録を行う。
先ず、一括関数エントリAFを作成して、afiをインクリメントする(ステップ1911)。
次に、artをAFの返数型欄に格納(ステップ1912)する。
次に、一意な名称afnを生成し、AFの仮返数名称欄に格納(ステップ1913)後、一括化係数欄にafkを格納する(ステップ1914)。
最後に、一括関数仮引数登録処理(ステップ235。詳細は図22)、一括関数仮返数登録処理(ステップ236。詳細は図23)を行って、一括関数情報テーブルへの登録を完了する。
以上で、一括呼出情報テーブルと一括関数情報テーブルへの登録が完了するので、一括化呼出情報登録処理を終了する。
【0056】
図20は、一括呼出実返数登録処理233のフローチャート図である。一括呼出実返数登録処理は、一括呼出テーブルの各エントリにある生成元呼出集合から一括実パラメータテーブル62を生成し、一括呼出テーブル61の一括呼出実返数集合欄616に登録する。以下、その手順を説明する。
先ず、一括呼出実返数集合AARSを空集合で初期化する(ステップ2001)。また、一括呼出実返数位置番号aaprも0で初期化する(ステップ2002)。
【0057】
そして、ACの生成呼出元集合をACS(ステップ2003)として、ACSに未処理の呼出Cが存在かを判定(ステップ2004)し、存在するときは、ステップ2005からステップ2013を反復実行する。
この反復処理では、Cの実返数集合をARS(ステップ2005)とし、ARSに未処理の実返数ARが存在かを判定(ステップ2006)し、存在するときは、ステップ2007からステップ2012を反復実行する。
この反復処理では、先ず、aaprをインクリメントする(ステップ2007)。
次に、ARの実パラメータ番号と名称を、それぞれari、arnとする(ステップ2008)。
次に、一括呼出実返数名称aarnを生成(ステップ2009)する。
次に、一括呼出実パラメータエントリAAPを生成し、aapiをインクリメント(ステップ2010)する。
【0058】
次に、AAPに一括呼出実返数情報を登録(ステップ2011)後、AARSにaariを加える(ステップ2012)。
ステップ2006の判定でnoとなったとき、全ての実返数の処理が終了するので、AARSをACの一括呼出実返数集合欄に格納(ステップ2013)後、次のACSの処理を行う。
ACSの全ての呼出エントリを処理し終えた時点で、一括呼出実返数登録処理233が終了する。
【0059】
図21は、一括呼出実引数登録処理234のフローチャート図である。一括呼出実引数登録処理は、一括呼出テーブルの各エントリにある生成元呼出集合から一括実パラメータテーブル62を生成し、一括呼出テーブル61の一括呼出実引数集合欄617に登録する。以下、その手順を説明する。
【0060】
先ず、一括呼出実引数集合AAASを空集合で初期化する(ステップ2101)。また、一括呼出実引数位置番号aapaも0で初期化する(ステップ2102)。
そして、ACの生成呼出元集合をACS(ステップ2103)として、ACSに未処理の呼出Cが存在かを判定(ステップ2104)し、存在するときは、ステップ2105からステップ2113を反復実行する。
この反復処理では、Cの実引数集合をAPS(ステップ2105)とし、APSに未処理の実引数APが存在かを判定(ステップ2106)し、存在するするときは、ステップ2107からステップ2112を反復実行する。
この反復処理では、先ず、aapaをインクリメントする(ステップ2107)。
【0061】
次に、APの実パラメータ番号と名称を、それぞれapi、apnとする(ステップ2108)。
次に、一括呼出実引数名称aapnを生成(ステップ2109)する。
次に、一括呼出実パラメータエントリAAPを生成し、aapiをインクリメント(ステップ2110)する。
次に、AAPに一括呼出実引数情報を登録(ステップ2111)後、AAASにaapiを加える(ステップ2112)。
ステップ2106の判定でnoとなったとき、全ての実引数の処理が終了するので、AAASをACの一括呼出実返数集合欄に格納(ステップ2013)後、次のACSの処理を行う。
ACSの全ての呼出エントリを処理し終えた時点で、一括呼出実引数登録処理234が終了する。
【0062】
図11および図12は、図9および図10で示された呼出情報テーブル5を入力とし、図20および図21の処理を行なった結果を示す一括呼出情報テーブル6の例となっている。
例えば、図11のエントリ618は、図9に示された呼出テーブル51のエントリ516とエントリ517の呼出が一括呼出化可能であることを示している。この一括呼出は、実引数として(p*p,q*q,p*q ,q*p )を渡し、型がintの配列である実返数arfに返却値を格納すればよいことが分かる。
【0063】
図22は、一括関数仮返数登録処理235のフローチャート図である。一括関数仮返数登録処理は、一括関数テーブルの各エントリにある生成元関数番号と一括化係数から、一括仮パラメータテーブル72を生成し、一括関数テーブル71の一括関数仮返数集合欄717に登録する。以下、その手順を説明する。
先ず、一括関数仮返数集合AFRSを空集合で初期化する(ステップ2201)。また、一括関数仮返数位置番号afprも0で初期化する(ステップ2202)。
次に、AFの一括化係数をafk、AFの生成元関数エントリをFとする(ステップ2203。両者は、既に一括呼出化常用登録処理で算出済み)。
さらに、反復回数iを0で初期化(ステップ2204)後、 iがafkと等しいかどうかを判定(ステップ2205)することで、iがafkと等しくなるまで、 ステップ2206からステップ2212を反復実行する。
この反復処理では、先ず、iをインクリメントする(ステップ2206)。
次に、afprをインクリメントする(ステップ2207)。
【0064】
次に、AFの仮パラメータ番号と名称を、それぞれfpi、fpnとする(ステップ2208)。
次に、一括関数仮返数名称afpnを生成(ステップ2209)する。
次に、一括関数仮パラメータエントリAFPを生成し、afpiをインクリメント(ステップ2210)する。
次に、AFPに一括関数仮返数情報を登録(ステップ2211)後、AFRSにafpiを加える(ステップ2212)。
ステップ2205の判定でnoとなったとき、AFRSをAFの一括関数仮返数集合欄に格納(ステップ2213)し、一括関数仮返数登録処理235が終了する。
【0065】
図23は、一括関数仮引数登録処理236のフローチャート図である。一括関数仮引数登録処理は、一括関数テーブルの各エントリにある生成元関数番号と一括化係数から、一括仮パラメータテーブル72を生成し、一括関数テーブル71の一括関数仮引数集合欄718に登録する。以下、その手順を説明する。
先ず、一括関数仮引数集合AFASを空集合で初期化する(ステップ2301)。また、一括関数仮引数位置番号afpaも0で初期化する(ステップ2302)。
次に、AFの一括化係数をafk、AFの生成元関数エントリをFとする(ステップ2303。両者は、既に一括呼出化常用登録処理で算出済み)。
【0066】
さらに、反復回数iを0で初期化(ステップ2304)後、 iがafkと等しいかどうかを判定(ステップ2305)することで、iがafkと等しくなるまで、 ステップ2306からステップ2315を反復実行する。
この反復処理では、先ず、 iをインクリメントする(ステップ2206)。次に、Fの仮引数集合をFAS(ステップ2307)とし、FASに未処理の仮引数FAが存在かを判定(ステップ2308)し、存在するするときは、ステップ2309からステップ2314を反復実行する。
この反復処理では、先ず、afpaをインクリメントする(ステップ2309)。
次に、AFの仮パラメータ番号と名称を、それぞれfpi、fpnとする(ステップ2310)。
【0067】
次に、一括関数仮引数名称afpnを生成(ステップ2311)する。
次に、一括関数仮パラメータエントリAFPを生成し、afpiをインクリメント(ステップ2312)する。
次に、AFPに一括関数仮引数情報を登録(ステップ2313)後、AFASにafpiを加える(ステップ2314)。
ステップ2308の判定でnoとなったとき、全ての仮引数の処理が終了するので、AFASをAFの一括関数仮引数集合欄に格納(ステップ2315)後、
次の反復処理を行う。
iとafkが一致するまで、一括化係数分反復実行した時点で、一括関数仮引数登録処理236が終了する。
【0068】
図13および図14は、図7から図10に示された関数情報テーブル4および呼出情報テーブル5を入力とし、図17から図23の処理を行なった結果を示す一括関数情報テーブル7の例となっている。
例えば、図13のエントリ719は、図7に示された関数テーブル41のエントリ417を、一括化係数2で一括関数化したものであることを示している。この一括関数は、仮引数として(x0,y0,x1,y1 )を渡され、型がintの配列である仮返数frfを返却する。
以上で、一括呼出化情報テーブル生成処理23の説明を終える。
一括呼出化情報テーブル生成処理23の後、一括化関数生成処理24、一括呼出化変換処理25を行う。以下順に説明する。
【0069】
図24は、一括関数生成処理24のフローチャート図である。
一括関数生成処理は、一括関数情報テーブル7の各エントリから、中間語3中に一括関数を生成する。以下、その手順を説明する。
未処理の一括関数エントリAFがあるかどうかを調べ(ステップ2401)、存在する全ての一括関数エントリに対し、ステップ2402以下の処理を行う。
先ず、AFの生成元関数番号をfi、AFの一括化係数をafkとする(ステップ2402)。
次に、AFの仮返数集合AFRSから、一括関数仮返数定義を生成する(ステップ2403)。
次に、AFの仮引数集合AFASから、一括関数仮引数定義を生成する(ステップ2404)。
以上で、一括関数の呼出インタフェースの生成が完了するので、次に、ステップ2406からステップ2413で一括関数本体を生成する。
【0070】
先ず、定義部反復回数mを0で初期化(ステップ2405)後、fiの定義部FBをコピーする(ステップ2406)。
次に、このコピーされた領域FB中の仮パラメータの変換を行う。
先ず、AFの仮返数集合AFRSと仮引数集合AFASの和集合を一括関数仮パラメータ集合AFPSとする(ステップ2407)。
AFPSに未処理の仮パラメータエントリAFPがあるか否かを判定(ステップ2408)し、存在する場合はステップ2409以降で仮パラメータの変換を行う。
【0071】
先ず、AFPの変換前名称をbcn、変換後名称をacnとする(ステップ2409)。
次に、FBに出現する名称bcnをacnに変換する(ステップ2410)後、さらに次の仮パラメータの変換のため、ステップ2408に進む。
AFPSの全要素の処理が終わったら、mをインクリメント(ステップ2411)し、一括化係数afkと一致するか否かを判定する(ステップ2412)。
一致しない間は、ステップ2406に進み反復実行し、mがafkと一致したら、AFの仮返数名称を用いて一括関数仮返数返却を生成(ステップ2413)し、ステップ2401に進んで次の一括関数エントリの処理を行う。
全ての一括関数エントリの処理が終わった時点で、一括関数生成処理が終了する。
【0072】
図6は、図13および図14に示された一括関数情報テーブル7を入力とし、図24の処理を行なった結果を示す(ソースプログラム形式による)中間語の例となっている。図6の30行から36行に、図13のエントリ719で示された一括関数が生成されている。32行には、一括関数仮返数定義が、35行には一括関数仮返数返却分が、それぞれ生成されている。
【0073】
図25は、一括呼出化変換処理25のフローチャート図である。
一括呼出化変換処理は、一括呼出情報テーブル6を使って、中間語3中の一括化可能同型呼出を、一括呼出に変換する。以下、その手順を説明する。
未処理の一括呼出エントリACがあるかどうかを調べ(ステップ2501)、存在する全ての一括呼出エントリに対し、ステップ2502以下の処理を行う。
先ず、ACの実返数名称から、一括呼出実返数定義を生成する(ステップ2502)。
次に、ACの生成元呼出集合をCS、ACの実返数集合をAAPSとする(ステップ2503)。
次に、CSの任意の要素Cを取り出し、呼出関数番号fiを取得する(ステップ2504)。
【0074】
次に、Cの呼出行番号から一括呼出生成位置acpを決定する(ステップ2505)。この一括呼出生成位置は、一括呼出化の可能性の判定により保証された場所ならば、何処でもよいが、本実施例では、便宜上、最初の呼出位置の直前とする。
次に、ACから一括呼出を作成し、acpに生成する(ステップ2506)。尚、一括呼出の作成は、一括呼出実返数名称、一括関数番号、一括呼出実引数集合により容易に作成できるので、詳細は略す。
次に、CSに未処理の呼出エントリCがあるかどうかを判定(ステップ2507)し、存在する場合は、Cの呼出行番号を見て呼出を削除する(ステップ2508)。
【0075】
CSの全ての呼出を削除したら、AARSに未処理の一括呼出実引数エントリAARがあるかどうかを判定(ステップ2509)し、存在する場合には、ステップ2510からステップ2511で、実返数の変換を行う。
AARの変換前名称をbcn、変換後名称をacn(ステップ2510)とし、fiの関数本体領域に出現するbcnをacnに変換する(ステップ2511)。
ステップ2509の判定のnoとなったとき、全ての一括呼出実返数の変換が終わり、ACに関する変換処理が終了する。
その後、ステップ2501に進み、次の一括呼出エントリの一括呼出化変換処理を行う。
全ての一括呼出エントリの処理が終わった時点で、一括呼出化変換処理が終了する。
【0076】
図6は、図13および図14に示された一括呼出情報テーブル6を入力とし、図25の処理を行なった結果を示す(ソースプログラム形式による)中間語の例となっている。
図5の17行と21行の2つの関数呼出が、図6では16行の一括呼出へと変換されている。また、14行には、一括呼出実返数定義生成されている。
本実施例によれば、関数呼出の回数を低減するにより、呼出オーバヘッドの削減を行うことが可能となり、オブジェクトプログラムの処理性能の向上に寄与する。
【0077】
図26に本発明の他の本実施例のコンパイラの処理手順を示す。図26は、ループ展開時に一括関数呼出化する第2の実施例と、ループ並列化時に一括関数呼出化する第3の実施例に共通のコンパイラの処理手順である。
構文解析201とコード生成処理203は図のそれと同様なので説明は省略する。
ループ展開ないしループ並列化と一括関数呼出化処理205は中間後3を入力とし、反復処理を直列/並列展開するループ展開/ループ並列化を行い、一括関数呼出化変換を行った中間語3を出力する。ループ展開の場合が第2実施例、ループ並列化の場合が第3実施例となる。尚、処理の大部分とテーブル構成等は、第1の実施例と同様であるため、以下では、概略のみを説明する。
【0078】
図27は、本発明の第2の実施例であるループ展開時に一括関数呼出化する場合の図26のステップ205の処理手順を示すフローチャート図である。以下順に説明する。
先ず、関数情報テーブル生成処理2701により、ソースプログラム中の関数定義の各種情報を抽出し、関数情報テーブル4を作成する。
次に、未処理のループLが存在するか否かを判定(ステップ2702)し、存在する場合にはステップ2703からステップ2710までを反復実行する。
この反復処理では、先ずLがループ展開可能であるかどうかを判定(ステップ2704)し、存在する場合にはステップ2705からステップ2710までを反復実行する。
【0079】
この反復処理では、先ずLをn回ループ展開を行う(ステップ2704)。
次に、呼出情報テーブル生成処理(ステップ2705)を行い、関数呼出に関する情報を抽出し、呼出情報テーブル5を生成する。
次に、Lからループ展開によって生成されたn個の同一関数の呼出を同型呼出集合SCSとする(ステップ2706)。
次に、同型呼出集合SCSから一括呼出化可能な呼出を抽出する一括呼出抽出処理(ステップ2707)を行い、抽出した一括呼出を一括呼出情報テーブルに登録する(ステップ2708)。
ステップ2702でnoとなった時、全てのループに対して処理を終え、一括関数生成処理(ステップ2709)、一括呼出化変換処理(ステップ2710)を行い、処理を終了する。
【0080】
尚、以下に図27のステップと図3のステップの対応関係を示す。以下の各ステップの処理内容は、括弧内で示した図3のステップと同様の処理である。
ステップ2701(図3のステップ21)
ステップ2705(図3のステップ22)
ステップ2709(図3のステップ231)
ステップ2710(図3のステップ232)
ステップ2711(図3のステップ24)
ステップ2712(図3のステップ25)
【0081】
図28は、本発明の第2および第3実施例の説明のためのソースプログラム例である。本実施例においても、中間語3ソースプログラムの形式で記述するものとする。従って、図28はソースプログラム例であるとともに、(一括呼出化前の)中間語31の例ともなっている。図28のプログラム例では、関数gの16行から22行に、関数fを呼び出すループが存在する。
【0082】
図29は、図27のステップ2704でループ展開した段階の中間語3を、ソースプログラム形式で表現したものである。図28の16行から22行に関数呼出を含むループが、図29の16行から22行へとループ展開されている。
【0083】
図30は、図27ソースプログラムを入力とし、図26の処理を行った結果の中間語3を、ソースプログラム形式で表現したものである。図29の16行から22行のループ展開中の関数fの呼出が一括関数呼出化されている。
本実施例によれば、ループ展開時に一括関数呼出化を行うため、ループ展開数に応じた効率的な一括関数呼出化を行うことができる。
【0084】
図31は、本発明の第3の実施例であるループ並列化時に一括関数呼出化する場合の図26のステップ205の処理手順を示すフローチャート図である。本処理手順は、図27とほとんど同じなので説明は省略する(ステップ3104とステップ3106が若干異なる)。
【0085】
図32は、図30のステップ2704でループ並列化した段階の中間語3を、ソースプログラム形式で表現したものである。図32の18行および19行にある「x||y;」の記法は、xとyが並列に実行されることを示している。図28の16行から22行に関数呼出を含むループが、図32の16行から21行へとループ並列化されていることが分かる。
【0086】
図33は、図27のソースプログラムを入力とし、図30の処理を行った結果の中間語3を、ソースプログラム形式で表現したものである。図31の16行から22行のループ並列化中の関数fの呼出が一括関数呼出化されていることがわかる。
本実施例によれば、ループ並列化時に一括関数呼出化を行うため、ループの並列度に応じた効率的な一括関数呼出化を行うことができる。
【0087】
【発明の効果】
本発明によれば、コンパイラないしソース変換プログラムは、同一関数の呼出を一括関数の呼出に変換することができる。即ち、インライン展開によらない呼出オーバヘッドの削減手段を提供している。、
これにより、インライン展開が適用できない場合にも、呼出オーバヘッドの削減を行うことが可能となり、オブジェクトプログラムの処理性能の向上に寄与する。
【図面の簡単な説明】
【図1】本発明を実施するコンパイラが稼働する計算機システムの構成図である。
【図2】本発明を実施するコンパイラの処理手順を示すフローチャート図である。
【図3】コンパイラの一括関数呼出化処理2のフローチャート図である。
【図4】本発明におけるコンパイラの一括関数呼出化処理2の処理構成図である。
【図5】ソースプログラムの例(一括関数呼出化前の中間語31のソースプログラム形式による構成例)である。
【図6】一括関数呼出化後の中間語32のソースプログラム形式による構成例である。
【図7】関数テーブル41の構成例である。
【図8】仮パラメータテーブル42の構成例である。
【図9】呼出テーブル51の構成例である。
【図10】実パラメータテーブル52の構成例である。
【図11】一括呼出テーブル61の構成例である。
【図12】一括実パラメータテーブル62の構成例である。
【図13】一括関数テーブル71の構成例である。
【図14】一括仮パラメータテーブル72の構成例である。
【図15】関数情報テーブル生成処理21のフローチャート図である。
【図16】呼出情報テーブル生成処理22のフローチャート図である。
【図17】一括呼出化情報テーブル生成処理23のフローチャート図である。
【図18】一括呼出化情報抽出処理231のフローチャート図である。
【図19】一括呼出化情報登録処理232のフローチャート図である。
【図20】一括呼出実返数登録処理233のフローチャート図である。
【図21】一括呼出実引数登録処理234のフローチャート図である。
【図22】一括関数仮返数登録処理235のフローチャート図である。
【図23】一括関数仮引数登録処理234のフローチャート図である。
【図24】一括関数生成処理24のフローチャート図である。
【図25】一括呼出化変換処理25のフローチャート図である。
【図26】第2および第3実施例のコンパイラの処理手順である。
【図27】ループ展開用一括関数呼出化処理のフローチャート図である。
【図28】第2および第3実施例の説明のためのソースプログラムの例である。
【図29】ループ展開後の中間語のソースプログラム形式による構成例である。
【図30】ループ展開用一括関数呼出化変換後の中間語のソースプログラム形式による構成例である。
【図31】ループ並列化用一括関数呼出化処理のフローチャート図である。
【図32】ループ展開後の中間語3のソースプログラム形式による構成例である。
【図33】ループ並列化用一括関数呼出化変換後の中間語のソースプログラム形式による構成例である。
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a program conversion technique such as a compiler, and in particular, for a language having a function call mechanism, collective function calls at the time of program conversion for analyzing the relationship between functions and function calls and generating them as function information and call information. It relates to the conversion method.
[0002]
[Prior art]
In programming in a high-level language, structuring is generally performed by a function (also called a procedure, but hereinafter unified by function). A function is a series of processes described in a parameterized form (hereinafter referred to as a function definition), and by calling it (hereinafter simply referred to as a call), the process within the function definition can be realized. The parameters on the function definition side include dummy arguments and return variables (hereinafter referred to as temporary return numbers). In the description in the function definition, processing is performed using dummy arguments and temporary return numbers (hereinafter referred to as temporary parameters). Is described. Caller parameters include actual arguments and return variables (hereinafter referred to as actual return numbers), and the parameters are specified using the caller variables / expressions (the variables / expressions used as this call interface are the actual parameters). Called). Hereinafter, the temporary parameter and the actual parameter are collectively referred to as an interface variable / expression. Various values can be specified for the actual parameter, and the same process (= function definition) can be repeatedly executed.
[0003]
Thus, while functions are a convenient mechanism for programming, they have a problem that overhead is required at the time of calling. That is, processing performance is reduced by passing arguments, updating / saving / recovering the stack pointer at the time of calling, and increasing the possibility of a cache miss accompanying an instruction jump. In particular, when a function with simple processing contents is repeatedly called, the call overhead cannot be ignored in terms of performance.
[0004]
In order to cope with such a situation, high-level languages often have an inline expansion function. Inline expansion replaces a function call with the contents of the function definition body and suppresses the call. Specifically, it is realized by expanding the contents of the function definition at each call point and replacing the temporary parameter with the actual parameter. For inline development, see Masataka Sasa's Iwanami lecture, Software Science 5 "Programming Language Processor" (Iwanami Shoten, 1989) Details on 450-451.
[0005]
[Problems to be solved by the invention]
Inline expansion is almost the only means of reducing call overhead in high-level languages. However, if the code size becomes too large due to the application of inline expansion, the chance of a cache miss increases and the performance may decrease. For this reason, inline expansion is usually restricted when a large function is called or there are many call locations. That is, when the code amount is extremely increased, the call overhead cannot be reduced by inline expansion. That is, the conventional technique has a problem that there is no means for reducing the call overhead when inline expansion cannot be applied.
An object of the present invention is to provide a means for reducing call overhead that does not depend on inline expansion, so that even when inline expansion cannot be applied, call overhead can be reduced and the processing performance of the object program can be improved. It is to provide a batch function call method.
[0006]
[Means for Solving the Problems]
Inline expansion expands the processing contents of the function definition at each call point and removes the call (at that call point). Therefore, whether or not inline expansion is applied determines whether or not the number of calls at each call point is zero. In the case of multiple calls to the same function, even if inline expansion cannot be applied, if the processing for multiple calls is expanded on the function definition side, the number of calls can be reduced without significantly increasing the code size. It is. In other words, by creating a batch function that executes multiple times of processing of the same function at once and providing a batch call generation means for replacing multiple calls of the same function with a single batch function call, inline expansion It is possible to provide a means for reducing call overhead that does not depend on.
As a result, even when inline expansion cannot be applied, it is possible to reduce the call overhead and contribute to the improvement of the processing performance of the object program.
[0007]
DETAILED DESCRIPTION OF THE INVENTION
The present invention relates to a method for converting a plurality of calls of the same function into a call of a batch function for batch processing.
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
Note that the present invention can be similarly applied when generating a converted source program from a source program and when the compiler converts an intermediate language into an intermediate language after conversion. Will be explained (however, the intermediate language is shown in the form of an equivalent source program).
[0008]
FIG. 1 is a configuration diagram of a computer system in which a compiler that implements the compiling method of the present invention operates. The computer system includes a CPU 101, a display device 102, a keyboard 103, a main storage device 104, and an external storage device 105.
A compiler activation command from the user is received from the keyboard 103. The compiler end message and the error message are displayed on the display device 102. A source program 106 and an object program 107 are stored in the external storage device 105.
The main storage device 104 includes a compiler 108, which stores an intermediate language 3, a function information table 4, a call information table 5, a collective call information table 6, and a collective function information table 7 that are necessary in the compiling process.
The compilation process is controlled by the CPU 101.
[0009]
FIG. 2 shows the processing procedure of the compiler of this embodiment.
In the syntax analysis 201, the lexical syntax analysis is performed with the source program 106 as an input, and the intermediate language 3 is output.
The loop expansion process 202 receives 3 after the middle, performs loop expansion that expands the iterative process to reduce the number of iterations, and outputs the intermediate word 3.
The batch functioning process 2 receives the intermediate language 3 as input, performs batch functioning processing that converts a plurality of function calls into batch command function calls, and outputs the intermediate language 3.
The code generation process 203 converts the intermediate language into the final object program 107 format.
The loop expansion 202 is a desirable process for increasing the application opportunities of the present invention, but is not an essential process.
[0010]
FIG. 3 is a flowchart showing an embodiment of the function call batching method according to the present invention, and shows the procedure of the function call batching process 2 of FIG.
First, the function information table generation process 21 extracts various information of the function definition in the source program and creates the function information table 4. Similarly, the call information table generation process 22 extracts information related to function calls and generates the call information table 5.
[0011]
Next, the batch call information table generation processing 23 extracts information on a batch function for batch processing a plurality of identical function calls from the call information table 5 to generate a batch function information table 6. The batch call information table generation processing 23 includes a homomorphic call extraction processing 230 that extracts information on the same function call, a batch call extraction processing 231 that extracts calls that can be batch-called from the same-type call set, and batches the extracted batch calls. It consists of a batch call information table registration process 232 to be registered in the call information table. Each process will be described in detail with reference to FIGS.
[0012]
Next, a collective function generation process 24 generates a collective function 3 after the middle based on the collective function information table 7.
Finally, the function call in the intermediate language 3 is converted into a batch function call based on the batch call information table 6 by the batch call conversion process 25.
[0013]
FIG. 4 is a processing configuration diagram showing the relationship between the function call batching related processing shown in FIG. 3 and intermediate words and tables as input / output. However, since the intermediate language 3 is generally referred to, only the main input / output relationships are shown.
The function information table generation process 21 receives the intermediate language 31 before calling a batch function as an input, and generates a function information table 4 storing function definition information. The function information table 4 includes a function table 41 that stores a list of functions, and a temporary parameter table 42 that stores information on a dummy argument and a temporary return number serving as a function interface.
The call information table generation process 22 receives the pre-call intermediate language 31 and generates a call information table 5 storing function call information. The call information table 5 includes a call table 51 that stores a list of function calls, and an actual parameter table 52 that stores information on actual arguments and actual return numbers serving as function call interfaces.
[0014]
The batch call information table generation processing 23 receives the call information table 5 and receives a batch call information table 6 that stores information on function calls that can be batch-called, and a batch function that stores information on function definitions to be collectively called. An information table 7 is generated. The batch call information table 6 includes a batch call table 61 that stores a list of calls that can be batch-called, and an actual parameter table 62 that stores information on actual arguments and the number of actual returns serving as a batch call interface. Similarly, the collective function information table 7 includes a collective function table 71 that stores a list of function definitions to be collectively called, and a formal parameter table 72 that stores information on dummy arguments and provisional numbers that serve as an interface for the collective function. Become.
[0015]
The batch function generation process 24 receives the intermediate language 31 before batch calling and the batch function information table 7 as input, and generates a batch function in the intermediate language 32 after batch calling.
The batch call conversion processing 25 receives the intermediate language 31 before batch calling and the batch call information table 6 as input, converts the function call of the intermediate language 31 before batch calling into a batch function call, and performs the intermediate language 32 after batch calling. To generate.
[0016]
Next, in order to explain a specific application example, an example of a source program to be processed is given.
FIG. 5 is an example of a source program (an example of a program written in C language) for explaining an embodiment of the present invention.
In this embodiment, the intermediate language 3 has information equivalent to that of the source program and does not need to be in the form of an intermediate language. Therefore, in the example of the intermediate language 3, it is described in the form of a source program. Therefore, FIG. 5 is an example of the source program and also an example of the intermediate language 31 (before the batch call).
Further, as described in the description of FIG. 2, in this embodiment, loop expansion (essentially unnecessary) is performed. In FIG. 5, loop expansion is not applied, but it can also be applied without loss of generality when a call to the same function is generated after loop expansion.
In the example of the program shown in FIG. 5, there are three functions f, g, and main. The function main calls the function g once, and the function g calls the function f twice. Calling the function f on lines 17 and 20 is a function that can be called collectively.
[0017]
FIG. 6 shows an example of a source program after the batch function call with respect to the source program example of FIG. 5, and corresponds to the intermediate language 32 after the batch function call. In FIG. 6, a collective function F that was not shown in FIG. 5 is newly generated (from line 30 to line 36). In FIG. 5, the function g called the function f twice, but in FIG. Performs processing equivalent to two calls of function f The batch function F is called once (16 lines). That is, this is an example of the result of performing batch call conversion by converting two calls of the function f into one call of the batch function F.
[0018]
Hereinafter, details of the batch function call processing 2 will be described.
In the description, the intermediate language in FIG. 5 is used as an input example, and output examples of various tables are sequentially shown. Therefore, first, a configuration example of various tables will be described, and then a processing procedure will be described.
Hereinafter, configuration examples of the function information table 4, the call information table 5, the collective call information table 6, and the collective function information table 7 will be described in this order.
[0019]
FIG. 7 is a configuration example of the function table 41 obtained for the example of FIG.
In the function table, an entry is created for each function definition that appears in the program. Each function is given a unique function number, and each entry can be accessed by the function number. Each entry includes a function number column 411, a function name column 412, a definition line number column 413, a provisional return number column 414, a formal argument set column 415, and a call set column 416.
[0020]
The function number column 411 stores the entry number of the function table, and the function name column 412 stores the name of the corresponding function.
The definition line number column 413 stores function definition information in the intermediate language 3 of the function. With this definition line number column, all information of the corresponding function definition can be obtained. For example, it is possible to acquire various interface information of a function and read / copy the function definition body. In this embodiment, as shown in FIG. 7, the line numbers of the source program are shown.
The temporary return number column 414 and the temporary argument set column 415 store the temporary return number and the dummy argument information of the function in the form of entry numbers in the temporary parameter table 42.
In the call set column 416, information on function calls existing in the function is stored in the entry number format of the call table 51.
[0021]
FIG. 8 is a configuration example of the temporary parameter table 42 obtained for the example of FIG.
The temporary parameter table is an auxiliary table for storing the function interface information of the function table 41. An entry is created for each temporary return number or dummy argument, and the entry number is stored in the temporary return number column or dummy argument set column of the function table 41.
Each entry includes a temporary parameter number column 421, a temporary parameter position number column 422, a temporary parameter type column 423, and a temporary parameter variable column 424.
[0022]
The temporary parameter number field 421 stores the entry number of the temporary parameter table.
In the temporary parameter position number field 422, the appearance position of the temporary parameter is indicated by a number. The position number of the temporary return number is 0, and the i-th dummy argument is the position number i.
The temporary parameter type field 423 stores temporary parameter type information.
The temporary parameter variable column 424 stores the name of the corresponding temporary parameter.
[0023]
FIG. 9 is a configuration example of the call table 51 obtained for the example of FIG.
An entry is created in the call table for each function call that appears in the program. Each entry includes a call number column 511, a call line number column 512, a call function number column 513, an actual return number column 514, and an actual argument set column 515.
[0024]
The call number column 511 stores the entry number of the call table, and the call line number column 512 stores the line number of the corresponding function call.
The call function number column 513 stores the function number of the function table 41 for the function called by the call.
The actual return number column 514 and the actual argument set column 515 store the actual return number and actual argument information of the call in the form of entry numbers in the actual parameter table 52.
[0025]
FIG. 10 is a configuration example of the actual parameter table 52 obtained for the example of FIG.
The actual parameter table is an auxiliary table for storing call interface information of the call table 51. An entry is created for each actual return number or actual argument, and the entry number is stored in the actual return number column or actual argument set column of the call table 51. Each entry includes an actual parameter number field 521, an actual parameter position number field 522, and an actual parameter expression field 522.
[0026]
The actual parameter number column 521 stores the entry number of the actual parameter table.
In the actual parameter position number column 522, the appearance position of the actual parameter is indicated by a number. The position number of the actual return number is 0 (similar to the temporary parameter position number field 422 of the temporary parameter table 42), and the i-th actual argument is the position number i.
The actual parameter expression field 523 stores the name of the corresponding actual parameter.
[0027]
FIG. 11 is a configuration example of the collective call table 61 obtained for the example of FIG.
In the batch call table, an entry is created for each (batch) call of a batch function. Each entry includes a batch call number column 611, a generation source call set column 612, a batch function number column 613, an actual return number column 614, an actual return type column 615, an actual return number set column 616, and an actual argument set column 617. Composed.
[0028]
The batch call number column 611 stores the entry number of the batch call table.
In the generation call set column 612, a set of calls to be collectively called is stored in the entry number format of the call table 51.
In the batch function number column 613, a batch function called by the batch call is stored as an entry number (batch function function number) of the batch function table 71.
The actual return number column 614 and the actual return type column 615 store the return name and return type.
The actual return number column 616 and the actual argument set column 617 store the actual return number and actual argument information of the batch call in the form of the entry number of the batch actual parameter table 62.
[0029]
FIG. 12 is a configuration example of the collective actual parameter table 62 obtained for the example of FIG.
The collective actual parameter table is an auxiliary table for storing the call interface information of the collective call table 61. An entry is created for each actual return number or actual argument, and the entry number is stored in the actual return number column or actual argument set column of the batch call table 61. Each entry includes a collective actual parameter number column 621, a collective actual parameter position number column 622, a generation source actual parameter number column 623, a pre-conversion name column 624, and a post-conversion name column 625.
[0030]
The batch actual parameter number field 621 stores the entry number of the batch call actual parameter table.
In the collective actual parameter position number column 622, the appearance position of the actual parameter is indicated by a number.
In the generation call set column 623, calls to be batched are stored in the form of a set of entry numbers in the call table 51.
The pre-conversion name column 724 stores the actual parameter name in the generation source call, and the post-conversion name column 725 stores the (collective) actual parameter name after the batch call. The pre-conversion name field 724 and the post-conversion name field 725 are fields that are valid only for the actual return number (the actual argument is always blank).
[0031]
FIG. 13 is a configuration example of the collective function table 71 obtained for the example of FIG.
In the batch function table, an entry is created for each function that generates a batch function. Each function is given a unique batch function number, and each entry can be accessed by the batch function number. Each entry includes a batch function number column 711, a batch function name column 712, a batch coefficient factor column 713, a generation function number column 714, a provisional return type column 715, a provisional return number name column 716, a provisional return number set column 717, It consists of a dummy argument number set column 718.
[0032]
In the batch function number column 711, the entry number of the batch function table,
The collective function name column 712 stores the name of the collective function to be generated.
The batching coefficient column 713 stores the number of calls to be batched.
In the generation function number column 714, functions to be grouped are stored in the function number format of the function table 41.
The provisional return type column 715 and provisional return number name column 716 store the return type and return number name.
The temporary return number column 717 and the temporary argument set column 718 store the temporary return number and dummy argument information of the batch function in the form of the entry number of the batch temporary parameter table 72.
[0033]
FIG. 14 is a configuration example of the collective temporary parameter table 72 obtained for the example of FIG.
The batch temporary parameter table is an auxiliary table for storing the function interface information of the batch function table 71. An entry is created for each temporary return number or dummy argument, and the entry number is stored in the temporary return number set column or dummy argument set column of the batch function table 71. Each entry includes a batch temporary parameter number column 721, a generation source temporary parameter number column 722, a batch temporary parameter position number column 723, a repetition number column 724, a pre-conversion name column 725, and a post-conversion name column 726.
[0034]
The batch temporary parameter number field 721 stores the entry number of the batch temporary parameter table.
In the generation source temporary parameter number column 722, the corresponding temporary parameter of the generation source function is stored in the format of the temporary parameter number in the temporary parameter table 42.
In the batch temporary parameter position number column 723, the appearance position of the temporary parameter is indicated by a number. In the batch temporary parameter position number, the temporary return number and the dummy argument are counted independently, and the i-th temporary return number / the dummy argument is the position number i.
[0035]
The iteration number column 724 stores the number of the temporary function parameter at the time of batching. This repetition number starts counting from 0, and when the batching coefficient is n, numbers up to n-1 are given.
The pre-conversion name field 725 stores a temporary parameter name in the generation source function, and the post-conversion name field 726 stores a (collective) temporary parameter name after batch function conversion.
This is the end of the description of various table configurations used in this embodiment.
[0036]
Hereinafter, various processes for generating / referencing these tables will be described in order.
FIG. 15 is a flowchart of the function information table generation process 21. In the function information table generation process, the intermediate language 3 is sequentially scanned, and when a function definition is detected, a function information table 4 in which the function definition information is collected and registered is generated. The procedure will be described below.
[0037]
First, the function number fi and the temporary parameter number fpi are initialized with 0 (step 1501).
Next, it is determined whether or not there is an unprocessed function (step 1502), and the processing after step 1503 is performed until there is no unprocessed function.
If there is an unprocessed function f, first, a function entry F is generated, and the function number fi is incremented (step 1503). Thereafter, the function information of the function f is stored in the function entry F in step 1504 and subsequent steps.
[0038]
First, the definition line number of f is set to fl, and the function name is set to fn (step 1504). Next, in order to obtain a temporary parameter set FPS, the FPS is initialized with an empty set (step 1505). Then, it is determined whether or not there is an unprocessed temporary parameter (step 1506), and processing from step 1507 is performed until there is no unprocessed temporary parameter.
If there is an unprocessed temporary parameter fp, a temporary parameter entry FP is generated and the temporary parameter number fpi is incremented (step 1507).
[0039]
Next, the temporary parameter information of fp is stored in the temporary parameter table 42 (step 1508), and the entry number fpi is added to the temporary parameter set FPS (step 1509). Thereafter, step 1506 to step 1509 are repeatedly executed until there is no unprocessed temporary parameter. Step 1508 stores temporary parameter information, temporary parameter number, temporary parameter position, temporary parameter type, temporary parameter type, and temporary parameter name in the entry FP, but details are omitted (in the temporary parameter table 42 of FIG. 8). See description).
[0040]
When the determination in step 1506 becomes no, collection of the temporary parameter set FPS ends, so all function information is stored in F (step 1510), and the next unprocessed function determination (step 1502) is performed. The process ends when all functions have been processed.
[0041]
7 and 8 are examples of function information tables indicating the results of performing the above processing on the source program shown in FIG.
For example, the entry 417 stores information on the function f defined in lines 003 to 008 in FIG. Further, it can be seen from the provisional return number column that there is a provisional return number having the name r, the provisional parameter position 0 (= provisional return number), and the provisional parameter type int.
[0042]
FIG. 16 is a flowchart of the call information table generation process 22.
In the call information table generation process, the intermediate language 3 is sequentially scanned, and when a function call is detected, a call information table 5 that collects and registers the call information is generated. The procedure will be described below.
[0043]
First, the call number ci and the actual parameter number api are initialized with 0 (step 1601).
Next, it is determined whether or not there is an unprocessed function (step 1602), and the processing from step 1603 is performed until there is no unprocessed function.
If there is an unprocessed function f, first, the function entry is set to F (step 1603), and the call set CS is initialized with an empty set (step 1604).
Next, it is determined whether or not there is an unprocessed function call in f (step 1605), and if it exists, call information is registered in step 1606 and subsequent steps.
In registering the call information, first, a call entry C is generated, and the call number ci is incremented (step 1606).
Next, the call line number cl and the call function number fi are obtained (step 1607). The call function number fi can be easily obtained by searching the function information table 41 (if it does not exist in the function information table, it is left blank and excluded from the target of batching).
[0044]
Next, in order to obtain the actual parameter set APS, the APS is initialized with an empty set (step 1608). Then, it is determined whether or not there is an unprocessed actual parameter (step 1609), and processing from step 1610 is performed until there is no unprocessed actual parameter.
That is, if there is an unprocessed actual parameter ap, an actual parameter entry AP is generated, the actual parameter number api is incremented (step 1610), and the actual parameter information of ap is stored in the actual parameter table 52 (step 1611). The entry number api is added to the actual parameter set APS (step 1612). In step 1611, the actual parameter number, the actual parameter position number, and the actual parameter expression, which are actual parameter information, are stored in the entry AP, but the details are omitted (see the description of the actual parameter table 52 in FIG. 14).
[0045]
Since the collection of the actual parameter set APS ends when the determination in step 1609 becomes no, all call information is stored in C (step 1613). (The actual parameter set APS combines the actual return number and the actual argument. Stored in the actual return number field and the actual argument field of the call information table). Then, ci is added to CS (step 1614), and the next unprocessed call determination (step 1605) is performed. Since all calls in the function f have been processed when the determination in step 1605 becomes no, CS is stored in the call set column of F (step 1615), and the next unprocessed function is determined (step 1602). Proceed to The process ends when all functions have been processed.
[0046]
9 and 10 are examples of the call information table 5 indicating the result of performing the above processing on the example of the source program of FIG. For example, the entry 516 in FIG. 9 stores the call information of the function f on the 17th line. In this call, (p * p, q * q) is passed as an actual argument, and the return value is stored in the actual return number r1.
[0047]
FIG. 17 is a flowchart of the batch call information table generation process 23.
The batch call information table generation process sequentially scans the call information table 51 and, when a call that can be batch-called is detected, generates a batch call information table 6 and a batch function information table 7 that collect and register the batch call information. To do. The procedure will be described below.
[0048]
First, the batch call number aci, the batch actual parameter number aapi, the batch function number afi, and the batch actual parameter number afpi are initialized to 0 (step 1701). Next, it is determined whether or not there is an unprocessed function entry (step 1702), and the processes in and after step 1703 are performed until there is no unprocessed function entry.
If there is an unprocessed function entry F, first, the call set is set as CS (step 1703).
[0049]
Next, the process proceeds to extraction processing (from step 1704 to step 1711) of the same type call set SCS which is a set of calls of the same function from CS. This extraction process of the isomorphic call set SCS corresponds to step 230 in FIG.
First, CS is stored in the work set WCS, and the SCS is initialized with an empty set (step 1704).
Next, it is determined whether or not there is an unprocessed call entry C in the CS (step 1705). If there is a call entry C, the call number ci and call function number fi of C are obtained (step 1706). ci is excluded (step 1707).
Next, it is determined whether or not there is an unprocessed entry WC in the WCS (step 1708), and if it exists, the WC call number wci and call function number wfi are obtained (step 1709).
Then, it is checked whether the same function is called by determining whether fi and wfi match (step 1710). If the functions are the same, wci is added to the SCS (step 1711) and the process proceeds to step 1708.
[0050]
When the elements of all work call sets are determined in step 1708, the extraction of the isomorphic call set SCS is completed.
Here, it is determined whether or not the SCS has a plurality of elements (step 1712). Only when there are a plurality of SCSs, collective call information extraction processing (step 231; see FIG. 18 for details) is executed, and step 1705 is performed. Thereafter, the process proceeds to the next isomorphic call set SCS.
When all entries have been processed in step 1705, the process proceeds to step 1702 to process the next function entry.
When all the function entries have been processed, the batch call information table generation process ends.
[0051]
FIG. 18 is a flowchart of the batch call information extraction process 231. In the batch call information extraction process, a batch call set ASCS obtained by collecting calls that can be batch-called is extracted from the given same-type call set SCS, and a batch call information table 6 and a batch function information table 7 are generated. The procedure will be described below.
First, it is determined whether or not there is an unprocessed call entry SC in the SCS (step 1801), and if it exists, the C call number sci is obtained (step 1802).
Next, the SCS is stored in the work set WSCS, the ASCS is initialized with an empty set (step 1803), and then sci is removed from the WSCS (step 1804).
Next, it is determined whether or not there is an unprocessed entry WSC in the WSCS (step 1805), and if it exists, the call number wsci of the WSC is acquired (step 1806).
[0052]
Then, it is determined whether sci and wsci can be collectively called (step 1807). If yes, wsci is added to ASCS (step 1808). The possibility of batch call is determined based on whether the call of wsci can be moved to the position of the call line number of sci or the like, but the details are omitted because it is not directly related to the present invention.
Thereafter, the process proceeds to step 1805 to examine the next WSC element.
When the elements of all work call sets WSCS are determined in step 1805, the extraction of the batch call set ASCS is completed.
Here, it is determined whether or not the ASCS has a plurality of elements (step 1809), and the batch call information registration process (step 232, see FIG. 19 for details) is executed only when there are a plurality of elements.
Next, ASCS is removed from the SCS (step 1810), and the process proceeds to the processing of the elements of the next isomorphic call set SCS after step 1801.
When all entries have been processed in step 1801, the batch call information extraction processing is terminated.
[0053]
FIG. 19 is a flowchart of the batch call information registration process 232. In the batch call information registration process, the batch call information table 6 and the batch function information table 7 are generated from the given batch call set ASCS. The procedure will be described below.
First, a batch call entry AC is created, aci is incremented (step 1901), and then ASCS is stored in the AC generation source call set column (step 1902).
Next, the call function number (of any element) of ASCS is ci and the number of elements is afk (step 1903).
Then, a type art as a variable is generated from the ASCS (step 1904), and stored in the return type column of the AC (step 1905). Although art is an array type in this embodiment, any type may be used as long as it can represent all the return numbers of the generation call set. Since the generation method is not essential to the present invention, details are omitted.
[0054]
Next, a unique name acn is generated and stored in the AC actual return name column (step 1906), and then a batch call actual argument registration process (step 233, details are shown in FIG. 20), a batch call actual return number registration process ( Step 234. Details are performed as shown in FIG.
[0055]
Next, registration to the batch function information table is performed.
First, a batch function entry AF is created, and afi is incremented (step 1911).
Next, art is stored in the AF return type column (step 1912).
Next, a unique name afn is generated and stored in the AF temporary return name column (step 1913), and then afk is stored in the batch coefficient column (step 1914).
Finally, a batch function dummy argument registration process (step 235, details are shown in FIG. 22) and a batch function temporary return number registration process (step 236, details are shown in FIG. 23) are performed to complete registration in the batch function information table.
Since the registration into the batch call information table and the batch function information table is completed, the batch call information registration process is terminated.
[0056]
FIG. 20 is a flowchart of the collective call actual return number registration process 233. In the batch call actual return number registration process, the batch actual parameter table 62 is generated from the source call set in each entry of the batch call table and registered in the batch call actual return number set column 616 of the batch call table 61. The procedure will be described below.
First, the batch call actual return number set AARS is initialized with an empty set (step 2001). The batch call actual return number position number aapr is also initialized to 0 (step 2002).
[0057]
Then, the generation call source set of AC is set as ACS (step 2003), and it is determined whether there is an unprocessed call C in the ACS (step 2004). If there is, the steps 2005 to 2013 are repeatedly executed.
In this iterative process, an actual return number set of C is set to ARS (step 2005), it is determined whether there is an unprocessed actual return number AR in the ARS (step 2006), and if there is, step 2007 to step 2012 are performed. Run repeatedly.
In this iterative process, first, aapr is incremented (step 2007).
Next, the actual parameter number and name of AR are set to ari and arn, respectively (step 2008).
Next, a collective call actual return number name aarn is generated (step 2009).
Next, a batch call actual parameter entry AAP is generated, and aapi is incremented (step 2010).
[0058]
Next, the batch call actual return number information is registered in the AAP (step 2011), and aari is added to the AARS (step 2012).
When the result of determination in step 2006 is no, the processing of all the actual return numbers is completed. Therefore, after the AARS is stored in the AC collective call actual return number set column (step 2013), the next ACS process is performed.
When all the call entries of ACS have been processed, the batch call actual return number registration process 233 ends.
[0059]
FIG. 21 is a flowchart of the batch call actual argument registration process 234. In the batch call actual argument registration process, the batch actual parameter table 62 is generated from the source call set in each entry of the batch call table and registered in the batch call actual argument set column 617 of the batch call table 61. The procedure will be described below.
[0060]
First, the batch call actual argument set AAAS is initialized with an empty set (step 2101). The batch call actual argument position number aapa is also initialized with 0 (step 2102).
Then, the generation call source set of AC is set as ACS (step 2103), and it is determined whether there is an unprocessed call C in the ACS (step 2104). If there is, the steps 2105 to 2113 are repeatedly executed.
In this iterative process, the actual argument set of C is set to APS (step 2105), it is determined whether there is an unprocessed actual argument AP in the APS (step 2106), and if there is, the process from step 2107 to step 2112 is repeated. Execute.
In this iterative process, first, aapa is incremented (step 2107).
[0061]
Next, the actual parameter number and name of the AP are set to api and apn, respectively (step 2108).
Next, a batch call actual argument name aapn is generated (step 2109).
Next, a batch call actual parameter entry AAP is generated, and aapi is incremented (step 2110).
Next, the batch call actual argument information is registered in the AAP (step 2111), and then aapi is added to the AAAS (step 2112).
When the determination in step 2106 is no, processing of all actual arguments is completed, so AAAS is stored in the AC batch call actual return number column (step 2013), and then the next ACS processing is performed.
When all the ACS call entries have been processed, the batch call actual argument registration process 234 ends.
[0062]
11 and 12 are examples of the collective call information table 6 that shows the results of performing the processes of FIGS. 20 and 21 with the call information table 5 shown in FIGS. 9 and 10 as an input.
For example, entry 618 in FIG. 11 indicates that calls of entry 516 and entry 517 of call table 51 shown in FIG. 9 can be collectively called. In this batch call, it is understood that (p * p, q * q, p * q, q * p) is passed as an actual argument, and the return value is stored in the actual return number arf that is an array of type int. .
[0063]
FIG. 22 is a flowchart of the batch function temporary return number registration process 235. In the batch function temporary return number registration process, the batch temporary parameter table 72 is generated from the source function number and the batching coefficient in each entry of the batch function table, and the batch function temporary return number set column 717 of the batch function table 71 is entered. register. The procedure will be described below.
First, the batch function temporary return number set AFRS is initialized with an empty set (step 2201). The batch function temporary return position number afpr is also initialized to 0 (step 2202).
Next, the AF batching coefficient is afk, and the AF source function entry is F (step 2203. Both have already been calculated in the batch call regular registration process).
Further, after initializing the number of iterations i to 0 (step 2204), it is determined whether i is equal to afk (step 2205), so that steps i2206 to 2212 are repeatedly executed until i becomes equal to afk. .
In this iterative process, first, i is incremented (step 2206).
Next, afpr is incremented (step 2207).
[0064]
Next, the temporary parameter number and name of AF are set to fpi and fpn, respectively (step 2208).
Next, a batch function temporary return name apfn is generated (step 2209).
Next, a batch function formal parameter entry AFP is generated, and afpi is incremented (step 2210).
Next, the batch function temporary return number information is registered in the AFP (step 2211), and afpi is added to the AFRS (step 2212).
When the determination in step 2205 is no, AFRS is stored in the AF batch function provisional number set column (step 2213), and the batch function provisional number registration process 235 ends.
[0065]
FIG. 23 is a flowchart of the batch function dummy argument registration process 236. In the batch function dummy argument registration process, a batch temporary parameter table 72 is generated from the source function number and batching coefficient in each entry of the batch function table and registered in the batch function dummy argument set column 718 of the batch function table 71. . The procedure will be described below.
First, the batch function dummy argument set AFAS is initialized with an empty set (step 2301). The batch function dummy argument position number afpa is also initialized to 0 (step 2302).
Next, the AF batching coefficient is afk, and the AF source function entry is F (step 2303. Both have already been calculated in the batch call regular registration process).
[0066]
Further, after initializing the number of iterations i to 0 (step 2304), it is determined whether i is equal to afk (step 2305), so that steps 2306 to 2315 are repeatedly executed until i becomes equal to afk. .
In this iterative process, first, i is incremented (step 2206). Next, the F parameter set of F is set to FAS (step 2307), and it is determined whether there is an unprocessed dummy parameter FA in the FAS (step 2308). If there is, the steps 2309 to 2314 are repeatedly executed. .
In this iterative process, first, afpa is incremented (step 2309).
Next, the temporary parameter number and name of AF are set to fpi and fpn, respectively (step 2310).
[0067]
Next, a collective function formal argument name apfn is generated (step 2311).
Next, a batch function formal parameter entry AFP is generated, and afpi is incremented (step 2312).
Next, the batch function dummy argument information is registered in the AFP (step 2313), and afpi is added to the AFAS (step 2314).
When the determination in step 2308 results in no, the processing of all dummy arguments is completed, so AFAS is stored in the AF batch function dummy argument set column (step 2315).
Perform the next iteration.
The batch function formal argument registration process 236 ends when the batch coefficient is repeatedly executed until i and afk match.
[0068]
FIGS. 13 and 14 are examples of the collective function information table 7 showing the results of performing the processes of FIGS. 17 to 23 with the function information table 4 and the call information table 5 shown in FIGS. 7 to 10 as inputs. It has become.
For example, the entry 719 in FIG. 13 indicates that the entry 417 in the function table 41 shown in FIG. This batch function is passed (x0, y0, x1, y1) as a dummy argument, and returns a temporary return number frf that is an array of type int.
This is the end of the description of the batch call information table generation process 23.
After the batch call information table generation process 23, a batch function generation process 24 and a batch call conversion process 25 are performed. This will be described in order below.
[0069]
FIG. 24 is a flowchart of the batch function generation process 24.
The batch function generation process generates a batch function in the intermediate language 3 from each entry of the batch function information table 7. The procedure will be described below.
It is checked whether or not there is an unprocessed batch function entry AF (step 2401), and the processing from step 2402 is performed on all existing batch function entries.
First, it is assumed that the AF generation function number is fi, and the AF batch coefficient is afk (step 2402).
Next, a batch function provisional number definition is generated from the AF provisional number set AFRS (step 2403).
Next, a batch function dummy argument definition is generated from the AF dummy argument set AFAS (step 2404).
Thus, generation of the batch function call interface is completed. Next, in step 2406 to step 2413, a batch function body is generated.
[0070]
First, after the definition section iteration count m is initialized to 0 (step 2405), the definition section FB of fi is copied (step 2406).
Next, the temporary parameters in the copied area FB are converted.
First, the union set of the AF temporary return number set AFRS and the dummy argument set AFAS is set as a batch function temporary parameter set AFPS (step 2407).
It is determined whether or not there is an unprocessed temporary parameter entry AFP in the AFPS (step 2408). If it exists, the temporary parameter is converted in step 2409 and subsequent steps.
[0071]
First, the pre-conversion name of AFP is bcn, and the post-conversion name is acn (step 2409).
Next, after the name bcn appearing in the FB is converted to acn (step 2410), the process proceeds to step 2408 to convert the next formal parameter.
When all the AFPS elements have been processed, m is incremented (step 2411), and it is determined whether or not it matches the batch coefficient afk (step 2412).
If not, the process proceeds to step 2406 and is repeatedly executed. If m matches afk, a batch function temporary return is generated using the AF temporary return name (step 2413). Perform batch function entry processing.
When all the batch function entry processes have been completed, the batch function generation process ends.
[0072]
FIG. 6 is an example of an intermediate language (in the source program format) showing the result of performing the processing of FIG. 24 using the collective function information table 7 shown in FIGS. 13 and 14 as an input. The batch function indicated by the entry 719 in FIG. 13 is generated from the 30th line to the 36th line in FIG. Line 32 generates a batch function provisional return number definition, and line 35 generates a batch function provisional return number.
[0073]
FIG. 25 is a flowchart of the batch call conversion process 25.
The batch call conversion processing uses the batch call information table 6 to convert batchable isomorphic calls in the intermediate language 3 into batch calls. The procedure will be described below.
It is checked whether or not there is an unprocessed batch call entry AC (step 2501), and the processing from step 2502 is performed on all existing batch call entries.
First, a batch call actual return number definition is generated from the AC actual return number name (step 2502).
Next, it is assumed that the generation call set of AC is CS and the actual return number set of AC is AAPS (step 2503).
Next, an arbitrary element C of CS is taken out and the call function number fi is acquired (step 2504).
[0074]
Next, the batch call generation position acp is determined from the call line number of C (step 2505). The collective call generation position may be anywhere as long as it is guaranteed by the determination of the possibility of collective call. In this embodiment, for convenience, it is set immediately before the first call position.
Next, a batch call is created from the AC and generated in an acp (step 2506). The batch call can be easily created by the batch call actual return number name, the batch function number, and the batch call actual argument set, and the details are omitted.
Next, it is determined whether or not there is an unprocessed call entry C in the CS (step 2507), and if it exists, the call is deleted by looking at the call line number of C (step 2508).
[0075]
When all calls of CS are deleted, it is determined whether or not there is an unprocessed batch call actual argument entry AAR in AARS (step 2509). If there is, conversion of the actual return number is performed in steps 2510 to 2511. I do.
The name of AAR before conversion is bcn, the name after conversion is acn (step 2510), and bcn that appears in the function body area of fi is converted to acn (step 2511).
When the determination in step 2509 is no, the conversion of all the batch call actual return numbers is completed, and the conversion process for AC is completed.
Thereafter, the process proceeds to step 2501 to perform batch call conversion processing of the next batch call entry.
When all the batch call entries have been processed, the batch call conversion process ends.
[0076]
FIG. 6 is an example of an intermediate language (in the source program format) showing the result of performing the processing of FIG. 25 using the collective call information table 6 shown in FIGS. 13 and 14 as an input.
The two function calls of lines 17 and 21 in FIG. 5 are converted into a batch call of 16 lines in FIG. In line 14, a batch call actual return number definition is generated.
According to this embodiment, it is possible to reduce the call overhead by reducing the number of function calls, which contributes to the improvement of the processing performance of the object program.
[0077]
FIG. 26 shows the processing procedure of the compiler according to another embodiment of the present invention. FIG. 26 shows a compiler processing procedure common to the second embodiment in which a batch function is called during loop expansion and the third embodiment in which a batch function is called during loop parallelization.
Since the syntax analysis 201 and the code generation process 203 are the same as those in the figure, description thereof is omitted.
Loop expansion or loop parallelization and batch function call processing 205 receives 3 after the middle, and performs loop expansion / loop parallelization that repeats serial processing in parallel / loop parallel processing, and intermediate language 3 subjected to batch function call conversion is obtained. Output. The case of loop expansion is the second embodiment, and the case of loop parallelization is the third embodiment. Since most of the processing and the table configuration are the same as in the first embodiment, only the outline will be described below.
[0078]
FIG. 27 is a flowchart showing the processing procedure of step 205 in FIG. 26 when the batch function is called at the time of loop expansion according to the second embodiment of the present invention. This will be described in order below.
First, the function information table generation process 2701 extracts various information of the function definition in the source program, and creates the function information table 4.
Next, it is determined whether or not an unprocessed loop L exists (step 2702). If there is an unprocessed loop L, steps 2703 to 2710 are repeatedly executed.
In this iterative process, it is first determined whether or not L can be loop-expanded (step 2704), and if it exists, step 2705 to step 2710 are repeatedly executed.
[0079]
In this iterative process, L is first loop expanded n times (step 2704).
Next, call information table generation processing (step 2705) is performed, information related to function calls is extracted, and the call information table 5 is generated.
Next, n calls of the same function generated by loop expansion from L are defined as an isomorphic call set SCS (step 2706).
Next, a batch call extraction process (step 2707) for extracting calls that can be batch-called from the same type call set SCS is performed (step 2707), and the extracted batch calls are registered in the batch call information table (step 2708).
When the answer is no in step 2702, the processing is completed for all the loops, batch function generation processing (step 2709) and batch call conversion processing (step 2710) are performed, and the processing ends.
[0080]
The correspondence between the steps of FIG. 27 and the steps of FIG. 3 is shown below. The processing content of each step below is the same processing as the step of FIG. 3 shown in parentheses.
Step 2701 (Step 21 in FIG. 3)
Step 2705 (Step 22 in FIG. 3)
Step 2709 (Step 231 in FIG. 3)
Step 2710 (Step 232 in FIG. 3)
Step 2711 (Step 24 in FIG. 3)
Step 2712 (Step 25 in FIG. 3)
[0081]
FIG. 28 shows an example of a source program for explaining the second and third embodiments of the present invention. Also in this embodiment, it is described in the form of an intermediate language 3 source program. Therefore, FIG. 28 is an example of a source program and also an example of the intermediate language 31 (before the collective call). In the program example of FIG. 28, there is a loop that calls the function f on the 16th to 22nd lines of the function g.
[0082]
FIG. 29 is a representation of the intermediate language 3 at the stage of loop expansion in step 2704 of FIG. 27 in a source program format. A loop including function calls on lines 16 to 22 in FIG. 28 is expanded from lines 16 to 22 in FIG.
[0083]
FIG. 30 represents the intermediate language 3 as a result of performing the processing of FIG. 26 with the source program of FIG. 27 as an input, in the source program format. In FIG. 29, the call of the function f during the loop expansion from the 16th line to the 22nd line is made into a batch function call.
According to this embodiment, since the batch function call is performed at the time of loop expansion, efficient batch function call according to the number of loop expansions can be performed.
[0084]
FIG. 31 is a flowchart showing the processing procedure of step 205 in FIG. 26 in the case of performing a batch function call during loop parallelization according to the third embodiment of the present invention. Since this processing procedure is almost the same as that in FIG. 27, a description thereof will be omitted (steps 3104 and 3106 are slightly different).
[0085]
FIG. 32 shows the intermediate language 3 at the stage where the loop is parallelized in step 2704 of FIG. 30 in a source program format. The notation “x || y;” on lines 18 and 19 in FIG. 32 indicates that x and y are executed in parallel. It can be seen that the loop including the function call from the 16th line to the 22nd line in FIG. 28 is loop-parallelized from the 16th line to the 21st line in FIG.
[0086]
FIG. 33 represents the intermediate language 3 as a result of performing the processing of FIG. 30 with the source program of FIG. 27 as an input, in a source program format. It can be seen that the call to the function f during the loop parallelization from the 16th line to the 22nd line in FIG. 31 is a batch function call.
According to the present embodiment, since the batch function call is performed at the time of loop parallelization, efficient batch function call according to the parallel degree of the loop can be performed.
[0087]
【The invention's effect】
According to the present invention, the compiler or the source conversion program can convert a call of the same function into a call of a batch function. In other words, a means for reducing call overhead that does not depend on inline expansion is provided. ,
As a result, even when inline expansion cannot be applied, it is possible to reduce the call overhead and contribute to the improvement of the processing performance of the object program.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of a computer system in which a compiler that implements the present invention operates.
FIG. 2 is a flowchart showing a processing procedure of a compiler implementing the present invention.
FIG. 3 is a flowchart of batch function call processing 2 of a compiler.
FIG. 4 is a processing configuration diagram of compiler batch function call processing 2 according to the present invention;
FIG. 5 is an example of a source program (a configuration example of the intermediate language 31 before calling a batch function in a source program format).
FIG. 6 is a configuration example of the intermediate language 32 after the batch function call in the source program format.
7 is a configuration example of a function table 41. FIG.
8 is a configuration example of a temporary parameter table 42. FIG.
9 is a configuration example of a call table 51. FIG.
10 is a configuration example of an actual parameter table 52. FIG.
11 is a configuration example of a collective call table 61. FIG.
12 is a configuration example of a collective actual parameter table 62. FIG.
13 is a configuration example of a batch function table 71. FIG.
14 is a configuration example of a collective temporary parameter table 72. FIG.
15 is a flowchart of function information table generation processing 21. FIG.
16 is a flowchart of a call information table generation process 22. FIG.
FIG. 17 is a flowchart of batch call information table generation processing 23;
FIG. 18 is a flowchart of batch call information extraction processing 231;
FIG. 19 is a flowchart of batch call information registration processing 232;
FIG. 20 is a flowchart of batch call actual return number registration processing 233;
FIG. 21 is a flowchart of batch call actual argument registration processing 234;
FIG. 22 is a flowchart of a batch function temporary return number registration process 235;
FIG. 23 is a flowchart of a batch function formal argument registration process 234;
24 is a flowchart of a batch function generation process 24. FIG.
FIG. 25 is a flowchart of batch call conversion processing 25;
FIG. 26 shows the processing procedure of the compilers of the second and third embodiments.
FIG. 27 is a flowchart of a loop expansion batch function calling process;
FIG. 28 is an example of a source program for explaining the second and third embodiments.
FIG. 29 is a configuration example of an intermediate language source program format after loop expansion;
FIG. 30 is a configuration example of the intermediate language source program format after the loop expansion batch function call conversion.
FIG. 31 is a flowchart of batch function call processing for loop parallelization;
FIG. 32 is a configuration example of the intermediate language 3 after the loop expansion in the source program format;
FIG. 33 is a configuration example of the intermediate language in a source program format after the conversion into a batch function for loop parallelization conversion.

Claims (7)

関数および関数呼出の関係を解析して関数情報および関数呼出情報を生成し、該関数情報および関数呼出情報を用いるプログラム変換処理の際の一括関数呼出化方法であって、
一関数の複数回の呼出を構成する命令列を、同等な単一関数の呼出を構成する命令列とする情報を生成する一括呼出化情報生成ステップと、
記一括呼出化情報から、同一関数の複数回実行処理を構成する命令列を一度に行う一括関数を構成する命令列を生成する一括関数生成ステップと、
上記一括呼出化情報から、同一関数の複数回の呼出を構成する命令列を1回の一括関数の呼出を構成する命令列に変換する一括呼出化変換ステップと
を有することを特徴とする一括関数呼出化方法。
A function call method for analyzing a relationship between a function and a function call to generate function information and function call information, and performing a program conversion process using the function information and the function call information,
A plurality of instruction sequences constituting the a call, collective call-information generating step of generating information for an instruction sequence which constitutes a call equivalent single function of the same function,
From the top Symbol collective call-information, and collectively function generation step of generating an instruction sequence that constitutes the bulk function of performing an instruction sequence composing the multiple execution of the same function at a time,
A collective call conversion step for converting from the collective call information into an instruction sequence constituting a plurality of calls of the same function into an instruction sequence constituting a single collective function call; call Shutsuka way.
請求項1に記載の一括関数呼出化方法において、
上記一括呼出化情報生成ステップが、上記関数呼出情報を用いて同一関数を構成する命令列の呼出である同型関数呼出を認識して同型呼出情報を生成する同型呼出認識ステップと、
上記同型呼出認識ステップが生成する同型呼出から一括関数の呼出を構成する命令列に変換可能な呼出を選択する一括呼出選択ステップと
を有することを特徴とする一括関数呼出方法。
In the batch function calling method according to claim 1,
The collective call information generation step recognizes an isomorphic function call that is a call of an instruction sequence that constitutes the same function using the function call information, and generates an isomorphic call information step; and
A batch function call method comprising: a batch call selection step for selecting a call that can be converted into an instruction sequence constituting a batch function call from the same type call generated by the same type call recognition step.
請求項2に記載の一括関数呼出化方法において、
上記一括呼出選択ステップが、上記複数の同型呼出が一括関数の呼出を構成する命令列に変換可能な否かを判定する一括呼出化判定ステップと、
上記一括呼出化判定ステップにより一括関数の呼出を構成する命令列に変換可能であると判定された関数群の一括呼出化の情報を生成する一括呼出化情報登録ステップと
を有することを特徴とする一括関数呼出化方法。
In the batch function calling method according to claim 2,
A batch call determination step for determining whether or not the plurality of isomorphic calls can be converted into an instruction sequence constituting a batch function call;
And a collective call information registration step for generating collective call information of a group of functions determined to be convertible into an instruction sequence constituting a collective function call by the collective call determination step. Batch function call method.
請求項2に記載の一括関数呼出化方法において、
上記同型呼出認識ステップは、ループ展開時に生成する同一関数の呼出を認識してループ展開時同型呼出情報を生成するループ展開時同型呼出認識ステップであり、
上記一括呼出選択ステップは、上記ループ展開時同型呼出認識ステップが生成するループ展開時同型呼出情報から一括関数を構成する命令列の呼出に変換可能な呼出を選択した一括呼出化情報を生成することを特徴とする一括関数呼出化方法。
In the batch function calling method according to claim 2,
The isomorphic call recognition step is a loop expansion isomorphic call recognition step that recognizes a call of the same function generated at the time of loop expansion and generates isomorphic call information at the time of loop expansion.
The batch call selection step generates batch call information in which a call that can be converted into a call of an instruction sequence constituting a batch function is selected from the loop expansion type isomorphic call information generated by the loop expansion type call recognition step. A collective function calling method characterized by
請求項4に記載の一括関数呼出化方法において、
上記一括呼出化情報生成ステップが決定する一括化係数を、ループ展開数とすることを特徴とする一括関数呼出化方法。
The collective function calling method according to claim 4 ,
A collective function calling method, wherein the collective coefficient determined in the collective call information generating step is a loop expansion number.
請求項2に記載の一括関数呼出化方法において、
上記同型呼出認識ステップは、ループ並列化時に生成する同一関数の呼出を認識してループ並列化時同型呼出情報を生成するループ並列化同型呼出認識ステップであり、
上記一括呼出選択ステップは、上記ループ並列化時同型呼出認識ステップが生成するループ並列化時同型呼出情報から一括関数を構成する命令列の呼出に変換可能な呼出を選択した一括呼出化情報を生成することを特徴とする一括関数呼出化方法。
In the batch function calling method according to claim 2,
The isomorphic call recognition step is a loop parallelization isomorphic call recognition step for recognizing a call of the same function generated at the time of loop parallelization and generating isomorphic call information at the time of loop parallelization.
The batch call selection step generates batch call information by selecting a call that can be converted into a call to an instruction sequence constituting a batch function from the loop parallel type isomorphic call information generated by the loop parallelization isomorphic call recognition step. A collective function calling method characterized by:
請求項6に記載の一括関数呼出化方法において、
上記一括呼出化情報生成ステップが決定する一括化係数を、ループ並列化の展開数とすることを特徴とする一括関数呼出化方法。
In the batch function calling method according to claim 6 ,
A collective function calling method, wherein the collective coefficient determined in the collective call information generating step is the number of loop parallelizations.
JP03441798A 1998-02-17 1998-02-17 Batch function call method Expired - Lifetime JP3726992B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP03441798A JP3726992B2 (en) 1998-02-17 1998-02-17 Batch function call method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP03441798A JP3726992B2 (en) 1998-02-17 1998-02-17 Batch function call method

Publications (2)

Publication Number Publication Date
JPH11232118A JPH11232118A (en) 1999-08-27
JP3726992B2 true JP3726992B2 (en) 2005-12-14

Family

ID=12413633

Family Applications (1)

Application Number Title Priority Date Filing Date
JP03441798A Expired - Lifetime JP3726992B2 (en) 1998-02-17 1998-02-17 Batch function call method

Country Status (1)

Country Link
JP (1) JP3726992B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6720993B2 (en) 2018-03-07 2020-07-08 オムロン株式会社 Support devices and programs

Also Published As

Publication number Publication date
JPH11232118A (en) 1999-08-27

Similar Documents

Publication Publication Date Title
JP3620860B2 (en) Simulation device
US5321606A (en) Data transforming method using externally provided transformation rules
JP3053092B2 (en) Parallel compilation method
JP2801931B2 (en) Logic design processing device, circuit conversion rule translation device, and circuit conversion rule translation method
JP3726992B2 (en) Batch function call method
US20040010780A1 (en) Method and apparatus for approximate generation of source code cross-reference information
Castro et al. Automatically deriving cost models for structured parallel processes using hylomorphisms
JP3318051B2 (en) Translation processing method
JPWO2011090032A1 (en) Parallel processing program generation method, parallel processing program generation program, and parallel processing program generation device
JP2003337707A (en) Method for increasing speed of compiler and loop for processing list structure data
JP2801193B2 (en) Vectorization processing device for induction variables
JP3582849B2 (en) Logic program verification method
JP3208300B2 (en) Method of extracting use form of physical entity in program and related extraction method
JPH0561687A (en) Processing system for compiler
JPH10133885A (en) Method for generating and compiling batch instruction
JPS63138427A (en) Processing system for scheduling instruction to array
JPH11161500A (en) Method for generating object program for reforming execution time dependent analysis
JP2786689B2 (en) Compiler processing method
JP3311775B2 (en) Pointer vectorization method
JP3167386B2 (en) Automatic program parallelization method
JPH06214777A (en) Method and device for developiig program
JP3018783B2 (en) Compilation method
JPH06161848A (en) Processing method for host variable for dbms
JPS62206668A (en) Parallel formation processing system for object program
JPH0950429A (en) Pointer vectorization system in compiler

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040909

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041015

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041213

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050107

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050302

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050510

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050627

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050909

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050922

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081007

Year of fee payment: 3

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

EXPY Cancellation because of completion of term