JPH0399330A - Procedure in-line development system - Google Patents

Procedure in-line development system

Info

Publication number
JPH0399330A
JPH0399330A JP23597989A JP23597989A JPH0399330A JP H0399330 A JPH0399330 A JP H0399330A JP 23597989 A JP23597989 A JP 23597989A JP 23597989 A JP23597989 A JP 23597989A JP H0399330 A JPH0399330 A JP H0399330A
Authority
JP
Japan
Prior art keywords
procedure block
procedure
intermediate text
internal
information table
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP23597989A
Other languages
Japanese (ja)
Inventor
Tomoyuki Yui
朋之 湯井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP23597989A priority Critical patent/JPH0399330A/en
Publication of JPH0399330A publication Critical patent/JPH0399330A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To improve the execution efficiency of an object program by deciding the validity of in-line development from the information of a procedure block information table, and when the development is valid, executing the in-line development. CONSTITUTION:A procedure block detecting means 42 detects an internal procedure block from an intermediate text 31 and registers a procedure block name and a file position in a procedure block information table 41 and a procedure block reference frequency detecting means 43 detects the access of the internal procedure block and registers the reference frequency in the table 41. A procedure block in-line developing means 44 decides the validity of in-line development for the access of each internal procedure block from the information of the table 41 and executes the in-line development when it is valid. Since processing to be required for subroutine linkage or the like can be omitted at the time of executing an object program, the execution efficiency of the object program can be improved.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明はコンパイラの最適化部における手続きインライ
ン展開方式に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a procedure inline expansion method in an optimization section of a compiler.

〔従来の技術〕[Conventional technology]

従来、高級言語で記述されたソースプログラムからオブ
ジェクトプログラムを生成するコンパイラにおいては、
ソースプログラムを中間テキストに変形した後、対応す
るコードに変換しており、内部で定義された手続きブロ
ック(内部手続きブロック)の呼び出し部分は、サブル
ーチンリンケージ等を行うためのプロローグ処理および
エピローグ処理のオブジェクトコードとされていた。
Conventionally, in compilers that generate object programs from source programs written in high-level languages,
After transforming the source program into intermediate text, it is converted into the corresponding code, and the calling part of the internally defined procedure block (internal procedure block) is an object for prologue processing and epilogue processing to perform subroutine linkage, etc. It was considered a code.

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

従来のコンパイラでは上述したように内部手続きブロッ
クの呼び出しが処理されていたため、サブルーチンリン
ケージ等のために実行効率が悪いという欠点があった。
Conventional compilers process calls to internal procedure blocks as described above, which has the disadvantage of poor execution efficiency due to subroutine linkage.

本発明は上記の点に鑑み提案されたものであり、その目
的とするところは、オブジェクトプログラムの実行効率
を高めることのできる手続きインライン展開方式を提供
することにある。
The present invention has been proposed in view of the above points, and its purpose is to provide a procedure inline expansion method that can improve the execution efficiency of object programs.

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

本発明は上記の目的を達成するため、各内部手続きブロ
ックに対してエントリを有し、各エントリに手続きブロ
ック名、ファイル位置、および、参照回数の項目を有す
る手続きブロック情報テーブルと、 中間テキストから内部手続きブロックを検出し、前記手
続きブロック情報テーブルに手続きブロック名とファイ
ル位置とを登録する手続きブロック検出手段と、 中間テキストから内部手続きブロックの呼び出しを検出
し、前記手続きブロック情報テーブルに参照回数を登録
する手続きブロック参照回数検出手段と、 各内部手続きブロックの呼び出しに対して前記手続きブ
ロック情報テーブルの情報からインライン展開の可否を
判断し、可能な場合にインライン展開を行う手続きブロ
ックインライン展開手段とを備えるようにしている。
In order to achieve the above object, the present invention provides a procedure block information table that has an entry for each internal procedure block, and each entry has items such as procedure block name, file position, and number of references, and intermediate text. a procedure block detection means for detecting an internal procedure block and registering a procedure block name and a file location in the procedure block information table; detecting a call to the internal procedure block from intermediate text and recording the number of references in the procedure block information table; A means for detecting the number of references to a procedure block to be registered; and a procedure block inline expansion means for determining whether or not inline expansion is possible based on information in the procedure block information table for a call to each internal procedure block, and performing inline expansion if possible. I'm trying to prepare.

〔作用〕[Effect]

本発明の手続きインライン展開方式にあっては、手続き
ブロック検出手段が中間テキストから内部手続きブロッ
クを検出して手続きブロック情報テーブルに手続きブロ
ック名とファイル位置とを登録し、手続きブロック参照
回数検出手段が中間テキストから内部手続きブロックの
呼び出しを検出して手続きブロック情報テーブルに参照
回数を登録し、手続きブロックインライン展開手段が各
内部手続きブロックの呼び出しに対して手続きブロック
情報テーブルの情報からインライン展開の可否を判断し
、可能な場合にインライン展開を行う。
In the procedure inline expansion method of the present invention, the procedure block detection means detects the internal procedure block from the intermediate text and registers the procedure block name and file position in the procedure block information table, and the procedure block reference count detection means detects the internal procedure block from the intermediate text and registers the procedure block name and file position in the procedure block information table. A call to an internal procedure block is detected from the intermediate text, the number of references is registered in the procedure block information table, and the procedure block inline expansion means determines whether inline expansion is possible for each internal procedure block call from the information in the procedure block information table. Determine and inline expansion when possible.

〔実施例〕〔Example〕

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

第1図は本発明の手続きインライン展開方式を適用した
コンパイラの一実施例を示す構成図である。第1図にお
いて、本実施例は、ソースプログラム1を入力して中間
テキストファイル3に中間テキスト31を出力するフロ
ントエンド部2と、中間テキストファイル3から中間テ
キスト31を入力して処理済中間テキストファイル5に
処理済中間テキス)51を出力する最適化部4と、処理
済中間テキストファイル5から処理済中間テキスト51
を入力してオブジェクトプログラム7を出力するバック
エンド部6と、各機能部を制御する制御部8とから構成
されている。
FIG. 1 is a block diagram showing an embodiment of a compiler to which the procedure inline expansion method of the present invention is applied. In FIG. 1, the present embodiment includes a front end section 2 which inputs a source program 1 and outputs an intermediate text 31 to an intermediate text file 3, and a front end section 2 which inputs a source program 1 and outputs an intermediate text 31 to an intermediate text file 3; an optimization unit 4 that outputs processed intermediate text) 51 to a file 5, and a processed intermediate text 51 from the processed intermediate text file 5;
It is comprised of a back-end section 6 that receives input and outputs an object program 7, and a control section 8 that controls each functional section.

また、最適化部4は、手続きブロック情報テーブル41
と手続きブロック検出手段42と手続きブロック参照回
数検出手段43と手続きブロックインライン展開手段4
4とから構成されている。
The optimization unit 4 also uses a procedure block information table 41.
and procedure block detection means 42, procedure block reference count detection means 43, and procedure block inline expansion means 4.
It is composed of 4.

なお、各部の機能は次の通りである。The functions of each part are as follows.

手続きブロック情報テーブル41;第2図に示すように
、中間テキスト31に含まれる各内部手続きブロックに
対してエントリ411を有し、各エントリに手続きブロ
ック名、ファイル位置、および、参照回数の項目を有す
る。
Procedure block information table 41: As shown in FIG. 2, it has an entry 411 for each internal procedure block included in the intermediate text 31, and each entry contains items such as procedure block name, file location, and number of references. have

手続きプロンク検出手段42;中間テキスト31から内
部手続きブロックを検出し、手続きブロック情報テーブ
ル41に手続きブロック名と中間テキストファイル3上
の当該内部手続きブロックのファイル位置とを登録する
機能を有している。
Procedure pronk detection means 42; has a function of detecting an internal procedure block from the intermediate text 31 and registering the procedure block name and the file position of the internal procedure block in the intermediate text file 3 in the procedure block information table 41. .

手続きブロック参照回数検出手段43;中間テキスト3
1から内部手続きブロックの呼び出しを検出し、手続き
ブロック情報テーブル41に参照回数を登録する機能を
有している。
Procedure block reference count detection means 43; intermediate text 3
1, it has a function of detecting calls to internal procedure blocks and registering the number of references in the procedure block information table 41.

手続きブロックインライン展開手段44;各内部手続き
ブロックの呼び出しに対して手続きブロック情報テーブ
ル41の情報からインライン展開の可否を判断し、可能
な場合にインライン展開を行う機能を有している。
Procedure block inline expansion means 44; has a function of determining whether or not inline expansion is possible based on the information in the procedure block information table 41 for a call to each internal procedure block, and performing inline expansion if possible.

以下、上記の実施例の動作を説明する。The operation of the above embodiment will be explained below.

コンパイラが起動されると、制御部8により、フロント
エンド部2→最適化部4→バックエンド部6の順で起動
が行われる。また、最適化部4内でも、同じ(制御部8
により、手続きブロック検出手段42→手続きブロック
参照回数検出手段43→手続きブロックインライン展開
手段44の順で起動が行われる。
When the compiler is activated, the control unit 8 activates the front end unit 2 → the optimization unit 4 → the back end unit 6 in this order. Also, the same is true within the optimization unit 4 (control unit 8
Accordingly, the procedure block detection means 42→procedure block reference count detection means 43→procedure block inline expansion means 44 are activated in this order.

先ず、フロントエンド部2はソースプログラム1を入力
し、構文解析等の処理を行って中間テキスト31を中間
テキストファイル3に出力する。
First, the front end unit 2 inputs the source program 1, performs processing such as syntax analysis, and outputs intermediate text 31 to the intermediate text file 3.

次いで、最適化部4の手続きブロック検出手段42は中
間テキストファイル3から中間テキスト31を入力し、
内部手続きブロックの開始を検出した場合、手続きブロ
ック情報テーブル41にその手続きブロック名と中間テ
キストファイル3上のファイル位置とを登録する。また
、参照回数を初期化する。
Next, the procedure block detection means 42 of the optimization unit 4 inputs the intermediate text 31 from the intermediate text file 3,
When the start of an internal procedure block is detected, the procedure block name and file position on the intermediate text file 3 are registered in the procedure block information table 41. Also, initialize the number of references.

次いで、手続きブロック参照回数検出手段43は中間テ
キストファイル3から中間テキスト31を入力し、内部
手続きブロックの呼び出しを検出した場合、手続きブロ
ック情報テーブル41から対応する手続きブロック名を
検索し、参照回数の項目の値に1を加算する。
Next, the procedure block reference count detection means 43 inputs the intermediate text 31 from the intermediate text file 3, and when detecting a call to an internal procedure block, searches for the corresponding procedure block name from the procedure block information table 41 and determines the reference count. Add 1 to the item value.

以上の処理の後、手続きブロックインライン展開手段4
4が起動され、第3図に示す処理を行う。
After the above processing, procedure block inline expansion means 4
4 is activated and performs the processing shown in FIG.

すなわち、手続きブロックインライン展開手段44は中
間テキストファイル3から中間テキスト31を1テキス
ト読み込み(ステップSL)、それが内部手続きブロッ
クの呼び出しであるか否かを判断しくステップS2)、
そうでない場合は読み込んだ中間テキスト31をそのま
ま処理済中間テキスト51として処理済中間テキストフ
ァイル5に出力する(ステップ33)。なお、ファイル
が終了の場合は処理を終了する。
That is, the procedure block inline expansion means 44 reads one text of the intermediate text 31 from the intermediate text file 3 (step SL), and determines whether or not it is a call to an internal procedure block (step S2).
If not, the read intermediate text 31 is output as it is to the processed intermediate text file 5 as the processed intermediate text 51 (step 33). Note that if the file ends, the process ends.

また、読み込んだテキストが内部手続きブロックの呼び
出しである場合には、手続きブロック情報テーブル41
から対応する手続きブロック名を検索しくステップS4
)、参照回数の項目の値が所定値n未満か否かを判断し
くステップS5)、nより大きい場合は読み込んだ中間
テキスト31、すなわち内部手続きブロックの呼び出し
命令に対応する中間テキストをそのまま処理済中間テキ
スト51として処理済中間テキストファイル5に出力す
る(ステップS3)。つまり、参照回数が多すぎる場合
はインライン展開によりオブジェクトプログラム7のサ
イズが膨大となってしまうため、インライン展開の対象
を参照回数がn未満のものに限定している。
In addition, if the read text is a call to an internal procedure block, the procedure block information table 41
Step S4: Search for the corresponding procedure block name from
), it is determined whether the value of the reference count item is less than a predetermined value n (step S5), and if it is greater than n, the read intermediate text 31, that is, the intermediate text corresponding to the calling instruction of the internal procedure block has been processed as is. It is output to the processed intermediate text file 5 as intermediate text 51 (step S3). That is, if the number of references is too large, the size of the object program 7 will become enormous due to inline expansion, so the objects of inline expansion are limited to those whose number of references is less than n.

一方、参照回数がn未満である場合には、現在のファイ
ル位置をセーブし、手続きブロック情報テーブル41の
当該内部手続きブロックのファイル位置を用いて中間テ
キストファイル3をポイントシ(ステップS6)、その
ファイル位置から中間テキスト31を1テキスト読み込
む(ステップS7)。
On the other hand, if the number of references is less than n, the current file position is saved, and the intermediate text file 3 is pointed to using the file position of the internal procedure block in the procedure block information table 41 (step S6). One text of intermediate text 31 is read from the file position (step S7).

次いで、内部手続きブロックの終了であるか否かを判断
しくステップS8)、終了でない場合はプロローグ処理
もしくはエピローグ処理のテキストであるか否かを判断
しくステップ5lO)、プロローグ処理もしくはエピロ
ーグ処理のテキストでない場合にはその中間テキスト3
1を処理済中間テキスト51として処理済中間テキスト
ファイル5に出力しくステップ5ll)、ステップS7
に戻る。また、プロローグ処理もしくはエピローグ処理
のテキストである場合には処理済中間テキストファイル
5には出力せずにステップS7に戻る。そして、内部手
続きブロックが終了すると、ファイル位置を元に戻しく
ステップS9)、ステップS1に戻る。
Next, it is determined whether the internal procedure block has ended or not (Step S8), and if it has not ended, it is determined whether the text is for prologue processing or epilogue processing (Step 5lO), and it is not text for prologue processing or epilogue processing. In that case, the intermediate text 3
1 to the processed intermediate text file 5 as the processed intermediate text 51), step S7
Return to If the text is for prologue processing or epilogue processing, the process returns to step S7 without outputting it to the processed intermediate text file 5. Then, when the internal procedure block is completed, the process returns to step S9) in which the file position is restored to the original position, and then the process returns to step S1.

上記の処理により、参照回数が所定値n未満の内部手続
きブロックについては、プロローグ処理。
As a result of the above processing, prologue processing is performed for internal procedure blocks whose number of references is less than the predetermined value n.

エピローグ処理のためのテキストを除いた本体部分のテ
キストだけが処理済中間テキスト51として処理済中間
テキストファイル5に出力される。
Only the text of the main body portion excluding the text for epilogue processing is outputted to the processed intermediate text file 5 as processed intermediate text 51.

これがインライン展開である。This is inline expansion.

次いで、バックエンド部6は処理済中間テキストファイ
ル5から処理済中間テキスト51を入力してコード生成
等を行い、オブジェクトプログラム7を出力する。
Next, the back end unit 6 inputs the processed intermediate text 51 from the processed intermediate text file 5, performs code generation, etc., and outputs the object program 7.

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

以上説明したように、本発明の手続きインライン展開方
式にあっては、内部手続きブロックの参照回数を考慮し
てインライン展開するか否かを決定し、可能な場合はプ
ロローグ処理およびエピローグ処理を含まない内部手続
きブロックの内容自体がコードとして展開されるため、
オブジェクトプログラムの実行時にサブルーチンリンケ
ージ等に要する処理が不要となって実行効率が大幅に向
上する効果がある。
As explained above, in the procedure inline expansion method of the present invention, it is decided whether or not to perform inline expansion in consideration of the number of references to an internal procedure block, and if possible, prologue processing and epilogue processing are not included. Since the contents of the internal procedure block itself are expanded as code,
This eliminates the need for processing required for subroutine linkage and the like when executing an object program, resulting in a significant improvement in execution efficiency.

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

第1図は本発明の手続きインライン展開方式を適用した
コンパイラの一実施例を示す構成図、第2図は第1図に
おける手続きブロック情報テーブルの詳細図および、 第3図は第1図における手続きブロックインライン展開
手段の処理のフローチャートである。 図において、 1・・・・・・ソースプログラム 2・・・・・・フロントエンド部 3・・・・・・中間テキストファイル 31・・・中間テキスト 4・・・・・・最適化部 41・・・手続きブロック情報テーブル42・・・手続
きブロック検出手段 43・・・手続きブロック参照回数検出手段4・・・手
続きブロックインライン展開手段・・・・・・処理済中
間テキストファイルト・・処理済中間テキスト ・・・・・・バックエンド部 ・・・・・・オブジェクトプログラム ・・・・・・制御部
FIG. 1 is a block diagram showing an embodiment of a compiler to which the procedure inline expansion method of the present invention is applied, FIG. 2 is a detailed diagram of the procedure block information table in FIG. 1, and FIG. 3 is a diagram showing the procedure in FIG. 1. It is a flowchart of the processing of a block inline expansion means. In the figure, 1... Source program 2... Front end section 3... Intermediate text file 31... Intermediate text 4... Optimization section 41.・Procedure block information table 42 ・Procedure block detection means 43 ・Procedure block reference count detection means 4 ・Procedure block inline expansion means ・Processed intermediate text file ・Processed intermediate Text: Backend section: Object program: Control section

Claims (1)

【特許請求の範囲】 各内部手続きブロックに対してエントリを有し、各エン
トリに手続きブロック名、ファイル位置、および、参照
回数の項目を有する手続きブロック情報テーブルと、 中間テキストから内部手続きブロックを検出し、前記手
続きブロック情報テーブルに手続きブロック名とファイ
ル位置とを登録する手続きブロック検出手段と、 中間テキストから内部手続きブロックの呼び出しを検出
し、前記手続きブロック情報テーブルに参照回数を登録
する手続きブロック参照回数検出手段と、 各内部手続きブロックの呼び出しに対して前記手続きブ
ロック情報テーブルの情報からインライン展開の可否を
判断し、可能な場合にインライン展開を行う手続きブロ
ックインライン展開手段とを備えたことを特徴とする手
続きインライン展開方式。
[Scope of Claims] A procedure block information table having an entry for each internal procedure block, each entry including a procedure block name, file location, and number of references, and detecting an internal procedure block from intermediate text. a procedure block detection means for registering a procedure block name and a file location in the procedure block information table; and a procedure block reference for detecting a call to an internal procedure block from intermediate text and registering the number of references in the procedure block information table. The present invention is characterized by comprising: a number of times detection means; and a procedure block inline expansion means that determines whether or not inline expansion is possible based on information in the procedure block information table for calls to each internal procedure block, and performs inline expansion if possible. Procedure inline expansion method.
JP23597989A 1989-09-12 1989-09-12 Procedure in-line development system Pending JPH0399330A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP23597989A JPH0399330A (en) 1989-09-12 1989-09-12 Procedure in-line development system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP23597989A JPH0399330A (en) 1989-09-12 1989-09-12 Procedure in-line development system

Publications (1)

Publication Number Publication Date
JPH0399330A true JPH0399330A (en) 1991-04-24

Family

ID=16994027

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23597989A Pending JPH0399330A (en) 1989-09-12 1989-09-12 Procedure in-line development system

Country Status (1)

Country Link
JP (1) JPH0399330A (en)

Similar Documents

Publication Publication Date Title
US20020169942A1 (en) VLIW processor
US20030028860A1 (en) Compiler and debugging device
JP3130446B2 (en) Program conversion device and processor
JPH0399330A (en) Procedure in-line development system
JPS61245239A (en) Logical circuit system
JPH04268928A (en) Emulation device and semiconductor device
JPH02278340A (en) Compiling system
JPH03144830A (en) Parallel processing system
JP3367438B2 (en) Conditional execution processing device
JP2606658B2 (en) Logic simulator and control method
JPH03116241A (en) Compiler
Xin et al. The architecture of the Java extension of 32-bit RISC for smart cards and other embedded systems
KR950014161B1 (en) How to handle stage instruction pipeline in array processor
WO1997007452A1 (en) Programmable compiler
JP2864589B2 (en) Function value difference output system
JPH03235135A (en) Automatic inspection system for program
JPH03152629A (en) In-line evolving system for external procedure
JPH04165537A (en) Program automatic inline expansion method
JP2000132405A (en) Inline expansion processing apparatus and method
JPH04308935A (en) Code preparing device
JPH08263300A (en) Inline expansion method
JPH03144835A (en) Calculation system for execution arithmetic number perprogram unit time
JPH01274241A (en) Instruction string generating system
JPH0659905A (en) Parallel processing system for compiler
JPS6182242A (en) Fortran translating system