[go: up one dir, main page]

JP2001067234A - Compiler and processor - Google Patents

Compiler and processor

Info

Publication number
JP2001067234A
JP2001067234A JP24226299A JP24226299A JP2001067234A JP 2001067234 A JP2001067234 A JP 2001067234A JP 24226299 A JP24226299 A JP 24226299A JP 24226299 A JP24226299 A JP 24226299A JP 2001067234 A JP2001067234 A JP 2001067234A
Authority
JP
Japan
Prior art keywords
instruction
load
store
alias
compiler
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
Application number
JP24226299A
Other languages
Japanese (ja)
Other versions
JP3608446B2 (en
Inventor
Satoshi Hosoi
聡 細井
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 JP24226299A priority Critical patent/JP3608446B2/en
Publication of JP2001067234A publication Critical patent/JP2001067234A/en
Application granted granted Critical
Publication of JP3608446B2 publication Critical patent/JP3608446B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)
  • Devices For Executing Special Programs (AREA)
  • Advance Control (AREA)

Abstract

(57)【要約】 【課題】 エイリアス状態をチェックするエイリアスチ
ェック命令を生成し、ストア命令の前にロード命令を配
置するコンパイラとエイリアス命令を有するプロセッサ
を提供することにある。 【解決手段】ソースプログラムから中間コードを生成す
る命令解析部と生成した中間コードの余分な命令の削除
等を行う命令最適化部と実行可能な目的プログラムに変
換する命令変換部とを備えたコンパイラであって、命令
最適化部は、命令解析部で生成した中間コードの中から
ストア命令、ロード命令の組を抽出するストア・ロード
命令抽出手段と、抽出したロード命令とストア命令のオ
ペランドアドレス間の重なりを実行時に検出するための
エイリアスチェック命令を生成するエイリアスチェック
命令生成手段と、エイリアスチェック命令、ロード命
令、ストア命令の順に命令列を再配置し、条件付命令を
ロード命令の元の位置に配置する命令配置手段とを有す
ることを特徴とするコンパイラ。
(57) [Problem] To provide a compiler which generates an alias check instruction for checking an alias state and arranges a load instruction before a store instruction, and a processor having the alias instruction. A compiler includes an instruction analysis unit that generates intermediate code from a source program, an instruction optimization unit that deletes extra instructions in the generated intermediate code, and an instruction conversion unit that converts an instruction into an executable target program. The instruction optimizing unit includes: a store / load instruction extracting unit that extracts a set of a store instruction and a load instruction from the intermediate code generated by the instruction analysis unit; Alias check instruction generating means for generating an alias check instruction for detecting the overlap at execution, and rearranging the instruction sequence in the order of an alias check instruction, a load instruction, and a store instruction, and replacing the conditional instruction with the original position of the load instruction And an instruction arranging means for arranging instructions.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、計算機の実行の高
速化のため、命令列を並べ替えて最適化処理を行うコン
パイラとコンパイラによりコンパイルした命令列を実行
するプロセッサに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compiler for rearranging an instruction sequence and performing an optimization process in order to speed up the execution of a computer, and a processor for executing an instruction sequence compiled by the compiler.

【0002】[0002]

【従来の技術と発明が解決しようとする課題】近年のプ
ロセッサの性能向上はめざましいが、演算速度ほどには
メモリのアクセス速度は向上しない。
2. Description of the Related Art Although the performance of processors has been remarkably improved in recent years, the access speed of a memory is not as fast as the operation speed.

【0003】そのため、ロード命令のときのキャッシュ
ミスヒットによるメモリアクセスの遅延やロード命令の
ときのキャッシュメモリ上のデータの転送待ちによる遅
延がますます大きくなる傾向がある。
Therefore, a delay in memory access due to a cache mishit at the time of a load instruction and a delay due to a data transfer wait on the cache memory at the time of a load instruction tend to be further increased.

【0004】従って、他の命令処理との並行処理を可能
にするため、メモリアクセス時間の遅いロード命令はで
きるだけグループ化して先行してメモリアクセスをして
おくことが必要となる。
[0004] Therefore, in order to enable parallel processing with other instruction processing, it is necessary to group load instructions having a slow memory access time as much as possible and access the memory first.

【0005】その為、ロード命令を先行化するコンパイ
ラが必要となる。
Therefore, a compiler that precedes the load instruction is required.

【0006】従来例のコンパイラ1の構成図を図7に示
す。
FIG. 7 shows a configuration diagram of a conventional compiler 1.

【0007】コンパイラ1は、ソースプログラム2から
中間コードを生成する命令解析部11と、生成した中間
コードの最適化処理(最適化処理とは、余分な命令の削
除、重複した命令のまとめ、より高速な命令への変換な
ど命令列の高速化のための処理をいう。)を行う命令最
適化部A12と、その最適化結果に基づき目的プログラ
ム3のコードを生成する命令変換部13より構成され
る。
[0007] The compiler 1 includes an instruction analysis unit 11 for generating intermediate code from the source program 2 and an optimization process for the generated intermediate code (the optimization process is a process for deleting extra instructions, collecting duplicate instructions, and so on). It is composed of an instruction optimizing unit A12 that performs processing for speeding up an instruction sequence such as conversion to a high-speed instruction, and an instruction converting unit 13 that generates a code of the target program 3 based on the optimization result. You.

【0008】目的プログラム3の各命令は、プロセッサ
4によりフェッチされ実行される。
Each instruction of the target program 3 is fetched and executed by the processor 4.

【0009】メモリアクセスの高速化のため、コンパイ
ラ上で、ストア命令の前にロード命令を再配置して先行
実行しようとすると、メモリ上のロード命令、ストア命
令のオペランドアドレスがコンパイラ上では、不明の場
合が発生し、ロード命令とストア命令のオペランドアド
レスの重なり(以下エイリアスと呼ぶ)の解析が困難で
あった。
When the load instruction is rearranged before the store instruction on the compiler in order to speed up the memory access and the preceding execution is performed, the operand address of the load instruction and the store instruction on the memory is unknown on the compiler. And it was difficult to analyze the overlap (hereinafter referred to as alias) of the operand addresses of the load instruction and the store instruction.

【0010】例えば、C言語で記述したプログラムでは
ポインタが多用されるため、コンパイラでは、ロード命
令とストア命令のエイリアス関係を検出できなかった。
For example, since pointers are frequently used in a program described in C language, the compiler cannot detect an alias relationship between a load instruction and a store instruction.

【0011】しかし、実際のプログラムの実行上では、
ほとんどロード命令とストア命令のオペランドアドレス
が重なることはないため、ロード命令をストア命令の前
に配置してロード命令のメモリアクセスによる遅延の影
響を少なくできる可能性を活かせていなかった。
However, in actual program execution,
Since the operand addresses of the load instruction and the store instruction hardly overlap, the possibility that the load instruction is arranged before the store instruction to reduce the influence of the delay due to the memory access of the load instruction has not been utilized.

【0012】本発明のコンパイラの目的は、エイリアス
状態をチェックするエイリアスチェック命令を生成し、
ストア命令の前にロード命令を配置することで、実行時
のロード命令のアクセスを高速化することである。
An object of the compiler of the present invention is to generate an alias check instruction for checking an alias state,
By arranging a load instruction before a store instruction, access to the load instruction at the time of execution is speeded up.

【0013】[0013]

【課題を解決するための手段】ソースプログラムから中
間コードを生成する命令解析部と生成した中間コードの
余分な命令の削除等を行う命令最適化部と実行可能な目
的プログラムに変換する命令変換部とを備えたコンパイ
ラであって、命令最適化部は、命令解析部で生成した中
間コードの中からストア命令、ロード命令の組を抽出す
るストア・ロード命令抽出手段と、抽出したロード命令
とストア命令のオペランドアドレス間の重なりを実行時
に検出するためのエイリアスチェック命令を生成するエ
イリアスチェック命令生成手段と、エイリアスチェック
命令、ロード命令、ストア命令の順に命令列を再配置
し、エイリアスチェック命令実行時に、オペランドアド
レス間の重なりが検出されたときには、ロード命令実行
の補正を行い、重なりが検出されなかったときには、何
も実行しない条件付命令をロード命令の元の位置に配置
する命令配置手段とを有する構成である。
An instruction analysis unit for generating an intermediate code from a source program, an instruction optimizing unit for deleting extra instructions in the generated intermediate code, and an instruction conversion unit for converting the generated intermediate code into an executable target program. Wherein the instruction optimizing unit comprises: a store / load instruction extracting unit for extracting a set of a store instruction and a load instruction from the intermediate code generated by the instruction analysis unit; An alias check instruction generating means for generating an alias check instruction for detecting an overlap between instruction operand addresses at the time of execution, and an instruction sequence rearranged in the order of an alias check instruction, a load instruction, and a store instruction, and executing the alias check instruction. When the overlap between the operand addresses is detected, the load instruction execution is corrected and the overlap is performed. There when not detected, nothing is configured to have an instruction arrangement means for arranging instruction with no execution condition to the original position of the load instruction.

【0014】この構成により、プロセッサによる目的プ
ログラムの実行時にエイリアスチェック命令が、エイリ
アス状態をチェックするので、ロード命令のストア命令
の前への移動の有効性の有無が確認できる。この結果、
移動が有効であれば、ロード命令が先行実行できるの
で、命令実行の高速化が可能となる。また移動が無効で
あれば、先行して実行したロード命令は無効のため、ロ
ード命令の内容を補正するための命令(ロード命令また
はムーブ命令)を実行する。この補正をする命令によ
り、ロード命令の先行実行の内容を補正できる。
According to this configuration, the alias check instruction checks the alias state when the target program is executed by the processor, so that it is possible to confirm whether the load instruction is moved before the store instruction. As a result,
If the movement is valid, the load instruction can be executed in advance, so that the speed of instruction execution can be increased. If the movement is invalid, the previously executed load instruction is invalid, so that an instruction (load instruction or move instruction) for correcting the content of the load instruction is executed. With this correction instruction, the contents of the preceding execution of the load instruction can be corrected.

【0015】また、エイリアスチェック命令はストア命
令のオペランドアドレスを設定する第1入力値と、ロー
ド命令のオペランドアドレスを設定する第2入力値と、
少なくとも1つ以上のロード命令のアドレスサイズの合
計値と、少なくとも1つ以上のストア命令のアドレスサ
イズの合計値とを比較して等しいかまたは大きい方のア
ドレスサイズの合計値を設定する第3入力値とを有し、
第1入力値と第2入力値との差の絶対値を計算し、計算
した結果が第3入力値より小さいときはロード命令のオ
ペランドアドレスとストア命令のオペランドアドレスと
が重なっていることを示すチェック情報をオンにする構
成である。
The alias check instruction has a first input value for setting an operand address of a store instruction, a second input value for setting an operand address of a load instruction,
A third input for comparing the total value of the address sizes of at least one or more load instructions with the total value of the address sizes of at least one or more store instructions and setting a total value of the equal or larger address size Has the value
The absolute value of the difference between the first input value and the second input value is calculated. If the calculated result is smaller than the third input value, it indicates that the operand address of the load instruction and the operand address of the store instruction overlap. The check information is turned on.

【0016】この構成により、1つ以上のロード命令を
1つ以上のストア命令の前に、まとめて移動できるので
ロード命令の先行実行の効果が大きくなるエイリアスチ
ェック命令を生成できる。
With this configuration, one or more load instructions can be moved together before one or more store instructions, so that an alias check instruction can be generated which increases the effect of preceding execution of the load instruction.

【0017】また、1つのロード命令のデータサイズ
と、1つのストア命令のデータサイズとを比較して等し
いときは、1をエイリアスチェック命令の第3入力値と
して設定し、等しくないときは、大きいデータサイズの
値を第3入力値として設定する構成である。
When the data size of one load instruction is equal to the data size of one store instruction, 1 is set as the third input value of the alias check instruction. In this configuration, the value of the data size is set as the third input value.

【0018】この構成により、1ロード命令と1ストア
命令間では、データサイズの比較のみにより、ストア命
令の前へのロード命令の先行実行の有効無効を判断する
エイリアスチェック命令が、生成できる。
With this configuration, an alias check instruction for determining whether the preceding execution of the load instruction before the store instruction is valid or invalid can be generated only by comparing the data size between the one load instruction and the one store instruction.

【0019】また、コンパイラにより生成された目的プ
ログラムを実行するプロセッサであって、コンパイラに
よって生成されたエイリアスチェック命令を実行する実
行手段を有する構成である。
Also, the processor for executing the target program generated by the compiler has an execution means for executing the alias check instruction generated by the compiler.

【0020】この構成により、生成されたエイリアスチ
ェック命令を実行できるプロセッサを使用して、先行実
行のためにロード命令をストア命令の前に配置した目的
プログラムを実行できる。
With this configuration, it is possible to execute a target program in which a load instruction is arranged before a store instruction for preceding execution by using a processor capable of executing the generated alias check instruction.

【0021】[0021]

【発明の実施の形態】実施例のコンパイラ1の構成図を
図1に示す。
FIG. 1 shows a configuration diagram of a compiler 1 according to an embodiment.

【0022】コンパイルラ1は,ソースプログラム2を
解析し中間コードを生成する命令解析部11,命令の最
適化処理を行う命令最適化部12,命令最適化部12の
結果に基づき目的プログラム3のコードを生成する命令
変換部13からなる。
The compiler 1 analyzes the source program 2 to generate an intermediate code, an instruction analyzing section 12 for optimizing instructions, and an instruction optimizing section 12 based on the results of the instruction optimizing section 12. The instruction conversion unit 13 generates a code.

【0023】命令最適化部12は、命令最適化部Aと命
令最適化部Bとからなる。
The instruction optimizing unit 12 includes an instruction optimizing unit A and an instruction optimizing unit B.

【0024】命令最適化部Aは、従来と同様に余分な命
令の削除、重複した命令のまとめ、より高速な命令への
変換など命令列の高速化のための処理を行う。
The instruction optimizing unit A performs processing for speeding up the instruction sequence, such as the removal of extra instructions, the grouping of duplicate instructions, and the conversion to higher-speed instructions, as in the prior art.

【0025】命令最適化部Bは、ロード命令とストア命
令のエイリアス状態のチェックを行うエイリアスチェッ
ク命令の生成処理とエイリアスチェック命令、ロード命
令、ストア命令等の命令列の配置処理を行うことで命令
列の高速化のための処理を行う。
The instruction optimizing unit B performs the processing of generating an alias check instruction for checking the alias state of a load instruction and a store instruction and the processing of arranging instruction strings such as an alias check instruction, a load instruction, and a store instruction. Performs processing to speed up columns.

【0026】プロセッサ4は、コンパイラ1で生成した
目的プログラムを入力してエイリアスチェック命令を含
む各命令を実行する。
The processor 4 inputs the target program generated by the compiler 1 and executes each instruction including an alias check instruction.

【0027】コンパイルラ1は,ソースプログラムを命
令解析部11に入力すると、文法チェックを行いエラー
がなければ、中間コードを生成する。
When the source program is input to the instruction analysis unit 11, the compiler 1 checks the grammar and generates an intermediate code if there is no error.

【0028】生成された中間コードを命令最適化部12
に入力し、最適化処理を行う。
The generated intermediate code is transferred to the instruction optimization unit 12
To perform optimization processing.

【0029】本発明の特徴である命令最適化部Bについ
て説明を行う。
The instruction optimizing unit B which is a feature of the present invention will be described.

【0030】図2に命令最適化部Bの流れ図を示す。 (1) 中間コードの中から、ロード命令とストア命令のグ
ループを検出する。(S1ステッフ゜) (2) 検出した命令を基に、エイリアスチェック命令生成
処理を行う。(S2ステッフ゜) (3) エイリアスチェック命令に続けてストア命令の前に
ロード命令を配置する。(S3ステッフ゜) (4) エイリアスチェック命令の第3入力値が1か否かの
チェックを行う。(S4ステッフ゜) (5) 第3入力値が1でなければ元のロード命令の位置に
条件付ロード命令を配置する。(S5ステッフ゜) (6) 第3入力値が1のときは元のロード命令の位置に条
件付ムーブ命令を配置する。(S6ステッフ゜) 図3には、エイリアスチェック命令生成処理の流れ図を
示す。
FIG. 2 shows a flow chart of the instruction optimization unit B. (1) Detect a group of load instruction and store instruction from the intermediate code. (2) Perform alias check instruction generation processing based on the detected instruction. (S2 step) (3) Place the load instruction before the store instruction following the alias check instruction. (S3 step) (4) Check whether the third input value of the alias check instruction is 1 or not. (S4 step) (5) If the third input value is not 1, a conditional load instruction is arranged at the position of the original load instruction. (S5 step) (6) When the third input value is 1, a conditional move instruction is arranged at the position of the original load instruction. (S6 Step) FIG. 3 shows a flowchart of the alias check instruction generation processing.

【0031】エイリアスチェック命令とは、ロード命令
とストア命令のオペランドアドレス(以下アドレスと略
す。)のエイリアス状態をチェックする命令である。
An alias check instruction is an instruction for checking the alias state of operand addresses (hereinafter, abbreviated as addresses) of a load instruction and a store instruction.

【0032】エイリアスチェック命令は、vailias a1,
a2,x と表す。
The alias check instruction is vailias a1,
a2, x.

【0033】第1入力値a1:ストア命令のアドレス 第2入力値a2:ロード命令のアドレス 第3入力値x:所定値 プロセッサ4による目的プログラム3の命令実行時にプ
ロセッサ4は、ストア命令のアドレス、ロード命令のア
ドレスとを比較して、所定値以上であれば、アドレスが
重ならないことを示すチェック情報(以下コンディショ
ンコードccのzフラグと呼ぶ)をオフとする。そしてS3
ステッフ゜で移動したロード命令の実行を有効とする。
First input value a1: Store instruction address Second input value a2: Load instruction address Third input value x: Predetermined value When the processor 4 executes the instruction of the target program 3, the processor 4 The address is compared with the address of the load instruction. If the address is equal to or more than a predetermined value, check information indicating that the addresses do not overlap (hereinafter, referred to as the z flag of the condition code cc) is turned off. And S3
The execution of the load instruction moved in step is made valid.

【0034】この時、元のロード命令の位置でのS5ステッフ
゜で生成した条件付ロード命令またはS6ステッフ゜で生成した
条件付ムーブ命令は、何も実行しない。
At this time, the conditional load instruction generated in S5 step or the conditional move instruction generated in S6 step at the position of the original load instruction does not execute anything.

【0035】また、ストア命令とロード命令のアドレス
の差が所定値より小さければ、アドレスが重なっている
ことを示すccのzフラグをオンとして、移動したロード
命令の実行を無効とみて、元のロード命令の位置で、条
件付きロード命令により、再度同じロード命令を実行す
るか又は、条件付ムーブ命令により所定のレジスタにム
ーブすることにより、ロード命令の補正処理を実行す
る。
If the difference between the address of the store instruction and the address of the load instruction is smaller than a predetermined value, the z flag of cc indicating that the addresses are overlapped is turned on, and the execution of the moved load instruction is regarded as invalid. At the position of the load instruction, the same load instruction is executed again by the conditional load instruction, or the load instruction is moved to a predetermined register by the conditional move instruction to execute the correction processing of the load instruction.

【0036】コンパイラ1でのエイリアスチェック命令
の生成について説明する。
The generation of an alias check instruction in the compiler 1 will be described.

【0037】複数のロード命令を複数のストア命令を超
えて移動させる例を示す。 (1) ストア命令のN個のグループを検索し、その基準ア
ドレスを示すレジスタを第1入力値にセットする。(S21
ステッフ゜) (2) ロード命令のM個のグループを検索し、その基準ア
ドレスを示すレジスタを第2入力値にセットする。(S22
ステッフ゜) (3) N=M=1か否かをチェックする。(S23ステッフ゜ ) (4) ストア命令のN個のグループと、ロード命令のM個
のグループの各アドレスサイズの合計値を取得し、比較
する。(S24ステッフ゜) (5) N=M=1ならロード命令とストア命令のデータサ
イズが等しいか否かをチェックする。(S25ステッフ゜) (6) N=M=1で、ロード命令とストア命令のデータサ
イズが等しいときは、第3入力値を1とする。(S26ステッフ
゜) (7) N=M=1で、ロード命令とストア命令のデータサ
イズが等しくないときはデータサイズの大きな方の値を
第3入力値としてセットする。(S27ステッフ゜) (8) ロード命令またはストア命令が複数命令であれば、
アドレスサイズが等しい値かまたは大きい値の方の値を
第3入力値としてセットする。(S28ステッフ゜) (9) 上記第1〜第3の入力値を基にエイリアスチェック
命令を生成する。(S29ステッフ゜) 以下に具体例を示す。
An example in which a plurality of load instructions are moved over a plurality of store instructions will be described. (1) Search for N groups of store instructions and set a register indicating the reference address to the first input value. (S21
(2) Search M groups of load instructions and set the register indicating the reference address to the second input value. (S22
Step 3) (3) Check whether N = M = 1. (S23 step) (4) Obtain and compare the total value of the address sizes of the N groups of store instructions and the M groups of load instructions. (S24 step) (5) If N = M = 1, it is checked whether the data size of the load instruction is equal to the data size of the store instruction. (S25 step) (6) When N = M = 1 and the data size of the load instruction is equal to the data size of the store instruction, the third input value is set to 1. (S26 step) (7) If N = M = 1 and the data sizes of the load instruction and the store instruction are not equal, the larger value of the data size is set as the third input value. (S27 step) (8) If the load or store instruction is multiple instructions,
A value having the same or larger address size is set as the third input value. (9) An alias check instruction is generated based on the first to third input values. (S29 step) A specific example is shown below.

【0038】図4に、実施例1のエイリアスチェック命
令生成時の命令列を示す。
FIG. 4 shows an instruction sequence when an alias check instruction is generated according to the first embodiment.

【0039】また、図4a は生成前の命令列、図4b
は、生成後の命令列を示す。
FIG. 4A shows an instruction sequence before generation, and FIG.
Indicates an instruction sequence after generation.

【0040】まず生成前の命令列を基にエイリアスチェ
ック命令を生成する。
First, an alias check instruction is generated based on the instruction string before generation.

【0041】命令列が複数のロード命令、複数のストア
命令の順番に配置されているとすると、エイリアスチェ
ック命令の生成処理は次のように行う。
Assuming that the instruction sequence is arranged in the order of a plurality of load instructions and a plurality of store instructions, the processing of generating an alias check instruction is performed as follows.

【0042】ストア命令のグループを検索した結果、ス
トア命令のデータサイズが1バイトの命令とすると、グ
ループのアドレスサイズは、アドレス〔r1〕から〔r1+
1〕までの2バイトである。(図4a の) 従ってエイリアスチェック命令の第1入力値は、〔r1〕
である。
As a result of searching the group of store instructions, if the data size of the store instruction is an instruction of 1 byte, the address size of the group is changed from address [r1] to [r1 +
1]. Therefore, the first input value of the alias check instruction is (r1)
It is.

【0043】一方ロード命令は、データサイズ4バイト
の命令とするとアドレスサイズは、アドレス〔r2〕から
〔r2+11〕まの12バイトである。(図4a の) 従ってエイリアスチェック命令の第2入力値は、〔r2〕
である。
On the other hand, if the load instruction is an instruction having a data size of 4 bytes, the address size is 12 bytes from address [r2] to [r2 + 11]. Therefore, the second input value of the alias check instruction is (r2)
It is.

【0044】次に、ストア命令のアドレスサイズ2バイ
トと、ロード命令のアドレスサイズ12バイトとを比較
すると、ロード命令のアドレスサイズが大きいので、そ
の値の12を第3入力値とする。
Next, comparing the address size of the store instruction with 2 bytes and the address size of the load instruction with 12 bytes, the address size of the load instruction is large. Therefore, the value 12 is set as the third input value.

【0045】図5に、実施例1のアドレスサイズの説明
図を示す。
FIG. 5 is an explanatory diagram of the address size according to the first embodiment.

【0046】実際にロード命令とストア命令の重なる範
囲は、〔r2〕から〔r2+11〕の間である。しかし、エイ
リアスチェック命令は、〔r2−11〕から〔r2+11〕の間
は、アドレスが重なると判断する。これは、〔r2-11 〕
から〔r2+11〕に〔r1〕があるとエイリアスになる可能
性があるため、その範囲に〔r1〕がないことを判断して
いる。これにより命令を複数命令でなく1命令で処理す
ることができるため、処理の高速化が可能となる。
The range where the load instruction and the store instruction overlap is actually between [r2] and [r2 + 11]. However, the alias check instruction determines that addresses overlap between [r2-11] and [r2 + 11]. This is [r2-11]
From [r2 + 11], if [r1] exists in [r2 + 11], it may become an alias, so it is determined that [r1] does not exist in that range. As a result, an instruction can be processed by one instruction instead of a plurality of instructions, so that the processing can be speeded up.

【0047】次に命令の配置処理について説明する。Next, the instruction placement processing will be described.

【0048】図4b には、エイリアスチェック命令生成
後の命令列を示す。
FIG. 4B shows an instruction sequence after the alias check instruction is generated.

【0049】エイリアスチェック命令(図4b )の次
に、複数のストア命令を飛び越して、グループ化した複
数のロード命令を配置する。(図4b ) 次に、ストア命令と元のロード命令の位置との配置関係
を保ったまま、ロード命令に続けてストア命令等を配置
する。(図4b ) 次に、元のロード命令の位置に条件付ロード命令を配置
する。(図4b の) 以上により、命令配置処理は、終了する。
After the alias check instruction (FIG. 4b), a plurality of store instructions are skipped and a plurality of grouped load instructions are arranged. (FIG. 4B) Next, a store instruction and the like are arranged following the load instruction while maintaining the arrangement relation between the store instruction and the position of the original load instruction. (FIG. 4B) Next, a conditional load instruction is arranged at the position of the original load instruction. Thus, the instruction arrangement processing is completed (of FIG. 4B).

【0050】このように配置した命令列を命令変換部1
3で、目的プログラム3に変換後、そのプログラムをプ
ロセッサ4が実行すると、次のような動作を行う。
The instruction sequence arranged as described above is transferred to the instruction conversion unit 1.
In step 3, after conversion into the target program 3, when the program is executed by the processor 4, the following operation is performed.

【0051】エイリアスチェック命令の実行により、|
r1-r2 |の値が第3入力値よりも小さければ、ccフラグ
のzフラグをオンとする。大きければオフとする。
By executing the alias check instruction, |
If the value of r1-r2 | is smaller than the third input value, the z flag of the cc flag is turned on. Turn off if larger.

【0052】アドレス〔r2〕、〔r2+4〕、〔r2+8〕
から各4バイトのデータをレジスタr30 、レジスタr3
1、レジスタr32にロードする。(図4b ) アドレス〔r1〕の示すアドレスにレジスタr10の示すデ
ータをストアする。(図4b ) 条件付ロード命令になると、zフラグがオンの場合にの
み、アドレス〔r2+4〕から4バイトのデータをレジス
タr31に再ロードする。(図4b の) zフラグがオフの場合は、何もせずに次の命令に進む。
アドレス〔r1+1〕の示すアドレスにレジスタr11の示
すデータをストアする。(図4b ) 条件付ロード命令になると、zフラグがオンの場合にの
み、アドレス〔r2+8〕から4バイトのデータをレジス
タr32にロードする。(図4b ) zフラグがオフの場合は、何もせずに次の命令に進む。
Address [r2], [r2 + 4], [r2 + 8]
4 bytes of data from register r30 and register r3
1. Load to register r32. (FIG. 4B) The data indicated by the register r10 is stored at the address indicated by the address [r1]. (FIG. 4B) When a conditional load instruction is issued, only when the z flag is ON, 4-byte data from the address [r2 + 4] is reloaded into the register r31. If the z flag (of FIG. 4b) is off, do nothing and go to the next instruction.
The data indicated by the register r11 is stored at the address indicated by the address [r1 + 1]. (FIG. 4B) When a conditional load instruction is issued, 4-byte data from the address [r2 + 8] is loaded into the register r32 only when the z flag is ON. (FIG. 4b) If the z flag is off, proceed to the next instruction without doing anything.

【0053】このように、コンパイラ1がエイリアスチ
ェック命令を条件付ロード命令とペアで、生成すること
で、プロセッサが命令の実行を高速化できる。
As described above, the compiler 1 generates the alias check instruction in a pair with the conditional load instruction, so that the processor can execute the instruction at high speed.

【0054】図6には、実施例2のエイリアスチェック
命令生成時の命令列を示す。
FIG. 6 shows an instruction sequence when an alias check instruction is generated in the second embodiment.

【0055】図6a には、生成前の命令列、図6b に
は、生成後の命令列を示す。
FIG. 6A shows an instruction sequence before generation, and FIG. 6B shows an instruction sequence after generation.

【0056】エイリアスチェック命令生成前の命令列が
1つのストア命令、1つのロード命令の順番に配置され
ている。
The instruction sequence before the generation of the alias check instruction is arranged in the order of one store instruction and one load instruction.

【0057】エイリアスチェック命令の生成処理は次の
ように行う。
The process of generating an alias check instruction is performed as follows.

【0058】ストア命令のグループを検索した結果、ス
トア命令がアドレス〔r1〕でデータ幅が4バイトの命令
とするとエイリアスチェック命令の第1入力値は、〔r
1〕である。(図6a ) 一方ロード命令は、アドレス〔r2〕でデータ幅4バイト
の命令のためエイリアスチェック命令の第2入力値は、
〔r2〕である。(図6a ) 次にストア命令のデータサイズとロード命令のデータサ
イズとを比較すると、両者が等しいので、第3入力値を
1とする。
As a result of searching the group of store instructions, if the store instruction is an instruction having an address [r1] and a data width of 4 bytes, the first input value of the alias check instruction is [r
1]. (FIG. 6a) On the other hand, since the load instruction is an instruction having a data width of 4 bytes at address [r2], the second input value of the alias check instruction is:
[R2]. (FIG. 6a) Next, comparing the data size of the store instruction and the data size of the load instruction, since they are equal, the third input value is set to 1.

【0059】次に命令の配置処理について説明する。Next, the instruction arrangement processing will be described.

【0060】図6b には、実施例2のエイリアスチェッ
ク命令生成時の命令列を示す。
FIG. 6B shows an instruction sequence when an alias check instruction is generated in the second embodiment.

【0061】エイリアスチェック命令(図6b )の次
に、ストア命令を飛び越して、ロード命令を配置する。
(図6b ) 次に、ストア命令と元のロード命令の位置との配置関係
を保ったまま、ロード命令に続けてストア命令を配置す
る。(図6b ) 次に元のロード命令の位置にチェックムーブ命令を配置
する。(図6b ) 以上により、命令の配置処理は、終了する。
After the alias check instruction (FIG. 6B), a load instruction is arranged, skipping a store instruction.
(FIG. 6B) Next, the store instruction is arranged after the load instruction while maintaining the arrangement relation between the store instruction and the position of the original load instruction. (FIG. 6B) Next, a check move instruction is arranged at the position of the original load instruction. (FIG. 6B) Thus, the instruction placement processing is completed.

【0062】プロセッサ4により、上記の命令を実行す
るときは、エイリアスチェック命令の実行により、|r1
-r2 |の値が1より小さければ、ccフラグのzフラグを
オンとする。大きければオフとする。(図6b ) アドレス〔r2〕から4バイトをレジスタr3にロードし、
レジスタr0をアドレス〔r1〕から4バイトにストアす
る。(図6b ) チェックムーブ命令になると、zフラグがオンの場合に
のみ、レジスタr0の内容をレジスタr3ヘ転送する。(図
6b ) zフラグがオフの場合は、何もせずに次の命令に進む。
When the above instruction is executed by the processor 4, | r1 is executed by executing the alias check instruction.
If the value of -r2 | is smaller than 1, the z flag of the cc flag is turned on. Turn off if larger. (Fig. 6b) 4 bytes from address [r2] are loaded into register r3,
The register r0 is stored in 4 bytes from the address [r1]. (FIG. 6B) When a check move instruction is issued, the contents of the register r0 are transferred to the register r3 only when the z flag is ON. (FIG. 6b) If the z flag is off, proceed to the next instruction without doing anything.

【0063】このように、コンパイラ1がエイリアスチ
ェック命令を条件付ムーブ命令とペアで、生成すること
で、プロセッサが命令の実行を高速化できる。
As described above, since the compiler 1 generates an alias check instruction in a pair with a conditional move instruction, the processor can execute the instruction faster.

【0064】[0064]

【発明の効果】本方式により、ロード命令のキャッシュ
ミスヒットなどによるメモリアクセス遅延の影響を小さ
くすることができる。
According to the present invention, the effect of memory access delay due to a cache miss of a load instruction can be reduced.

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

【図1】 実施例のコンパイラの構成図FIG. 1 is a configuration diagram of a compiler according to an embodiment;

【図2】 実施例の命令最適化部Bの流れ図FIG. 2 is a flowchart of an instruction optimization unit B of the embodiment.

【図3】 実施例のエイリアスチェック命令生成処理
の流れ図
FIG. 3 is a flowchart of an alias check instruction generation process according to the embodiment;

【図4】 実施例1のエイリアスチェック命令生成時
の命令列
FIG. 4 is an instruction sequence when an alias check instruction is generated according to the first embodiment.

【図5】 実施例1のアドレスサイズの説明図FIG. 5 is an explanatory diagram of an address size according to the first embodiment;

【図6】 実施例2のエイリアスチェック命令生成時
の命令列
FIG. 6 shows an instruction sequence when an alias check instruction is generated according to the second embodiment.

【図7】 従来例のコンパイラの構成図FIG. 7 is a configuration diagram of a conventional compiler.

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

1 コンパイラ 2 ソースプログラム 3 目的プログラム 4 プロセッサ 11 命令解析部 12 命令最適化部 13 命令変換部 DESCRIPTION OF SYMBOLS 1 Compiler 2 Source program 3 Objective program 4 Processor 11 Instruction analysis part 12 Instruction optimization part 13 Instruction conversion part

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 ソースプログラムから中間コードを生成
する命令解析部と生成した中間コードの余分な命令の削
除等を行う命令最適化部と実行可能な目的プログラムに
変換する命令変換部とを備えたコンパイラであって、 命令最適化部は、命令解析部で生成した中間コードの中
からストア命令、ロード命令の組を抽出するストア・ロ
ード命令抽出手段と、 抽出したロード命令とストア命令のオペランドアドレス
間の重なりを実行時に検出するためのエイリアスチェッ
ク命令を生成するエイリアスチェック命令生成手段と、 エイリアスチェック命令、ロード命令、ストア命令の順
に命令列を再配置し、 エイリアスチェック命令実行時に、オペランドアドレス
間の重なりが検出されたときにはロード命令実行の補正
を行い、重なりが検出されなかったときには何も実行し
ない条件付命令をロード命令の元の位置に配置する命令
配置手段とを有することを特徴とするコンパイラ。
An instruction analyzing unit for generating an intermediate code from a source program, an instruction optimizing unit for deleting extra instructions of the generated intermediate code, and an instruction converting unit for converting the generated intermediate code into an executable target program. A compiler, wherein the instruction optimizing unit is a store / load instruction extracting unit for extracting a set of a store instruction and a load instruction from the intermediate code generated by the instruction analysis unit; and an operand address of the extracted load instruction and the store instruction. An alias check instruction generating means for generating an alias check instruction for detecting overlap between executions, and an instruction sequence rearranged in the order of an alias check instruction, a load instruction, and a store instruction. When an overlap is detected, the load instruction execution is corrected, and no overlap is detected. Compiler characterized in that it comprises an instruction arrangement means for arranging the original position of the load instruction instruction conditional do not do anything when the Tsu.
【請求項2】エイリアスチェック命令は、 ストア命令のオペランドアドレスを設定する第1入力値
と、 ロード命令のオペランドアドレスを設定する第2入力値
と、 少なくとも1つ以上のロード命令のアドレスサイズの合
計値と、少なくとも1つ以上のストア命令のアドレスサ
イズの合計値とを比較して等しいかまたは大きい方のア
ドレスサイズの合計値を設定する第3入力値とを有し、 第1入力値と第2入力値との差の絶対値を計算し、計算
した結果が第3入力値より小さいときはロード命令のオ
ペランドアドレスとストア命令のオペランドアドレスと
が重なっていることを示すチェック情報をオンにするこ
とを特徴とする請求項1記載のコンパイラ。
The alias check instruction is a sum of a first input value for setting an operand address of a store instruction, a second input value for setting an operand address of a load instruction, and an address size of at least one load instruction. And a third input value for comparing the sum of the address sizes of at least one or more store instructions to set a sum value of the equal or larger address size, the first input value and the third input value. The absolute value of the difference between the two input values is calculated, and if the calculated result is smaller than the third input value, check information indicating that the operand address of the load instruction and the operand address of the store instruction overlap is turned on. 2. The compiler according to claim 1, wherein:
【請求項3】1つのロード命令のデータサイズと、1つ
のストア命令のデータサイズとを比較して等しいとき
は、1をエイリアスチェック命令の第3入力値として設
定し、等しくないときは、大きい方のデータサイズの値
を第3入力値として設定することを特徴とする請求項2
記載のコンパイラ。
3. When the data size of one load instruction is equal to the data size of one store instruction, 1 is set as the third input value of the alias check instruction. The value of the data size is set as a third input value.
The listed compiler.
【請求項4】コンパイラにより生成された目的プログラ
ムを実行するプロセッサであって、 請求項1記載のコンパイラによって生成されたエイリア
スチェック命令を有することを特徴とするプロセッサ。
4. A processor for executing a target program generated by a compiler, the processor having an alias check instruction generated by the compiler according to claim 1.
JP24226299A 1999-08-27 1999-08-27 Compiler device and processor Expired - Fee Related JP3608446B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP24226299A JP3608446B2 (en) 1999-08-27 1999-08-27 Compiler device and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP24226299A JP3608446B2 (en) 1999-08-27 1999-08-27 Compiler device and processor

Publications (2)

Publication Number Publication Date
JP2001067234A true JP2001067234A (en) 2001-03-16
JP3608446B2 JP3608446B2 (en) 2005-01-12

Family

ID=17086659

Family Applications (1)

Application Number Title Priority Date Filing Date
JP24226299A Expired - Fee Related JP3608446B2 (en) 1999-08-27 1999-08-27 Compiler device and processor

Country Status (1)

Country Link
JP (1) JP3608446B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1306399C (en) * 2002-12-10 2007-03-21 英特尔公司 Virtual machine for network processor
JP2018156568A (en) * 2017-03-21 2018-10-04 株式会社東芝 Compilation device
JP2023508984A (en) * 2019-12-24 2023-03-06 アドバンスト・マイクロ・ディバイシズ・インコーポレイテッド Optimization of runtime alias checking

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1306399C (en) * 2002-12-10 2007-03-21 英特尔公司 Virtual machine for network processor
JP2018156568A (en) * 2017-03-21 2018-10-04 株式会社東芝 Compilation device
JP2023508984A (en) * 2019-12-24 2023-03-06 アドバンスト・マイクロ・ディバイシズ・インコーポレイテッド Optimization of runtime alias checking
JP7727636B2 (en) 2019-12-24 2025-08-21 アドバンスト・マイクロ・ディバイシズ・インコーポレイテッド Runtime alias checking optimization

Also Published As

Publication number Publication date
JP3608446B2 (en) 2005-01-12

Similar Documents

Publication Publication Date Title
US7458069B2 (en) System and method for fusing instructions
US10268454B2 (en) Methods and apparatus to eliminate partial-redundant vector loads
US20020144101A1 (en) Caching DAG traces
TW201719389A (en) Handling exceptions for vector arithmetic instructions
JPH08292886A (en) Method and apparatus for implementing a non-faulting load instruction
JP3130446B2 (en) Program conversion device and processor
CN1194302C (en) Extended instruction word folding equipment
WO2021036173A1 (en) Method and apparatus for explaining and executing bytecode instruction stream
JP2006313422A (en) Calculation processing device and method for executing data transfer processing
US5854928A (en) Use of run-time code generation to create speculation recovery code in a computer system
US9182960B2 (en) Loop distribution detection program and loop distribution detection method
JP4137735B2 (en) Method and system for controlling immediate delay of control speculative load using dynamic delay calculation information
JP2007531164A (en) Method and structure for explicit software control of data speculation
JP3608446B2 (en) Compiler device and processor
CN119473394A (en) A method for optimizing AVX instruction simulation execution based on loop dependency analysis
JP3599499B2 (en) Central processing unit
JP2011501286A (en) Java byte code conversion method
US20090070569A1 (en) Branch prediction device,branch prediction method, and microprocessor
JP5068552B2 (en) Prefetch method and cache mechanism unit
JPH07168719A (en) Redundant removal device
JP3739556B2 (en) Information processing device
CN109710310B (en) Data processing method, system, terminal and storage medium for embedded environment
JP5679263B2 (en) Information processing apparatus and microinstruction processing method
JP2629479B2 (en) Information processing device
JP2024030940A (en) Source code conversion program and source code conversion method

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040614

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040629

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040812

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040921

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20041004

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20071022

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20081022

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20081022

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091022

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20091022

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20101022

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20101022

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20111022

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20111022

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20121022

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20121022

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20131022

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees