JP3464019B2 - Register allocation method - Google Patents

Register allocation method

Info

Publication number
JP3464019B2
JP3464019B2 JP14919493A JP14919493A JP3464019B2 JP 3464019 B2 JP3464019 B2 JP 3464019B2 JP 14919493 A JP14919493 A JP 14919493A JP 14919493 A JP14919493 A JP 14919493A JP 3464019 B2 JP3464019 B2 JP 3464019B2
Authority
JP
Japan
Prior art keywords
register
virtual
variable
virtual register
registers
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.)
Expired - Fee Related
Application number
JP14919493A
Other languages
Japanese (ja)
Other versions
JPH07141193A (en
Inventor
義雄 高橋
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP14919493A priority Critical patent/JP3464019B2/en
Publication of JPH07141193A publication Critical patent/JPH07141193A/en
Application granted granted Critical
Publication of JP3464019B2 publication Critical patent/JP3464019B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • G06F9/30105Register structure
    • G06F9/30112Register structure comprising data of variable length

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、ソースプログラムから
実行プログラムを出力するコンパイラに係り、特に仮想
レジスタを用いたコンパイル方式に適用して有効な技術
に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compiler which outputs an execution program from a source program, and more particularly to a technique which is effective when applied to a compilation method using virtual registers.

【0002】[0002]

【従来の技術】C言語、FORTRAN、COBOL等
の言語仕様で記述されたソースプログラムを翻訳(コン
パイル)して目的プログラムを生成するコンパイラで
は、「構文解析」、「コード最適化」、「最適化処
理」、「コード出力」等の一連の処理が行われる。
2. Description of the Related Art A compiler that translates (compiles) a source program described in language specifications such as C language, FORTRAN, and COBOL to generate a target program is "syntactic analysis", "code optimization", "optimization". A series of processing such as "processing" and "code output" is performed.

【0003】従来のコンパイラでは、処理中にコンパイ
ラが確保する作業領域は実際にコンパイラが作動してい
る計算機の主記憶に確保するか、あるいはその作業領域
が短い場合にはレジスタに確保し、このレジスタ長より
も長い領域が必要な場合には主記憶に確保するものが一
般的であった。
In a conventional compiler, the work area reserved by the compiler during processing is reserved in the main memory of the computer on which the compiler is actually operating, or in a register when the work area is short. When an area longer than the register length is required, it is generally secured in the main memory.

【0004】最近、コンパイラにおいてもその処理途中
で仮想的なレジスタ(以下、単に「仮想レジスタ」とい
う)を生成し、作業領域をこの仮想レジスタに割り当て
る方式が知られている。この仮想レジスタの概念を導入
した先行技術としては以下のものがある。
Recently, there is known a method in which a compiler also generates a virtual register (hereinafter, simply referred to as "virtual register") during the processing and allocates a work area to this virtual register. The following are prior arts that introduce the concept of this virtual register.

【0005】コンパイル時に無限個数の仮想レジスタを
設定して主記憶とのデータ転送を低減する技術として特
開平3−73026号公報がある。また、仮想レジスタ
を用いた命令列を含む目的プログラムを実行する場合の
実レジスタへの割付についての技術として特開平2−1
94439号がある。さらに、仮想レジスタを実メモリ
に割り付ける際にプロフィット指数を用いて効率化を図
る技術として特開平2−236638号公報がある。
Japanese Patent Laid-Open No. 3-73026 discloses a technique for setting an infinite number of virtual registers at the time of compilation to reduce data transfer with the main memory. Further, as a technique for allocating to a real register when executing an object program including an instruction sequence using virtual registers, Japanese Patent Laid-Open No. 2-1.
There is 94439 issue. Further, as a technique for improving efficiency by using a profit index when allocating a virtual register to a real memory, there is JP-A-2-236638.

【0006】[0006]

【発明が解決しようとする課題】前記従来技術からも明
かなように、コンパイル処理に仮想レジスタの概念を導
入することにより、レジスタ割付の課程は、ソースプロ
グラムに対する仮想レジスタの割付と、この仮想レジス
タから実レジスタへの割付とに分解されコンパイル時の
処理効率および目的プログラムの実行効率の向上が図ら
れている。
As is apparent from the above-mentioned prior art, by introducing the concept of a virtual register into the compilation process, the register allocation process is performed by assigning the virtual register to the source program and the virtual register. Is allocated to the real register to improve the processing efficiency at the time of compilation and the execution efficiency of the target program.

【0007】しかし、前記従来技術では、いずれも仮想
レジスタの長さは実レジスタの長さと同一長に設定され
ていることが前提であった。すなわち仮想レジスタに格
納する変数値は目的プログラムの実行時において実レジ
スタにそのまま格納されるため仮想レジスタ長は実レジ
スタ長と一致させておく必要があった。
However, in the above-mentioned prior arts, it is premised that the length of the virtual register is set to be the same as the length of the real register. That is, since the variable value stored in the virtual register is stored in the real register as it is when the object program is executed, the virtual register length needs to match the real register length.

【0008】そのため、仮想レジスタ長よりも長い作業
領域を必要とするCOBOL言語等では、仮想レジスタ
への割付が困難となるため、コンパイル時に作業領域を
主記憶上に確保せざるを得なかった。
Therefore, in the COBOL language or the like which requires a work area longer than the virtual register length, it is difficult to allocate to the virtual register, so that the work area must be secured in the main memory at the time of compilation.

【0009】主記憶とのデータ転送命令は周知のように
参照および更新ともにレジスタとのそれに比較して時間
がかかるため、プログラムの実行効率が低下せざるを得
なかった。
As is well known, a data transfer instruction to and from a main memory requires a longer time for both reference and update than that for a register, so that the execution efficiency of the program cannot help but be lowered.

【0010】本発明はこのような点に鑑みてなされたも
のであり、レジスタ長よりも大きい作業領域を必要とす
る言語系においても仮想レジスタを適用できるようにし
てプログラム実行時の処理効率を大幅に向上させる技術
を提供することにある。
The present invention has been made in view of such a point, and the virtual register can be applied even in a language system requiring a work area larger than the register length to significantly improve the processing efficiency during program execution. It is to provide the technology to improve.

【0011】[0011]

【課題を解決するための手段】本発明は、原理図である
図1に示すように、解析手段1において構文ツリー情報
を取得して、これに基づいて作業変数を生成した後、仮
想レジスタ割付手段2において前記作業変数が単一の実
レジスタよりも小さい場合には実レジスタと同じ長さの
1つの仮想レジスタを設定し、変数が単一の実レジスタ
よりも大きい場合には実レジスタと同じ長さを有する仮
想レジスタを複数組み合わせて仮想レジスタリストを設
定する。そして、仮想レジスタ演算展開手段3におい
て、仮想レジスタに格納された変数同士の演算の際に、
実レジスタと同じ長さのデータ長での演算に変換する。
According to the present invention, as shown in FIG. 1 which is a principle diagram, the parsing means 1 acquires syntax tree information, generates work variables based on the syntax tree information, and then allocates virtual registers. In the means 2, if the work variable is smaller than the single real register, one virtual register having the same length as the real register is set, and if the variable is larger than the single real register, it is the same as the real register. A virtual register list is set by combining a plurality of virtual registers having lengths. Then, in the virtual register arithmetic expansion means 3, when the variables stored in the virtual register are arithmetically operated,
Convert to an operation with the same data length as the actual register.

【0012】[0012]

【作用】本発明によれば、仮想レジスタ割付手段2にお
いて、変数を仮想レジスタに割り付ける際に、割り付け
る変数の長さと実レジスタの長さとを比較する。ここで
一つずつの仮想レジスタは、実レジスタ長と同じ長さと
仮定しておく。そして、割り付けようとする変数が実レ
ジスタ1個分のデータ長よりも大きい場合には複数の仮
想レジスタを組み合わせた仮想レジスタリストを設定す
る。これにより、実レジスタ1個分の長さよりも長いデ
ータの仮想レジスタへの割り付けを実現する。
According to the present invention, when the variable is allocated to the virtual register in the virtual register allocating means 2, the length of the variable to be allocated is compared with the length of the real register. Here, it is assumed that each virtual register has the same length as the actual register length. Then, when the variable to be allocated is larger than the data length of one real register, a virtual register list combining a plurality of virtual registers is set. As a result, allocation of data longer than the length of one real register to the virtual register is realized.

【0013】そして、変数が割り付けられた仮想レジス
タに対する演算を展開する場合には、個々の仮想レジス
タ同士のつながり(上位バイトが含まれる仮想レジスタ
等)を意識して、複数レジスタ(仮想レジスタリスト)
に対する演算処理(たとえばレジスタ2個分同士の変数
の加算等)を一つ一つのレジスタに対する演算に展開す
ればよい。
In the case of expanding an operation for a virtual register to which a variable is assigned, a plurality of registers (virtual register list) are taken into consideration in consideration of connection between individual virtual registers (virtual register including upper byte, etc.).
The arithmetic processing for (for example, addition of variables between two registers) may be expanded to the arithmetic operation for each register.

【0014】本発明によれば、浮動小数点演算を複数の
レジスタで表現する場合のようなレジスタ使用における
制約は存在しない。そのため、レジスタの使用はソフト
ウエアで完全に制御できる。また、ベクトル演算のよう
に使用するレジスタの構成を変更するわけではないの
で、ハードウエアあるいはソフトウエアにおける複雑な
前処理が不要である。
According to the present invention, there are no restrictions on register usage as in the case of expressing a floating point operation by a plurality of registers. Therefore, the use of registers can be completely controlled by software. Further, since the configuration of the register used is not changed like the vector operation, complicated preprocessing in hardware or software is unnecessary.

【0015】[0015]

【実施例】図2は本発明の一実施例であるコンパイル処
理の全体の流れを示すフロー図である。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 2 is a flow chart showing the overall flow of a compiling process which is an embodiment of the present invention.

【0016】コンパイル処理は同図に示すように、構文
解析→領域割付→仮想レジスタ割付→仮想レジスタ演算
展開→最適化→実レジスタ割付の順で行われる。「構文
解析」ステップでは、まずC言語、FORTRAN、C
OBOL等の高級プログラミング言語え記述されたソー
スプログラムの構文およびその意味を解析して、その解
析に基づいて構文ツリーを生成する。以下の処理はここ
で生成された構文ツリーに基づいて行われることにな
る。
As shown in the figure, the compilation process is performed in the order of syntax analysis → area allocation → virtual register allocation → virtual register arithmetic expansion → optimization → real register allocation. In the "parsing" step, first, C language, FORTRAN, C
A syntax of a source program written in a high-level programming language such as OBOL and its meaning are analyzed, and a syntax tree is generated based on the analysis. The following processing will be performed based on the syntax tree generated here.

【0017】「領域割付」ステップでは、ユーザーによ
り明示的に記述された変数とコンパイラ自身が作業用に
使用する変数とをメモリに割り付ける処理を行う。「仮
想レジスタ割付」ステップでは、主にコンパイラが生成
する作業変数に対して1つ以上の仮想レジスタを割り付
ける作業を行う。ここで変数の使われ方を考慮して2通
りの仮想レジスタの割り付け方法のうちいずれかが選択
される。この判断フローを示したものが図3である。
In the "area allocation" step, the variable explicitly described by the user and the variable used by the compiler for work are allocated to the memory. In the "virtual register allocation" step, one or more virtual registers are mainly allocated to the work variables generated by the compiler. Here, one of two virtual register allocation methods is selected in consideration of how the variables are used. FIG. 3 shows this determination flow.

【0018】同図において、まずレジスタに格納すべき
変数の長さと単位レジスタ長(実レジスタを構成するバ
イト長)とを比較し(ステップ301)、当該変数長が
単位レジスタ長よりも小さいかあるいは等しい場合に
は、一つの仮想レジスタを設定し、当該変数を格納する
(ステップ302)。一方、格納すべき変数長が単位レ
ジスタよりも大きい場合には、この変数を格納するため
に必要となる単位レジスタの個数(n)を決定し(30
3)、n個の仮想レジスタを設定する(304)。たと
えば、単位レジスタ長の大きさが4バイトで、格納すべ
き変数が10バイトである場合には3個の仮想レジスタ
を割り当てることになる。このとき、変数が数値である
場合には図4に示すようにLSB→MSB方向にデータ
を格納していく。これに対して変数が数値以外の文字列
である場合にはMSB→LSB方向にデータを格納して
いく。このように、変数が数値の場合にLSB→MSB
方向にデータを格納していくのは、演算における桁上が
りの処理に対応するためである。この桁上がりの詳細に
ついては次の仮想レジスタ演算展開ステップで説明す
る。
In the figure, first, the length of the variable to be stored in the register is compared with the unit register length (the byte length forming the actual register) (step 301), and the variable length is smaller than the unit register length, or If they are equal, one virtual register is set and the variable is stored (step 302). On the other hand, if the variable length to be stored is larger than the unit register, the number (n) of unit registers required to store this variable is determined (30
3), n virtual registers are set (304). For example, if the unit register length is 4 bytes and the variable to be stored is 10 bytes, 3 virtual registers will be allocated. At this time, when the variable is a numerical value, the data is stored in the LSB → MSB direction as shown in FIG. On the other hand, when the variable is a character string other than a numerical value, the data is stored in the MSB → LSB direction. Thus, when the variable is a numerical value, LSB → MSB
The reason why the data is stored in the direction is to handle the carry process in the calculation. Details of this carry will be described in the next virtual register arithmetic expansion step.

【0019】「仮想レジスタ演算展開」ステップでは、
仮想レジスタ同士のつながり(格納された変数の上位バ
イトを含む仮想レジスタ等)を意識して、複数の仮想レ
ジスタに対する演算処理(レジスタ2個分同士の変数の
加算等)を単位レジスタ同士の演算に展開する。
In the "virtual register arithmetic expansion" step,
In consideration of the connection between virtual registers (such as the virtual register including the upper byte of the stored variable), the calculation processing for multiple virtual registers (addition of variables between two registers, etc.) is performed for calculation between unit registers. expand.

【0020】この演算展開の具体例を以下に示す。下記
は、仮想レジスタリスト(複数のレジスタブロックで構
成された仮想レジスタの組)であるPRGL1とPRG
L2とを加算してその結果をPRGL3に格納する計算
を行う具体例である。ここで、仮想レジスタリストPR
LG1〜PRLG3は図5に示すような構成となってい
る。すなわち、仮想レジスタリストPRLG1〜PRL
G3はそれぞれ12バイトで構成され、これらの仮想レ
ジスタリストはそれぞれ単位レジスタ長(実レジスタ
長)である4バイトの仮想レジスタ(PRG)を3個用
いて構成されている。なお、下記のリストは概念的に記
述されたもので、実際のアセンブラ記述とは異なる。
A specific example of this arithmetic expansion is shown below. The following is a virtual register list (a set of virtual registers composed of multiple register blocks) PRGL1 and PRG.
This is a specific example in which L2 and L2 are added and the result is stored in PRGL3. Here, the virtual register list PR
LG1 to PRLG3 are configured as shown in FIG. That is, the virtual register lists PRLG1 to PRL
Each G3 is composed of 12 bytes, and each of these virtual register lists is composed of three 4-byte virtual registers (PRG) that are unit register lengths (real register lengths). Note that the following list is a conceptual description and differs from the actual assembler description.

【0021】[0021]

【数1】10:MOVE [PRGL1の最下位バイトを含むブロック
(PRG(1-3))], PRG-a 20:MOVE [PRGL2の最下位バイトを含むブロック(PRG(2-
3))], PRG-b 30:ADD PRG-a,PRG-b,PRG-C 40:IF 桁上がり PRG-d,1 50:STORE PRG-c,[PRGL3の最下位(PRG(3-3)] 60:MOVE [PRGL1の次のブロック(PRG(1-2))], PRG-a 70:MOVE [PRGL2の次のブロック(PRG(2-2))], PRG-b 80:ADD PRG-a,PRG-b,PRG-c 90:IF 桁上がり 100:ADD PRG-c,PRG-d,PRG-c 110:STORE PRG-c,[PRGL3の次のブロック(PRG(3-2)] 120:JUMP 60 前記数1式に示したアセンブラプログラムにおいて、第
10行目では、仮想レジスタPRGL1の最下位ブロッ
ク(PRG(1−3))から順に格納値をレジスタPR
G−aに取り出している。第11行目では同じようにし
て仮想レジスタPRGL2の最下位ブロック(PRG
(2−3))から順に格納値をレジスタPRG−bに取
り出している。
[Equation 1] 10: MOVE [PRGL1 containing the least significant byte
(PRG (1-3))], PRG-a 20: MOVE [Block containing the least significant byte of PRGL2 (PRG (2-
3))], PRG-b 30: ADD PRG-a, PRG-b, PRG-C 40: IF Carry PRG-d, 1 50: STORE PRG-c, [PRGL3 least significant (PRG (3-3 )] 60: MOVE [PRGL1 next block (PRG (1-2))], PRG-a 70: MOVE [PRGL2 next block (PRG (2-2))], PRG-b 80: ADD PRG -a, PRG-b, PRG-c 90: IF Carry 100: ADD PRG-c, PRG-d, PRG-c 110: STORE PRG-c, [Next block of PRGL3 (PRG (3-2)] 120: JUMP 60 In the assembler program shown in the above equation 1, in the tenth line, the stored values are sequentially registered from the lowest block (PRG (1-3)) of the virtual register PRGL1 to the register PR.
It is taken out to G-a. In the 11th line, the lowest block (PRG) of the virtual register PRGL2 is similarly processed.
The stored value is taken out to the register PRG-b in order from (2-3)).

【0022】第30行目では、PRG−aとPRG−b
の格納値を加算してその結果をPRG−cに格納してい
る。ここで、もし桁上がりが発生した場合には、演算用
作業レジスタとして設定されているPRG−dに1を格
納しておく(第40行目)。そして、PRG−cの格納
値を仮想レジスタリストPRLG3の最下位ブロック
(PRG(3−3))にストアする。
On line 30, PRG-a and PRG-b
Stored values are added and the result is stored in PRG-c. If a carry occurs, 1 is stored in PRG-d set as the operation work register (40th line). Then, the stored value of PRG-c is stored in the lowest block (PRG (3-3)) of the virtual register list PRLG3.

【0023】以上のようにして仮想レジスタPRLG3
の最下位ブロックの演算を完了した後、中位ブロックの
演算を次の第60行目〜第110行目および図6に示し
たように行う。
As described above, the virtual register PRLG3
After the calculation of the lowest block of the above is completed, the calculation of the middle block is performed as shown in the following 60th line to 110th line and FIG.

【0024】第60行目では、第10行目で読み出した
仮想レジスタPRGL1における次のPRG、すなわち
第10行目で読み出したブロックよりも一つ上位のブロ
ック(PRG(1−2))の値をPRG−aに格納す
る。同様にして第70行目では仮想レジスタPRGL2
の次のブロック、すなわちPRG(2−2)の値をPR
G−bに格納する。そして、PRG−aとPRG−bと
を加算してその結果をPRG−cに格納する。このとき
前述の第40行目で桁上がりが生じていた場合には、P
RG−cにPRG−dの値”1”を加算してその結果を
PRG−cに代入する。このPRG−cの値を仮想レジ
スタPRLG3の中位ブロック(PRG(3−2))に
格納する。なおこのときさらに桁上がりが発生した場合
には、演算用作業レジスタであるPRG−dに”1”を
加算しておく。
On the 60th line, the value of the next PRG in the virtual register PRGL1 read on the 10th line, that is, the value of the block immediately above the block read on the 10th line (PRG (1-2)). Is stored in PRG-a. Similarly, in the 70th line, the virtual register PRGL2
The next block of PRG (2-2)
Store in Gb. Then, PRG-a and PRG-b are added and the result is stored in PRG-c. At this time, if a carry has occurred on the 40th line, P
The value "1" of PRG-d is added to RG-c and the result is substituted into PRG-c. The value of this PRG-c is stored in the middle block (PRG (3-2)) of the virtual register PRLG3. If a carry occurs further at this time, "1" is added to the operation work register PRG-d.

【0025】次にPRLG1およびPRLG2の最上位
ブロック(PRG(1−1),PRG(2−1))の演
算処理を行いこの結果をPRLG3のブロック(PRG
(3−1))にストアするが、この処理は第60行目〜
第110行目の処理(図6に示した処理)と同様である
ので説明を省略する。
Next, the uppermost blocks (PRG (1-1), PRG (2-1)) of PRLG1 and PRLG2 are subjected to arithmetic processing, and the result is calculated as the block of PRLG3 (PRG).
(3-1)), but this process starts from the 60th line.
Since it is the same as the processing in the 110th line (processing shown in FIG. 6), description thereof will be omitted.

【0026】このように、本実施例によれば、実レジス
タよりも長い構成の仮想レジスタリストの演算も、個々
の単位レジスタ長(前記例では4バイト)の演算処理に
分解することにより、仮想レジスタの長さを意識するこ
となく処理が可能となる。
As described above, according to the present embodiment, the operation of the virtual register list which is longer than the actual register is decomposed into the operation processing of each unit register length (4 bytes in the above example), thereby The processing can be performed without considering the length of the register.

【0027】「最適化処理」は、前記で説明した仮想レ
ジスタを引数に持つ中間言語に対して行われる。そして
この後、「実レジスタ割り付け」が行われる。実レジス
タへの割り付けは、従来技術のカラーリング方式等を用
いることにより、作業領域のうち最小限の部分だけを主
記憶に割り付ければよいため、主記憶への参照を抑制で
き、高速な処理が可能となる。
The "optimization process" is performed on the intermediate language having the virtual register described above as an argument. After this, "real register allocation" is performed. Allocation to the actual registers can be suppressed by using the coloring method of the prior art, etc., and only the minimum part of the work area needs to be allocated to the main memory. Is possible.

【0028】[0028]

【発明の効果】本発明によれば、最近の計算機にはレジ
スタ(実レジスタ)の数が多いことをふまえ、レジスタ
(実レジスタ)の長さよりも長い作業領域を複数のレジ
スタ(仮想レジスタ)に分散して確保することにより、
作業領域への参照および更新時間を短縮し、プログラム
の実行時間を短縮することができる。
According to the present invention, a recent computer has a large number of registers (real registers), so that a work area longer than the length of the registers (real registers) is allocated to a plurality of registers (virtual registers). By distributing and securing,
It is possible to shorten the reference time to the work area and the update time, and to shorten the program execution time.

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

【図1】本発明の原理図である。FIG. 1 is a principle diagram of the present invention.

【図2】本発明の一実施例であるコンパイル処理を示す
フロー図である。
FIG. 2 is a flowchart showing a compiling process which is an embodiment of the present invention.

【図3】実施例におけるレジスタ割付手段2の処理を示
すフロー図である。
FIG. 3 is a flowchart showing a process of register allocating means 2 in the embodiment.

【図4】実施例におけるレジスタへの変数の格納方法を
示す模式図である。
FIG. 4 is a schematic diagram showing a method of storing variables in registers in the embodiment.

【図5】実施例において仮想レジスタリスト同士の演算
を示す説明図である。
FIG. 5 is an explanatory diagram showing an operation between virtual register lists in the embodiment.

【図6】実施例において仮想レジスタリスト同士の演算
を示す説明図である。
FIG. 6 is an explanatory diagram showing an operation between virtual register lists in the embodiment.

【符号の説明】[Explanation of symbols]

1・・解析手段 2・・仮想レジスタ割付手段 3・・演算展開手段 4・・判定手段 1 ... Analysis means 2..Virtual register allocation means 3 ... Computing means 4..Judgment means

Claims (3)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 プログラム言語で記述されたソースプロ
グラムを解析する解析手段と、 前記解析手段により得られた構文ツリー情報に基づいて
生成された作業変数に対して、この変数が単一の実レジ
スタよりも小さい場合には実レジスタと同じ長さの1つ
の仮想レジスタを設定し、変数が単一の実レジスタより
も大きい場合には実レジスタと同じ長さを有する仮想レ
ジスタを複数組み合わせて構成される仮想レジスタリス
トを設定する仮想レジスタ割付手段と、 仮想レジスタに格納された変数同士の演算の際に、実レ
ジスタと同じ長さのデータ長での演算に変換する仮想レ
ジスタ演算展開手段とを備え 前記仮想レジスタ演算展開手段は、仮想レジスタリスト
を構成する仮想レジスタと同じ長さを有する演算用レジ
スタと、桁上がりを示す桁上がり演算作業レジスタとを
有し、仮想レジスタリストの演算を行う際に、仮想レジ
スタリストの下位ブロックの演算で桁上がりが発生した
場合に演算用作業レジスタに”1”を加算しておき、こ
れよりも上位ブロックの演算処理を行う場合に演算用作
業レジスタに格納された”1”を上位ブロックでの演算
結果に加算するように展開する ことを特徴とするレジス
タの割付方式。
1. An analyzing unit for analyzing a source program written in a programming language, and a work variable generated based on syntax tree information obtained by the analyzing unit, the variable being a single real register. If the variable is larger than a single real register, one virtual register with the same length as the real register is set. If the variable is larger than a single real register, it is configured by combining multiple virtual registers with the same length. Virtual register allocating means for setting a virtual register list, and virtual register arithmetic expansion means for converting the variables stored in the virtual registers into arithmetic operations with the same data length as the actual registers. The virtual register arithmetic expansion means is a virtual register list.
Register with the same length as the virtual register that composes
And a carry operation register that indicates a carry.
Has a virtual register when performing operations on the virtual register list.
Carry occurred in operation of lower block of starist
In this case, add "1" to the work register for calculation.
If you want to perform arithmetic processing of the upper block than
"1" stored in the work register is calculated in the upper block
Register allocation method characterized by expanding so as to add to the result .
【請求項2】 前記仮想レジスタ割付手段には、コンパ
イルにおいて確保すべき作業領域が実レジスタの大きさ
よりも大きい領域を必要としているか否かを判定する判
定手段を備え、当該判定手段は、 確保すべき作業領域が実レジスタの大きさよりも大きい
領域を必要としていない場合には単一の仮想レジスタを
設定し、 大きい領域を必要としている場合には複数の仮想レジス
タからなる仮想レジスタリストを設定することを特徴と
する請求項1記載のレジスタの割付方式。
2. The virtual register allocating means is provided with a judging means for judging whether or not a work area to be secured in the compilation requires an area larger than the size of the real register, and the judging means secures the area. Set a single virtual register if the work area to be used does not require an area larger than the size of the real register, and set a virtual register list consisting of multiple virtual registers if it needs a large area. The register allocating method according to claim 1, wherein:
【請求項3】 前記仮想レジスタ割付手段は、仮想レジ
スタまたは仮想レジスタリストに変数を格納する場合に
当該変数が数値データである場合には最下位ビットから
最上位ビット方向に数値を格納することを特徴とする請
求項1記載のレジスタの割付方式。
3. The virtual register allocating means stores a numerical value from the least significant bit to the most significant bit when the variable is numerical data when the variable is stored in the virtual register or virtual register list. The register allocating method according to claim 1, wherein the register allocating method is a register allocating method.
JP14919493A 1993-06-21 1993-06-21 Register allocation method Expired - Fee Related JP3464019B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP14919493A JP3464019B2 (en) 1993-06-21 1993-06-21 Register allocation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP14919493A JP3464019B2 (en) 1993-06-21 1993-06-21 Register allocation method

Publications (2)

Publication Number Publication Date
JPH07141193A JPH07141193A (en) 1995-06-02
JP3464019B2 true JP3464019B2 (en) 2003-11-05

Family

ID=15469876

Family Applications (1)

Application Number Title Priority Date Filing Date
JP14919493A Expired - Fee Related JP3464019B2 (en) 1993-06-21 1993-06-21 Register allocation method

Country Status (1)

Country Link
JP (1) JP3464019B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5967618B2 (en) * 2013-04-17 2016-08-10 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Method for optimizing binary code of a language having access to binary-coded decimal variables, and computer and computer program thereof

Also Published As

Publication number Publication date
JPH07141193A (en) 1995-06-02

Similar Documents

Publication Publication Date Title
US4763255A (en) Method for generating short form instructions in an optimizing compiler
US6367067B1 (en) Program conversion apparatus for constant reconstructing VLIW processor
US5551039A (en) Compiling a source code vector instruction by generating a subgrid loop for iteratively processing array elements by plural processing elements
US5729748A (en) Call template builder and method
US5303357A (en) Loop optimization system
US5920723A (en) Compiler with inter-modular procedure optimization
EP0806725B1 (en) Method and apparatus for early insertion of assembler code for optimization
JP2002527815A (en) Program code conversion method
JPH04330527A (en) Optimization method for compiler
US5418959A (en) Instruction operation size optimization
US7636914B1 (en) System and method for providing context to operator overloading
US20010039653A1 (en) Program conversion method, program conversion apparatus, storage medium for storing program conversion program and program conversion program
JP3464019B2 (en) Register allocation method
JP2904099B2 (en) Compiling device and compiling method
JP4719415B2 (en) Information processing system and code generation method
EP0180077B1 (en) A data processing machine for compiling computer programs
JPH11345127A (en) Compiler
JP2008523523A (en) Compiling method, compiling device and computer system for loop in program
JP3028821B2 (en) Parallel compilation method
JP4260895B2 (en) Multiple format addressing in microcontrollers
JPH02176938A (en) Machine language instruction optimizing system
JP2002312176A (en) Conversion program, compiler, computer device, program converting method, and storage medium
JP3246043B2 (en) Compiler unit
JPH02236638A (en) Register allocation managing system
CA2132764C (en) Method and system of generating combined storage references

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20020813

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080822

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090822

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090822

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100822

Year of fee payment: 7

LAPS Cancellation because of no payment of annual fees