JPH04199428A - Register device and register allocating method - Google Patents
Register device and register allocating methodInfo
- Publication number
- JPH04199428A JPH04199428A JP2334716A JP33471690A JPH04199428A JP H04199428 A JPH04199428 A JP H04199428A JP 2334716 A JP2334716 A JP 2334716A JP 33471690 A JP33471690 A JP 33471690A JP H04199428 A JPH04199428 A JP H04199428A
- Authority
- JP
- Japan
- Prior art keywords
- register
- registers
- virtual
- data
- group
- 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
Links
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.
Description
【発明の詳細な説明】
産業上の利用分野
本発明は、複数の汎用レジスタを有し、マイクロプロセ
ッサ等のデータ処理装置に適用されるレジスタ装置と、
このレジスタ装置が適用されたデータ処理装置で実行さ
れるプログラムをコンパイルする際などに、プログラム
中の各変数等をレジスタに割り付けるレジスタ割り付け
方法に関するものである。DETAILED DESCRIPTION OF THE INVENTION Field of Industrial Application The present invention relates to a register device having a plurality of general-purpose registers and applied to a data processing device such as a microprocessor;
The present invention relates to a register allocation method for allocating each variable in a program to a register when compiling a program to be executed by a data processing device to which this register device is applied.
従来の技術
従来のレジスタ装置としては、例えば森下厳暑、「マイ
クロコンピュータのハードウェアJ 、pp、44−4
5に示されているものが知られている。BACKGROUND OF THE INVENTION Conventional register devices include, for example, Morishita Genshu, "Microcomputer Hardware J, pp. 44-4.
The one shown in No. 5 is known.
第4図はこの種のレジスタ装置が適用されたデータ処理
装置の要部の構成を示すブロック図であり、110は汎
用レジスタ群(GR)、110a・110b・・・はレ
ジスタ、120は算術論理演算装置(ALU) 、12
1〜123はラッチ回路、131〜133はバスである
。FIG. 4 is a block diagram showing the configuration of the main parts of a data processing device to which this type of register device is applied, in which 110 is a general-purpose register group (GR), 110a, 110b, . . . are registers, and 120 is an arithmetic logic Arithmetic unit (ALU), 12
1 to 123 are latch circuits, and 131 to 133 are buses.
上記レジスタ110a・・・は、それぞれバス131ま
たはバス132に接続される2つの出力ポートを有し、
レジスタ110a・・・のうち2つのレジスタから同時
にバス131およびバス132にデータを出力し得るよ
うになっている。The registers 110a... each have two output ports connected to the bus 131 or the bus 132,
Data can be simultaneously output from two of the registers 110a to the bus 131 and the bus 132.
このようなデータ処理装置では、例えばレジスタ110
a・110bに格納されているデータについて算術論理
演算装置120で演算を行う場合には、次のような動作
が行われる。In such a data processing device, for example, the register 110
When the arithmetic and logic unit 120 performs an operation on the data stored in the a/110b, the following operation is performed.
まず、レジスタ110a・110bから2つのデータが
同時に出力され、それぞれバス131・132を介して
ランチ回路121・122に保持される。ラッチ回路1
21・122に保持されたデータは算術論理演算袋W1
20で演算され、ランチ回路123に格納される。ラッ
チ回路123に格納されたデータは、バス133を介し
てレジスタ110a・・・のうちのいずれか1つに格納
される。First, two pieces of data are simultaneously output from the registers 110a and 110b and held in the launch circuits 121 and 122 via buses 131 and 132, respectively. Latch circuit 1
The data held in 21 and 122 is the arithmetic and logic operation bag W1.
20 and stored in the launch circuit 123. The data stored in the latch circuit 123 is stored in any one of the registers 110a . . . via the bus 133.
すなわち、2つのデータをバス131・132に同時に
出力することにより、演算速度を向上させ得るようにな
っている。That is, by outputting two pieces of data to the buses 131 and 132 at the same time, the calculation speed can be improved.
発明が解決しようとする課題
しかしながら、上記従来のレジスタ装置では、演算速度
の向上は図り得るものの、それぞれのレジスタ110a
・・・、より詳しく各レジスタ110aのすべてのメモ
リセルが、バス131またはバス132に接続される2
つの出力ポートを備えているために回路構成が複雑であ
るという問題点を有していた。Problems to be Solved by the Invention However, in the conventional register device described above, although it is possible to improve the calculation speed, each register 110a
..., in more detail, all memory cells of each register 110a are connected to bus 131 or bus 132.
The problem is that the circuit configuration is complicated because it has two output ports.
特に、この種の装置はLSI化されることが多いが、そ
の際にチップ面積が大きなものとなり、製造コストも高
くつくことになる。In particular, this type of device is often implemented as an LSI, which requires a large chip area and increases manufacturing costs.
本発明は、かかる点に鑑み、簡潔な回路構成で、しかも
演算速度の向上環を図り得るレジスタ装置およびレジス
タ割り付け方法の提供を目的としている。SUMMARY OF THE INVENTION In view of the above, an object of the present invention is to provide a register device and a register allocation method that have a simple circuit configuration and are capable of improving calculation speed.
課題を解決するための手段
上記目的を達成するため、請求項第1項記載の発明は、
複数のレジスタグループにグループ分けされた複数のレ
ジスタと、互いに異なるレジスタグループに含まれる複
数のレジスタからデータを出力させる場合には、各レジ
スタに同時にデータを出力させる一方、同一のレジスタ
グループに含まれる複数のレジスタからデータを出力さ
せる場合には、各レジスタに順次データを出力させるレ
ジスタ制御手段と、前記レジスタグループから出力され
た各データをそれぞれ所定のバスに出力する切り換え手
段とを備えたことを特徴としている。Means for Solving the Problems In order to achieve the above object, the invention as set forth in claim 1:
When outputting data from multiple registers grouped into multiple register groups and multiple registers included in different register groups, output data from each register at the same time, while outputting data from multiple registers included in the same register group. In the case of outputting data from a plurality of registers, the present invention includes register control means for sequentially outputting data to each register, and switching means for outputting each data output from the register group to a predetermined bus, respectively. It is a feature.
また、請求項第2項記載の発明は、請求項第1項記載の
レジスタ装置を備えたデータ処理装置で実行されるプロ
グラム中の各変数および/または演算の途中結果を前記
各レジスタに割り付けるレジスタ割り付け方法であって
、前記各変数および/または演算の途中結果を第1の仮
想レジスタ群の無限側の仮想レジスタに割り付けるステ
ップと、前記各仮想レジスタを第2の仮想レジスタ群を
構成する、データ処理装置の実レジスタの個数と同じ個
数の仮想レジスタに割り付けるステップと、前記第2の
仮想レジスタ群の各仮想レジスタを前記実レジスタに割
り付ける複数通りの対応関係について、前記同一のレジ
スタグループに含まれる複数のレジスタから順次データ
を出力させる頻度を算出し、この算出結果に基づいて、
第2の仮想レジスタ群の各仮想レジスタを実レジスタに
割り付けるステップとを有することを特徴としている。Further, the invention according to claim 2 provides a register for allocating each variable and/or intermediate result of an operation in a program executed by a data processing device equipped with the register device according to claim 1 to each of the registers. The allocation method includes the step of allocating each variable and/or the intermediate result of the operation to a virtual register on the infinite side of a first virtual register group, and the step of allocating each of the virtual registers to a data Regarding the step of allocating the same number of virtual registers as the number of real registers of the processing device, and the plurality of correspondence relationships of allocating each virtual register of the second virtual register group to the real register, registers included in the same register group Calculate the frequency of sequentially outputting data from multiple registers, and based on this calculation result,
and allocating each virtual register of the second virtual register group to a real register.
作 用
請求項第1項記載の発明によれば、レジスタ制御手段は
、互いに異なるレジスタグループに含まれる複数のレジ
スタからデータを出力させる場合には、各レジスタに同
時にデータを出力させる一方、同一のレジスタグループ
に含まれる複数のレジスタからデータを出力させる場合
には、各レジスタに順次データを出力させる。切り換え
手段は、レジスタグループから出力された各データをそ
れぞれ所定のバスに出力する。According to the invention described in claim 1, when the register control means outputs data from a plurality of registers included in mutually different register groups, the register control means causes each register to output data at the same time, while outputting data from the same register group. When outputting data from a plurality of registers included in a register group, each register is outputted sequentially. The switching means outputs each data output from the register group to a predetermined bus.
請求項第2項記載の発明によれば、プログラム中の各変
数および/または演算の途中結果は、まず第1の仮想レ
ジスタ群の無限個の仮想レジスタに割り付けられ、この
仮想レジスタは、第2の仮想レジスタ群の実レジスタの
個数と同じ個数の仮想レジスタに割り付けられる。According to the invention described in claim 2, each variable and/or intermediate result of an operation in a program is first allocated to an infinite number of virtual registers in a first virtual register group, and this virtual register is allocated to an infinite number of virtual registers in a first virtual register group. The number of virtual registers is the same as the number of real registers in the virtual register group.
さらに、第2の仮想レジスタ群の仮想レジスタは、実レ
ジスタに割り付ける複数通りの対応関係について、同一
のレジスタグループに含まれる複数のレジスタから順次
データを出力させる頻度が算出され、この算出結果に基
づいて、実レジスタに割り付けられる。Furthermore, for the virtual registers of the second virtual register group, the frequency of sequentially outputting data from multiple registers included in the same register group is calculated for multiple correspondence relationships assigned to real registers, and based on this calculation result. and allocated to real registers.
実施例
第1図はレジスタ装置が適用されたデータ処理装置の要
部の構成を示すブロック図である。Embodiment FIG. 1 is a block diagram showing the configuration of the main parts of a data processing device to which a register device is applied.
第1図において、11は8個のレジスタlla・llb
・・・が備えられて成る第1の汎用レジスタ群(GRi
)、12は8個のレジスタ12a・12b・・・が備え
られて成る第2の汎用レジスタ群(GR2)、20は算
術論理演算装置(ALU)、21〜23はラッチ回路、
31〜33はバス、40はレジスタ制御手段、311・
321は選択器である。In FIG. 1, 11 indicates eight registers lla and llb.
The first general-purpose register group (GRi
), 12 is a second general-purpose register group (GR2) comprising eight registers 12a, 12b, . . . , 20 is an arithmetic logic unit (ALU), 21 to 23 are latch circuits,
31 to 33 are buses, 40 is a register control means, 311.
321 is a selector.
上記第1の汎用レジスタ群11における各レジスタll
a・・・は、それぞれ選択器311・312に接続され
る1つのボートを有し、図示しないクロック信号に応じ
て、いずれか1つのレジスタから選択器311にデータ
が出力されるようになっている。Each register ll in the first general-purpose register group 11
a... each has one port connected to the selectors 311 and 312, and data is output from any one register to the selector 311 in response to a clock signal (not shown). There is.
また、第2の汎用レジスタ群12における各レジスタ1
2a・・・も、同様に、それぞれ選択器312に接続さ
れる1つのボートを有し、クロック信号に応じていずれ
か1つのレジスタから選択器311・312にデータが
出力されるようになっている。Furthermore, each register 1 in the second general-purpose register group 12
Similarly, 2a... each has one port connected to the selector 312, and data is outputted from one of the registers to the selectors 311 and 312 in response to a clock signal. There is.
選択器311は、汎用レジスタ群11・12から出力さ
れたデータを選択的にハス31に出力する一方、選択器
312は、汎用レジスタ群11・12から出力されたデ
ータを選択的にバス32に出力するようになっている。The selector 311 selectively outputs the data output from the general-purpose register groups 11 and 12 to the bus 31, while the selector 312 selectively outputs the data output from the general-purpose register groups 11 and 12 to the bus 32. It is designed to be output.
レジスタ制御手段40は、図示しない演算制御装置から
出力されるレジスタ指定信号1・2に基づいて、上記汎
用レジスタ群11のうちの1つのレジスタと、汎用レジ
スタ群12のうちの1つのレジスタとからデータを出力
させるときには、各レジスタから同時に出力させるとと
もに、選択器311・312を切り換えて、それぞれの
データをバス31、またはバス32に出力させるように
なっている。The register control means 40 selects one register from the general-purpose register group 11 and one register from the general-purpose register group 12 based on register designation signals 1 and 2 output from an arithmetic control device (not shown). When data is outputted, each register is outputted simultaneously, and selectors 311 and 312 are switched to output each data to bus 31 or bus 32.
レジスタ制御手段40は、また、汎用レジスタ群11・
12のうちの一方に含まれる2つのレジスタからデータ
を出力させるときには、各レジスタから順次出力させる
とともに、選択器311・312を順次切り換えて、一
方のデータをバス31に、他方のデータをバス32に出
力させるようになっている。The register control means 40 also controls the general-purpose register group 11.
When data is output from two registers included in one of the registers 12, the data is output from each register sequentially, and the selectors 311 and 312 are sequentially switched to send one data to the bus 31 and the other data to the bus 32. It is designed to output to .
ラッチ回路21・22は、それぞれバス31・32を介
して送られたデータを保持し、算術論理演算装置20は
保持されたデータに対して演算を行うようになっている
。また、ラッチ回路23は、演算結果を保持し、バス3
3に出力するようになっている。The latch circuits 21 and 22 hold data sent via buses 31 and 32, respectively, and the arithmetic and logic unit 20 performs operations on the held data. In addition, the latch circuit 23 holds the calculation result and
It is designed to output to 3.
上記の構成において、例えば汎用レジスタ群11のレジ
スタIlaに格納されているデータと、汎用レジスタ群
12のレジスタllaに格納されているデータとについ
て演算する場合、および同一の汎用レジスタ群11のレ
ジスタlla・11bに格納されているデータについて
演算する場合には、次のような動作が行われる。In the above configuration, for example, when calculating data stored in register Ila of general-purpose register group 11 and data stored in register lla of general-purpose register group 12, and register lla of the same general-purpose register group 11, - When calculating data stored in 11b, the following operations are performed.
まず、レジスタ制御手段40は、レジスタ指定信号l・
2によってレジスタlla・12aが指定されている場
合には、これらのレジスタlla・12aが互いに異な
る汎用レジスタ群11・12に分散していることを検知
し、各汎用レジスタ群11・12に出力指示信号を同時
に出力する。First, the register control means 40 receives the register designation signal l.
When registers lla and 12a are specified by 2, it is detected that these registers lla and 12a are distributed in mutually different general-purpose register groups 11 and 12, and output instructions are given to each general-purpose register group 11 and 12. Output signals simultaneously.
また、選択器311に汎用レジスタ群11を選択させる
選択信号、および選択器312に汎用レジスタ群12を
選択させる選択信号を出力する。It also outputs a selection signal that causes the selector 311 to select the general-purpose register group 11 and a selection signal that causes the selector 312 to select the general-purpose register group 12.
そこで、汎用レジスタ群11・12からは、同一の1ク
ロツクサイクルでレジスタlla・12aに格納されて
いるデータが出力され、選択器311・312およびバ
ス31・32を介してラッチ回路21・22に保持され
る。Therefore, the data stored in the registers lla and 12a are outputted from the general-purpose register groups 11 and 12 in the same one clock cycle, and sent to the latch circuits 21 and 22 via the selectors 311 and 312 and the buses 31 and 32. is maintained.
ラッチ回路21・22に保持されたデータは算術論理演
算装置20で演算された後、ラッチ回路23に保持され
、バス33を介してレジスタ11a・・・・12a・・
・のうちのいずれかに格納される。After the data held in the latch circuits 21 and 22 is operated on by the arithmetic and logic unit 20, it is held in the latch circuit 23, and then passed through the bus 33 to the registers 11a...12a...
・It is stored in one of the following.
一方、レジスタ指定信号1・2によってひとつの汎用レ
ジスタ群11のレジスタlla・llbが指定されてい
る場合には、レジスタ制御手段40は、これらのレジス
タlla・llbが同一の汎用レジスタ群11に含まれ
ていることを検知し、汎用レジスタ群11に、まずレジ
スタllaに対する出力指示信号を出力するとともに、
選択器311に汎用レジスタ群11を選択させる選択信
号を出力する。また、レジスタ制御手段40は演算制御
装置にコンフリクション信号を出力し、算術論理演算装
置20等の動作の一時停止を要求する。On the other hand, when registers lla and llb of one general-purpose register group 11 are specified by register designation signals 1 and 2, the register control means 40 determines whether these registers lla and llb are included in the same general-purpose register group 11. It detects that the register lla is set and outputs an output instruction signal to the register lla to the general-purpose register group 11, and
A selection signal that causes the selector 311 to select the general-purpose register group 11 is output. Further, the register control means 40 outputs a conflict signal to the arithmetic control unit to request a temporary stop of the operation of the arithmetic and logic unit 20 and the like.
そこで、汎用レジスタ群11から、1クロツクサイクル
目でレジスタllaに格納されているデータが出力され
、選択器311およびバス31を介してラッチ回路21
に保持される。Therefore, the data stored in register lla is outputted from general-purpose register group 11 in the first clock cycle, and sent to latch circuit 21 via selector 311 and bus 31.
is maintained.
次に、レジスタ制御手段40は、汎用レジスタ群11に
レジスタllbに対する出力指示信号を出力するととも
に、選択器312に汎用レジスタ群11を選択させる選
択信号を出力する。また、上記コンフリクション信号を
リセットする。Next, the register control means 40 outputs an output instruction signal for register llb to the general-purpose register group 11, and also outputs a selection signal for causing the selector 312 to select the general-purpose register group 11. It also resets the conflict signal.
そこで、汎用レジスタ群工1から、2クロツクサイクル
目でレジスタIlbに格納されているデータが出力され
、選択器312およびバス32を介してラッチ回路22
に保持される。そしてラッチ回路21・22に格納され
たデータが算術論理演算装置20で演算されて、ラッチ
回路23に保持され、バス33を介してレジスタlla
・・・・12a・・・のうちのいずれかに格納される。Therefore, the data stored in the register Ilb is output from the general-purpose register group 1 at the second clock cycle, and sent to the latch circuit 22 via the selector 312 and the bus 32.
is maintained. The data stored in the latch circuits 21 and 22 is then operated on by the arithmetic and logic unit 20, held in the latch circuit 23, and transferred to the register lla via the bus 33.
. . 12a . . .
また、レジスタ指定信号1・2によって指定された2つ
のレジスタが共に汎用レジスタ群12に含まれている場
合にも同様の動作が行われる。A similar operation is also performed when the two registers specified by the register designation signals 1 and 2 are both included in the general-purpose register group 12.
すなわち、演算の対象となる各レジスタが汎用レジスタ
群11・12に分散している場合には、1クロツクサイ
クルで演算処理が行われ、同一の汎用レジスタ群11・
12に含まれる場合には、2クロツクサイクルを要する
が、演算処理は適正に行われる。In other words, when the registers to be operated on are distributed among the general-purpose register groups 11 and 12, the arithmetic processing is performed in one clock cycle, and the same general-purpose register group 11 and
12, it takes two clock cycles, but the arithmetic processing is performed properly.
ここで、上記のように演算の対象となる各レジスタが同
一の汎用レジスタ群11・12に含まれる頻度が小さい
ほど、演算処理は高速に行われる。Here, as described above, the less frequently each register that is the target of an operation is included in the same general-purpose register group 11, 12, the faster the operation process will be performed.
そこで、例えば高級言語で記述されたプログラムを上記
データ処理装置で実行させるための目的プログラムにコ
ンパイルする場合、次のようにしてプログラム中の変数
や演算の途中結果を各レジスタに割り付けることにより
、演算処理の高速化を確実に図ることができる。Therefore, for example, when compiling a program written in a high-level language into a target program to be executed on the data processing device mentioned above, the variables and intermediate results of operations in the program are assigned to each register as follows. It is possible to reliably speed up the processing.
第2図はレジスタ割り付け装置の構成を示すブロック図
である。FIG. 2 is a block diagram showing the configuration of the register allocation device.
第2図において、51はプログラムの入力装置、52は
レジスタの割り付けを行い、目的プログラムを生成する
処理装置、53は生成された目的プログラムを出力する
出力装置である。In FIG. 2, 51 is a program input device, 52 is a processing device that allocates registers and generates a target program, and 53 is an output device that outputs the generated target program.
上記処理装置52は、生成された目的プログラムが実行
されるデータ処理装置と同一の構成を有するものでもよ
いし、異なる構成のものでもよい。The processing device 52 may have the same configuration as the data processing device on which the generated target program is executed, or may have a different configuration.
また、出力装置53は、生成された目的プログラムを記
憶装置等に出力するものでもよいし、目的プログラムを
実行するデータ処理装置に直接入力して実行を開始させ
るようになっているものでもよい。Further, the output device 53 may be one that outputs the generated target program to a storage device or the like, or may be one that directly inputs the target program to a data processing device that executes the target program to start execution.
以下、上記処理装置52で行われるレジスタ割り付け処
理動作を第3図に示すフローチャートに基づいて説明す
る。The register allocation processing operation performed by the processing device 52 will be explained below based on the flowchart shown in FIG.
ここで、目的プログラムを実行する前記データ処理装置
の汎用レジスタ群11・12における8個ずつのレジス
タのうち、1個ずつのレジスタは、いわゆるスタックポ
インタ、またはフレームポインタとして用いられ、残り
の7個ずつのレジスタに、プログラム中の変数等を割り
当てるとする。Here, among the eight registers each in the general-purpose register groups 11 and 12 of the data processing device that executes the target program, one register is used as a so-called stack pointer or frame pointer, and the remaining seven registers are used as a so-called stack pointer or frame pointer. Assume that variables in the program are assigned to each register.
まず、高級言語で記述されたプログラムをデータ処理装
置0目的プログラムの形式とI!(以した形式を持つ中
間コードに翻訳する(Sl)。このとき、プログラム中
の変数の値や計算の途中結果の第1群の仮想レジスタへ
の割り付け処理を行うが、処理を簡単にするために、上
記第1群の仮想レジスタは無限個用い得ると仮定して割
り付ける。First, a program written in a high-level language is defined as a data processing device 0 purpose program format and an I! (Translate into intermediate code having the following format (Sl). At this time, the values of variables in the program and intermediate results of calculations are allocated to the first group of virtual registers, but to simplify the process, The first group of virtual registers is allocated on the assumption that an infinite number of them can be used.
次に、中間コード中における上記第1群の仮想レジスタ
を14個の第2群の仮想レジスタに割り付け、中間コー
ドを変更する(S2)。Next, the first group of virtual registers in the intermediate code are allocated to the 14 second group of virtual registers, and the intermediate code is changed (S2).
上記S2で行われるレジスタの割り付け処理は、例えば
G、J、ChaitinらによるrRegister
A11ocation and Spilling v
ia Graph Coloring J (Pro
ceedings of the 5IGPLAN S
ymposium on Co1IpilerCons
truction+ pp、98−105. June
1982 )に示されている手法を適用して行うこと
ができる。すなわち、[同時に異なるデータを保持する
レジスタが同じ色にならないように、使用しているすべ
ての仮想レジスタを14色以下の色で塗り分ける」とい
う問題をグラフ理論を応用して解くことにより、行われ
る。The register allocation process performed in S2 above is, for example, rRegister by G. J. Chaitin et al.
A11ocation and Spilling v
ia Graph Coloring J (Pro
ceedings of the 5IGPLAN S
ymposium on ColIpilerCons
truction+ pp, 98-105. June
This can be done by applying the method shown in (1982). In other words, by applying graph theory to solve the problem of ``coloring all virtual registers in use with 14 or fewer colors so that registers that hold different data at the same time do not have the same color,'' be exposed.
なお、その手法の詳細は上記参考文献に詳しく述べられ
ているのでここでは説明を省略する。Note that the details of this method are described in detail in the above-mentioned reference literature, so the explanation will be omitted here.
ただし、上記手法においては、中間コード中の第1群の
仮想レジスタを実レジスタに割り付けているのに対し、
S2では実レジスタの個数と同じ14個の第2群の仮想
レジスタに割り付けている。However, in the above method, the first group of virtual registers in the intermediate code is allocated to real registers, whereas
In S2, the second group of 14 virtual registers, which is the same number as the real registers, is allocated.
これは、各レジスタが複数の出力ボートを有して複数の
レジスタから同時にデータを出力し得るレジスタ装置に
おいては、同時に異なるデータを保持する仮想レジスタ
が同一の実レジスタに割り当てられることさえなければ
、いずれの実レジスタに割り当てられても演算処理速度
は同じであるが、前述のようにレジスタがグループ分け
されたレジスタ装置を用いる場合には、S2で第2群の
仮想レジスタに割り付け、以下に示すS3・S4におい
て、同時に演算対象となるレジスタができるだけ同一の
グループに属さないように実レジスタを割り当てる処理
を行う。This means that in a register device where each register has multiple output ports and can output data from multiple registers simultaneously, as long as virtual registers holding different data at the same time are not allocated to the same real register, The arithmetic processing speed is the same no matter which real register is assigned, but when using a register device in which registers are grouped as described above, the assignment is made to the second group of virtual registers in S2, as shown below. In S3 and S4, processing is performed to allocate real registers so that registers to be simultaneously operated on do not belong to the same group as much as possible.
すなわち、S3では、前述のように第2群の仮想レジス
タが14個で、汎用レジスタ群11・12の実レジスタ
数がそれぞれ7個である場合には、各仮想レジスタがい
ずれの汎用レジスタ群のレジスタに割り付けられるかの
対応関係の組み合わせは、14C7”=3400通りな
ので、そのすべての組み合わせについて、プログラムの
実行時に同時に演算対象となるレジスタが同一のグルー
プに属している頻度を算出する。That is, in S3, if the number of virtual registers in the second group is 14 as described above and the number of real registers in general-purpose register groups 11 and 12 is 7 each, each virtual register is assigned to any general-purpose register group. Since there are 14C7''=3400 combinations of correspondence relationships that can be allocated to registers, the frequency with which registers that are simultaneously subject to operations during program execution belong to the same group is calculated for all of the combinations.
この算出処理は、近年のデータ処理装置の処理能力を考
慮すれば十分算出可能な処理であるが、実レジスタ数が
多い場合などには、例えば、[2色の色を使用して、同
一命令で使用するレジスタには異なる色を塗るJという
問題を、前記グラフ理論を用いて解く方法を使用すれば
計算量を減少させることも可能である。This calculation process is quite possible considering the processing power of recent data processing devices, but if there are many actual registers, for example, [using two colors and using the same command] It is also possible to reduce the amount of calculation by using the above-mentioned graph theory method to solve the problem J in which the registers used in J are painted with different colors.
ここで、中間コード中にループを形成している処理が含
まれている場合には、そのループの深さに応じて、上記
頻度に重み係数を乗じて算出すれば、より確実に演算速
度の向上を図ることができる。If the intermediate code includes processing that forms a loop, calculating the frequency by multiplying the above frequency by a weighting factor will more reliably improve the calculation speed. You can improve your performance.
次に、S4で、上記算出された頻度がもっとも小さくな
る対応関係で、第2群の仮想レジスタを実レジスタに割
り付け、目的プログラムを生成する。Next, in S4, the virtual registers of the second group are allocated to real registers according to the correspondence relationship that minimizes the calculated frequency, and a target program is generated.
以上のように、各レジスタの出力ボート数を少なくして
も、参照するレジスタが各グループに分散していれば、
実質的に同時参照可能なレジスタ数は減少しないので、
演算速度の向上とともに、回路構成の簡素化を図ること
ができる。As described above, even if the number of output ports for each register is reduced, if the referenced registers are distributed among each group,
Since the number of registers that can be referenced simultaneously does not actually decrease,
In addition to improving the calculation speed, it is possible to simplify the circuit configuration.
特に、同一グループ内の複数レジスタの同時参照頻度が
小さくなるようにレジスタの割り付け処理を行うことに
より、上記演算速度を確実に向上させることができる。In particular, by performing register allocation processing such that the frequency of simultaneous reference to multiple registers in the same group is reduced, the above calculation speed can be reliably improved.
発明の詳細
な説明したように、請求項第1項記載の発明によれば、
複数のレジスタグループにグループ分けされた複数のレ
ジスタと、互いに異なるレジスタグループに含まれる複
数のレジスタからデータを出力させる場合に、各レジス
タに同時にデータを出力させるレジスタ制御手段を備え
ていることにより、各レジスタに複数のポートを設けな
くでも、複数のレジスタから複数のバスに同時にデータ
を出力させることができるので、簡潔な回路構成で、し
かも演算速度の向上等を図ることができるという効果を
奏する。As described in detail, according to the invention described in claim 1,
By providing a plurality of registers grouped into a plurality of register groups and a register control means that causes each register to simultaneously output data when data is output from a plurality of registers included in mutually different register groups, Data can be output from multiple registers to multiple buses at the same time without providing multiple ports for each register, resulting in a simple circuit configuration and the ability to improve calculation speed. .
また、請求項第2項記載の発明によれば、各変数および
/または演算の途中結果をレジスタに割り付ける複数通
りの対応関係について、同一のレジスタグループに含ま
れる複数のレジスタから順次データを出力させる頻度を
算出し、この算出結果に基づいてレジスタの割り付けを
行うので、確実に演算速度の向上を図ることができる。Further, according to the invention described in claim 2, data is sequentially output from a plurality of registers included in the same register group regarding a plurality of correspondence relationships in which each variable and/or an intermediate result of an operation is assigned to a register. Since the frequency is calculated and the registers are allocated based on the calculation result, it is possible to reliably improve the calculation speed.
第1図はレジスタ装置が適用されたデータ処理装置の要
部の構成を示すブロック図、第2図はレジスタ割り付け
装置の構成を示すブロック図、第3図は処理装置で行わ
れるレジスタ割り付け処理動作を示すフローチャート、
第4図は従来のレジスタ装置が適用されたデータ処理装
置の要部の構成を示すブロック図である。
11・12・・・汎用レジスタ群、lla・llb・1
2a・12b・・・レジスタ、40・・・レジスタ制御
手段、52・・・処理装置、311・312・・・選択
器
代理人 弁理士 中島 司朗
第3図
第4図
1.32Fig. 1 is a block diagram showing the configuration of the main parts of a data processing device to which a register device is applied, Fig. 2 is a block diagram showing the configuration of a register allocation device, and Fig. 3 is a register allocation processing operation performed in the processing device. A flowchart showing
FIG. 4 is a block diagram showing the configuration of main parts of a data processing device to which a conventional register device is applied. 11・12...General-purpose register group, lla, llb, 1
2a, 12b...Register, 40...Register control means, 52...Processing device, 311, 312...Selector agent Patent attorney Shiro Nakajima Figure 3 Figure 4 Figure 1.32
Claims (2)
数のレジスタと、 互いに異なるレジスタグループに含まれる複数のレジス
タからデータを出力させる場合には、各レジスタに同時
にデータを出力させる一方、同一のレジスタグループに
含まれる複数のレジスタからデータを出力させる場合に
は、各レジスタに順次データを出力させるレジスタ制御
手段と、前記レジスタグループから出力された各データ
をそれぞれ所定のバスに出力する切り換え手段とを備え
たことを特徴とするレジスタ装置。(1) When outputting data from multiple registers grouped into multiple register groups and multiple registers included in different register groups, output data from each register at the same time, while outputting data from the same register group. In the case of outputting data from a plurality of registers included in the register, the register control means includes register control means for outputting data sequentially to each register, and switching means for outputting each data output from the register group to a predetermined bus, respectively. A register device characterized by:
処理装置で実行されるプログラム中の各変数および/ま
たは演算の途中結果を前記各レジスタに割り付けるレジ
スタ割り付け方法であって、前記各変数および/または
演算の途中結果を第1の仮想レジスタ群の無限個の仮想
レジスタに割り付けるステップと、 前記各仮想レジスタを第2の仮想レジスタ群を構成する
、データ処理装置の実レジスタの個数と同じ個数の仮想
レジスタに割り付けるステップと、前記第2の仮想レジ
スタ群の各仮想レジスタを前記実レジスタに割り付ける
複数通りの対応関係について、前記同一のレジスタグル
ープに含まれる複数のレジスタから順次データを出力さ
せる頻度を算出し、この算出結果に基づいて、第2の仮
想レジスタ群の各仮想レジスタを実レジスタに割り付け
るステップと を有することを特徴とするレジスタ割り付け方法。(2) A register allocation method for allocating each variable and/or intermediate result of an operation in a program executed by a data processing device equipped with the register device according to claim 1 to each of the registers, the method comprising: and/or allocating intermediate results of the operation to an infinite number of virtual registers of the first virtual register group, each virtual register being equal to the number of real registers of the data processing device constituting the second virtual register group. The step of allocating the virtual registers to a number of virtual registers, and the plurality of correspondence relationships of allocating each virtual register of the second virtual register group to the real register, sequentially outputting data from a plurality of registers included in the same register group. A register allocation method comprising the steps of calculating the frequency and allocating each virtual register of the second virtual register group to a real register based on the calculation result.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2334716A JPH04199428A (en) | 1990-11-29 | 1990-11-29 | Register device and register allocating method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2334716A JPH04199428A (en) | 1990-11-29 | 1990-11-29 | Register device and register allocating method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH04199428A true JPH04199428A (en) | 1992-07-20 |
Family
ID=18280417
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2334716A Pending JPH04199428A (en) | 1990-11-29 | 1990-11-29 | Register device and register allocating method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH04199428A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009059001A (en) * | 2007-08-29 | 2009-03-19 | Internatl Business Mach Corp <Ibm> | Technique for allocating register to variable for compiling program |
-
1990
- 1990-11-29 JP JP2334716A patent/JPH04199428A/en active Pending
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009059001A (en) * | 2007-08-29 | 2009-03-19 | Internatl Business Mach Corp <Ibm> | Technique for allocating register to variable for compiling program |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5056000A (en) | Synchronized parallel processing with shared memory | |
| US5872987A (en) | Massively parallel computer including auxiliary vector processor | |
| US20030061601A1 (en) | Data processing apparatus and method, computer program, information storage medium, parallel operation apparatus, and data processing system | |
| JPS58151655A (en) | Information processing device | |
| JPS6027984A (en) | data processing equipment | |
| KR100288170B1 (en) | Data processor with a compute unit that shares a set of register files | |
| US4755931A (en) | Vector processing unit capable of reading vector data from a vector register simultaneously to plural resources | |
| JP3144842B2 (en) | Microprocessor | |
| JPH04199428A (en) | Register device and register allocating method | |
| JPH0650512B2 (en) | Data processing device | |
| EP0314342B1 (en) | Parallel pipelined computer processor | |
| JPS60204029A (en) | Signal processing device | |
| JPS62145435A (en) | Microprocessor with concurrent processing instructions | |
| CN109948785B (en) | High-efficiency neural network circuit system and method | |
| JP2545798B2 (en) | Digital signal processing circuit | |
| JPH0199132A (en) | Multi-task executing device | |
| JPH0789320B2 (en) | Processor | |
| JPH025104A (en) | Arithmetic processing unit | |
| JPS62164138A (en) | Microprocessor with concurrent loop | |
| JP2760808B2 (en) | Data processing device | |
| JPS63204322A (en) | information processing equipment | |
| JPH04184535A (en) | Parallel arithmetic units | |
| JPH0452760A (en) | Vector processor | |
| CN121478350A (en) | Instruction execution equipment, instruction execution method and electronic device | |
| JP2560120B2 (en) | Arithmetic unit |