JPH02105224A - Data allocation system in compiler - Google Patents

Data allocation system in compiler

Info

Publication number
JPH02105224A
JPH02105224A JP25790388A JP25790388A JPH02105224A JP H02105224 A JPH02105224 A JP H02105224A JP 25790388 A JP25790388 A JP 25790388A JP 25790388 A JP25790388 A JP 25790388A JP H02105224 A JPH02105224 A JP H02105224A
Authority
JP
Japan
Prior art keywords
data
allocation
memory
compiler
allocated
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
JP25790388A
Other languages
Japanese (ja)
Inventor
Toshimi Osanai
小山内 聡美
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 JP25790388A priority Critical patent/JPH02105224A/en
Publication of JPH02105224A publication Critical patent/JPH02105224A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To perform the optimum allocation of data on a memory in compilation by providing a data allocation means with allocation decision function, and allocating the data by referring to an allocation bit in a data name table. CONSTITUTION:A front end processor 2, in the case of inputting a source program 1, outputs a text & table 3 including the data name table by performing the processing of syntax analysis, etc. Next, a back end processor 4 reads in the table 3 by an input means 5, and starts up the data allocation means 6 with allocation decision function in the case of detecting a procedure text including the reference of the data. The means 6 refers to the allocation bit attached on the data name table in the table 3 for referred data, and performs the allocation of the data on the memory when a value representing incompletion is OFF, and performs no allocation when the value representing completion is ON. In such a manner since no allocation is applied on the data on which the allocation is applied once even when reference is repeated, it is possible to perform the optimum allocation of the data on the memory in the compilation, and to improve processing capacity.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明はコンピュータシステムで用いられるコンパイラ
においてメモリへデータを割付ける方式%式% 〔従来の技術〕 第3図は従来のコンパイラの構成を示したものであり、
フロントエンド32は原始プログラム31を入力すると
構文解析、意味解析等の処理を行って中間テキストおよ
び各種テーブルを含むテキスト&テーブル34を出力す
ると共に、データ割付は手段33により原始プログラム
31中において宣言されたデータ(暗黙の宣言も含む、
)の全てを宣言された順番にメモリに対して割付け、制
御をバンクエンド35に渡し、バックエンド35は入力
手段36によりテキスト&テーブル34を読み込み、コ
ード生成手段37により対応するコードに変換して目的
プログラム3Bを生成していた。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a method for allocating data to memory in a compiler used in a computer system. [Prior Art] Fig. 3 shows the configuration of a conventional compiler. It is
When the front end 32 inputs the source program 31, it performs processing such as syntactic analysis and semantic analysis and outputs a text & table 34 including intermediate text and various tables, and data allocation is declared in the source program 31 by means 33. (including implicit declarations,
) are allocated to memory in the order in which they are declared, and control is passed to the bank end 35. The back end 35 reads the text & table 34 using the input means 36, converts it into the corresponding code using the code generation means 37, and transfers control to the bank end 35. Target program 3B was being generated.

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

従来のコンパイラは上記のように構成され動作するもの
であったが、フロントエンド32のデータ割付は手段3
3において、原始プログラム31中で宣言されたデータ
の全てを無条件にメモリに割付けていたため、手続文に
おいて実際には参照されない不必要なデータに対しても
メモリ領域を確保することとなり、目的プログラム38
の実行の際に使用できるメモリ資源がその分だけ減少し
、処理能力の低下および効率の劣化を招くという欠点が
あった。
Conventional compilers were configured and operated as described above, but data allocation in the front end 32 was performed using means 3.
3, all the data declared in the source program 31 was unconditionally allocated to memory, so a memory area was reserved even for unnecessary data that was not actually referenced in the procedure statement, and the target program 38
This has the disadvantage that the memory resources that can be used during execution are reduced by that amount, leading to a decrease in processing power and efficiency.

本発明は上記の点に鑑み提案されたものであり、その目
的とするところは、コンパイル時においてメモリに対し
て最適にデータの割付けが行えるコンパイラにおけるデ
ータ割付は方式を提供することにある。
The present invention has been proposed in view of the above points, and its purpose is to provide a method for data allocation in a compiler that can optimally allocate data to memory during compilation.

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

本発明は上記の目的を達成するため、原始プログラムを
入力して目的プログラムを生成するコンパイラにおける
メモリへのデータ割付は方式において、 前記原始プログラム中に宣言されたデータについてのデ
ータ名テーブルに割付は済みビットを付加し、 コード生成を行う前に、参照されたデータにつき前記デ
ータ名テーブルを参照して割付は済みピッtが未済であ
る場合にのみメモリへのデータ割付けを行うと共に当該
割付は済みビットを既済に変更するようにしている。
In order to achieve the above object, the present invention includes a method for allocating data to memory in a compiler that inputs a source program and generates a target program, and a method for allocating data to a data name table for data declared in the source program. Before code generation, refer to the data name table for the referenced data and allocate the data to memory only if the allocated bit is unfinished, and the allocation is completed. I am trying to change the bit to already done.

すなわち、本発明では手続文で実際に参照されるデータ
についてのみメモリへのデータ割付けを行うことにより
、不必要なデータの割付けを防止している。なお、実際
に参照されるデータについて全てデータ割付けを行うと
、同じデータが複数回参照される場合に不都合が生じる
ため、割付は済みビットを導入して同じデータに対して
2度以上データ割付けを行わないようにしている。
That is, in the present invention, unnecessary data allocation is prevented by allocating data to memory only for data that is actually referred to in a procedure statement. Note that if you allocate all the data that is actually referenced, it will cause problems if the same data is referenced multiple times, so by introducing the already allocated bit, it is possible to allocate data to the same data more than once. I try not to do it.

〔作用〕[Effect]

本発明のコンパイラにおけるデータ割付は方式にあって
は、原始プログラム中に宣言されたデータについてのデ
ータ名テーブルに割付は済みビットを付加しておき、コ
ード生成を行う前にデータ割付けを行い、手続文で実際
に参照されたデータにつき前記データ名テーブルを参照
して割付は済みビットが未済である場合にのみメモリへ
のデータ割付けを行うと共に当該割付は済みビットを既
済に変更する。
The method of data allocation in the compiler of the present invention is to add an already allocated bit to the data name table for the data declared in the source program, perform the data allocation before code generation, and The data name table is referred to for the data actually referred to in the sentence, and data is allocated to the memory only when the allocated bit is not yet completed, and the allocated bit is changed to already completed.

〔実施例〕〔Example〕

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

第1図は本発明のデータ割付は方式を通用したコンパイ
ラの一実施例を示す構成図である。第1図において、本
実施例は、原始プログラム1を入力してテキスト&テー
ブル3を出力するフロントエンド2と、テキスト&テー
ブル3を入力して目的プログラム8を生成・出力するバ
ックエンド4とから構成されている。また、バックエン
ド4は入力手段5と、割付は済み判定機能付きデータ割
付は手段6と、コード生成手段7とから構成されている
。なお、フロントエンド2は、周知の構文解析手段、意
味解析手段等から構成されている。
FIG. 1 is a block diagram showing an embodiment of a compiler that uses the data allocation method of the present invention. In FIG. 1, this embodiment consists of a front end 2 that inputs a source program 1 and outputs a text and table 3, and a back end 4 that inputs the text and table 3 and generates and outputs a target program 8. It is configured. Further, the back end 4 is composed of an input means 5, a data allocation means 6 with a function for determining whether allocation has been completed, and a code generation means 7. Note that the front end 2 includes well-known syntactic analysis means, semantic analysis means, and the like.

しかして、フロントエンド2は原始プログラム1を入力
すると構文解析、意味解析等の処理を行って中間テキス
トおよび各種テーブルを含むテキストルテーブル3を出
力する。テーブルの中には原始プログラムz中で宣言さ
れたデータの全てに対するデータ名テーブルが含まれて
いる。データ名テーブルはデータ名と、そのデータに関
する各種の情報が対応して格納されており、更に、本発
明ではそのデータがメモリに対して既に割付けられてい
るか否かを示す情報である割付は済みビ。
When the front end 2 receives the source program 1, it performs processes such as syntactic analysis and semantic analysis, and outputs a text table 3 including intermediate text and various tables. The table contains a data name table for all of the data declared in the source program z. The data name table stores data names and various information related to the data in correspondence with each other.Furthermore, in the present invention, the data name table is information that indicates whether or not the data has already been allocated to the memory. B.

トが付加されている。なお、初期状態では割付は済みビ
ットは未済を示す値(例えば0FF)が格納されている
。ここで、例えば原始プログラムlに −B と記述された文があり、これがデータAにデータBの内
容を代入するという言語仕様であるとすると、テキスト
&テーブル3には、代入という手続を示す情報と、デー
タA、Bに関するデータ名テーブルとが含まれることに
なる。
has been added. Note that in the initial state, the allocated bit stores a value indicating that the allocation has not been completed (for example, 0FF). Here, for example, if there is a statement written as -B in the source program l, and this is a language specification that assigns the contents of data B to data A, then Text & Table 3 contains information indicating the procedure of assignment. and a data name table regarding data A and B.

次いで、バックエンド4は入力手段5によりテキスト&
テーブル3を読み込み、データの参照がある手続文を検
出すると割付は済み判定機能付きデータ割付は手段6を
起動する。
Next, the back end 4 inputs the text &
When reading the table 3 and detecting a procedure statement that references data, the data allocation means 6 with a function for determining whether the allocation is completed is activated.

第2図は割付は済み判定機能付きデータ割付は手段6の
処理を示す流れ図であり、起動された割付は済み判定機
能付きデータ割付は手段6は、参照されたデータに対応
するデータ名テーブルの割付は済みビットを参照しくス
テップ21)、未済であることを示す値(OFF)であ
ればメモリに対してデータの割付けを行い(ステップ2
2)、そのデータに対応するデータ名テーブルの割付は
済みビットを既済を示す値(ON)とする(ステップ2
3)、また、ステップ21において、参照されたデータ
に対応するデータ名テーブルの割付は済みビットが既済
を示す値(ON)であれば、そのデータについては既に
データ割付けが終了しているため、データ割付けを行わ
ず、処理を終了する。こうすることで、−置割付けられ
たデータはその後に何度参照されても再び割付けられる
ことはなく、最初の参照の際に割付けられるのみである
FIG. 2 is a flowchart showing the processing of the data allocation means 6 with the function of determining that the allocation has been completed, and the activated data allocation means 6 with the function of determining that the allocation has been completed is a flowchart showing the processing of the data allocation means 6 with the function of determining that the allocation has been completed. Refer to the allocated bit (step 21), and if the value indicates that the allocation has not been completed (OFF), data is allocated to the memory (step 2).
2) Set the assignment completion bit of the data name table corresponding to the data to a value indicating assignment completion (ON) (Step 2)
3) Also, in step 21, if the Allocation Completed bit of the data name table corresponding to the referenced data is a value indicating Allocation Already (ON), the data allocation has already been completed for that data. Ends processing without performing data allocation. By doing this, the data that has been allocated will not be allocated again no matter how many times it is subsequently referenced, but will only be allocated the first time it is referenced.

次いで、第1図に戻り、バックエンド4はコード生成手
段7により、割付けられたデータおよびテキスト&テー
ブル3の情報を対応するコードに変換して目的プログラ
ム8を生成する。これらの動作をテキスト&テーブル3
の全ての手続文に対して行い、コンパイラの処理を終了
する。
Next, returning to FIG. 1, the back end 4 uses the code generation means 7 to convert the allocated data and the information of the text & table 3 into corresponding codes to generate the target program 8. Text & Table 3
This is done for all procedural statements in , and the compiler processing ends.

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

以上説明したように、本発明のコンパイラにおけるデー
タ割付は方式にあっては、手続文で実際に参照されたデ
ータについて、データ名テーブルの割付は済みビットを
参照して、最初の1回目だけデータ割付けを行うように
しているので、実際に参照されない不必要なデータのた
めにメモリを&1保することがなくなり、メモリ資源の
有効利用および処理能力の向上が図れる効果がある。
As explained above, in the data allocation method in the compiler of the present invention, for the data actually referenced in the procedure statement, the allocated bit of the data name table is referred to, and the data is allocated only for the first time. Since the allocation is performed, the memory is not held by &1 for unnecessary data that is not actually referenced, and the effect is that memory resources can be used effectively and processing capacity can be improved.

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

第1図は本発明のデータ割付は方式を通用したコンパイ
ラの一実施例を示す構成図、 第2図は第1図における割付は済み判定機能付きデータ
割付は手段の処理を示す流れ図および、第3図は従来の
コンパイラを示す構成図である。 図において、 1・・・原始プログラム 2・・・フロントエンド 3・・・テキスト&テーブル 4・・・バックエンド 5・・・入力手段 6・・・割付は済み判定機能付きデータ割付は手段7・
・・コード生成手段 8・・・目的プログラム
FIG. 1 is a block diagram showing an embodiment of a compiler that uses the data allocation method of the present invention, and FIG. FIG. 3 is a block diagram showing a conventional compiler. In the figure, 1... Source program 2... Front end 3... Text & table 4... Back end 5... Input means 6... Data allocation with a function to determine that the allocation is complete is performed by means 7.
...Code generation means 8...Target program

Claims (1)

【特許請求の範囲】 原始プログラムを入力して目的プログラムを生成するコ
ンパイラにおけるメモリへのデータ割付け方式において
、 前記原始プログラム中に宣言されたデータについてのデ
ータ名テーブルに割付け済みビットを付加し、 コード生成を行う前に、参照されたデータにつき前記デ
ータ名テーブルを参照して割付け済みビットが未済であ
る場合にのみメモリへのデータ割付けを行うと共に当該
割付け済みビットを既済に変更することを特徴としたコ
ンパイラにおけるデータ割付け方式。
[Claims] In a data allocation method for memory in a compiler that generates a target program by inputting a source program, an allocated bit is added to a data name table for data declared in the source program, and a code Before generation, the data name table is referred to for the referenced data, and only if the allocated bit is unfinished, the data is allocated to the memory, and the allocated bit is changed to the allocated bit. data allocation method in the compiler.
JP25790388A 1988-10-13 1988-10-13 Data allocation system in compiler Pending JPH02105224A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25790388A JPH02105224A (en) 1988-10-13 1988-10-13 Data allocation system in compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP25790388A JPH02105224A (en) 1988-10-13 1988-10-13 Data allocation system in compiler

Publications (1)

Publication Number Publication Date
JPH02105224A true JPH02105224A (en) 1990-04-17

Family

ID=17312790

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25790388A Pending JPH02105224A (en) 1988-10-13 1988-10-13 Data allocation system in compiler

Country Status (1)

Country Link
JP (1) JPH02105224A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016136368A (en) * 2015-01-23 2016-07-28 富士電機株式会社 Language conversion device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016136368A (en) * 2015-01-23 2016-07-28 富士電機株式会社 Language conversion device

Similar Documents

Publication Publication Date Title
US20020062478A1 (en) Compiler for compiling source programs in an object-oriented programming language
JPH02105224A (en) Data allocation system in compiler
JPH09223023A (en) Compile system and compiler
JPH04311227A (en) Microcomputer
JP2003256215A (en) Program conversion method, data processor using the same, and program
JP3327674B2 (en) Program translation apparatus and method
JP2556148B2 (en) Vector register allocation method
JPH07105013A (en) Register allocation system
KR100323372B1 (en) Type Reconstruction Method Of Run Time Stack For EM Code
JPH06324882A (en) Compiler device
JP3464019B2 (en) Register allocation method
JPH0373026A (en) Compile system
JPS6365530A (en) Code optimizing system
JPH0991151A (en) Compiler and processor system
JPS62182843A (en) Fast compiling/linking system
JPH0126091B2 (en)
JPH01161443A (en) Dynamic dispatching system
JPS63120369A (en) Program transformation device
JPH01194034A (en) System for selecting data to be optimized in program
JP2002099424A (en) Compile method to use register in storage area
JPH06103079A (en) Compile system
JPS6373434A (en) Program production system for debugging of data flow type computer
JPS63238628A (en) Register allocating system
JPH02201541A (en) Compiling system
JPH10228455A (en) Optimum parallel program generating method