JPH01217632A - System for allocating register to data - Google Patents

System for allocating register to data

Info

Publication number
JPH01217632A
JPH01217632A JP4353788A JP4353788A JPH01217632A JP H01217632 A JPH01217632 A JP H01217632A JP 4353788 A JP4353788 A JP 4353788A JP 4353788 A JP4353788 A JP 4353788A JP H01217632 A JPH01217632 A JP H01217632A
Authority
JP
Japan
Prior art keywords
data
block
registers
processing unit
register
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
JP4353788A
Other languages
Japanese (ja)
Inventor
Mitsuo Tsuda
津田 三男
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 JP4353788A priority Critical patent/JPH01217632A/en
Publication of JPH01217632A publication Critical patent/JPH01217632A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/441Register allocation; Assignment of physical memory space to logical memory space

Abstract

PURPOSE:To improve the availability of registers by allocating these registers among blocks related with each other like the brethren in a shared form. CONSTITUTION:An information collecting process part 1 checks and stores the application frequency of each data on a source program at every block. Then a register allocation processing part 2 allocates the registers to the data having higher application frequencies while sharing those data allocated to data among the blocks related with each other like the brethren based on the application frequency of each data stored in the part 1. A prolog/epilog processing part 3 saves the contents of the shared register at the prolog of the block between the blocks related with each other like the brethren based on the allocation carried out by the part 2. Then an object is produced so that the contents of the shared register are recovered at the epilog between the blocks related with each other like the brethren based on the allocation of the part 2. Thus the availability of registers can be improved.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明はデータへのレジスタ割付は方式に関し、特にブ
ロック構造を有する言語により記述された原始プログラ
ムを扱うコンパイラのオブジェクト生成(目的プログラ
ムの生成)におけるデータへのレジスタ割付は方式に関
する。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a register allocation method for data, and in particular object generation (generation of a target program) of a compiler that handles a source program written in a language with a block structure. The register allocation to data in is related to the method.

〔従来の技術〕[Conventional technology]

従来、この種のデータへのレジスタ割付は方式は、ブロ
ック構造に無関係に原始プログラムにおける各データの
使用頻度(参照回数)を調べ、その各データの使用頻度
に基づいて使用頻度の高いデータに対して優先的にレジ
スタを割り付けていた(レジスタが割り付けられなかっ
たデータは実行時にメモリ上で取り扱われることになる
)。
Conventionally, the method for register allocation for this type of data was to check the frequency of use (number of references) of each data in the source program, regardless of the block structure, and to assign registers to frequently used data based on the frequency of use of each data. Registers were allocated preferentially (data for which registers were not allocated will be handled in memory during execution).

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

上述した従来のデータへのレジスタ割付は方式では、ブ
ロック構造に無関係に各データの使用頻度が調べられて
各データの使用頻度に基づいて使用頻度の高いデータに
対して優先的にレジスタが割り付けられているので、あ
るブロックのデータにレジスタが割り付けられた場合に
割り付けられたレジスタは当該ブロック内のみでしか使
用されず(当該ブロックと兄弟関係にある他のブロック
でもそのレジスタは使用されない)、データに割り付け
られたレジスタの使用効率が悪い(兄弟関係にあるブロ
ックの間ではデータの参照関係がないのでレジスタを共
用することが容易である。それにもかかわらず、上述の
ようにレジスタの共用を行わないということは使用効率
が悪いといえる)という欠点がある。
In the conventional register allocation method for data described above, the frequency of use of each data is checked regardless of the block structure, and registers are allocated preferentially to frequently used data based on the frequency of use of each data. Therefore, when a register is allocated to data in a certain block, the allocated register is used only within that block (the register is not used in other blocks that are siblings of the block), and the data Inefficient use of registers allocated to The disadvantage is that the lack of such a system means that the usage efficiency is poor.

本発明の目的は、上述の点に鑑み、データに割り付けら
れるレジスタを兄弟関係にあるブロック間で共用し、レ
ジスタの使用効率を向上させるデータへのレジスタ割付
は方式を提供することにある。
In view of the above-mentioned points, an object of the present invention is to provide a method for allocating registers to data in which registers allocated to data are shared between blocks having a sibling relationship, and register usage efficiency is improved.

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

本発明のデータへのレジスタ割付は方式は、原始プログ
ラムにおける各データの使用頻度をブロック単位に調査
し記憶する情報収集処理部と、この情報収集処理部によ
り記憶されている各データの使用頻度を用いてデータに
割り付けられるレジスタを兄弟関係にあるブロック間で
共用しながら使用頻度の高いデータに対してレジスタを
割り付けるレジスタ割付は処理部と、ブロックのプロロ
ーグにおいて当該ブロックと兄弟関係にあるブロックと
の間で前記レジスタ割付は処理部の割付けに基づき共用
しているレジスタの内容を退避しブロックのエピローグ
において当該ブロックと兄弟関係にあるブロックとの間
で前記レジスタ割付は処理部の割付けに基づき共用して
いるレジスタの内容を回復するようにオブジェクト生成
を行うプロローグ・エピローグ処理部とを有する。
The register allocation method for data in the present invention consists of an information collection processing section that investigates and stores the frequency of use of each data in the source program in block units, and an information collection processing section that investigates and stores the frequency of use of each data stored in the source program. Register allocation, which allocates registers for frequently used data while sharing registers allocated to data between blocks that have a sibling relationship, is a process between the processing unit and the block that is sibling to the block in the prologue of the block. In the epilogue of the block, the contents of the registers that are shared based on the allocation of the processing unit are saved, and the register allocation is shared between the block and the blocks that have a sibling relationship based on the allocation of the processing unit. It has a prologue/epilogue processing unit that generates objects so as to restore the contents of the registers.

〔作用〕[Effect]

本発明のデータへのレジスタ割付は方式では、情報収集
処理部が原始プログラムにおける各データの使用頻度を
ブロック単位に調査し記憶し、レジスタ割付は処理部が
情報収集処理部により記憶されている各データの使用頻
度を用いてデータに割り付けられるレジスタを兄弟関係
にあるブロック間で共用しながら使用頻度の高いデータ
に対してレジスタを割り付け、プロローグ・エピローグ
処理部がブロックのプロローグにおいて当該ブロックと
兄弟関係にあるブロックとの間でレジスタ割付は処理部
の割付けに基づき共用しているレジスタの内容を退避し
ブロックのエピローグにおいて当該ブロックと兄弟関係
にあるブロックとの間でレジスタ割付は処理部の割付け
に基づき共用しているレジスタの内容を回復するように
オブジェクト生成を行う。
In the method of register allocation to data of the present invention, the information collection processing section investigates and stores the frequency of use of each data in the source program in block units, and the processing section performs register allocation for each data stored by the information collection processing section. The prologue/epilogue processing unit allocates registers to frequently used data while sharing the registers allocated to data between blocks that have a sibling relationship based on the frequency of use of the data, and the prologue/epilogue processing unit has a sibling relationship with the block in the prologue of the block. The contents of the shared registers are saved based on the processing unit's allocation with the block in question, and in the epilogue of the block, the register allocation between the block and the sibling block is based on the processing unit’s allocation. Objects are generated to recover the contents of the shared registers based on the information.

〔実施例〕〔Example〕

次に、本発明について図面を参照して説明する。 Next, the present invention will be explained with reference to the drawings.

第1図は、本発明のデータへのレジスタ割付は方式の一
実施例の構成を示すブロック図である。
FIG. 1 is a block diagram showing the configuration of an embodiment of the register allocation method for data according to the present invention.

本実施例のデータへのレジスタ割付は方式は、原始プロ
グラムにおける各データの使用頻度をブロック単位に調
査し記憶する(情報テーブル4に設定する)情報収集処
理部1と、情報収集処理部1により記憶されている各デ
ータの使用頻度を用いて兄弟関係にあるブロック間でデ
ータに割り付けられるレジスタを共用しながら使用頻度
の高いデータに対してレジスタを割り付ける(原始プロ
グラムを記述する言語のブロック構造および情報テーブ
ル4内の各データの使用頻度に基づくデータへのレジス
タの割付けが行われる)レジスタ割付は処理部2と、ブ
ロックのプロローグでデータに割り付けられたレジスタ
の内容を退避しブロックのエピローグでデータに割り付
けられたレジスタの内容を回復するようにオブジェクト
生成を行うプロローグ・エピローグ処理部3と、原始プ
ログラムの各データに関するブロック情報および使用頻
度等を記憶する情報テーブル4とを含んで構成されてい
る。
Register allocation to data in this embodiment is performed by an information collection processing unit 1 that investigates and stores the frequency of use of each data in the source program block by block (sets it in the information table 4); Registers are allocated to frequently used data while sharing registers allocated to data between blocks in a sibling relationship using the usage frequency of each stored data (block structure of the language used to write source programs and Registers are allocated to data based on the frequency of use of each data in information table 4) Register allocation is done by processing unit 2, the contents of registers allocated to data are saved in the prologue of the block, and the contents of the registers allocated to the data are saved in the epilogue of the block. The program includes a prologue/epilogue processing unit 3 that generates objects so as to recover the contents of registers allocated to the source program, and an information table 4 that stores block information and frequency of use regarding each data of the source program. .

第2図を参照すると、情報収集処理部1の処理は、デー
タ抽出ブロック情報設定ステップ11と、使用頻度設定
ステップ12とからなる。
Referring to FIG. 2, the processing of the information collection processing section 1 consists of a data extraction block information setting step 11 and a usage frequency setting step 12.

第3図を参照すると、レジスタ割付は処理部2の処理は
、高使用頻度データレジスタ割付はステツブ21と、兄
弟関係ブロックデータレジスタ再割付はステップ22と
からなる。
Referring to FIG. 3, the processing of the register allocation processing section 2 consists of step 21 for allocation of frequently used data registers, and step 22 for reallocation of sibling block data registers.

第4図を参照すると、プロローグ・エピローグ処理部3
の処理は、レジスタ内容退避回復オブジェクト生成ステ
ップ31からなる。
Referring to FIG. 4, the prologue/epilogue processing unit 3
The process includes a register content save recovery object generation step 31.

第5図を参照すると、情報収集処理部1で設定が行われ
レジスタ割付は処理部2で参照および設定が行われプロ
ローグ・エピローグ処理部3で参照が行われる情報テー
ブル4には、レジスタ割付けが可能なデータの個数分の
エントリ (第5図中の「データAに対する情報」およ
び「データBに対する情報」等のエントリ)が存在する
。各データに対するエントリは、当該データを識別する
ための名標と、情報収集処理部1により設定される当該
データの使用頻度と、当該データが定義されているブロ
ック(当該データが含まれている)゛ロック)のブロッ
ク番号およびそのブロックの親ブロックのブロック番号
を有するブロック情報と、当該データにレジスタが割り
付けられたか否かを示すレジスタ割付は有無および割り
付けられたレジスタを識別するためのレジスタ番号を有
するレジスタ情報とから構成されている。
Referring to FIG. 5, the register allocation is set in the information collection processing unit 1, the register allocation is referenced and set in the processing unit 2, and the register allocation is referenced in the prologue/epilogue processing unit 3. There are entries for the number of possible pieces of data (entries such as "information for data A" and "information for data B" in FIG. 5). The entry for each data includes a name for identifying the data, the frequency of use of the data set by the information collection processing unit 1, and the block in which the data is defined (the data is included). Block information including the block number of the block (lock) and the block number of the parent block of that block, the presence or absence of register allocation indicating whether a register has been allocated to the data, and the register number to identify the allocated register. It consists of the register information that it has.

次に、このように構成された本実施例のデータへのレジ
スタ割付は方式の動作について説明する。
Next, the operation of the register allocation method for data in this embodiment configured as described above will be explained.

ブロック構造を有する言語で記述された原始プログラム
に基づいてコンパイラによりオブジェクト生成が行われ
る場合には、情報収集処理部1は、原始プログラムのデ
ータの中でレジスタ割付けの対象となるデータをブロッ
ク単位で抽出し、そのブロックのブロック番号とそのブ
ロックの親ブロックのブロック番号(親ブロック番号)
とを情報テーブル4の所定の(各データに対する)エン
トリ内のブロック情報に設定する(ステップ11)。
When an object is generated by a compiler based on a source program written in a language with a block structure, the information collection processing unit 1 collects data to be allocated to registers in blocks in the source program data. Extract the block number of that block and the block number of the parent block of that block (parent block number)
is set in the block information in a predetermined entry (for each data) in the information table 4 (step 11).

さらに、情報収集処理部1は、ステップ11で抽出した
データの原始プログラムにおける使用頻度をカウントし
て情報テーブル4の所定のエントリ内に設定する(ステ
ップ12)。
Further, the information collection processing unit 1 counts the frequency of use of the data extracted in step 11 in the source program and sets it in a predetermined entry in the information table 4 (step 12).

情報収集処理部1から制御が渡されたレジスタ割付は処
理部2は、最も上位の親ブロックの直属の子ブロックの
1つに含まれる各データについて、情報収集処理部1で
収集されて情報テーブル4に設定されている各データの
使用頻度およびブロック情報(各データ(名標により識
別される)に対応する情報テーブル4の所定のエントリ
内の「使用頻度」および「ブロック情報」)を情報テー
ブル4より取得(参照)し、使用頻度の高いデータに対
してレジスタを割り付ける(各データに対応する情報テ
ーブル4の所定のエントリ内の「レジスタ情報」にレジ
スタが割り付けられたこと(「レジスタ割付は有無」に
設定される)および割り付けられたレジスタの識別情報
(「レジスタ番号」に設定される)が設定される)(ス
テップ21)。
The register allocation processing unit 2, to which control is passed from the information collection processing unit 1, collects each data included in one of the direct child blocks of the highest parent block and creates an information table. The usage frequency and block information of each data set in 4 ("usage frequency" and "block information" in a predetermined entry of information table 4 corresponding to each data (identified by name tag)) are displayed in the information table. 4 and allocates registers to frequently used data (registers are allocated to "register information" in a predetermined entry in information table 4 corresponding to each data (register allocation is (set to "Presence/Presence") and identification information of the allocated register (set to "Register Number") (step 21).

次に、レジスタ割付は処理部2は、上述の子ブロックと
兄弟関係にある他の子ブロックに含まれる各データにつ
いて、情報テーブル4に設定されている各データの使用
頻度およびブロック情報(このブロック情報に基づいて
兄弟関係の有無が調べられる)を情報テーブル4より取
得し、使用頻度の高いデータに対してステップ21の処
理で割り付けられたレジスタを再び割り付ける(ステッ
プ22) 。
Next, the register allocation processing unit 2 calculates the frequency of use of each data set in the information table 4 and the block information (this block The presence or absence of a sibling relationship can be checked based on the information) is obtained from the information table 4, and the registers allocated in step 21 are allocated again to frequently used data (step 22).

上述のステップ21およびステップ22の処理が子ブロ
ックを親ブロックとして最も低位の子ブロックまで繰り
返される。
The processes of steps 21 and 22 described above are repeated up to the lowest child block with the child block as the parent block.

レジスタ割付は処理部2から制御が渡されたプロローグ
・エピローグ処理部3は、各ブロックのプロローグで当
該ブロックと兄弟関係にあるブロックとの間で共用して
いるレジスタの内容を退避し各ブロックのエピローグで
プロローグで退避された内容を当該ブロックと兄弟関係
にあるブロックとの間で共用しているレジスタに回復す
るような目的プログラムを生成する(この退避および回
復により他のブロックに含まれるデータの値が破壊され
ることを防いでいる)(ステップ31)。
The prologue/epilogue processing unit 3, to which control is passed from the processing unit 2 for register allocation, saves the contents of the registers shared between the block and sibling blocks in the prologue of each block, and Generate a target program that, in the epilogue, restores the contents saved in the prologue to the registers shared by the relevant block and sibling blocks (this saving and recovery will cause data contained in other blocks to be restored). (preventing the value from being destroyed) (step 31).

このようにして、兄弟関係にあるブロック間で各ブロッ
クに含まれるデータに割り付けられるレジスタを共用す
ることができ、レジスタの使用効率を高めることができ
る。
In this way, the registers allocated to the data included in each block can be shared between the blocks having a sibling relationship, and the efficiency of register use can be improved.

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

以上説明したように本発明は、兄弟関係にあるブロック
間でレジスタを共用して割り付けることにより、レジス
タの使用範囲が拡大しく1つのレジスタが複数のデータ
のために割り付けられるようになる)、レジスタが割り
付けられるデータの数が増加し、レジスタの使用効率が
向上するという効果がある。
As explained above, in the present invention, by sharing and allocating registers between blocks that have a sibling relationship, the range of use of registers is expanded and one register can be allocated for multiple data), registers This has the effect of increasing the amount of data that can be allocated and improving register usage efficiency.

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

第1図は本発明の一実施例の構成を示すブロック図、 第2図は第1図中の情報収集処理部の処理を示す流れ図
、 第3図は第1図中のレジスタ割付は処理部の処理を示す
流れ図、 第4図は第1図中のプロローグ・エピローグ処理部の処
理を示す流れ図、 第5図は第1図中の情報テーブルの構成を示す図である
。 図において、 ■・・・情報収集処理部、 2・・・レジスタ割付は処理部、 3・・・プロローグ・エピローグ処理部、4・・・情報
テーブルである。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention, FIG. 2 is a flowchart showing the processing of the information collection processing section in FIG. 1, and FIG. 3 is a register allocation shown in FIG. 4 is a flowchart showing the processing of the prologue/epilogue processing section in FIG. 1; FIG. 5 is a diagram showing the configuration of the information table in FIG. 1. In the figure, 1... information collection processing section, 2... register allocation processing section, 3... prologue/epilogue processing section, 4... information table.

Claims (1)

【特許請求の範囲】  原始プログラムにおける各データの使用頻度をブロッ
ク単位に調査し記憶する情報収集処理部と、この情報収
集処理部により記憶されている各データの使用頻度を用
いてデータに割り付けられるレジスタを兄弟関係にある
ブロック間で共用しながら使用頻度の高いデータに対し
てレジスタを割り付けるレジスタ割付け処理部と、 ブロックのプロローグにおいて当該ブロックと兄弟関係
にあるブロックとの間で前記レジスタ割付け処理部の割
付けに基づき共用しているレジスタの内容を退避しブロ
ックのエピローグにおいて当該ブロックと兄弟関係にあ
るブロックとの間で前記レジスタ割付け処理部の割付け
に基づき共用しているレジスタの内容を回復するように
オブジェクト生成を行うプロローグ・エピローグ処理部
と、 を有することを特徴とするデータへのレジスタ割付け方
式。
[Scope of Claims] An information collection processing unit that investigates and stores the usage frequency of each data block in the source program, and an information collection processing unit that investigates and stores the usage frequency of each data block in the source program, and an information collection processing unit that allocates data using the usage frequency of each data item stored by the information collection processing unit. a register allocation processing unit that allocates registers for frequently used data while sharing the registers between blocks that are in a sibling relationship; and a register allocation processing unit that allocates registers to frequently used data while sharing the registers between the blocks that are in a sibling relationship; save the contents of the registers that are shared based on the allocation of the block, and restore the contents of the registers that are shared based on the allocation of the register allocation processing section between the block and the sibling blocks in the epilogue of the block. 1. A register allocation method for data, comprising: a prologue/epilogue processing unit that generates an object at a time; and a register allocation method for data.
JP4353788A 1988-02-26 1988-02-26 System for allocating register to data Pending JPH01217632A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4353788A JPH01217632A (en) 1988-02-26 1988-02-26 System for allocating register to data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4353788A JPH01217632A (en) 1988-02-26 1988-02-26 System for allocating register to data

Publications (1)

Publication Number Publication Date
JPH01217632A true JPH01217632A (en) 1989-08-31

Family

ID=12666490

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4353788A Pending JPH01217632A (en) 1988-02-26 1988-02-26 System for allocating register to data

Country Status (1)

Country Link
JP (1) JPH01217632A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2400388A1 (en) * 2010-06-14 2011-12-28 Intel Corporation (INTEL) Register mapping techniques for efficient dynamic binary translation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2400388A1 (en) * 2010-06-14 2011-12-28 Intel Corporation (INTEL) Register mapping techniques for efficient dynamic binary translation
US8479176B2 (en) 2010-06-14 2013-07-02 Intel Corporation Register mapping techniques for efficient dynamic binary translation

Similar Documents

Publication Publication Date Title
US6199075B1 (en) Method and apparatus for generational garbage collection of a heap memory shared by multiple processors
US6854108B1 (en) Method and apparatus for deterministic replay of java multithreaded programs on multiprocessors
US7069279B1 (en) Timely finalization of system resources
US6820101B2 (en) Methods and apparatus for optimizing garbage collection using separate heaps of memory for storing local objects and non-local objects
US6757890B1 (en) Methods and apparatus for enabling local Java object allocation and collection
US6526421B1 (en) Method of scheduling garbage collection
JP4701321B2 (en) Memory management
EP0953908A2 (en) Method, apparatus, and article of manufacture for time profiling multithreaded programs
US20160328319A1 (en) Managing memory in a computer system
US6219678B1 (en) System and method for maintaining an association for an object
US6951018B2 (en) Method and apparatus for efficiently tracking monitors
US7321908B2 (en) Mostly concurrent garbage collection
CN102209016B (en) Data processing method, device and data processing system
US20090228537A1 (en) Object Allocation System and Method
JPH01217632A (en) System for allocating register to data
CN113568581B (en) Multi-application resource recovery method and system for embedded equipment
JPH05241936A (en) Garbage collection processing system and storage device for the system
CN114611711A (en) Programmable artificial intelligence accelerator execution unit and artificial intelligence acceleration method
JPH0344747A (en) Memory control processing system
Mattson Portable programs for parallel computers using STRAND/sup 88
JPH047643A (en) Data discriminating system
Sreeram et al. Hybrid transactions: Lock allocation and assignment for irrevocability
JPS62216042A (en) Memory allocating system for data area
Johnson A highly concurrent priority queue based on the B-link tree. University of Florida, Department of CIS
JPH0552976B2 (en)