JPH0322031A - Optimizing processing system for branch instruction - Google Patents

Optimizing processing system for branch instruction

Info

Publication number
JPH0322031A
JPH0322031A JP15762589A JP15762589A JPH0322031A JP H0322031 A JPH0322031 A JP H0322031A JP 15762589 A JP15762589 A JP 15762589A JP 15762589 A JP15762589 A JP 15762589A JP H0322031 A JPH0322031 A JP H0322031A
Authority
JP
Japan
Prior art keywords
branch instruction
branch
optimized
instruction
optimizing
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
Application number
JP15762589A
Other languages
Japanese (ja)
Inventor
Mitsuko Okumura
奥村 晃子
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP15762589A priority Critical patent/JPH0322031A/en
Publication of JPH0322031A publication Critical patent/JPH0322031A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To shorten the processing time by holding an optimizing branch instruction, the relative address of the branch destination, optimizing branch instruction between this optimizing branch instruction and its branch destination, optimizing branch instructions interposed between other optimizing branch instructions and their destinations, and their branch destinations and temporary addressed to determine and optimum branch instruction. CONSTITUTION:A central processing unit 1, an optimizing branch instruction table part 2, an optimizing branch instruction relation table part 3, a symbol table part 4, and a source program file 5 are provided to constitute a system. An optimizing branch instruction, the relative address of its branch destination and optimizing branch instructions existing between this optimizing branch instruction and its branch destination are recognized and held, and optimizing branch instructions interposed between other optimizing branch instructions and their branch destinations, branch destinations, and temporary addresses are held to determine an optimum branch instruction. Thus, the optimizing processing of a branch instruction is quickly performed only with the table operation without increasing the number of busses.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は分岐命令の最適化処理方式に関し、特に翻訳プ
ログラムにおける分岐命令の最適化処理方式に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a branch instruction optimization processing method, and particularly to a branch instruction optimization processing method in a translation program.

〔従来の技術〕[Conventional technology]

分岐命令とその分岐命令の分岐先の相対アドレスによっ
てコード長が異なる分岐命令を有するマイクロプロセッ
サをターゲットとする翻訳プログラムの中には、コード
長の短い分岐命令による分岐が可能な場合に、自動的に
コード長の短い分岐命令を選択(以降、この選択処理を
分岐命令の最適化処理と称する)する機能を有する翻訳
プログラムがある。
Some translation programs that target microprocessors that have branch instructions with different code lengths depending on the branch instruction and the relative address of the branch destination of that branch instruction automatically There is a translation program that has a function of selecting a branch instruction with a short code length (hereinafter, this selection process will be referred to as branch instruction optimization processing).

分岐命令の最適化処理は、最適な分岐命令に置き換える
為の命令(以降、この命令を最適化分岐命令と称する〉
を、仮に最も長い(または短い)コード長の分岐命令と
して分岐命令とその分岐先の相対アドレスを計算し、そ
の相対アドレスが仮に決定した分岐命令よりも短いコー
ド長の分岐命令で分岐可能な値だった場合(またはその
相対アドレスが仮に決定した分岐命令で分岐不可能だっ
た場合)には、より短い(または長い)コード長の分岐
命令に置き換えることにより行う。
Optimization processing of branch instructions involves replacing them with an optimal branch instruction (hereinafter, this instruction is referred to as an optimized branch instruction).
Assuming that the branch instruction has the longest (or shortest) code length, calculate the relative address of the branch instruction and its branch destination, and then calculate the value that allows the relative address to branch with a branch instruction with a shorter code length than the branch instruction that has been temporarily determined. (or if the relative address cannot be branched with the temporarily determined branch instruction), this is done by replacing it with a branch instruction with a shorter (or longer) code length.

コード長の異なる分岐命令に置き換えると相対アドレス
が変化してしまい、他の最適化分岐命令における最適な
分岐命令が変わってしまう可能性がある。
If a branch instruction with a different code length is substituted, the relative address will change, and the optimal branch instruction among other optimized branch instructions may change.

これを解決する為に、従来は、ソース・プログラムの先
頭から最後まで仮のアドレスを与え、この仮アドレスに
よって、ソース・プログラムの先頭の最適化分岐命令か
ら、分岐命令とその分岐先の相対アドレスを順に計算し
、仮に決定したコード長と異なる分岐命令に最適化分岐
命令を置き換えた場合には以降の仮アドレスを変更して
次の最適化分岐命令とその分岐先の相対アドレスを計算
する、という手順で、ソース・プログラムの最後の分岐
命令までを最適化する。
In order to solve this problem, conventionally, a temporary address is given from the beginning to the end of the source program, and this temporary address is used to calculate the relative address of the branch instruction and its branch destination from the optimized branch instruction at the beginning of the source program. are calculated in order, and if the optimized branch instruction is replaced with a branch instruction that differs from the temporarily determined code length, the subsequent temporary addresses are changed and the relative address of the next optimized branch instruction and its branch destination is calculated. This procedure optimizes the source program up to the last branch instruction.

この方法では、コード長の異なる分岐命令に置き換えた
ことにより、既に相対アドレスを計算した分岐命令とそ
の分岐先の相対アドレスが変化する可能性がある。この
為、一度ソース・プログラムの最後まで最適化しても、
さらにソース・プログラムの先頭の最適化分岐命令から
最適な分岐命令を選択する為に同様の処理を行い、すべ
ての分岐命令がそれ以上最適化できなくなるまで、バス
(ソース・プログラム・ファイルまたはソース・ブグラ
ムを圧縮した作業用のファイルを最初から最後まで入力
し、処理すること〉を繰り返す必要があった。
In this method, by replacing the branch instruction with a branch instruction having a different code length, there is a possibility that the relative address of the branch instruction whose relative address has already been calculated and the branch destination thereof will change. For this reason, even if you optimize the source program to the end,
Furthermore, similar processing is performed to select the optimal branch instruction from the optimized branch instructions at the beginning of the source program, and the process is continued until all branch instructions can no longer be optimized. It was necessary to repeatedly input and process a compressed program file from beginning to end.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

上述したように従来の翻訳プログラムでは、最適化のた
めに多くのパスを必要とし、特に最適化分岐命令が多様
されたソース・プログラムの処理には、アセンブル林了
までに長い時間を要するという欠点があった。
As mentioned above, conventional translation programs require many passes for optimization, and the disadvantage is that it takes a long time to assemble, especially when processing a source program with a variety of optimization branch instructions. was there.

〔課題を解決する為の手段〕[Means to solve problems]

本発明の分岐命令の最適化処理方式は、最適化分岐命令
とその分岐先の相対アドレスを認識、保持する手段と、
最適化分岐命令とその分岐先の間に存在する最適化分岐
命令を認識、保持する手段と、最適化分岐命令を挟んで
他の最適化分岐命令とその分岐先が存在する最適化分岐
命令を保持する手段と、分岐先とその仮アドレスを保持
する手段を備え、最適な分岐命令を決定する構戊を有し
ている。
The branch instruction optimization processing method of the present invention includes means for recognizing and retaining an optimized branch instruction and the relative address of its branch destination;
A means for recognizing and retaining an optimized branch instruction that exists between an optimized branch instruction and its branch destination, and a means for recognizing and retaining an optimized branch instruction that exists between an optimized branch instruction and its branch destination. It has a structure for determining an optimal branch instruction, and includes means for holding a branch destination and its temporary address.

〔実施例〕〔Example〕

次に、本発明の実施例について図面を参照して説明する
Next, embodiments of the present invention will be described with reference to the drawings.

第1図(a)、(b)はそれぞれ本発明の第lの実施例
のハードウエアのブロック図及び動作を説明するための
フローチャートである。
FIGS. 1(a) and 1(b) are a block diagram of hardware and a flowchart for explaining the operation of the first embodiment of the present invention, respectively.

この実施例のハードウエアは、中央処理装置1と、最適
化分岐命令テーブル部2と、最適化分岐命令関係テーブ
ル部3と、シンボル・テーブル部4、5はソース・プロ
グラム・ファイルとを備えて構戊される。
The hardware of this embodiment includes a central processing unit 1, an optimized branch instruction table section 2, an optimized branch instruction relationship table section 3, and symbol table sections 4 and 5 containing source program files. be confused.

この実施例に適用されるソース・プログラムの例を第1
表に示す。
The first example of the source program applied to this embodiment is
Shown in the table.

以下余白 第1表 このソース・プログラムでは、最適化分岐命令はBR,
分岐命令はBRSSBRLの2種類で、BRSでは相対
アドレス4まで、BRLではすべてのアドレスに分岐で
き、BRSはコード長1、BRLはコード長3としてい
る。分岐命令のほかに、領域を確保する命令DSがあり
、“DS  3”はコード長3の領域を確保するものと
する。
Table 1 in the margin below In this source program, the optimized branch instructions are BR,
There are two types of branch instructions: BRSSBRL. BRS allows branching to up to a relative address of 4, and BRL allows branching to all addresses. BRS has a code length of 1, and BRL has a code length of 3. In addition to branch instructions, there is an instruction DS that secures an area, and "DS 3" secures an area with a code length of 3.

このソース・プログラムを用いて、この実施例の動作及
び構或について説明する。
The operation and structure of this embodiment will be explained using this source program.

フローF1 :まずソース・プログラム全体に仮アドレ
スを与える。最適化分岐命令は、最もコード長の短い分
岐命令と同じコード長であるとして、仮アドレスを計算
する。この際、シンボルとその仮アドレスを第2図(a
)のシンボル・テーブル部4のl4と15に、最適化分
岐命令のアイデントとその仮アドレス、その分岐先を第
3図(a)の最適化分岐命令テーブル部2の6と7、8
に格納する。
Flow F1: First, a temporary address is given to the entire source program. The temporary address is calculated on the assumption that the optimized branch instruction has the same code length as the branch instruction with the shortest code length. At this time, the symbol and its temporary address are shown in Figure 2 (a
), the ident of the optimized branch instruction, its temporary address, and its branch destination are stored in l4 and 15 of the symbol table section 4 of FIG.
Store in.

第3図(a)、(b)において、6はソース・プログラ
ム中の最適化分岐命令を一意に示すアイデントであり、
7は最適化分岐命令の仮のアドレス、8は分岐先、9は
最適化分岐命令と分岐先の相対アドレス、10は最適化
分岐命令を置き換える最適な分岐命令、11は6の最適
化分岐命令とその分岐先の間にある最適化分岐命令(以
降、間最適化分岐命令と称する)のアイデントの例を示
す。最適化分岐命令のアイデントとして、ここではソー
ス・プログラム中の登場順に″1”から採番するものと
する。第1表の例では、最適化分岐命令はBRSと同じ
コード長“1”として仮アドレスを与え、“L1”を第
2図(a)の14に、仮アドレス“0”を15に、“B
R  L2”のアイデントを“1”として第3図(a)
の6に、仮アドレス“5″を第3図(a)の7に、分岐
先“L2″を第3図の8に格納する。“BR  L3”
以下も、同様に第2図の14、15、第3図(a)の6
、7、8に格納する。
In FIGS. 3(a) and (b), 6 is an identifier that uniquely indicates an optimized branch instruction in the source program,
7 is the temporary address of the optimized branch instruction, 8 is the branch destination, 9 is the relative address of the optimized branch instruction and the branch destination, 10 is the optimal branch instruction to replace the optimized branch instruction, 11 is the optimized branch instruction of 6 An example of an ident of an optimized branch instruction (hereinafter referred to as an inter-optimized branch instruction) located between and its branch destination is shown. The identifiers of optimized branch instructions are numbered starting from "1" in the order in which they appear in the source program. In the example in Table 1, the optimized branch instruction gives a tentative address with the same code length as BRS, "1", "L1" to 14 in FIG. 2(a), tentative address "0" to 15, " B
Figure 3 (a) with the ident of “R L2” set to “1”.
6, the temporary address "5" is stored in 7 in FIG. 3(a), and the branch destination "L2" is stored in 8 in FIG. “BR L3”
Similarly, 14 and 15 in Figure 2 and 6 in Figure 3 (a) are shown below.
, 7, 8.

フロ一F2 :次に、第3図(a)の最適化分岐命令テ
ーブル部2に格納されている最適化分岐命令に関し、最
適化分岐命令の仮アドレス7とその分岐先の仮アドレス
15の間の仮アドレスを持つ最適化分岐命令を第3図(
a)の最適化分岐命令テーブル部2から検出し、間最適
化分岐命令として11に格納し、第4図の最適化分岐命
令関係テーブル部3の12に間最適化分岐命令を、挟最
適化分岐命令13に第3図(a)6の最適化分岐命令を
格納する。
Flow F2: Next, regarding the optimized branch instruction stored in the optimized branch instruction table section 2 in FIG. Figure 3 shows an optimized branch instruction with a temporary address of
It is detected from the optimized branch instruction table section 2 in a) and stored in 11 as an inter-optimized branch instruction, and the inter-optimized branch instruction is stored in 12 of the optimized branch instruction relation table section 3 in FIG. 4 as an inter-optimized branch instruction. The optimized branch instruction 6 in FIG. 3(a) is stored in the branch instruction 13.

第4図において、l2は間最適化分岐命令を、13はそ
の間最適化分岐命令を挟んで最適化分岐命令とその分岐
先が存在する最適化分岐命令(以降、挟最適化分岐命令
と称する)の例を示す。このとき、12に既に同じ間最
適化分岐命令がある場合は、12には格納せず、同じ間
最適化分岐命令の13に6の最適化分岐命令を格納する
。第1表の例では、第3図(a)の6、分岐命令“1”
の仮アドレス“5”と分岐先“L2”の仮アドレス“9
”の間のアドレス(5〈仮アドレスく9)を第3図の仮
アドレス7から検出する。仮アドレス“6″を持つ最適
化分岐命令“2”と、仮アドレス“7”を持つ最適化分
岐命令“3″が検出できるので、第4図の間最適化分岐
命令12として最適化分岐命令“2”と“3”、及び挟
最適化分岐命令13として最適化分岐命令“1″を、そ
れぞれ格納する。同様に、第3図(a)の6、分岐命令
“2”の仮アドレス“6″と分岐先“L2”の仮アドレ
ス“8”の間の仮アドレス(6〈仮アドレスく8〉を仮
アドレス“7″から検出する。
In FIG. 4, l2 is an optimized branch instruction, and 13 is an optimized branch instruction in which an optimized branch instruction and its branch destination exist with the optimized branch instruction in between (hereinafter referred to as a narrow optimized branch instruction). Here is an example. At this time, if there is already a same-duration optimized branch instruction in 12, the optimized branch instruction of 6 is not stored in 12, but is stored in 13 of the same-duration optimized branch instruction. In the example in Table 1, 6 in FIG. 3(a), branch instruction "1"
The temporary address “5” of the branch destination “L2” and the temporary address “9” of the branch destination “L2”
” is detected from the temporary address 7 in FIG. 3. Optimized branch instruction “2” with temporary address “6” and optimized branch instruction “2” with temporary address “7” Since the branch instruction "3" can be detected, the optimized branch instructions "2" and "3" as the optimized branch instruction 12 and the optimized branch instruction "1" as the narrowly optimized branch instruction 13 in FIG. Similarly, the temporary address 6 in FIG. 8> is detected from the temporary address "7".

仮アドレス“7”を持つ最適化分岐命令“3”が検出で
きるので、第4図の間最適化分岐命令12として既に格
納されている最適化分岐命令“3″の挟最適化分岐命令
13として、最適化分岐命令“2″を格納する。
Since the optimized branch instruction "3" with the temporary address "7" can be detected, the optimized branch instruction "3" which is already stored as the optimized branch instruction 12 in FIG. , stores the optimized branch instruction "2".

フロ−F,:最適化分岐命令と分岐先との相対アドレス
を計算し、第3図(a〉 9に格納する。
Flow-F: Calculates the relative address between the optimized branch instruction and the branch destination and stores it in FIG. 3(a>9).

第1表の例において最適化分岐命令“1”は仮アドレス
が#5”、分岐先“L2”の仮アドレスが“9”だから
、相対アドレス9は“4”となる。
In the example in Table 1, the temporary address of the optimized branch instruction "1" is #5" and the temporary address of the branch destination "L2" is "9", so the relative address 9 is "4".

フローF4:次に最適化分岐命令(仮に最適化分岐命令
Aと称する)とその分岐先の相対アドレス9から最適な
分岐命令を選択し、1oに格納する。第1表の例では、
最適化分岐命令“l”“2″共に相対アドレスが“4”
以下なノテ、コード長の短い分岐命令BRSが選択でき
、最適化分岐命令“3”は相対アドレスが“7”なので
、コード長の長い分岐命令BRLが選択できる。
Flow F4: Next, the optimum branch instruction is selected from the optimized branch instruction (temporarily referred to as optimized branch instruction A) and the relative address 9 of its branch destination, and is stored in 1o. In the example in Table 1,
The relative address of both optimized branch instructions “l” and “2” is “4”
The following note: Since the branch instruction BRS with a short code length can be selected, and the relative address of the optimized branch instruction "3" is "7", the branch instruction BRL with a long code length can be selected.

(第3図(a)の状B)。(Shape B in Figure 3(a)).

フロ一Fs:このとき、最適化分岐命令Aについて仮定
していた最適化分岐命令のコード長と選択した分岐命令
1oのコード長が異なれば、最適化分岐命令八と同じ最
適化分岐命令が第4図のl2にあれば、最適化分岐命令
Aの挾最適化分岐命令13と同じ最適化分岐命令(仮に
最適化分岐命令Bと称する)について、第3図(a)の
最適化分岐命令と分岐先の相対アドレス9に、仮に決定
していた最適化分岐命令Aのコード長とIOのコード長
の差分を増減する。最適化分岐命令のコード長を分岐命
令の最短コード長である“ビと仮定していたので、第1
表の例では、最適化分岐命令“1”, “2″は仮定し
ていたコード長と選択した分岐命令BRSのコード長が
同じだが、最適化分岐命令“3”は仮定していたコード
長と選択した分岐命令BRLのコード長が異なるので、
第4図の間最適化分岐命令“3”の挟最適化分岐命令“
l“2”について、第3図(a)の最適化分岐命令と分
岐先の相対アドレス9に、仮定していたコード長“l”
と選択した分岐命令BRLのコード長“3”の差分“2
″を加算する。従って、最適化分岐命令“1”.“2”
の相対アドレスはそれぞれ“4“から“6”と“2”か
ら“4”に変更になる。
Flow 1 Fs: At this time, if the code length of the optimized branch instruction assumed for optimized branch instruction A and the code length of the selected branch instruction 1o are different, the same optimized branch instruction as optimized branch instruction 8 is 4, the optimized branch instruction (temporarily referred to as optimized branch instruction B), which is the same as the optimized branch instruction 13 of optimized branch instruction A, is the same as the optimized branch instruction in FIG. 3(a). The difference between the temporarily determined code length of the optimized branch instruction A and the code length of the IO is increased or decreased in the relative address 9 of the branch destination. Since the code length of the optimized branch instruction was assumed to be ``bi'', which is the shortest code length of the branch instruction, the first
In the example in the table, the assumed code length of optimized branch instructions “1” and “2” is the same as the code length of the selected branch instruction BRS, but the optimized branch instruction “3” has the assumed code length. Since the code length of the selected branch instruction BRL is different,
Figure 4 Optimized branch instruction “3” between optimized branch instructions
Regarding l "2", the assumed code length "l" is specified in the optimized branch instruction and the relative address 9 of the branch destination in Figure 3 (a).
The difference between the code length “3” and the selected branch instruction BRL is “2”.
” is added. Therefore, the optimized branch instruction “1”. “2”
The relative addresses of are changed from "4" to "6" and from "2" to "4", respectively.

フローF6 :最適化分岐命令Bが最適な分岐命令を選
択済みであれば、Bの最適な分岐命令を変更する必要が
あるか否かを判定する。即ち、差分を増減したBの相対
アドレス9に最適な分岐命令が、第3図(a)の最適化
分岐命令Bの選択した分岐命令lOにならなければ、最
適化分岐命令Bの最適な分岐命令を再検討する。最適化
分岐命令1、2はそれぞれ最適な分岐命令を選択済みで
あるから、最適な分岐命令を変更する必要があるか否か
を判定する。最適化分岐命令“l”の相対アドレスは#
6”になったので、選択したBRSでは分岐が不可能に
なった為、最適化分岐命令“1”についてはフロ一F4
から再処理する。最適化分岐命令“2′″の相対アドレ
スは“4″になったが、選択したBRSで分岐が可能な
為、再処理はしない。
Flow F6: If the optimal branch instruction for optimized branch instruction B has been selected, it is determined whether the optimal branch instruction for B needs to be changed. That is, if the optimal branch instruction for the relative address 9 of B whose difference has been increased or decreased is not the branch instruction lO selected by the optimized branch instruction B in FIG. 3(a), the optimal branch of the optimized branch instruction B is Reconsider the order. Since the optimal branch instructions for the optimized branch instructions 1 and 2 have already been selected, it is determined whether the optimal branch instructions need to be changed. The relative address of optimized branch instruction “l” is #
6", branching is no longer possible with the selected BRS, so for the optimized branch instruction "1", flow F4 is executed.
reprocess from The relative address of the optimized branch instruction "2'" has become "4", but since branching is possible with the selected BRS, no reprocessing is performed.

第3図(a)のテーブルのすべての最適化分岐命令6に
対し、上述のフローF4、F5、F6の処理を終了した
ら(第3図(b)の状態)、決定した分岐命令10に従
ってソース・プログラムの先頭から実際のアドレスを決
定し、最適化処理を終了する。
After completing the processing of the above-mentioned flows F4, F5, and F6 for all the optimized branch instructions 6 in the table in FIG. 3(a) (state in FIG. 3(b)), source・Determine the actual address from the beginning of the program and end the optimization process.

第5図は本発明の第2の実施例のフローチャートである
FIG. 5 is a flowchart of a second embodiment of the present invention.

7口一F,、F2の処理は、第1の実施例の処理と同じ
である。
The processing of 7 mouths F, , F2 is the same as the processing of the first embodiment.

フロ一F3 二次に、最適化分岐命令(仮に最適化分岐
命令八と称する)の仮アドレス7とその分岐先8の仮ア
ドレス15から最適な分岐命令を選択し、10に格納す
る。第1表の例では、最適化分岐命令“1”の仮アドレ
ス“5”と分岐先“L2′の仮アドレス“9”から、相
対アドレスは“4”なのでBRSを選択する。最適化分
岐命令“2”についても同様に、BRSを選択する。最
適化分岐命令“3”は仮アドレスが“7″、分岐先“L
ビの仮アドレスが“0”の為、相対アドレスは“7”と
なり、コード長の長い分岐命令BRLを選択する(第6
図(a)及び第2図(a)の状!I4)。
Flow F3 Second, the optimum branch instruction is selected from the temporary address 7 of the optimized branch instruction (temporarily referred to as optimized branch instruction 8) and the temporary address 15 of its branch destination 8, and stored in 10. In the example in Table 1, the relative address is "4" from the temporary address "5" of the optimized branch instruction "1" and the temporary address "9" of the branch destination "L2'", so BRS is selected.Optimized branch instruction Similarly, BRS is selected for "2".The optimized branch instruction "3" has a temporary address "7" and a branch destination "L".
Since the temporary address of B is “0”, the relative address is “7”, and the branch instruction BRL with the long code length is selected (6th
The state shown in Figure (a) and Figure 2 (a)! I4).

フローF4 :このとき、最適化分岐命令八について仮
定していた最適化分岐命令のコード長と選択した分岐命
令10のコード長が異なれば、最適化分岐命令Aの仮ア
ドレス7より大きい、第6図のすべての最適化分岐命令
の仮アドレス7と第2図のすべてのシンボルの仮アドレ
ス15について、仮に決定していた最適化分岐命令八の
コード長と選択した分岐命令10のコード長の差分を増
滅する。最適化分岐命令のコード長を分岐命令の最短コ
ード長である“1″と仮定していたので、第1表の例で
は、最適化分岐命令“1”,“2″は仮定していたコー
ド長と選択した分岐命令BRSのコード長が同じだが、
最適化分岐命令“3”は仮定していたコード長と選択し
た分岐命令BRLのコード長が異なるので、最適化分岐
命令“3”の仮アドレス“7”以降の仮アドレスをすべ
て変更する。即ち、第2図のシンボルL3,L2の仮ア
゜ドレスはそれぞれ“8”が“10”に、“9″が“1
1”に変更になる。
Flow F4: At this time, if the code length of the optimized branch instruction assumed for optimized branch instruction 8 and the code length of the selected branch instruction 10 are different, the 6th temporary address larger than the temporary address 7 of optimized branch instruction A is Regarding the temporary addresses 7 of all the optimized branch instructions in the figure and the temporary addresses 15 of all the symbols in FIG. 2, the difference between the code length of the temporarily determined optimized branch instruction 8 and the code length of the selected branch instruction 10. increase or decrease. Since the code length of the optimized branch instruction was assumed to be "1", which is the shortest code length of the branch instruction, in the example in Table 1, the code length of the optimized branch instructions "1" and "2" are the assumed codes. The length and the code length of the selected branch instruction BRS are the same, but
Since the assumed code length of the optimized branch instruction "3" differs from the code length of the selected branch instruction BRL, all tentative addresses after the tentative address "7" of the optimized branch instruction "3" are changed. That is, the temporary addresses of symbols L3 and L2 in FIG. 2 are "8" changed to "10" and "9" changed to "1", respectively.
It will be changed to 1”.

フローF,:最適化分岐命令Aと同じ最適化分岐命令が
第4図のl2にあれば、最適化分岐命令Aの挟最適化分
岐命令13と同じ最適化分岐命令(仮に最適化分岐命令
Bを称する)が最適な分岐命令を選択済みであるかどう
かを判定し、選択済みであれば、最適化分岐命令Bの最
適な分岐命令を変更する必要があるか否かを判定する。
Flow F: If the same optimized branch instruction as optimized branch instruction A is at l2 in FIG. ) has already selected the optimal branch instruction, and if so, determines whether it is necessary to change the optimal branch instruction of the optimized branch instruction B.

即ち、差分を増減したBの仮アドレス7と分岐先の仮ア
ドレス15に最適な分岐命令が、第6図の最適化分岐命
令Bの選択済の分岐命令10にならなければ、最適化分
岐命令Bの最適な分岐命令を再検討する。第4図から最
適化分岐命令“3”の挟最適化分岐命令は最適化分岐命
令“12,“2”である。最適化分岐命令“l”,“2
″はそれぞれ最適な分岐命令を選択済みであるから、最
適な分岐命令を変更する必要があるか否かを判定する。
In other words, if the optimal branch instruction for the temporary address 7 of B whose difference has been increased or decreased and the branch destination temporary address 15 does not become the selected branch instruction 10 of the optimized branch instruction B in FIG. Reconsider B's optimal branch instruction. From FIG. 4, the optimization branch instructions narrower to the optimization branch instruction “3” are the optimization branch instructions “12,” “2”. The optimization branch instructions “l”, “2”
Since the optimal branch instructions have already been selected for each of ``, it is determined whether it is necessary to change the optimal branch instructions.

最適化分岐命令1の仮アドレスは“5″で変更ないが、
最適化分岐命令“l”の分岐先L2の仮アドレスは“l
1″になったので、相対アドレスは“6”となり、選択
したBRSでは分岐が不可能になった為、最適化分岐命
令“1″についてはフローF,から再処理する。最適化
分岐命令“2”の仮アドレスは“6”で変更なく、分岐
先L3の仮アドレスは“10″になったが、相対アドレ
スは“4”で選択したBRSで分岐が可能な為、再処理
はしない。
The temporary address of optimized branch instruction 1 remains unchanged at "5", but
The temporary address of the branch destination L2 of the optimized branch instruction “l” is “l”
1", the relative address becomes "6" and branching is no longer possible with the selected BRS, so the optimized branch instruction "1" is reprocessed from flow F. Optimized branch instruction " The temporary address of ``2'' remains unchanged at ``6'', and the temporary address of branch destination L3 is now ``10'', but the relative address is ``4'' and branching is possible with the selected BRS, so no reprocessing is performed.

第6図(a)のテーブルのすべての最適化分岐命令6に
対し、上述のフローF3 、F4 、Fsの処理を終了
したら(第6図(b)及び第2図(b)の状態)、最適
化処理を終了する。
After completing the processing of the above-mentioned flows F3, F4, and Fs for all the optimized branch instructions 6 in the table of FIG. 6(a) (states of FIG. 6(b) and FIG. 2(b)), Finish the optimization process.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明は、バスを増やさずにテーブ
ル操作のみで高速で分岐命令の最適化処理を行うことが
できる効果がある。
As explained above, the present invention has the advantage of being able to perform branch instruction optimization processing at high speed only by table manipulation without increasing the number of buses.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図(a).  (b)はそれぞれ本発明の第1の実
施例のハードウェアのブロック図及び動作を説明するた
めのフローチャート、第2図(a).(b)はそれぞれ
本発明の第1の実施例のシンボル・テーブル部の処理中
の状態及び処理終了時の状態を示すデータ配置図、第3
図(a),  (b)は本発明の第1の実施例の最適化
分岐命令テーブル部の処理中の状態及び処理終了時の状
態を示すデータ配置図、第4図は、本発明の第1の実施
例の最適化分岐命令関係テーブル部のデータ配置図、第
5図は、本発明の第2の実施例の動作を説明するための
フローチャート、第6図(a),  (b)はそれぞれ
本発明の第2の実施例の最適化分岐命令テーブル部の処
理中の状態及び処理終了時の状態のデータ配置図である
。 ■・・・・・・中央処理装置、2・・・・・・最適化分
岐命令テーブル部、3・・・・・・最適化分岐命令関係
テーブル部、4・・・・・・シンボル・テーブル部、5
・・・・・・ソース・プログラム・ファイル、6・・・
・・・最適化分岐命令、7・・・・・・仮アドレス、8
・・・・・・分岐先、9・・・・・・相対アドレス、1
0・・・・・・選択した分岐命令、11.12・・・・
・・間最適化分岐命令、13・・・・・・最適化分岐命
令、14・・・・・・シンボル、l5・・・・・・シン
ボルの仮アドレス。 S4 a)
Figure 1(a). 2(b) is a block diagram of the hardware of the first embodiment of the present invention and a flowchart for explaining the operation, and FIG. 2(a). (b) is a data layout diagram showing the state during processing and the state at the end of processing of the symbol table section of the first embodiment of the present invention, respectively;
Figures (a) and (b) are data layout diagrams showing the state during processing and the state at the end of processing of the optimized branch instruction table section of the first embodiment of the present invention. FIG. 5 is a flowchart for explaining the operation of the second embodiment of the present invention, and FIGS. 6(a) and 6(b) are FIG. 7 is a data arrangement diagram of a state during processing and a state at the end of processing, respectively, of the optimized branch instruction table section according to the second embodiment of the present invention. ■... Central processing unit, 2... Optimized branch instruction table section, 3... Optimized branch instruction relation table section, 4... Symbol table Part, 5
...Source program file, 6...
...Optimized branch instruction, 7...Temporary address, 8
...Branch destination, 9...Relative address, 1
0...Selected branch instruction, 11.12...
... Optimized branch instruction, 13... Optimized branch instruction, 14... Symbol, l5... Temporary address of symbol. S4 a)

Claims (1)

【特許請求の範囲】[Claims] 最適化分岐命令とその分岐先の相対アドレスを認識、保
持する手段と、最適化分岐命令とその分岐先の間に存在
する最適化分岐命令を認識、保持する手段と、最適化分
岐命令を挟んで他の最適化分岐命令とその分岐先が存在
する最適化分岐命令を保持する手段と、分岐先とその仮
アドレスを保持する手段を備え、最適な分岐命令を決定
することを特徴とする分岐命令の最適化処理方式。
A means for recognizing and retaining the relative address of an optimized branch instruction and its branch destination, a means for recognizing and retaining an optimized branch instruction existing between an optimized branch instruction and its branch destination, and a means for recognizing and retaining an optimized branch instruction existing between an optimized branch instruction and its branch destination, and a means for recognizing and retaining the relative address of an optimized branch instruction and its branch destination, and A branch characterized by comprising means for holding an optimized branch instruction in which another optimized branch instruction and its branch destination exist, and means for holding the branch destination and its temporary address, and determining an optimal branch instruction. Instruction optimization processing method.
JP15762589A 1989-06-19 1989-06-19 Optimizing processing system for branch instruction Pending JPH0322031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15762589A JPH0322031A (en) 1989-06-19 1989-06-19 Optimizing processing system for branch instruction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15762589A JPH0322031A (en) 1989-06-19 1989-06-19 Optimizing processing system for branch instruction

Publications (1)

Publication Number Publication Date
JPH0322031A true JPH0322031A (en) 1991-01-30

Family

ID=15653821

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15762589A Pending JPH0322031A (en) 1989-06-19 1989-06-19 Optimizing processing system for branch instruction

Country Status (1)

Country Link
JP (1) JPH0322031A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08227363A (en) * 1995-02-21 1996-09-03 Nec Corp Method for processing branch instruction
JPH08234998A (en) * 1995-02-28 1996-09-13 Nec Corp Assembler processing method
JPH08241196A (en) * 1995-03-05 1996-09-17 Nec Corp Branch instruction processing system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08227363A (en) * 1995-02-21 1996-09-03 Nec Corp Method for processing branch instruction
JPH08234998A (en) * 1995-02-28 1996-09-13 Nec Corp Assembler processing method
JPH08241196A (en) * 1995-03-05 1996-09-17 Nec Corp Branch instruction processing system

Similar Documents

Publication Publication Date Title
JP5065337B2 (en) Computer-executable workflow resource management system
JPH05505263A (en) Routing transaction commands
JPH0322031A (en) Optimizing processing system for branch instruction
JPS5856171A (en) Resource information control method in multi-system
JPS63142431A (en) Pipeline control system
KR100289058B1 (en) Process definition and control method of workflow management system
JPH0687225B2 (en) File service request processing method and apparatus
JPH06195253A (en) File management device
JPH0863420A (en) Method for incorporating input/output control program
JPS62194542A (en) Program control system
JPH0256666A (en) System for dynamically updating job network unitary control system generating information
JPH09212398A (en) Method for updating and referring to data base
JPH036535B2 (en)
CN117032772A (en) Flow processing method, device, equipment and medium
JP2570959B2 (en) Data processing device
JPH04330526A (en) Relocatable assembler
JP2692141B2 (en) Sequence controller
JP2573926B2 (en) Verification method of file update
JP2831726B2 (en) Memory element allocation support device
JP2575945B2 (en) Space management method
JPH0314132A (en) Error processing control system
JPH09247234A (en) Communication device
JPH0348950A (en) Memory control system
JPH0676018A (en) Method and system for logic circuit design
JPS62232048A (en) Plural logical filing system for single physical file