JPH03260732A - Register allocation system - Google Patents
Register allocation systemInfo
- Publication number
- JPH03260732A JPH03260732A JP5947190A JP5947190A JPH03260732A JP H03260732 A JPH03260732 A JP H03260732A JP 5947190 A JP5947190 A JP 5947190A JP 5947190 A JP5947190 A JP 5947190A JP H03260732 A JPH03260732 A JP H03260732A
- Authority
- JP
- Japan
- Prior art keywords
- registers
- data
- register allocation
- register
- symbol
- 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 allocation method in a compiler that analyzes a source program and generates a target program with high execution efficiency.
(従来の技術)
第3図は従来のコンパイラの基本的な構成を示すもので
、コンパイラは、ソースプログラム(1)を人力し、構
文解析部(2)によって構文のチエツクを行うとともに
、適切な中間コードに変換し、以下、記憶域の割り当て
部(3) 最適化部(4)及びレジスタ割り付け部(
5)の処理を経て、コード生成部(6) によって最終
的な目的プログラム(7)を生成すようになっている。(Prior art) Figure 3 shows the basic configuration of a conventional compiler. The compiler manually inputs a source program (1), checks the syntax using a syntax analyzer (2), and performs appropriate code analysis. The intermediate code is converted into intermediate code, and the storage allocation section (3), optimization section (4), and register allocation section (
After the process 5), the final target program (7) is generated by the code generator (6).
実行効率のよい目的プログラムを生成するためには、各
種の最適化技術の中でもレジスタ割り付けの最適化が重
要な位置を占めている。コンパイラの作成に関する標準
的な著作であるAho等による°’Compilers
Pr1nciples、 techniques、a
ndTools (八ddison−Wesl
ey Publishing Company。In order to generate a target program with high execution efficiency, register allocation optimization plays an important role among various optimization techniques. °'Compilers by Aho et al., the standard work on writing compilers
Pr1ciples, techniques, a
ndTools (8ddison-Wesl
ey Publishing Company.
1986)では、プログラムを基本ブロックと呼ばれる
連続するステートメントの列に分割し、これらの基本ブ
ロックに対して局所的なレジスタ割り付けを行い、残っ
たレジスタを用いてより広い範囲を対象にした大域的レ
ジスタ割り付けを行う方式を代表的なレジスタ割り付け
方式として述べている。(1986), a program is divided into a sequence of consecutive statements called basic blocks, local register allocation is performed for these basic blocks, and the remaining registers are used to create global registers that cover a wider range. The allocation method is described as a typical register allocation method.
理論的には、レジスタ割り付けは、割り付けの対象とな
るデータと有限個のレジスタとの間のマツピングを決定
する問題に帰着できるが、最適解を求めることは甚だ困
難であることが知られている。Theoretically, register allocation can be reduced to the problem of determining the mapping between the data to be allocated and a finite number of registers, but it is known that finding the optimal solution is extremely difficult. .
従って、種々の発見的な手法が従来より開発されている
。大域的なレジスタ割り付けを例にとると、プログラム
中に存在するループ毎にレジスタを割り付けていくのが
典型的な処理である。これはプログラム全体の実行時間
のうち、ループの実行に占める割合が非常に高いという
経験則に基づいている。一つの方法は、ループ中に出現
する頻度か高いデータの順にレジスタを割り付けていく
ことである。この方法では、データとレジスタとのマツ
ピングは一対一である。すなわち、あるデータに一度割
り付けられたレジスタはループの全範囲で固定的にその
データに対応している。Accordingly, various heuristic techniques have been developed in the past. Taking global register allocation as an example, a typical process is to allocate registers for each loop that exists in a program. This is based on the empirical rule that loop execution takes up a very high proportion of the entire program's execution time. One method is to allocate registers in order of the frequency of data appearing during the loop. In this method, the mapping between data and registers is one-to-one. In other words, a register once allocated to certain data permanently corresponds to that data throughout the loop.
上述の大域的レジスタ割り付け方式は単純なアルゴリズ
ムでわかりゃすいものであるが、レジスタの割り付け効
率という点では不十分なところがある。Although the above-mentioned global register allocation method is a simple algorithm and easy to understand, it is insufficient in terms of register allocation efficiency.
chaitin等はレジスタの割り付けをグラフの彩色
問題として解析することにより、より効率的な大域的レ
ジスタ割り付け方式を開発した。これは、レジスタの割
り付けの対象となるデータをグラフ上のノードに対応さ
せ、プログラム中の任意の地点で同時に生きているデー
タに関しては、対応するノード間を線で結ぶ。このよう
にして得られたグラフをレジスタの干渉グラフと呼ぶ。Chaitin et al. developed a more efficient global register allocation method by analyzing register allocation as a graph coloring problem. This associates the data to which registers are allocated with nodes on the graph, and connects corresponding nodes with lines for data that is simultaneously active at any point in the program. The graph obtained in this way is called a register interference graph.
グラフの彩色とは、干渉グラフ上に隣り合うノード(線
で結ばれたノード)には互いに異なる色をぬることであ
り、彩色に用いられる色がレジスタに対応する。ある有
限個の色を使って干渉グラフ上の全てのノードを彩色す
ることができないとぎ、プロフィツトが最も小さいノー
ドを選び、4のノートをグラフ上から除去することによ
って彩色処理を継続するというような手法が提案されて
いる。なお、グラフの彩色を使用したレジスタ割り付け
方式はchaitin等による”Register A
l−1ocation Via Coloring
(Computer LanguagesVol、 6
.1981 pp、47−57)及びChaitinに
よる”Register A11ocation an
d Spilling Via GraphColor
ing (Proceeding 5IGPLAN8
2. Symposiumon Compiler C
on5truction、 5IGPLAN Noti
ces。Coloring a graph means applying different colors to adjacent nodes (nodes connected by lines) on an interference graph, and the colors used for coloring correspond to registers. If it is not possible to color all the nodes on the interference graph using a certain finite number of colors, we can select the node with the smallest profit and continue the coloring process by removing the note 4 from the graph. A method has been proposed. The register allocation method using graph coloring is the “Register A” method by Chaitin et al.
l-1location Via Coloring
(Computer Languages Vol. 6
.. 1981 pp, 47-57) and “Register A11ocation an
d Spilling Via Graph Color
ing (Proceeding 5IGPLAN8
2. Symposium Compiler C
on5truction, 5IGPLAN Noti
ces.
1982、 pp98−105)に詳細が記述されてい
る。1982, pp98-105).
以上に述べたレジスタ割り付け方式では、いずれの場合
でも、レジスタ割り付けの対象となるデータにレジスタ
が割り付けられた時に、割り付けられなかった場合と比
べてどの程度利益があるかを示すプロフィツトを算出し
、このプロフィツトを評価することがレジスタ割り付け
の処理において重要な役割を果たしている。In any case, in the register allocation method described above, the profit is calculated, which shows how much profit there is when a register is allocated to the data that is the target of register allocation, compared to when it is not allocated. Evaluating this profit plays an important role in register allocation processing.
(発明が解決しようとする課題)
従来のレジスタ割り付けレテ式では、レジスタ割り付け
の対象となるデータに関してプロフィツトを求めておき
、そのプロフィツトの値を評価して、レジスタを割り付
けるべきデータの集合を決定したり、逆に、割り付けの
候補から除外すべきデータを決定するというようなこと
が行われていた。(Problem to be Solved by the Invention) In the conventional register allocation method, the profit is calculated for the data to be allocated to registers, and the value of the profit is evaluated to determine the set of data to which registers should be allocated. Or, conversely, data to be excluded from allocation candidates was determined.
しかし、データとレジスタとのマツピングを決定する処
理に先立って一括してプロフィツトを計算するため、上
記のマツピングを決定する処理の進行に伴い、
・配列要素と当該配列要素のインデックス・ポインタと
当該ポインタによって示されるデータ
のように、一方のデータに対するレジスタ割り付けの状
況に応じて、他方のデータのプロフィツトの値が変化す
るようなケースでは、プロフィツトの評価が正確に行わ
れずレジスタ割り付けの効率が低下するという問題点が
あった。However, since the profits are calculated all at once before the process of determining the mapping between data and registers, as the process of determining the mapping described above progresses, ・Array elements and the index of the array element ・Pointer and the pointer In cases where the profit value of one data changes depending on the status of register allocation for the other data, such as the data shown by , the profit is not evaluated accurately and the efficiency of register allocation decreases. There was a problem.
上記の様子を図面を参照しながら説明する。第4図は、
FORTRANプログラムの一部(8) を示すもので
あるが、これに対応する中間コードにおいて、ステート
メント(9)から始まるDOループに含まれるステート
メント(lO)〜(13)に出現するデータの参照回数
が第5図に示すように求められたとする。簡単のために
、上記のプロフィツトをデータの参照回数と考える。3
個のレジスタを使用して、このループに現れるデータに
対してプロフィツトの大きい順に一対−にレジスタを割
り付けると、第6図に示すような結果が得られる。The above situation will be explained with reference to the drawings. Figure 4 shows
Part (8) of a FORTRAN program is shown, and in the corresponding intermediate code, the number of references to data appearing in statements (IO) to (13) included in the DO loop starting from statement (9) is Suppose that the results are obtained as shown in FIG. For simplicity, consider the above profit as the number of data references. 3
When registers are allocated to the data appearing in this loop in pairs in descending order of profit, a result as shown in FIG. 6 is obtained.
レジスタが割り付けられたデータ集合(14)の中に、
添字Iの値を評価した結果のインデックス1ndexと
1ndexによって間接参照される配列要素^(ind
ex)が共に含まれている。しかし、A (index
)にレジスタが割り付けられた結果、ステートメント(
10)に現れるA (index)の最初の参照を除い
ては、1ndexを用いる必要がなくなる。In the data set (14) to which registers are allocated,
Array elements ^(ind
ex) are both included. However, A (index
), the result is that the statement (
There is no need to use 1ndex except for the first reference to A (index) that appears in 10).
従って、1ndexの実質的な参照回数は3だけ減って
3になる。第5図によれば、1ndexの実質的な参照
回数は全体の中で第4番目に位置するので、1ndex
の代わりに、レジスタが割り付けていないデータ集合(
15)にに含まれる他のデータTにレジスタを割り付け
る方が効率のよい目的プログラムとなる。Therefore, the actual number of references to 1ndex is reduced by 3 to 3. According to FIG. 5, the actual number of references to 1ndex is the 4th in the whole, so 1ndex
Instead of a data set with no registers allocated (
15) It is more efficient to allocate registers to other data T included in the target program.
この発明は上記のような問題点を解消するためになされ
たもので、レジスタ割り付けの過程でプロフィツトの値
が変化することを防ぎ、効率的な目的プログラムが得ら
れるレジスタ割り付け方式を提供することを目的とする
。This invention was made in order to solve the above-mentioned problems, and aims to provide a register allocation method that prevents the value of profit from changing during the register allocation process and provides an efficient target program. purpose.
この発明に係るレジスタ割り付け方式は、レジスタ割り
付けの処理を2つの段階に分け、第1段階で、レジスタ
割り付け処理のために使用可能な物理レジスタの個数以
下の記号レジスタを用いて、配列要素又はポインタによ
って指されるデータのように目的プログラムのレベルで
間接的に参照されるデータを対象に記号レジスタを割り
付け、第2段階で、上記の処理によって記)レジスタが
割り付けられた間接参照データを記号レジスタに置換し
た中間コードに関して、記号レジスタとスカラデータな
対象にして物理レジスタを割り付けるようにしたもので
ある。The register allocation method according to the present invention divides the register allocation process into two stages, and in the first stage, uses a number of symbol registers equal to or less than the number of physical registers that can be used for the register allocation process to assign array elements or pointers. A symbol register is allocated to data that is indirectly referenced at the level of the target program, such as data pointed to by Regarding the intermediate code replaced with , physical registers are allocated to symbol registers and scalar data.
〔作用)
この発明においては、上記の第1段階の処理によって、
プログラム中の一部のデータに対して記号レジスタが割
り付けられ、その情報を中間コードに反映した後に、第
2段階の処理によって、これらの記号レジスタと第1段
階の処理対象外であるスカラデータに対して最終的な物
理レジスタ割り付けが行なわれ、プログラム中のデータ
に対するレジスタ割り付けが完了する。[Function] In this invention, by the above-mentioned first stage treatment,
Symbol registers are allocated to some data in the program, and after that information is reflected in the intermediate code, in the second stage processing, these symbol registers and scalar data that are not subject to processing in the first stage are allocated. Final physical register allocation is performed for the data in the program, and register allocation for the data in the program is completed.
(実施例) 以下、この発明の一実施例について説明する。(Example) An embodiment of the present invention will be described below.
第1図は本実施例に係るレジスタ割り付け部の構成を示
したものである。第1図において、(16)は前の処理
部から受は渡された中間コード、(17)はレジスタ割
り付け情報、(18)は記号レジスタを含む中間コード
、(19)は物理レジスタを含む中間コードであり、ま
た、本実施例におけるレジスタ割り付け部(5)は、間
接参照データに対する記号レジスタ割り付け部(5a)
と、中間コードの変換部(5b)及び物理レジスタ割り
付け部(5C)でなる。FIG. 1 shows the configuration of a register allocation section according to this embodiment. In Figure 1, (16) is an intermediate code received from the previous processing unit, (17) is register allocation information, (18) is an intermediate code that includes symbol registers, and (19) is an intermediate code that includes physical registers. The register allocation unit (5) in this embodiment is a symbol register allocation unit (5a) for indirect reference data.
, an intermediate code conversion unit (5b), and a physical register allocation unit (5C).
上記間接参照データに対する記号レタス4割り付け部(
5a)では、中間コード(16)を入力し、間接参照デ
ータすなわち配列要素又はポインタによって指されるデ
ータだけを対象にして記号レジスタを割り付け、その結
果がレジスタ割り付け情報(17)として出力される。Symbol lettuce 4 allocation part for the above indirect reference data (
In 5a), intermediate code (16) is input, symbol registers are allocated only for indirect reference data, that is, data pointed to by array elements or pointers, and the result is output as register allocation information (17).
レジスタ割り付けの範囲は特に限定しないが、通常はル
ープ毎又はプログラム全体を対象にした大域的な割り付
けを行う。The scope of register allocation is not particularly limited, but generally global allocation is performed for each loop or for the entire program.
なお、ここでいう記号レジスタとは、最終的には物理レ
ジスタと一対一に対応するが、特定のレジスタ番号はま
だ決定していない状態のレジスタを意味する。ただし、
特別な場合として物理レジスタそのものであってもよい
。Note that the symbol register herein means a register that ultimately has a one-to-one correspondence with a physical register, but whose specific register number has not yet been determined. however,
As a special case, it may be a physical register itself.
ループ毎に間接参照データに対する記号レジスタ割り付
けを行う場合のフローチャートを第2図に示す。以下で
は、第2図に沿ってこの処理を説明する。FIG. 2 shows a flowchart for allocating symbol registers to indirect reference data for each loop. This process will be explained below with reference to FIG.
まず、レジスタ割り付けの対象となるループを探す(ス
テップSl)。多重にネストしたループの場合、最内側
のループの実行回数が最も多いので、レジスタ割り付け
では最内側のループから未処理のループを探していく。First, a loop to be allocated to registers is searched for (step Sl). In the case of multiple nested loops, the innermost loop executes the most times, so register allocation searches for unprocessed loops starting from the innermost loop.
未処理のループが存在しない場合、処理は終了する(ス
テップS2)。If there is no unprocessed loop, the process ends (step S2).
そうでなければ、当該ループ中に現れる間接参照データ
の集合■を求める(ステップS3)。配列要素の場合、
添字式を解析して、添字が同一の値をもつものは集合V
中の一つの要素とする。ポインタによって指されるデー
タの場合も同様に、ポインタが同一の値をもつものは集
合V中の一つの要素とする。Otherwise, a set of indirect reference data appearing in the loop is determined (step S3). For array elements,
Analyzing the subscript expressions, those whose subscripts have the same value are the set V
It is one of the elements inside. Similarly, in the case of data pointed to by pointers, data whose pointers have the same value are treated as one element in the set V.
集合■が空(ステップS4)、すなわち割り付けの対象
となるデータが存在しない場合、次のループの処理に移
る(ステップSl)。そうでない時、割り付けに使用す
る記号レジスタの集合Rを求める(ステップS5)。If the set ■ is empty (step S4), that is, there is no data to be allocated, the process moves to the next loop (step S1). If not, a set R of symbol registers to be used for allocation is determined (step S5).
記号レジスタの数は使用可能な物理レジスタの個数以下
であり、どの程度の個数にするかはループ中に現れる間
接参照データが全データの中でどの程度の割合を占める
か等を調べて決定する。The number of symbol registers is less than or equal to the number of usable physical registers, and the number of symbol registers should be determined by examining how much of the total data the indirect reference data that appears during the loop accounts for, etc. .
次に、集合■の各要素についてプロフィツトを算出する
(ステップS6)。簡単のために、ここではプロフィツ
トとして参照回数を考える。Next, the profit is calculated for each element of the set (step S6). For simplicity, here we consider the number of references as profit.
次に、集合■の中でプロフィツトが最大のデータvIを
探して、これに集合Rの中の任意の記号レジスタR」を
割り付ける(ステップS7)。Next, the data vI with the largest profit is found in the set (2), and an arbitrary symbol register R in the set R is assigned to it (step S7).
その後で、集合■から割り付けの対象となったデータv
Iを取り除き(ステップS8)、集合Vが空(ステップ
59)ならば次のループの処理に移る(ステップSl)
。そうでなければ、集合Rから割り付けに使用した記号
レジスタR,を取り除く(ステップ510 )。集合R
が空(ステップ511)ならば、次のループの処理に移
る(ステップSL)。そうでなければ、次のデータに対
する割り付けに移る(ステップS7)。After that, the data v to be allocated from the set ■
Remove I (step S8), and if the set V is empty (step 59), move on to the next loop (step Sl)
. Otherwise, the symbol register R used for allocation is removed from the set R (step 510). set R
If is empty (step 511), the process moves to the next loop (step SL). Otherwise, the process moves to allocation to the next data (step S7).
第1図に戻って説明を続ける。次に、中間コードの変換
部(5b)では、レジスタ割り付け情報(17)を参照
し、上記の処理によって記号レジスタが割り付けられた
間接参照データに対して、中間コード(16)上で記号
レジスタに置ぎ換える処理を行う。その結果、記号レジ
スタを含む中間コード(18)が生成される。Returning to FIG. 1, the explanation will continue. Next, the intermediate code conversion unit (5b) refers to the register allocation information (17), and converts the indirect reference data to which the symbol register has been allocated by the above process into the symbol register on the intermediate code (16). Performs the replacement process. As a result, an intermediate code (18) containing symbol registers is generated.
ソースプログラムの表現に近い高位レベルの中間コード
の場合には、配列要素又はポインタによりて指されるデ
ータに関する参照を単純に記号レジスタに置き換えるだ
けでよいが、機械語の表現に近い低位レベルの中間コー
ドの場合には、間接参照データに対する参照が複数のテ
キストによって表わされているので、例えば、当該配列
要素に対するインデックスのロード命令を削除するよう
な処理も合わせて必要になる。In the case of high-level intermediate code that is close to the representation of the source program, references to data pointed to by array elements or pointers may simply be replaced with symbolic registers, but in the case of low-level intermediate code that is close to the machine language representation, In the case of code, since references to indirect reference data are expressed by multiple texts, processing such as deleting an index load instruction for the array element is also required, for example.
次に、物理レジスタ割り付け部(5C)では、上記の処
理によって変換された記号レジスタを含む中間コード(
18)に関して、記号レジスタとスカラデータを対象に
物理レジスタを割り付け、物理レジスタを含む中間コー
ド(19)が出力される。Next, the physical register allocation unit (5C) generates an intermediate code (
Regarding 18), physical registers are allocated for symbol registers and scalar data, and an intermediate code (19) including the physical registers is output.
間接参照データについては、間接参照データに対する記
号レジスタ割り付け部(5a)で既に処理しており、た
とえ未割り付けの間接参照データが存在しても、物理レ
ジスタ割り付けの対象とはしない。The indirect reference data has already been processed by the indirect reference data symbol register allocation unit (5a), and even if unallocated indirect reference data exists, it is not subject to physical register allocation.
また、記号レジスタに対しては、必ず物理レジスタが割
り付けられなければならないが、記号レジスタの数を物
理レジスタの数置下に制限しているので、これは原理的
に保証される。Furthermore, physical registers must be allocated to symbol registers, but this is guaranteed in principle since the number of symbol registers is limited to the number of physical registers.
間接参照データに対する記号レジスタ割り付け部(5a
)と同様に、レジスタ割り付けの範囲は特に限定しない
。ループ毎の割り付けについては、間接参照データに対
する記号レジスタ割り付け部(5a)の処理で説明した
のと同様な方法が適用できる。ここで、記号レジスタに
関してはプロフィツトの値を無限大に設定し、スカラデ
ータよりも優先的に割り付けが行われるようにする。Symbol register allocation unit for indirect reference data (5a
), the range of register allocation is not particularly limited. Regarding the allocation for each loop, a method similar to that described in the process of the symbol register allocation unit (5a) for indirect reference data can be applied. Here, the value of profit for the symbol register is set to infinity so that it is allocated with priority over scalar data.
なお、上記実施例では、各段階の処理でループ毎に大域
レジスタ割り付けを行うものとして説明したが、グラフ
彩色法等地の割り付け方式を使用してもかまわない。ま
た、レジスタ割り付け部の内部構成は各処理部が連続し
ているものとして説明したが、中間コードの変換部(5
b)と物理レジスタ割り付け部(5c)は離れていても
よく、例えば最適化処理部が間に入ってもかまわない。Although the above embodiment has been described on the assumption that global register allocation is performed for each loop in each stage of processing, a local allocation method such as a graph coloring method may be used. Furthermore, although the internal configuration of the register allocation section has been explained assuming that each processing section is continuous, the intermediate code conversion section (5
b) and the physical register allocation unit (5c) may be separated; for example, an optimization processing unit may be placed between them.
以上のように、この発明によれば、レジスタ割り付けの
処理を2つの段階に分け、間接参照データに対する割り
付けと通常のスカラデータに対する割り付けを分離した
構成にしたので、間接参照データと間接インデックスの
対に関して、一方のデータに対するレジスタ割り付けの
状況に応じて、他方のデータをプロフィツトが変化する
ということがなくなり、正確なプロフィツトを求めるこ
とができるようになったため、より精度の高いレジスタ
割り付けができ、効率のよい目的プログラムが得られる
という効果がある。As described above, according to the present invention, the register allocation process is divided into two stages, and the allocation to indirect reference data and the allocation to normal scalar data are separated, so that the association between indirect reference data and indirect indexes is separated. Regarding the above, the profit for one data does not change depending on the status of register allocation for the other data, and it is now possible to calculate the accurate profit, which enables more accurate register allocation and improves efficiency. This has the effect of providing a good objective program.
また、マシンアーキテクチャによっては、特定の命令又
は特定のデータ参照方式に対しては使用できるレジスタ
に制限がつくことがあり、第1段階の処理で記号レジス
タを使用することにより、第2段階の処理開始時点では
特定のレジスタ番号は決定していないので、第2段階の
処理で一括してターゲットマシンに依存したより極めの
細かい割り付けができるという効果もある。Also, depending on the machine architecture, there may be restrictions on the registers that can be used for specific instructions or specific data reference methods, so by using symbolic registers in the first stage of processing, the second stage of processing Since specific register numbers have not been determined at the start, the second stage of processing also has the effect of allowing more detailed allocation depending on the target machine at once.
第1図はこの発明の一実施例におけるレジスタ割り付け
部の構成図、第2図はこの発明の一実施例におけるレジ
スタ割り付け部の中の間接参照データに対する記号レジ
スタ割り付け部の処理概要を示すフローチャート、第3
図はコンパイラの基本構成図、第4図はこの発明が解決
しようとする課題を説明するためのFORTRANプロ
グラムの一部を示す説明図、第5図は第4図のプログラ
ム−のDOループ中におけるデータの参照回数を表す説
明図、第6図は従来の方式でレジスタ割り付けを行った
場合のデータとレジスタとのマツピング関係を示す説明
図である。
図面において、(1)はソースプログラム、(5)はレ
ジスタ割り付け部、(5a)は間接参照データに対する
記号レジスタ割り付け部、(5b)は中間コードの変換
部、(5C)は記号レジスタとスカラデータに対する物
理レジスタ割り付け部、(7)は目的プログラム、(1
6)は中間コード、(17)はレジスタ割り付け情報、
(18)は記号レジスタを含む中間コード、(19)は
物理レジスタを含む中間コードを示す。
なお、各図中、同一符号は同一または相当部分を示す。FIG. 1 is a configuration diagram of a register allocation section in an embodiment of the present invention, and FIG. 2 is a flowchart showing an overview of processing of the symbol register allocation section for indirect reference data in the register allocation section in an embodiment of the invention. Third
The figure is a basic configuration diagram of a compiler, Figure 4 is an explanatory diagram showing a part of a FORTRAN program to explain the problem to be solved by this invention, and Figure 5 is a diagram showing a portion of the FORTRAN program in the DO loop of the program in Figure 4. FIG. 6 is an explanatory diagram showing the number of times data is referenced, and FIG. 6 is an explanatory diagram showing the mapping relationship between data and registers when register allocation is performed using the conventional method. In the drawings, (1) is a source program, (5) is a register allocation section, (5a) is a symbol register allocation section for indirect reference data, (5b) is an intermediate code conversion section, and (5C) is a symbol register and scalar data. The physical register allocation part for (7) is the target program, (1
6) is intermediate code, (17) is register allocation information,
(18) indicates an intermediate code including symbol registers, and (19) indicates an intermediate code including physical registers. In each figure, the same reference numerals indicate the same or corresponding parts.
Claims (1)
スタの総容量に比べて十分大きい記憶容量を有し該レジ
スタよりも遅いアクセス時間を有するメモリに接続され
るプロセッサに対する目的プログラムを生成するコンパ
イラにおいて、第1段階として、使用可能な物理レジス
タの個数以下の記号レジスタを用いて、配列要素又はポ
インタによって示されるデータのように目的プログラム
のレベルで間接インデックスによってアクセスされる間
接参照データを対象に記号レジスタを割り付け、第2段
階として、上記の処理によって記号レジスタが割り付け
られたデータを記号レジスタに置換した中間コードに関
して、記号レジスタとスカラデータを対象に物理レジス
タ割り付けを行うことを特徴とするレジスタ割り付け方
式。In a compiler that analyzes a source program and generates a target program for a processor connected to a finite number of registers and a memory that has a storage capacity sufficiently larger than the total capacity of the registers and has a slower access time than the registers, As a first step, the number of symbolic registers equal to or less than the number of available physical registers is used to target indirect reference data that is accessed by indirect indexing at the level of the target program, such as data pointed to by array elements or pointers. A register allocation method characterized in that, as a second step, physical register allocation is performed for symbol registers and scalar data with respect to intermediate code in which data to which symbol registers have been allocated by the above processing is replaced with symbol registers. .
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5947190A JPH03260732A (en) | 1990-03-09 | 1990-03-09 | Register allocation system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5947190A JPH03260732A (en) | 1990-03-09 | 1990-03-09 | Register allocation system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH03260732A true JPH03260732A (en) | 1991-11-20 |
Family
ID=13114258
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP5947190A Pending JPH03260732A (en) | 1990-03-09 | 1990-03-09 | Register allocation system |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH03260732A (en) |
-
1990
- 1990-03-09 JP JP5947190A patent/JPH03260732A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5293631A (en) | Analysis and optimization of array variables in compiler for instruction level parallel processor | |
| EP0428084B1 (en) | Method and apparatus for compiling computer programs with interprocedural register allocation | |
| US5790862A (en) | Resource assigning apparatus which assigns the variable in a program to resources | |
| JP3311462B2 (en) | Compile processing unit | |
| US5966539A (en) | Link time optimization with translation to intermediate program and following optimization techniques including program analysis code motion live variable set generation order analysis, dead code elimination and load invariant analysis | |
| US7185327B2 (en) | System and method for optimizing operations via dataflow analysis | |
| US7493610B1 (en) | Versioning optimization for dynamically-typed languages | |
| JP2500079B2 (en) | Program optimization method and compiler system | |
| JPH0776927B2 (en) | Compile method | |
| US20080134151A1 (en) | Compiler register allocation and compilation | |
| JPS63121930A (en) | Improvement of code generation efficiency for compiler | |
| US5367684A (en) | Register allocation using an improved register candidate usage matrix | |
| US6925639B2 (en) | Method and system for register allocation | |
| WO1995031779A1 (en) | Instruction creation device | |
| US6029005A (en) | Method for identifying partial redundancies in a new processor architecture | |
| US6009273A (en) | Method for conversion of a variable argument routine to a fixed argument routine | |
| US6016398A (en) | Method for using static single assignment to color out artificial register dependencies | |
| Franke et al. | Compiler transformation of pointers to explicit array accesses in DSP applications | |
| Guyer et al. | Optimizing the use of high performance software libraries | |
| CN113741861B (en) | Method for calculating data dependency in program and computer readable storage medium | |
| US20050144605A1 (en) | Information processing system and code generation method | |
| JPH03260732A (en) | Register allocation system | |
| JPH06103462B2 (en) | Vector length control range division processing method | |
| Bose | Instruction set design for support of high-level languages | |
| Bloom et al. | Criteria for Evaluating the Performance of Compilers |