JPS58161045A - Register management method in compiler - Google Patents
Register management method in compilerInfo
- Publication number
- JPS58161045A JPS58161045A JP4387382A JP4387382A JPS58161045A JP S58161045 A JPS58161045 A JP S58161045A JP 4387382 A JP4387382 A JP 4387382A JP 4387382 A JP4387382 A JP 4387382A JP S58161045 A JPS58161045 A JP S58161045A
- Authority
- JP
- Japan
- Prior art keywords
- register
- code
- address
- information
- instruction
- 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.)
- Granted
Links
- 238000007726 management method Methods 0.000 title claims description 32
- 238000000605 extraction Methods 0.000 claims description 2
- 150000001875 compounds Chemical class 0.000 abstract description 30
- 238000012545 processing Methods 0.000 abstract description 28
- 238000006243 chemical reaction Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 8
- 238000012546 transfer Methods 0.000 description 8
- 238000009825 accumulation Methods 0.000 description 7
- 238000005457 optimization Methods 0.000 description 6
- 238000000034 method Methods 0.000 description 5
- 230000004913 activation Effects 0.000 description 2
- 238000007689 inspection Methods 0.000 description 2
- 239000011229 interlayer Substances 0.000 description 2
- 239000002131 composite material Substances 0.000 description 1
- 238000013329 compounding Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 239000010410 layer Substances 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
【発明の詳細な説明】
(1発明の技術分野
本発明はコンパイラにおけるレジスタ管理方式KIIL
、’Iにマシンの持つレジスタに関連する処理(例えば
レジスタ割付け、最適化)を行う際にレジスタの使用情
報を簡単に得ることができるようKし九りラスタ管焉方
式に関する。Detailed Description of the Invention (1) Technical Field of the Invention The present invention relates to a register management system KIIL in a compiler.
, ``I'' relates to a raster management method that allows register usage information to be easily obtained when performing processing related to registers of a machine (for example, register allocation, optimization).
(2)技術の背景
高級言語で記述基れ九ソース・プログラムからオブジェ
クト・コードを生成するコ/ノ(イラでは。(2) Technical background A technology that generates object code from a source program written in a high-level language.
マシンのもつレジスタに関連する処理(例えばレジスタ
割付砂、最適化)を行う際にレジスタ管理を行っている
。Register management is performed when processing related to the registers of the machine (for example, register allocation, optimization).
レジスタ0IIIjIIを正確に行うためには、コンノ
くイラが生成した各コードでのレジスタの使用情報が必
要になる。そこでコンパイラでは、各コードでのレジス
タ使用情報を何らかの方法で得て、この得られ九情報を
何らかの形で蓄える。コンノくイラ社この情報を参照し
て、レジスタ割付けや最適化などのレジスタに関連する
処理を行う。In order to perform register 0IIIjII accurately, register usage information in each code generated by Konnokuira is required. Therefore, the compiler uses some method to obtain register usage information for each code, and stores this obtained information in some form. Konno Kuirasha refers to this information and performs register-related processing such as register allocation and optimization.
例えばマシンが次の■〜■の特徴を持っている場合につ
いてこれを説明する。For example, this will be explained in the case where the machine has the following characteristics (1) to (2).
■A、Hの2つのレジスタをもつ。■It has two registers, A and H.
■メモリから人レジスタへの転送命令と、メモリからB
レジスタへの転送命令をもつ。■Transfer command from memory to human register and from memory to B
Has a transfer instruction to a register.
■i!に、 #記■の2つの命令を同時KiIj行でき
る命令(以下複合命令という)を4つ。■i! There are four instructions (hereinafter referred to as compound instructions) that can execute the two instructions marked #■ at the same time.
このような特徴をもつマシンのコードを生成するコンパ
イラ−における最適化として、コンパイラが生成したコ
ードからIil記■の2つの転送命令を見つけて、これ
らを前記■の複合命令に変換する複合命令化があげられ
る。このような複合命令化を行うことがマシンの夾行効
率、メモリ使用効率を向上させることになり、tたこの
ようなことと効果的に行うことがコンパイラの性能評価
のポイントともなる。As an optimization for a compiler that generates code for a machine with such characteristics, it finds the two transfer instructions in item II (ii) from the code generated by the compiler, and converts them into the compound instructions in item (iii) above. can be given. Making such complex instructions improves the machine's interleaving efficiency and memory usage efficiency, and the point of compiler performance evaluation is to do this effectively.
このコンパイラが行う複合命令化の内容は次の5点であ
る。The contents of the compound instruction conversion performed by this compiler are as follows.
■′メモリからAレジスタへの転送命令(MOWNA
メモリ)と、メモリからBレジスタへの転送命令(MO
VE Rメモリ)のコードのペアを見つける。■' Transfer command from memory to A register (MOWNA
memory) and a transfer instruction from memory to B register (MO
VER memory).
■′このペアが複合命令として1命令に変換できるか否
かを調べる。■'Check whether this pair can be converted into one instruction as a compound instruction.
d複合命令化できるペアがあれば、2つのコードを1つ
のコードに変化する。dIf there is a pair that can be made into a compound instruction, the two codes are changed into one code.
すなわち、第1図(イ)K示す如く、コンパイラが生成
して命令メ毫りMBMに保持されたコードの中からまず
飾記σ0処焉を行って、第1図(イ)におけるコード1
とコード2のペアを見りける。That is, as shown in FIG. 1(a), the code 1 in FIG.
You can see a pair of code 2 and code 2.
次に仁のコード1とコード2の間にあるコードでムレジ
スタとBレジスタの使用状況を調うヘて。Next, use the code between Jin's code 1 and code 2 to check the usage status of the M register and B register.
コード1とコード2との間にあるコードの中で。In the code between code 1 and code 2.
Aレジスタ、Bレジスタともに使用している場合を除き
(すなわち前記aの処理)、第1図(ロ)に示す如く、
1命令でメモリからそれぞれ人レジスタとBレジスタへ
転送命令の機能を有する複合命令化を行う(1111記
■′の処jl)。Unless both the A register and the B register are used (i.e., the process in a), as shown in FIG. 1 (b),
A single instruction is converted into a compound instruction having the function of a transfer instruction from the memory to the register and the B register respectively (processing jl of 1111 ■').
このようにコード1とコード2の間でAレジスタを使っ
ていないならば前記の如く複合命令化を実行するが、第
2図(イ)K示す如く、コード1とコード2の間でAレ
ジスタ、Bレジスタともに使用している場合(例えばA
レジスタとBレジスタを加算するADD命令があるとき
)、コード1とコード2を複合命令化して、第2図(ロ
)に示す如く。In this way, if the A register is not used between code 1 and code 2, the compound instruction is executed as described above, but as shown in FIG. and B registers are used (for example, A
When there is an ADD instruction that adds a register and a B register), code 1 and code 2 are converted into a compound instruction as shown in FIG. 2 (b).
1つのコードに変換すると、この結果得られるコードの
実行結果は元のコードとは違うものになり。When converted into a single code, the execution result of the resulting code will be different from the original code.
ぐ・誤りである。すなわち、第2図(ロ)Kおける A
DD命令で用いるAレジスタには、コード1のときに人
レジスタに記入されているメモリからの転記内容が入っ
ていないので、第2図(イ)に示す元のコードの7実行
結果とは別のものとなる。This is incorrect. In other words, A in Figure 2 (b) K
Since the A register used in the DD instruction does not contain the contents transferred from memory written in the human register at code 1, it is different from the 7 execution result of the original code shown in Figure 2 (a). Becomes the property of
従ってコンパイラが生成するコードにおいて。Therefore in the code generated by the compiler.
どのコードでA、B2つのレジスタの記入内容を使用し
ているのか(以下useという)、あるいは人、B2つ
のレジスタにデータを記入しているのか(以下d@fと
いう)を示すレジスタ情報をコンパイラがもち、複合命
令化しなければ正しい結果を得ることはできない。The compiler generates register information indicating which code is using the contents of the two registers A and B (hereinafter referred to as "use") or whether data is being written in the two registers B (hereinafter referred to as "d@f"). However, it is not possible to obtain the correct result unless it is made into a compound instruction.
(3) 従来技術と間層点
前記の如く、コンパイラが生成したコードの複合命令化
という最適化を行うためには、コンパイラは生成した各
コードの正確なレジスタ情報をもつ必要がある。(3) Prior art and interlayer points As mentioned above, in order to optimize the code generated by the compiler by converting it into complex instructions, the compiler needs to have accurate register information for each code it generates.
一般にこの複合命令化を行う前に、コードの移動を伴う
レジスタ関連の処理(例えば、レジスタ割付けの最適化
)を行っており、勿論このようなレジスタ関連のlI&
堰においても、複合命令化と同機にレジスタの使用情報
が必要である。Generally, register-related processing that involves code movement (e.g. register allocation optimization) is performed before making this complex instruction, and of course such register-related lI &
Weir also requires complex instructions and register usage information for the same machine.
このコードの移動を伴うレジスタ関連の処理の後に、複
合命令化を正しく行う丸めには、レジスタ情味の変化に
注意してレジスタ1理を行う必要がある。After this register-related processing that involves code movement, rounding to correctly convert the code into a compound instruction requires performing register processing while paying attention to changes in register characteristics.
従来のレジスタ管理方式で社、コンパイラが生成し九各
コードのオペレージ曹ンとオペランドをチェックして、
このコードで使用するレジスタの2つの使用情報vse
とdef、すなわち・レジスタを使っているのか(us
e )・レジスタにのせているのか(def)を求めて
レジスタ管雇用の情報テーブルを作成してい友。Using the traditional register management method, the compiler generates 9 codes and checks the operands and operands of each code.
Two register usage information vse used in this code
and def, i.e. Are you using registers (US
e)・I am creating an information table for register management employment in order to find out whether it is on the register (def).
例えば、第5図(イ)に示す如く、コンパイラが生成し
九コードが命令メモリMRM中に記入されているとき(
なお第5図(イ)で左側の数字はコードの拳香を示す)
、これより第5図(ロ)に示す励きレジスタ管理用の情
報テーブルTを作成する。ここでaυ、(7)は、第5
図((IKおける左側の数字を示し。For example, as shown in FIG. 5(a), when nine codes generated by the compiler are written in the instruction memory MRM (
In addition, the numbers on the left side in Figure 5 (a) indicate the code name)
From this, an information table T for managing registers shown in FIG. 5(b) is created. Here aυ, (7) is the fifth
Figure ((shows the numbers on the left in IK).
Aレジスタは順番fiυのコードによりメモリからデー
タが記入され、Bレジスタ社順番四のフードによ抄メモ
リからデ、−夕が記入されることを示している。This shows that data is written from the memory in the A register by the code of order fiυ, and data is written from the memory in the hood of the B register company order 4.
このとき、レジスター付けの最適化のために。At this time, for optimization of register assignment.
例えば第3図(イ)に順番αυで示したコードが、第4
図(イ)K示すように順番a9に移動され九とき、これ
に応じて、第4図(ロ)K示すように、これに応じてレ
ジスタ管理用の情報テーブルTの内容を変更しておかな
ければ、紋情報テーブルTを参照して行う複合命令化を
正しく実行することはできない。For example, the code shown in the order αυ in Figure 3 (a) is
When the order is moved to a9 as shown in Figure (A) K, the contents of the information table T for register management are changed accordingly, as shown in Figure 4 (B) K. Otherwise, it is not possible to correctly execute compound instruction conversion performed by referring to the print information table T.
すなわち、従来のレジスタ管理方式を用いて複合命令化
を正しく行うためには、レジスタ管理用の情報テーブル
を修正する地理が心機不可欠であり、そのための手数が
多く必要とした。もしも修正地理を行わないとすれば複
合命令化を行う前に。In other words, in order to correctly perform compound instructions using the conventional register management method, it is essential to modify the register management information table, which requires a lot of effort. If you don't do corrective geography, before you do compound imperatives.
再びコンパイラが生成したコードのオペレージ四ンとオ
ペ2ンドをチェックしてレジスタ管理用の情報テーブル
を新らしく作る処理が必要であり。It is necessary to again check the operands and operands of the code generated by the compiler and create a new information table for register management.
さらに多くの手数を必要とする。It requires more work.
4)発明の目的 本発明の易的紘、レジスタ’1131を行うために。4) Purpose of the invention To perform the easy implementation of the present invention, register '1131.
コードの移動の度にその書替を必要とするこのような情
報テーブルを使用することのないコン7(イツにおける
レジスタ管理方式を提供するものである。The present invention provides a register management system in the computer 7 that does not use such an information table that requires rewriting every time a code is moved.
(5) 発明の構成
この目的を達成する九め本発明のコン7(イラにおける
レジスタ管理方式では、高級言語で記述されたソース−
プログラムからオブジェクト・コードを作成するコンパ
イラにおいて、オブジェクト・コードが使用するレジス
タのレジスタ使用情報を付加するコード生成手段と、前
記レジスタ使用情報が付加場れたコードを記入するコー
ド用メモリ手段と、#記コード用メモリ手段の調査範囲
を指示する指示手段と、前記レジスタ使用情報を抽出す
るレジスタ使用情報抽出手段を有し、管理すべき範囲内
のコードに付加されたレジスタ使用情嚢をチェックする
ことによ抄レジスタ管理を行うようにしたことを特徴と
する。(5) Structure of the Invention The ninth feature of the present invention to achieve this purpose is to use a source code written in a high-level language.
In a compiler that creates object code from a program, code generation means adds register usage information of registers used by the object code; code memory means writes code to which the register usage information is added; The present invention has an instruction means for instructing an investigation range of the code memory means, and a register usage information extraction means for extracting the register usage information, and checks register usage information packets added to codes within the range to be managed. A feature of this system is that the register management is performed automatically.
(61発明の実施例
本発明の一実施例を詳述するに先立ち、第5図〜第8図
にもとづきその概略を説明する。(61 Embodiment of the Invention Before describing in detail one embodiment of the present invention, its outline will be explained based on FIGS. 5 to 8.
本発明では、ソース・プログ2ムからコン7(イラがオ
ブジェク)番コードを生成するとき、第5図に示す如く
、この生成したコードにマシンの4つレジスタの使用情
報ビットbを付加する。例え#i人レジスタとBレジス
タのuseとdef f示すエリアをコードに付加する
場合に社、コート°にb1〜b4の4ビツトのエリアを
とり、第6図に示す如く、″Aレクラタ、Bレジスタの
uae 、 dafの状態に応じてrOJ、rIJを定
める。このレジスタ情報用の各ビットをコ/ノ(イラが
コードを生成すると色。In the present invention, when generating a code No. 7 (an object) from a source program, use information bits b of four registers of the machine are added to the generated code, as shown in FIG. For example, when adding an area indicating the use and def f of the #i register and the B register to the code, take a 4-bit area from b1 to b4 in the column and code, and write "A register, B register" as shown in Figure 6. rOJ and rIJ are determined according to the states of the registers uae and daf. Each bit for this register information is set as a color when the code is generated.
−」時にセットする。そしてレジスタ関連処理における
レジスタ管履けすべてコードに付加したレジスタ使用情
報ビットbをチェックす冷ことにより行い、レジスタ管
理用の情報テーブルは不要とする。-” set. All register management in register-related processing is performed by checking the register usage information bit b added to the code, eliminating the need for an information table for register management.
例えば第7図(イ)に示す如く、命令メモjJ MBM
K前記σに示したコン7(イラが生成したコート°を記
入するとき、そのコードにおけるレジスタの使用情報を
記入する。すなわち、第7図(イ)における**Uのコ
ードではムレジスタにメモリからデータを転記する丸め
Kd@fを示すビットb1に「1」力≦記入され、11
番(至)のコードではBレジスタにメモリからデータを
転記するので、同蟻にピッ) baに「1」が記入され
ている。For example, as shown in FIG. 7(a), the instruction memo jJ MBM
When writing the code generated by code 7 (Ira) shown in σ above, write the register usage information in that code. In other words, in the code **U in Figure 7 (a), the code from memory is stored in the mu register. “1” is written in bit b1 indicating rounding Kd@f to transfer data, and 11
In the code number (to), data is transferred from memory to the B register, so "1" is written in ba for the same ant.
したがって順番Iのコードに対してレジスタ関連の処理
で、第7図(ロ)K示す位置にコート°の移動がある場
合、単に該コードを移動するだけでよい。Therefore, if there is a shift of the code to the position shown in FIG. 7(b) K in register-related processing for the code in order I, it is sufficient to simply move the code.
複合命令化を行う場合、コン7(イラが生成したコード
の一部が第8図(イ)に示す状態にあるとき。When converting into compound instructions, a part of the code generated by Con7 (Ira) is in the state shown in FIG. 8 (A).
**aSと(2)のコードがこの複合命令の候補である
。**aS and code (2) are candidates for this compound instruction.
これらのゴ・=ドを°1合化するために、このコート。This coat is used to combine these go-dos.
のベアが複合命令化できるか否かをチェックすることが
必要であるが、このとき職番a唾からlI唾までの中で
AレジスタとBレジスタの使用状況をチェックする。こ
の楊合、各コードにレジスタ使用情報ビットbI−b4
をチェックすれば簡単にそれらの使用情報を得ることが
できる。これらのチェックの結果、珈番霞からaltで
のAレジスタのus@情報ビットがすべて「0」であれ
ば順番α$と(至)のコードを複合命令化できる。これ
により、18図(ロ)に示す如<、J[I(+49と(
2)のコードを1つの複合命令に変換することができる
。It is necessary to check whether the bear can be converted into a compound instruction or not. At this time, the usage status of the A register and B register in job numbers a to lI is checked. In this case, each code has register usage information bits bI-b4
You can easily get information on their usage by checking . As a result of these checks, if all the us@ information bits of the A register from kabanka to alt are "0", the code in the order α$ and (to) can be converted into a compound instruction. As a result, as shown in Figure 18 (b), <, J[I(+49 and (
The code in 2) can be converted into one compound instruction.
次に本発明の一実施例構成をis9図にもとづき説明す
る。Next, the configuration of an embodiment of the present invention will be described based on an IS9 diagram.
図中、1はコード生成部、2は複合命令化処理部、5は
レジスタ管理部、4線命令メモリ、5紘入出力レジスタ
、6は出力レジスタ、7は命令アドレス・レジスタ、8
は第1アドレス・レジスタ。In the figure, 1 is a code generation section, 2 is a composite instruction processing section, 5 is a register management section, 4-line instruction memory, 5 is a Hiro input/output register, 6 is an output register, 7 is an instruction address register, 8
is the first address register.
9は第2アドレス・レジスタ、10は情報選択レジスタ
、11は使用情報レジスタ、12は第5アドレス・レジ
スタ、15は第4アドレス・レジスタ、14は第5アド
レス・レジスタ、15は第1情−レジスタ、16は第2
情報レジスタ、17は情報累積レジスタ、18は第3情
報レジスタ。9 is a second address register, 10 is an information selection register, 11 is a usage information register, 12 is a fifth address register, 15 is a fourth address register, 14 is a fifth address register, 15 is a first information register. register, 16 is the second
Information register 17 is an information accumulation register, 18 is a third information register.
1?紘子アドレス定部、20はアドレス・カウントアツ
プ部、21はアンド操作部、22はオア操作部、25は
コント四−2である。1? 20 is an address/count-up section, 21 is an AND operation section, 22 is an OR operation section, and 25 is a controller 4-2.
コード生成部1はソース・プログラムからオブジェクト
・コードを生成すゐものであって、生成したコードは命
令メモリ4に保持される。The code generation unit 1 generates object code from a source program, and the generated code is held in the instruction memory 4.
壷金命令化処理部2紘;−ド生成部1により生成され九
コードのうち複合化できる屯のがあればこれを検出して
複合命令を作成するものである。If there is a code that can be compounded among the nine codes generated by the code generating section 1, it detects it and creates a compound instruction.
レジスタ管理部3は命令メモリ4中に格納されているコ
ードにおけるレジスタの使用状態を管理するもので6に
複金命令化lI&履部2からの指示により、vk述する
ように指示された範囲のチェックを行うものである。The register management unit 3 manages the usage status of registers in the code stored in the instruction memory 4. The register management unit 3 manages the usage status of registers in the code stored in the instruction memory 4. This is a check.
命令メ毫り4はコード生成部1によりコンパイラが生成
したフードが格納されるものであり、第7図、第8図の
命令メモIJMEMK対応する。この命令メモリ4の内
部には、第5図に示す如きフォーマットのコード、すな
わち命令コードとレジスタ使用情報ビットb1〜b4が
記入されており、このレジスタ使用情報ピッ) bt〜
b4の定義は、第6図に示す通りである。The instruction memo 4 stores the food generated by the compiler by the code generation unit 1, and corresponds to the instruction memo IJMEMK shown in FIGS. 7 and 8. Inside this instruction memory 4, a code in a format as shown in FIG. 5 is written, that is, an instruction code and register usage information bits b1 to b4.
The definition of b4 is as shown in FIG.
入出力レジスタ5は、コード生成部1tたは複合命令化
処理部2からコードを受けて命令メモリ4に入力したり
、あるい紘命令メモリ4がら出力されたコードがセット
され石ものである。The input/output register 5 receives a code from the code generation section 1t or the complex instruction processing section 2 and inputs it to the instruction memory 4, or is set with a code output from the instruction memory 4.
出力レジスタ6は命令メモリ4から出力し九コードを保
持するものであり、そのうち特にレジスタ使用情報ピッ
) bs〜b4が外部に出方されるように構成されてい
る。The output register 6 is configured to output nine codes from the instruction memory 4 and to output the register usage information (P) to b4 to the outside.
命令アドレス・レジスタ7社命令メモリ4をアクセスす
るためのアドレスがセットされるアドレス・レジスタで
ある。Instruction address register 7 This is an address register in which an address for accessing the instruction memory 4 is set.
第1アドレスφレジスタ8は命令メモリ4のどのコード
からレジスタ管理を行うかを示すアドレスがセットされ
るものであ#)、このアドレスを複合命令化処理部2か
ら受けてレジスタ管理部3に伝達するものである。The first address φ register 8 is set with an address indicating from which code in the instruction memory 4 register management is to be performed.This address is received from the compound instruction processing unit 2 and transmitted to the register management unit 3. It is something to do.
第2アドレス・レジスタ9は命令メモリ4のどのコード
壕でレジスタ管理を行うかを示すアドレスがセット宴れ
るものであ抄、仁のアドレスを複合命令化処理部2かも
受けてレジスタ管理部5に伝達するものである。The second address register 9 stores an address indicating which code trench in the instruction memory 4 is used for register management. It is something that is communicated.
情報選択レジスタ10は、コードに付加したレジスタ使
用情報ビットb1〜b4のうちどのビットを取出すのか
を指示するものであに、この指示は複合命令化処111
12から出力され、レジスタ管理部15に伝達するもの
である。もしAレジスタのdef状態と、Bレジスタの
def状態を取出す場合にはレジスタ使用情報ビットb
、とb4のみを取出せばよく、このとき社情報選択レジ
スタ100ビットb。The information selection register 10 instructs which bit of the register usage information bits b1 to b4 added to the code is to be extracted.
12 and is transmitted to the register management section 15. If you want to retrieve the A register's def state and the B register's def state, register usage information bit b
, and b4 only need to be taken out. At this time, company information selection register 100 bit b.
とb4位置にそれぞれ「1」で他のビットblとす、が
それぞれ「0」の選択指示情報が記入されることになる
。Selection instruction information is written in which the other bits bl and b4 are respectively "1" and "0".
使用情報レジスタ11祉レジスタ管理部5から送出され
るレジスタ使用情報がセットされるものである。Usage information register 11 Register usage information sent from the welfare register management section 5 is set therein.
g15アドレス会レジスタ12は、命令メモリ4からレ
ジスタ使用情報を耽出すコードのアドレスがセットされ
るレジスタである。The g15 address register 12 is a register in which the address of a code that extracts register usage information from the instruction memory 4 is set.
第4アドレス会レジスタ13は、後述するアーレス判定
部19から出方されるアドレスがセットされるものであ
る。The fourth address register 13 is set with an address issued from an address determination section 19, which will be described later.
第5アドレス・レジスタ14は、後述するアドレスQカ
ウントアツプ部2oより出力された。第4アドレスルジ
スタ13にセットされたアドレスの次のアドレスがセッ
トされるものである。The fifth address register 14 is outputted from an address Q count up section 2o, which will be described later. The address next to the address set in the fourth address register 13 is set.
第1情報レジスタ15は命令メモリ4よに胱出し九コー
ドに付加されたレジスタ使用情報ビットb、〜b4がセ
ットされるものである。In the first information register 15, the register usage information bits b, to b4 added to the instruction memory 4 and the bladder release code are set.
第2情報レジスタ16祉後述するアンド操作部21より
出力されるレジスタ使用情報がセットされるものである
。The second information register 16 is used to set register use information output from the AND operation section 21, which will be described later.
情*11累横レジスタ17社命令メモリ4から読出した
レジスタ使用情報が累積されるものである。Register use information read from the instruction memory 4 is accumulated.
第5情報レジスタ18は、41述するオア操作部22か
ら出力されるレジスタ使用情報がセッートされる4ので
ある。The fifth information register 18 is set with register usage information output from the OR operation unit 22 described in 41.
アドレス判定1119Fi、第2アドレス・レジスタ?
にセットされたアドレスと、第5アドレス拳レジスタ1
2にセットされ九アドレスとが一致するか否かを判定す
る4のであって、一致したときこれを後述するコントロ
ーラ25に報告するものである。Address judgment 1119Fi, 2nd address register?
and the address set in 5th address register 1
It is set to 2 and determines whether or not the 9th address matches or not, and when there is a match, this is reported to the controller 25, which will be described later.
アドレス拳カウントアツプ部20a、Ii4アトVX・
レジスタ15にセットされたアドレスを1つ増やしてこ
れを第5アドレス・レジスタ14に出力するものである
。Address fist count up part 20a, Ii4at VX・
The address set in the register 15 is incremented by one and this is output to the fifth address register 14.
アンド操作部21は、情報選択レジスタ1o上にセット
された選択指示情報(取出したいビットが「1」で他が
「0」)と第1情報レジスタ15との各ビットbI〜b
4毎のビット対応のアンドをとるものである。The AND operation unit 21 selects the selection instruction information set on the information selection register 1o (the bit to be extracted is "1" and the others are "0") and each bit bI to b of the first information register 15.
This is an AND operation corresponding to every 4 bits.
オア操作部22祉第2情報レジスタ16と情報累積レジ
スタ17にそれぞれセットされたレジスタ使用情報の各
ピッ) b、−’−b、毎のビット対応のオアをとるも
のである。The OR operation unit 22 performs an OR operation on each bit of the register use information set in the second information register 16 and the information accumulation register 17, respectively.
コントローラ25はレジスタ管理s5を1括制御するも
のであって、鉤えば複合命令化処理部2からスタート信
号を受けたとtlKこのレジスタ管理部5を起動させた
抄、レジスタ管理が終了した信号を複合命令化処理部2
に送出した抄、アドレス判定部19やアドレス拳カウン
トアツプ部20゜アンド操作部21.オア操作部22に
起動をか轄たり、アートレス判定Wh19からの終了信
号によりレジスタ使用情報をしジ久グ管理部3から出力
させる勢のような各種制御を行うものである。The controller 25 collectively controls the register management s5, and when it receives a start signal from the compound instruction processing unit 2, it composes the signal that started the register management unit 5 and the signal that register management has finished. Instruction processing unit 2
The address judgment unit 19, address count up unit 20, and operation unit 21. It performs various controls such as instructing the OR operation section 22 to start up, and outputting register usage information from the digital management section 3 in response to an end signal from the artless determination Wh19.
次に第9図の動作について説明する。Next, the operation shown in FIG. 9 will be explained.
■ いま、コード生成部1より第5図に示す状態のコー
ドが作成され、これが第8図(イ)K示すような状態で
命令メモリ4に格納されており、*誉a喝〜■がそのi
t命令メモリ4のアドレスに相当する本のとする。そし
て複合命令化処理部2がコード生成部1のコード作成状
態を監視し、命令メモリ4のアドレス「15」とアドレ
ス「20」に格納されているコードを複合命令化すべき
であると判断したとを、アドレス「16」〜アドレスr
lWJ間に存在するコードがAレジスタとBレジスタを
delの状態で使用していないことをチェックしなけれ
ばならない。したがって複合命令化処理部2鉱、第1ア
ドレス・レジスタ8にアドレス「16」ヲセットし、第
2アドレスeレジスタ9にアドレス「19」をセットし
、情報選択レジスタ10にk)l+b4に相当のビット
に「1」を記入した「o i OIJを記入し、各=−
ドのす、、b4に対する情報選択を指示する。それから
複合命令化処理部2はレジスタ管理部SK起動信号を送
出する。■ Now, the code in the state shown in Figure 5 is created by the code generator 1, and this is stored in the instruction memory 4 in the state shown in Figure 8 (a) K. i
t is the book corresponding to the address of the instruction memory 4. Then, when the compound instruction conversion processing section 2 monitors the code creation status of the code generation section 1 and determines that the code stored at address "15" and address "20" of the instruction memory 4 should be converted into compound instructions. , from address "16" to address r
It must be checked that the code existing between lWJ does not use the A and B registers in the del state. Therefore, the compound instruction processing unit 2 sets the address "16" in the first address register 8, sets the address "19" in the second address e register 9, and sets the bit corresponding to k)l+b4 in the information selection register 10. Enter "1" in "o i OIJ", each = -
Instructs to select information for the code, b4. Then, the compound instruction processing section 2 sends out a register management section SK activation signal.
■ コント3−ツ23は仁の複合命令化処理部2からの
起動信号を受けたとき、アドレス判定部1?、アドレス
・カウントアツプ部20.アンド操作部21.オア操作
部22を起動する。■ When the control unit 23 receives the activation signal from the complex instruction processing unit 2, the address determination unit 1? , address count-up section 20. AND operation section 21. The OR operation section 22 is activated.
■ 第1アドレス・レジスタ8にセットされたアトレー
ス「16」は第5アドレス・レジスタ12にセットされ
る。アドレス判定部19拡この第3アドレス・レジスタ
12にセットされたアドレス「16」が第2アドレス・
レジスタ9にセットされたアドレス「19」に達しない
ので、第3アドレス・レジスタ12にセットされたアド
レスを第4アドレス・レジスタ13に出力され、これK
より命令アドレス・レジスタ7にアドレス「16」がセ
ットされ命令メモリ4の尚該アドレスが読出されてその
コード及びレジスタ使用情報が出力レジスタ6に出力さ
れる。そしてこのレジスタ使用情報が第1情報レジスタ
15にセットされ、前記情報選択レジスタ10で指示さ
れているb1〜b4[0101Jに対するビット対応の
論理積がアンド操作部21で求められる。したがって命
令メモリ4のアドレス「16」に記入されているコード
がAレジスタ及びBレジスタを使用していないときには
第1情報レジスタ15に[0OOOJがセットされるの
で。■ Atrace "16" set in the first address register 8 is set in the fifth address register 12. The address “16” set in the third address register 12 of the address determination unit 19 is the second address.
Since the address "19" set in register 9 is not reached, the address set in third address register 12 is output to fourth address register 13, and this is K.
The address "16" is set in the instruction address register 7, the address in the instruction memory 4 is read out, and its code and register usage information are outputted to the output register 6. This register use information is then set in the first information register 15, and the AND operation unit 21 calculates the logical AND of the bits corresponding to b1 to b4[0101J designated by the information selection register 10. Therefore, when the code written at address "16" of the instruction memory 4 does not use the A register and the B register, [0OOOJ is set in the first information register 15.
アンド操作部21からは[0OOOJが出力され。The AND operation section 21 outputs [0OOOJ.
これが第2情報レジスタ14にセットされる。This is set in the second information register 14.
■ この第2情報レジスタ16にセットされ九データは
、オア操作部22を経由して第3情報レジスタ18に伝
達され、それから情報累積レジスタ17にセットされる
。(2) The nine data set in the second information register 16 are transmitted to the third information register 18 via the OR operation section 22, and then set in the information accumulation register 17.
■ 一方、’J4アドレス・レジスタ13に七ッツプ部
20によp+1されて「17」となり、 $5アドレス
・レジスタ14を経由して第3アドレス・レジスタ12
にセットされる。そしてこのアドレスj17Jが、これ
壜九第2アドレス・レジスタ9にセットされているアド
レスrl?JK達したかどうかの判別が行なわれ、それ
からこのアドレス「17」が第4アドレス・レジスタ1
3にセットされ、同様にして命令メモリ4のアクセスが
行われる。そしてこのアドレス「17」におけるコード
のレジスタ使用情報が第1情報レジスタ15にセットさ
れ、前記と同様なアンド操作がアンド操作部21によ知
行われる。■ On the other hand, the 'J4 address register 13 is incremented by p+1 by the seventh step section 20 and becomes "17", which is then sent to the third address register 12 via the $5 address register 14.
is set to And this address j17J is the address rl? set in the second address register 9? A determination is made as to whether JK has been reached, and then this address "17" is stored in the fourth address register 1.
3, and the instruction memory 4 is accessed in the same way. Then, the register use information of the code at address "17" is set in the first information register 15, and the AND operation section 21 performs the same AND operation as described above.
0 このようなことが順次行なわれて第3アドレス・レ
ジスタ12にアドレス[19Jがセットされ九ときアド
レス判定部19はコントローラ25に対して、このアド
レスが第2アドレス・レジスタ9にセットされた値と一
致することを報告し。0 When these steps are performed in sequence and the address [19J is set in the third address register 12, the address determination unit 19 informs the controller 25 that this address is the value set in the second address register 9. Report that it matches.
第4アドレス・レジスタ15にこのアドレス「19Jを
出力する。;ントローラ25はこれによりアドレス・カ
ウントアツプ部200動作を停止させる。This address "19J" is output to the fourth address register 15. The controller 25 thereby stops the operation of the address count-up section 200.
とζろで命令メモリ4では第4アドレス・レジスタ15
を経由して命令アドレス・レジスタ7に−にットされた
アドレス「1 ?J K対するアクセスが行なわれ、そ
のコードに付加されたレジスタ使用情報が第1情報レジ
スタ15にセットされ、m記の場合と同様にアンド操作
されてこれが第2情報レジスタ16にセットされ、これ
と情報累積レジスタ17にセットされているアドレス「
16」〜「18」までのレジスタ使用情報とビット対応
してオア操作されてgJ5情報レジスタ18を経由して
、今度はアドレス「16」〜「19」までのレジスタ使
用情報が情報累積レジスタ17にセットされる。それか
らコントローラ23よ抄出力指令がオア操作部22に伝
達されるので、オア操作部22は仁の情報累積レジスタ
17に累積されたレジスタ使用情報を第3情報レジスタ
18を経由して使用情報レジスタ11に出力する。In the instruction memory 4, the fourth address register 15
An access is made to the address "1? As in the case, an AND operation is performed and this is set in the second information register 16, and this and the address set in the information accumulation register 17 are
The register usage information from addresses "16" to "19" is ORed in correspondence with the bits and passed through the gJ5 information register 18, and then the register usage information from addresses "16" to "19" is stored in the information accumulation register 17. Set. Then, the output command from the controller 23 is transmitted to the OR operation unit 22, so the OR operation unit 22 transfers the register usage information accumulated in the information accumulation register 17 via the third information register 18 to the usage information register 11. Output to.
■ もし命令メ毫り4のアドレス「16」〜「19」に
記入されたコードがAレジスタもBレジスタも使用しな
ければ(bs g haに関する態様で)使用情報レジ
スタ11Ka 「0000Jが記入されることになる。■ If the code written in addresses ``16'' to ``19'' of instruction message 4 does not use register A or register B (in the manner related to bs g ha), ``0000J'' is written in usage information register 11Ka. It turns out.
し九がりて複素命令化処理部2は使用情報レジスタII
K記入されたデータより前記アドレス区間内におけるコ
ードがムレジスタもBレジスタも使用されていないこと
をg*する。そしてその結果第8図(ロ)に示す如くア
ドレス「15」とj20Je:I−ドを複合化した複合
命令を作成し。Finally, the complex instruction processing unit 2 uses the usage information register II.
From the data written in K, it is g* determined that neither the M register nor the B register is used for the code within the address area. As a result, a compound instruction is created by compounding the address "15" and the j20Je:I- code as shown in FIG. 8(b).
これを入出力レジスタ5にセットする。そしてコント四
−223からむのセットに必要なアドレスを命令アドレ
ス争レジスタに送出させる。仁のようKして、第8図(
ロ)に示す如く、複合命令が命令メ毫す4に記入される
ととになる。Set this in the input/output register 5. Then, the address necessary for setting the controller 4-223 is sent to the instruction address conflict register. Figure 8 (
As shown in b), when a compound command is written in the command message field 4, the result is as follows.
■ ところが、命令メモリ4のアドレス「16」と「1
9J 0II4に、例えば「ADD A、BJのよう
K。■ However, the addresses "16" and "1" of instruction memory 4
9J 0II4, for example, "ADD A, BJ like K.
人レジスタのデータとBレジスタのデータを加算し、こ
れをムレジスタにセットするようなコードが存在する場
合にはそのレジスタ使用情報は「1110」と記入され
ており、その結果、使用情報レジスタ11には「010
0J(bs+bsは情報1択しジスタ10でrQJのた
め)がレジスタ管1ullsから出力される。接合命令
化処理部2はこれによりAレジスタを書替えるコードが
アドレス「16」〜「19」に存在することを判別し、
このような場合には僚合命令化処理を行わない。If there is a code that adds the data of the person register and the data of the B register and sets this to the mu register, the register usage information is written as "1110", and as a result, the usage information register 11 is written as "1110". is “010
0J (because bs+bs is rQJ with information 1 selected and register 10) is output from the register tube 1uls. The joining instruction processing unit 2 thereby determines that the code for rewriting the A register exists at addresses "16" to "19", and
In such a case, the collaborating command processing is not performed.
なお前記の説明ではムレジスタとBレジスタの2つのレ
ジスタが使用される例について説明したが、勿論管理さ
れるレジスタは2つのみに限定されるものではなく適宜
増加することができる。そしてこれに応じて使用情味ビ
ットも増加することになる。In the above description, an example has been described in which two registers, the M register and the B register, are used, but of course the number of registers to be managed is not limited to only two, and can be increased as appropriate. The usage bits will also increase accordingly.
(7)発明の効果
本発明によれに、コードにレジスタ使用情報ビットを付
加し、コードを移動処理するときこのレジスタ使用情報
ビットを付加した11移動するので、レジスタ関連処理
におけるレジスタ管層線すべてコードに付加したレジス
タ使用情報ビットをチェックすることによ如可能になる
。したがって従来のようにコードの移動に伴ってその書
替が必要となるレジスタ情報テーブルを作成する必要が
ない。(7) Effects of the Invention According to the present invention, a register usage information bit is added to the code, and when the code is moved, 11 moves with this register usage information bit added are performed, so all register management layer lines in register related processing are This can be done by checking the register usage information bit added to the code. Therefore, there is no need to create a register information table that needs to be rewritten as the code is moved, unlike in the past.
このように本発明によればレジスタ情報を害鳥にチェツ
タできるのみならず、コードの移動にともなうレジスタ
情報テーブルを修正する手間もいらなく*b、コードを
移動してもレジスタ管理を害鳥に、正確に奥行できゐ。As described above, according to the present invention, not only can register information be checked against harmful birds, but also there is no need to modify the register information table as the code is moved. It has depth.
t 5uite簡単な説明
第1閣紘豪会命令化処履の説明図、第2図は検金命令化
処理ができないケースの説明図、第3図。t 5uite Brief Explanation 1st is an explanatory diagram of the Kakakugokai ordering process, Figure 2 is an explanatory diagram of the case where the payment inspection ordering process is not possible, and Figure 3 is an explanatory diagram of the case where the payment inspection ordering process is not possible.
第4Illは従来のレジスタ管理及びその間層点の説明
図、第1L第6図は本発明における生成コード及びその
説明図、第7図及び第8図は本発明の動作説明図、第9
閣は本発明の一実施例構成図で参る。4Ill is an explanatory diagram of conventional register management and interlayer points, 1L FIG. 6 is a generated code in the present invention and its explanatory diagram, FIGS. 7 and 8 are explanatory diagrams of the operation of the present invention,
The following is a diagram showing the configuration of an embodiment of the present invention.
図中、1はコード生虞部、2は資金命令化処理部、3は
レジスタ管理部、4紘命令メモリ、5は入出力レジスタ
、6は出力レジスタ、7は命令アドレス・レジスタ、a
は第1アドレス拳レジスタ。In the figure, 1 is a code generation section, 2 is a capital instruction processing section, 3 is a register management section, 4 is a basic instruction memory, 5 is an input/output register, 6 is an output register, 7 is an instruction address register, a
is the first address fist register.
9社第2アドレス・レジスタ、10は情報選択レジスタ
、11は使用情報レジスタ、12は第5アドレス・レジ
スタ、13はjl14アドレス・レジス/、14til
15アドレス・レジスタ、15は第1情報レジスタ、1
6社第2情報レジx夕styは情報累積レジスタ、18
は第5情報レジスタ。9 second address register, 10 information selection register, 11 usage information register, 12 fifth address register, 13 jl14 address register/, 14til
15 address register; 15 is first information register; 1
6 companies 2nd information register x evening sty is information accumulation register, 18
is the fifth information register.
19はアドレス判定部、20紘アドレスe力ウントアツ
プ部、21はアンド操作部、22はオア操作部、25は
コントローラである。Reference numeral 19 designates an address determination section, 20 an address e-power unloading section, 21 an AND operation section, 22 an OR operation section, and 25 a controller.
特許出願人 富士通株式会社
代理人弁理士 山 谷 晧 榮
21
オ1I121 tイ)
(ロ)f4PjJ (イ)
(q)才
5図
コード゛ bhbb
宅ヒθm、イ)Patent applicant Fujitsu Ltd. Representative Patent Attorney Akira Yamatani 21 O1I121T)
(b) f4PjJ (b)
(q) Age 5 code ゛ bhbb househi θm, a)
Claims (1)
オブジェクトコードを作成するコンパイラにおいて、オ
ブジェクトコードが使用するレジスタのレジスタ使用情
報を付加するコード生成手段と。 前記レジスタ使用情報が付加されたコードを記入するコ
ード用メモリ手段と、前記コード用メモリ手段の調査範
囲を指示する指示手段と、前記レジスタ使用情報を抽出
するレジスタ使用情報抽出手段を有し、管理すべき範囲
内のコードに付加されたレジスタ使用情報をチェックす
ることによりレジスタ管理を行うようKしたことを特徴
とするコンパイラにおけるレジスタ管理方式。(1) In a compiler that creates object code from a source program written in a high-level language, code generation means adds register usage information of registers used by the object code. a code memory means for writing a code to which the register usage information is added; an instruction means for instructing a survey range of the code memory means; and a register usage information extraction means for extracting the register usage information; 1. A register management method in a compiler, characterized in that register management is performed by checking register usage information added to code within a target range.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP4387382A JPS58161045A (en) | 1982-03-19 | 1982-03-19 | Register management method in compiler |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP4387382A JPS58161045A (en) | 1982-03-19 | 1982-03-19 | Register management method in compiler |
Publications (2)
Publication Number | Publication Date |
---|---|
JPS58161045A true JPS58161045A (en) | 1983-09-24 |
JPH0228174B2 JPH0228174B2 (en) | 1990-06-21 |
Family
ID=12675811
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP4387382A Granted JPS58161045A (en) | 1982-03-19 | 1982-03-19 | Register management method in compiler |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS58161045A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6081641A (en) * | 1983-10-11 | 1985-05-09 | Matsushita Electric Ind Co Ltd | Tracing device of register |
JPS61110240A (en) * | 1984-10-31 | 1986-05-28 | インタ−ナショナル ビジネス マシ−ンズ コ−ポレ−ション | Optimization compiler |
JPS61183744A (en) * | 1985-02-04 | 1986-08-16 | インタ−ナショナル ビジネス マシ−ンズ コ−ポレ−ション | Code generation |
-
1982
- 1982-03-19 JP JP4387382A patent/JPS58161045A/en active Granted
Non-Patent Citations (1)
Title |
---|
OBJECT CODE OPTINIZATION=1969 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6081641A (en) * | 1983-10-11 | 1985-05-09 | Matsushita Electric Ind Co Ltd | Tracing device of register |
JPH0522936B2 (en) * | 1983-10-11 | 1993-03-31 | Matsushita Electric Ind Co Ltd | |
JPS61110240A (en) * | 1984-10-31 | 1986-05-28 | インタ−ナショナル ビジネス マシ−ンズ コ−ポレ−ション | Optimization compiler |
JPS61183744A (en) * | 1985-02-04 | 1986-08-16 | インタ−ナショナル ビジネス マシ−ンズ コ−ポレ−ション | Code generation |
JPH0519173B2 (en) * | 1985-02-04 | 1993-03-16 | Intaanashonaru Bijinesu Mashiinzu Corp |
Also Published As
Publication number | Publication date |
---|---|
JPH0228174B2 (en) | 1990-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPS63231550A (en) | Multiple virtual space control method | |
KR950012256A (en) | Computer system for processing vector data and method thereof | |
JPH0315211B2 (en) | ||
US3351909A (en) | Information storage and transfer system for digital computers | |
US4280177A (en) | Implicit address structure and method for accessing an associative memory device | |
JPS58161045A (en) | Register management method in compiler | |
JPH0137787B2 (en) | ||
JPS62202247A (en) | Cache memory contents coincidence processing system | |
CN112181637A (en) | Method and device for allocating memory resources | |
US7000089B2 (en) | Address assignment to transaction for serialization | |
JPS582950A (en) | Prefix conversion method | |
JPS6019534B2 (en) | Transfer control device | |
JPH113270A (en) | Flash memory device and method of writing data to flash memory | |
CN105446840A (en) | Cache consistency limit test method | |
JPS58179977A (en) | Memory controller | |
JP2523152B2 (en) | Address translation method | |
JPH0129639Y2 (en) | ||
JPS58166585A (en) | Buffer storage control method | |
JPS6143367A (en) | Register control system | |
JPS63266560A (en) | Buffer memory control method | |
JPS58166443A (en) | Logical operation control method | |
JPS5828675B2 (en) | Interleaved memory addressing method | |
JPS61262945A (en) | Storage device | |
JPS58146948A (en) | Function macro | |
JPS62133544A (en) | Memory device |