JPH0281228A - Address determining system for branch instruction in assembler - Google Patents

Address determining system for branch instruction in assembler

Info

Publication number
JPH0281228A
JPH0281228A JP23416788A JP23416788A JPH0281228A JP H0281228 A JPH0281228 A JP H0281228A JP 23416788 A JP23416788 A JP 23416788A JP 23416788 A JP23416788 A JP 23416788A JP H0281228 A JPH0281228 A JP H0281228A
Authority
JP
Japan
Prior art keywords
text
instruction
branch instruction
downward
machine language
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
JP23416788A
Other languages
Japanese (ja)
Inventor
Goji Yamamoto
剛司 山本
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 JP23416788A priority Critical patent/JPH0281228A/en
Publication of JPH0281228A publication Critical patent/JPH0281228A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To shorten a processing time by eliminating a no-operation instruction and updating a downward branch instruction text linked with a label text which is updated together with a downward text, when a downward branch instruction outputted temporarily by a first machine language is changed to a second machine language. CONSTITUTION:An address determining part 3 sets successively a branch destination address of a branch instruction which is brought to downward branch to the label concerned, and when a downward branch instruction which is changed to a second machine language 6 from a first machine language (as for word length, a first machine language > a second machine language) exists therein, a no-operation instruction NOP is eliminated and a downward text 2 is all updated from its downward branch instruction. Subsequently, from its downward branch instruction, a label text 13 is detected successively and a branch address of the downward branch instruction is set. In such a way, since it is unnecessary to verify a text having no relation to an elimination of the no-operation instruction NOP, a machine language from which the no- operation instruction is eliminated can be outputted quickly.

Description

【発明の詳細な説明】 〔概 要〕 本発明はアセンブラにおける分岐命令のアドレス決定方
式に関し、 機械語長の大なる機械語で仮出力された下方への分岐命
令がアドレス決定時に機械語長の小なる機械語に変更さ
れたときに挿入される無動作命令を削除することを目的
とし、 プログラムを翻訳しテキストを作成するテキスト作成部
と、該テキストに基づき未決定アドレスを解決するアド
レス決定部とを備え、分岐先ラベルとのアドレス幅に応
じて機械語長の異なる第1、第2の機械語に翻訳される
分岐命令の中下方へ1分岐する下方分岐命令のテキスト
には機械語長の大なる第1の機械語を仮出力しておき、
アドレス決定時に第2の機械語に変更したとき残る領域
に無動作命令を充当するアセンブラにおける分岐命令の
アドレス決定方式において、下方分岐命令テキストとラ
ベルテキストとにそれぞれ連係情報格納領域を設けると
ともに、プログラムステップに対応じてテキストを作成
し該連係情報格納N域に連係情報を格納して同一ラベル
への下方分岐命令テキストをラベルテキストより順次連
係するテキスト作成部と、テキストアドレスの上方より
順次ラベルテキストを検出して該連係情報に基づき下方
分岐命令の分岐先アドレスを決定し第2の機械語に変更
した下方分岐命令があれば無動作命令を削除して該分岐
命令より下方のテキストを更新するとともに更新された
該ラベルテキストに連係された設定済み下方分岐命令テ
キストを更新するアドレス決定部とを設け、第1の機械
語で仮出力された下方分岐命令が第2の機械語に変更さ
れたとき、該無動作命令を削除して下方のテキストとと
もに、更新されたラベルテキストに連係された下方分岐
命令テキストを更新するように構成する。
[Detailed Description of the Invention] [Summary] The present invention relates to an address determination method for a branch instruction in an assembler. A text creation section that translates a program and creates text with the purpose of removing non-operational instructions inserted when the program is changed to a small machine language, and an address determination section that resolves undetermined addresses based on the text. The text of the downward branch instruction, which branches one step downward, is translated into the first and second machine language, which have different machine language lengths depending on the address width with the branch destination label. Temporarily output the large first machine language,
In an address determination method for a branch instruction in an assembler that allocates a non-action instruction to the area that remains when changing to the second machine language when determining an address, a linkage information storage area is provided for each downward branch instruction text and label text, and the program A text creation unit that creates text corresponding to a step, stores linkage information in the linkage information storage N area, and links downward branch instruction text to the same label sequentially from the label text; is detected, the branch destination address of the downward branch instruction is determined based on the linkage information, and if there is a downward branch instruction that has been changed to the second machine language, the no-operation instruction is deleted and the text below the branch instruction is updated. and an address determination unit that updates the set downward branch instruction text linked to the updated label text, and the downward branch instruction tentatively output in the first machine language is changed to the second machine language. When the no-action instruction is deleted, the downward branch instruction text linked to the updated label text is updated together with the text below.

〔産業上の利用分野〕[Industrial application field]

本発明はプロセッサの命令を翻訳するアセンブラに係わ
り、特に下方分岐のアドレス決定方式に関する。
The present invention relates to an assembler that translates processor instructions, and more particularly to a downward branch address determination method.

アセンブラにおける下方分岐のアドレスは、2PASS
 (パス)方式によって解決している。
The address of the downward branch in the assembler is 2PASS
This problem is solved using the (pass) method.

即ち、1パス目で機械語と分岐先のラベルアドレスとを
決定し、2バス目で未決定であった下方への分岐命令の
分岐先アドレスを解決する。
That is, the machine language and the label address of the branch destination are determined in the first pass, and the branch destination address of the undetermined downward branch instruction is resolved in the second bus.

しかし、例えばインテル社製マイクロプロセッサ808
6のごと< 、JMP命令が分岐先とのアドレス幅(以
下オフセットと称する)によってショートJ?IP命令
(2バイト命令)またはロングJ?IP命令(3バイト
命令)のいずれか一方の機械語に翻訳される場合、下方
分岐のJMP命令を2パス目で設定すると機械語長が変
更されて他の命令の決定済みアドレスに影響を与える。
However, for example, Intel microprocessor 808
6 <, the JMP instruction is short J? due to the address width (hereinafter referred to as offset) from the branch destination. IP instruction (2-byte instruction) or long J? When one of the IP instructions (3-byte instructions) is translated into machine language, setting the downward branch JMP instruction in the second pass changes the machine language length and affects the determined address of the other instruction. .

このため、従来では、lパス目でロング命令を仮出力し
ておき、ショートJ?IP命令に変更した場合は残る1
バイトをNOP命令(無動作)で充当しており、プログ
ラムが長くなってメモリ容量が増大するとともに、動作
時間が長(なるという課題があった。
For this reason, conventionally, a long instruction is provisionally output in the lth pass, and a short J? If you change to IP instruction, 1 will remain.
Bytes are allocated to NOP instructions (no operation), which results in longer programs, increased memory capacity, and longer operating times.

このため、このNOP命令を削除する分岐命令のアドレ
ス決定方式が求められている。
Therefore, there is a need for a branch instruction address determination method that deletes this NOP instruction.

〔従来の技術〕[Conventional technology]

従来例を以下のソースプログラム例(インテル社製プロ
セッサ8086のアセンブラ言語)で説明する。
The conventional example will be explained using the following source program example (assembler language for Intel processor 8086).

A:JMPB MOV^χ、BX MP  A B : この入力ソースによるアセンブラの動作は以下のように
なる。
A: JMPB MOV^χ, BX MP A B: The operation of the assembler based on this input source is as follows.

(1パス目) 11)  ラベルAを登録する。(1st pass) 11) Register label A.

(21J?IPBはラベルBがソース上に現れていない
ため、アドレス未解決のままロングJMP命令(E9X
XXX)を仮出力する。
(21J?IPB does not appear on the source because label B does not appear on the source, so the long JMP instruction (E9X
XXX) is temporarily output.

(3)  NOVの機械語を出力する。(3) Output NOV machine language.

(4)JMPAはアドレス解決されているため、オフセ
ットを計算し、ショートJMP命令(EBXX)を出力
する。
(4) Since the address of JMPA has been resolved, the offset is calculated and a short JMP instruction (EBXX) is output.

(5)  ラベルBを登録する。(5) Register label B.

以上の結果、 0000  A 0000  t’9XXXX 0003 89t3 0005  E[IF9 0007  B となる。As a result of the above, 0000 A 0000 t’9XXXX 0003 89t3 0005 E[IF9 0007 B becomes.

(2パス目) アドレス未解決のJMP B  (E9XXXX)のア
ドレスを解決する。オフセットは1バイト以下であるか
ら、(ショートJMP命令EBO5) + (NOP 
90)に変更する。この結果、 0000  A 0000  EBO590 000389C3 0005HBF9 0007  B となる。
(2nd pass) Resolve the unresolved address of JMP B (E9XXXX). Since the offset is 1 byte or less, (Short JMP instruction EBO5) + (NOP
90). As a result, 0000 A 0000 EBO590 000389C3 0005HBF9 0007 B.

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

2パス目でオフセットを計算しショートJMP 企令に
変更されたとき、従来では残る1バイトにはN叶命令を
充当しているが、これは無動作であり、無駄な命令であ
る。
When the offset is calculated in the second pass and the command is changed to a short JMP command, the remaining 1 byte is conventionally assigned to the N-go command, but this has no operation and is a useless command.

このため、このNOPを削除することが考えられるが、
あるNOPを削除することによってロング用P命令がシ
ョートJMP命令になる場合があり、この変更によって
更に他のロングJMP命令がショートJMP命令になる
等の状態が発生するため、最終的にアドレスが決定され
るまで、繰り返しプログラムの先頭から終わりまで該当
命令を検索してアドレスの再設定を行わなければならず
、アセンブラの処理時間が長くなるという課題がある。
For this reason, it may be possible to delete this NOP, but
By deleting a certain NOP, a long P instruction may become a short JMP instruction, and this change may cause other long JMP instructions to become short JMP instructions, so the final address is determined. The problem is that the address must be reset by repeatedly searching for the relevant instruction from the beginning to the end of the program until it is executed, which increases the processing time of the assembler.

本発明は、上記課題に鑑み、NOPを削除してアドレス
を決定する簡易なアセンブラにおける分岐命令のアドレ
ス決定方式を提供することを目的とする。
In view of the above problems, it is an object of the present invention to provide a simple address determination method for a branch instruction in an assembler that determines an address by deleting NOPs.

〔課題を解決するための手段〕[Means to solve the problem]

上記目的を達成するため、本発明のアセンブラにおける
分岐命令のアドレス決定方式は、第1図実施例のアセン
ブラブロック図に示すように、下方分岐命令テキスト(
11)ならびにラベルテキスI−(13)にそれぞれ連
係情報格納領域(14)を設けるとともに、 プログラムステップごとに対応する前記テキスト(2)
を作成し、該連係情報格納領域(14)に連係情報を格
納して同一ラベルへの下方分岐命令テキスト(11)を
該ラベルテキスト(13)より順次連係するテキスト作
成部(1)と、 テキストアドレスの上方より順次該ラベルテキスト(1
3)を検出して該連係情報に基づき該下方分岐命令の分
岐先アドレスを決定し、第2の機械語(6)に変更した
下方分岐命令があれば無動作命令を削除して該分岐命令
より下方のテキスト(2)を更新するとともに更新され
た該ラベルテキスト (13)に連係された設定済み下
方分岐命令テキスト(11)を更新するアドレス決定部
(3)とを設ける。
In order to achieve the above object, the branch instruction address determination method in the assembler of the present invention is as shown in the assembler block diagram of the embodiment in FIG.
11) and label text I-(13), respectively, are provided with a link information storage area (14), and the text (2) corresponding to each program step is provided.
a text creation unit (1) that creates a linkage information storage area (14), stores linkage information in the linkage information storage area (14), and links downward branch instruction text (11) to the same label sequentially from the label text (13); The label text (1
3) and determines the branch destination address of the downward branch instruction based on the linkage information, and if there is a downward branch instruction changed to the second machine language (6), delete the no-operation instruction and execute the branch instruction. An address determination unit (3) is provided which updates the lower text (2) and also updates the set downward branch instruction text (11) linked to the updated label text (13).

〔作 用〕[For production]

機械語長が変更されたとき、その命令の上方にある命令
のうちアドレス決定に影響が及ぶ命令は、その変更され
た命令の下方にあるラベルへの下方分岐命令のみである
から、ラベルより連係してこの下方分岐命令のみ更新対
象とする。
When the machine word length is changed, the only instruction that affects address determination among the instructions above that instruction is the downward branch instruction to the label below the changed instruction. Then, only this downward branch instruction is subject to update.

このため、連係情報格納領域14を備えた下方分岐命令
テキスト11およびラベルテキスト13とを設け、テキ
スト2作成時に、テキスト作成部1によって、同一ラベ
ルへ分岐する下方分岐命令テキスト11をラベルテキス
ト13より順次連係する。
For this reason, a downward branch instruction text 11 having a link information storage area 14 and a label text 13 are provided, and when text 2 is created, the text creation unit 1 selects the downward branch instruction text 11 that branches to the same label from the label text 13. Link sequentially.

この連係情報に従い、アドレス決定部3は順次該当ラベ
ルへ下方分岐する分岐命令の分岐先アドレスを設定する
が、その中に第1の機械語5 (語長は第1の機械語〉
第2の機械語)より第2の機械語6に変更された下方分
岐命令(複数の場合は上方の下方分岐命令)があれば、
無動作命令NOPを削除してその下方分岐命令より下方
のテキスト2をすべて更新するとともに、その下方分岐
命令より順次ラベルテキスト13を検出して下方分岐命
令の分岐先アドレスを設定する。
According to this linkage information, the address determination unit 3 sequentially sets the branch destination address of the branch instruction to branch downward to the corresponding label, and in the address determination unit 3, the first machine language 5 (the word length is the first machine language) is set.
If there is a downward branch instruction (in the case of multiple instructions, an upper downward branch instruction) changed from the second machine language) to the second machine language 6,
The no-action instruction NOP is deleted and all text 2 below the downward branch instruction is updated, and label texts 13 are sequentially detected from the downward branch instruction to set the branch destination address of the downward branch instruction.

無動作命令NOPの削除によって、上方分岐命令が第1
の機械語5から第2の機械語6に変更されることがある
が、テキストの上記更新処理時に再設定を行う。
By deleting the no-operation instruction NOP, the upward branch instruction becomes the first
The machine language 5 may be changed to the second machine language 6, but this is reset during the text update process.

以上の結果、無動作命令NOPの削除に無関係なテキス
トを検証しなくて済むため、速やかに無動作命令を削除
した機械語を出力することができる。
As a result of the above, since there is no need to verify text unrelated to the deletion of the no-action command NOP, machine language with the no-action command deleted can be quickly output.

〔実施例〕〔Example〕

本発明の実施例を図を用いて詳細に説明する。 Embodiments of the present invention will be described in detail with reference to the drawings.

第1図は実施例のアセンブラブロック図、第2図はテキ
スト例を表す図、第3図は処理フローチャート図、第4
図はテキスト作成処理説明図、第5図はアドレス決定処
理説明図(その1)、第6図はアドレス決定処理説明図
(その2)、第7図はアドレス決定処理説明図(その3
)である。
Fig. 1 is an assembler block diagram of the embodiment, Fig. 2 is a text example, Fig. 3 is a processing flowchart, and Fig. 4 is an assembler block diagram of the embodiment.
The figure is an explanatory diagram of the text creation process, Figure 5 is an explanatory diagram of the address determination process (part 1), Figure 6 is an explanatory diagram of the address determination process (part 2), and Figure 7 is an explanatory diagram of the address determination process (part 3).
).

以下、マイクロプロセッサ8086のJMP命令(分岐
命令)を例として説明する。なお、このJMP命令では
、第1の機械語5はロングJMP命令(3バイト命令)
に、第2の機械語6はショートJMP命令(2バイト命
令)にそれぞれ対応する。
The JMP instruction (branch instruction) of the microprocessor 8086 will be explained below as an example. Note that in this JMP instruction, the first machine language 5 is a long JMP instruction (3-byte instruction).
The second machine language 6 corresponds to a short JMP instruction (2-byte instruction).

第1図において、 lはテキスト作成部で、アセンブラソースプログラムを
読み込み、後述するテキスト形式に従って各ステップの
テキストを作成し、同一ラベルへの下方分岐命令テキス
H1を連係するもの、2は後述するテキスト、 3はアドレス決定部で、作成されたテキスト2に基づき
無動作命令(NOP ’)を削除しつつ未解決のアドレ
スを決定するものである。
In FIG. 1, 1 is a text creation unit that reads an assembler source program, creates text for each step according to the text format described later, and links downward branch instruction text H1 to the same label; 2 is a text that will be described later. , 3 is an address determination unit that determines unresolved addresses while deleting no-operation instructions (NOP') based on the created text 2.

第2図は各種命令のテキスト例を示したもので、無条件
命令テキスト10は、MOV 、 ADD 、 PLI
SI+命令等のようにアドレスに関係なく固定的に出力
できる命令のテキストで、その命令の機械語アドレスに
(テキスト長−2)を加算して次の機械語アドレスを求
める。
Figure 2 shows text examples of various commands, and the unconditional command text 10 is MOV, ADD, PLI.
In the text of an instruction such as the SI+ instruction that can be output fixedly regardless of the address, the next machine language address is obtained by adding (text length - 2) to the machine language address of the instruction.

下方分岐命令テキスト11は従来の分岐命令テキストに
連係情報格納領域14と無効製格納領域15とを付加し
たもので、連係情報格納領域14には上方にある同一ラ
ベルへの下方分岐命令テキスト11のテキストアドレス
が記入され、無効製格納領域15には3バイト命令が2
バイト命令に変更されたとき1バイトを削除したものと
して“0ビが記入される。
The downward branch instruction text 11 is obtained by adding a linkage information storage area 14 and an invalid product storage area 15 to the conventional branch instruction text. A text address is written, and two 3-byte instructions are written in the invalid storage area 15.
When changed to a byte instruction, "0bi" is written as if one byte was deleted.

なお、無効長の領域は、NOPを削除してもテキストア
ドレスが変わらないように設けられたものである。この
命令の次の機械語アドレスは(テキスト長−8−無効長
)を加算して求める。
Note that the invalid length area is provided so that the text address does not change even if the NOP is deleted. The next machine language address of this instruction is obtained by adding (text length - 8 - invalid length).

上方分岐命令テキスト12は、上方に分岐するJMP命
令のテキストで、対応するラベルテキストのテキストア
ドレスが記入され、さらに下方分岐命令テキスト11と
同様に、無効製格納領域15が付加される。この命令の
次の機械語アドレスは(テキスト長−〇−無効長)を加
算して求める。
The upward branch instruction text 12 is the text of the JMP instruction that branches upward, the text address of the corresponding label text is entered, and, like the downward branch instruction text 11, an invalid product storage area 15 is added. The next machine language address of this instruction is obtained by adding (text length - 0 - invalid length).

なお、上方ならびに下方分岐命令テキスト11.12に
は機械語アドレスが記入され、IP(インストラフシラ
ンポインタ、次のステップの機械′語アドレス)士ラベ
ルの機械語アドレスをオフセントとして分岐先アドレス
が設定される。
Note that the machine language address is entered in the upper and lower branch instruction texts 11.12, and the branch destination address is set with the machine language address of the IP (instruction pointer, next step machine language address) label as an offset. be done.

ラベルテキスト13はラベルの機械語アドレスが設定さ
れるもので、連係情報格納領域14が設けられる。
The label text 13 is for setting the machine language address of the label, and is provided with a linkage information storage area 14.

その他、CALL命令1条件付きJ?IP命令等機械語
長の変更のない命令は図示省略したが上方分岐命令テキ
スト12のうち無効製格納領域を削除したものとなる。
Others, CALL instruction 1 conditional J? Instructions such as IP instructions whose machine language length does not change are not shown, but are the upper branch instruction text 12 with the invalid storage area deleted.

以下、第3図を参照しつつ、アセンブラの動作を説明す
る。
The operation of the assembler will be explained below with reference to FIG.

〔テキスト作成〕[Text creation]

機械語アドレスを演算しつつ各ステップのテキスト2を
作成する。
Create text 2 for each step while calculating machine language addresses.

このとき、下方分岐命令テキスト11の連係情報格納領
域14には、ラベルテキスト13より上方に向かって同
一ラベルへの下方分岐命令テキスト11の連係情報、即
ちテキストアドレスが格納される。
At this time, the association information storage area 14 of the downward branch instruction text 11 stores association information of the downward branch instruction text 11 to the same label upward from the label text 13, that is, the text address.

第4図は以上の処理によって作成されたテキスト例を示
したもので、JMP L3は下方JMP命令であるため
、機械語として3バイト命令が仮出力されるとともに、
ラベルL3より順次上方のJMP L3のテキストアド
レスが記入されて連係された状態を示している。
Figure 4 shows an example of the text created by the above processing.Since JMP L3 is a downward JMP instruction, a 3-byte instruction is temporarily output as machine language, and
The text address of JMP L3 sequentially above label L3 is entered and linked.

なお、連係の終端には終端記号(FFFFFF)が記入
される。
Note that a terminal symbol (FFFFFF) is written at the end of the linkage.

〔アドレス決定〕[Address determination]

(11アドレス上位よりラベルテキスト13を検索する
(Search for label text 13 from the upper address of 11.

(2)検出したラベルテキスト13に対応する下方分岐
命令テキス目lを連係情報に基づき検索し、分岐先アド
レスを設定する。
(2) Search for the downward branch instruction text l corresponding to the detected label text 13 based on the association information, and set the branch destination address.

第5図は、第4図のテキストに対応したもので、JMP
 L3は2バイト命令であるので、NOP  (’90
’が充当され、無効製格納領域15に”01゛ が記入
される。
Figure 5 corresponds to the text in Figure 4.
Since L3 is a 2-byte instruction, NOP ('90
' is applied, and "01" is written in the invalid product storage area 15.

(3)2バイト命令があれば、このテキストより下方の
テキストの機械語アドレスならびに他の命令の分岐先ア
ドレスを更新する。
(3) If there is a 2-byte instruction, update the machine language address of the text below this text and the branch destination address of other instructions.

第6図では、テキストアドレス0OOOOBが上位のシ
ョートJMP命令であるため、この命令より下方の機械
語アドレスを演算しつつテキストアドレス000016
以下のテキストを更新する。
In FIG. 6, since the text address 0OOOOOB is an upper short JMP instruction, the text address 000016 is calculated while calculating the machine language addresses below this instruction.
Update the text below.

これにより、第6図では、上方分岐命令(テキストアド
レス0O003C)はEBF2よりEBF4に変更され
る。
As a result, in FIG. 6, the upward branch instruction (text address 0O003C) is changed from EBF2 to EBF4.

このとき、上方JMP命令が3バイト命令から2バイト
命令に変更された場合はNOPを挿入せず、以降のテキ
スト2を更新する。
At this time, if the upper JMP instruction is changed from a 3-byte instruction to a 2-byte instruction, the subsequent text 2 is updated without inserting a NOP.

(4)機械語長の変更された下方JMP命令より以降の
テキストよりラベルテキストを検索し、(2L (31
の処理を行う。
(4) Search for the label text from the text after the lower JMP instruction whose machine language length has been changed, and search for the label text (2L (31
Process.

これにより、設定済み下方分岐命令であっても、ラベル
テキスト13が更新されているため、再設定が行われる
As a result, even if it is a downward branch instruction that has already been set, the label text 13 has been updated, so the setting is performed again.

(5)機械語長に変更がなければ次のラベルについて下
方分岐のアドレス決定を行う。
(5) If there is no change in the machine word length, determine the downward branch address for the next label.

第7図は、複数のJMP命令が交錯した例を示したもの
で、ラベルへに付いてJMP八■へ■のアドレス決定を
行った結果、JMP A■が2バイト命令であれば、J
MP命令■以降のテキスト2を更新し、JMP Cより
ラベルテキスト3を検索する。
Figure 7 shows an example where multiple JMP instructions intersect.As a result of determining the address of JMP 8■ to ■ following the label, if JMP A■ is a 2-byte instruction, JMP
Update text 2 after MP command ■ and search for label text 3 from JMP C.

従って設定済みのラベル8■についてJMP B■の再
設定を行うことになり、さらにJMP B■が2バイト
命令に変更された場合は、このJMP B■を基準とし
てテキスト2を更新することになる。
Therefore, JMP B■ will be reconfigured for label 8■ that has already been set, and if JMP B■ is changed to a 2-byte instruction, text 2 will be updated based on this JMP B■. .

通常3バイト命令から2バイト命令に変更されることは
比較的少ないから、上記操作により、順次下方に向かっ
てアドレス決定が行われることになる。
Normally, it is relatively rare for a 3-byte instruction to be changed to a 2-byte instruction, so the above operation causes addresses to be determined sequentially downward.

なお、上記実施例では、テキスト更新処理で上方用P命
令等の再設定処理を行ったが、機械語アドレスを更新し
た後機械語長の変更されたテキストより順次他の命令の
アドレス再設定処理を行い、上方JMP命令で機械語長
が変更されたときはその上方JMP命令を基準として機
械語を再設定し、またラベルテキス1−13が検出され
ると上記処理を行うという手順を採用すると、さらに処
理時間を短縮することができる。
In the above embodiment, the resetting process for upward P instructions, etc. was performed in the text update process, but after updating the machine language address, the address resetting process for other instructions is performed sequentially from the text whose machine language length has been changed. When the machine language length is changed by an upper JMP instruction, the machine language is reset based on the upper JMP instruction, and when label text 1-13 is detected, the above process is performed. Furthermore, processing time can be shortened.

以上のごとく、3バイト命令が2バイト命令に変更され
たとき、その命令より上方の命令のアドレス再設定の要
否の検証は、下方にあるラベルテキスト13に連係され
た下方分岐命令テキス目1のみについて行えばよく、連
係情報で容易に検索できるため、無動作命令を削除した
アドレス決定を短時間に行うことができる。
As described above, when a 3-byte instruction is changed to a 2-byte instruction, the verification of whether or not it is necessary to reset the address of the instructions above the instruction is performed using the text 1 of the downward branch instruction linked to the label text 13 below. Since it is only necessary to perform a search on linkage information and it can be easily searched using linkage information, addresses can be determined in a short time by eliminating non-operating instructions.

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

本発明は、下方分岐のアドレス決定で機械語長が変更さ
れたとき、従来無動作命令で充当された領域を削除しつ
つアドレスを決定する処理速度の速い方式を提供するも
ので、機械語から無動作命令を削除してメモリ量の削減
、プログラムの処理速度の改善が達成できる効果は多大
である。
The present invention provides a fast processing method for determining addresses while deleting the area conventionally occupied by non-operating instructions when the machine word length is changed in determining the address of a downward branch. By deleting non-operational instructions, the effect of reducing the amount of memory and improving the processing speed of the program is significant.

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

第1図は実施例のアセンブラブロック図、第2図はテキ
スト例を表す図、 第3図は処理フローチャート図、 第4図はテキスト作成処理説明図、 第5図はアドレス決定処理説明図(そのl)、第6図は
アドレス決定処理説明図(その2)、第7図はアドレス
決定処理説明図(その3)である。図中、 1はテキスト作成部、2はテキスト、3はアドレス決定
部、5は第1の機械語、3バイト命令、ロングJMP命
令、6は第2の機械語、2バイト命令。 ショートJMP命令、10は無条件命令テキスト、11
は下方分岐命令テキスト、12は上方分岐命令テキスト
、13はラベルテキスト、14は連係情報格納領域、1
5は無効長格納領域である。 処理フローチャート図 第3図 実施例のアセンブラブロック図 第1図 テキスト例を表す図 第2図 テキスト作成処理説明図 第4図 アドレス決定処理説明図(その1) 第5図 アドレス決定処理説BIE(その2) 第6図 アドレス決定処理説明図(その3) 第7図
Figure 1 is an assembler block diagram of the embodiment, Figure 2 is a diagram representing a text example, Figure 3 is a processing flowchart, Figure 4 is an illustration of text creation processing, and Figure 5 is an illustration of address determination processing (its 1), FIG. 6 is an explanatory diagram of the address determination process (part 2), and FIG. 7 is an explanatory diagram of the address determination process (part 3). In the figure, 1 is a text creation section, 2 is a text, 3 is an address determination section, 5 is a first machine language, a 3-byte instruction, a long JMP instruction, and 6 is a second machine language, a 2-byte instruction. Short JMP command, 10 is unconditional command text, 11
1 is a downward branch instruction text, 12 is an upward branch instruction text, 13 is a label text, 14 is a linkage information storage area, 1
5 is an invalid length storage area. Figure 3: Assembler block diagram of the embodiment Figure 1: Text example Figure 2: Text creation process illustration Figure 4: Address determination process (part 1) Figure 5: Address determination processing explanation BIE (part 1) 2) Figure 6 Address determination process explanatory diagram (Part 3) Figure 7

Claims (1)

【特許請求の範囲】 プログラムを翻訳しテキストを作成するテキスト作成部
と、該テキストに基づき未決定のアドレスを解決するア
ドレス決定部とを備え、分岐先ラベルとのアドレス幅に
応じて機械語長の異なる第1および第2の機械語に翻訳
される分岐命令のうち下方へ分岐する下方分岐命令の該
テキストには機械語長の大なる第1の機械語(5)を仮
出力しておき、アドレス決定時に第2の機械語(6)に
変更したとき残る領域に無動作命令を充当するアセンブ
ラにおける分岐命令のアドレス決定方式において、 下方分岐命令テキスト(11)ならびにラベルテキスト
(13)にそれぞれ連係情報格納領域(14)を設ける
とともに、 プログラムステップごとに対応する前記テキスト(2)
を作成し、該連係情報格納領域(14)に連係情報を格
納して同一ラベルへの下方分岐命令テキスト(11)を
該ラベルテキスト(13)より順次連係するテキスト作
成部(1)と、 テキストアドレスの上方より順次該ラベルテキスト(1
3)を検出して該連係情報に基づき該下方分岐命令の分
岐先アドレスを決定し、第2の機械語(6)に変更した
下方分岐命令があれば無動作命令を削除して該分岐命令
より下方のテキスト(2)を更新するとともに更新され
た該ラベルテキスト(13)に連係された設定済み下方
分岐命令テキスト(11)を更新するアドレス決定部(
3)とを設け、 第1の機械語(5)で仮出力された下方分岐命令が機械
語長の小なる第2の機械語(6)に変更されたとき、該
無動作命令を削除して、下方のテキストとともに、更新
された該ラベルテキストに連係された下方分岐命令テキ
ストを更新することを特徴とするアセンブラにおける分
岐命令のアドレス決定方式。
[Scope of Claims] A text creation unit that translates a program and creates text, and an address determination unit that resolves undetermined addresses based on the text, and the machine language length is determined according to the address width with the branch destination label. Among the branch instructions to be translated into first and second machine languages that are different in length, the text of the downward branch instruction that branches downward is temporarily outputted with the first machine language (5) having a large machine language length. , in an address determination method for a branch instruction in an assembler that allocates a no-action instruction to the area remaining when changing to the second machine language (6) when determining the address, the downward branch instruction text (11) and label text (13) are respectively In addition to providing a linkage information storage area (14), the text (2) corresponding to each program step is provided.
a text creation unit (1) that creates a linkage information storage area (14), stores linkage information in the linkage information storage area (14), and links downward branch instruction text (11) to the same label sequentially from the label text (13); The label text (1
3) and determines the branch destination address of the downward branch instruction based on the linkage information, and if there is a downward branch instruction changed to the second machine language (6), delete the no-operation instruction and execute the branch instruction. an address determination unit (2) that updates the lower text (2) and also updates the set downward branch instruction text (11) linked to the updated label text (13);
3) is provided, and when the downward branch instruction provisionally output in the first machine language (5) is changed to the second machine language (6) with a smaller machine word length, the no-action instruction is deleted. A branch instruction address determination method in an assembler, characterized in that a downward branch instruction text linked to the updated label text is updated together with the downward text.
JP23416788A 1988-09-19 1988-09-19 Address determining system for branch instruction in assembler Pending JPH0281228A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP23416788A JPH0281228A (en) 1988-09-19 1988-09-19 Address determining system for branch instruction in assembler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP23416788A JPH0281228A (en) 1988-09-19 1988-09-19 Address determining system for branch instruction in assembler

Publications (1)

Publication Number Publication Date
JPH0281228A true JPH0281228A (en) 1990-03-22

Family

ID=16966713

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23416788A Pending JPH0281228A (en) 1988-09-19 1988-09-19 Address determining system for branch instruction in assembler

Country Status (1)

Country Link
JP (1) JPH0281228A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7774581B2 (en) 2007-03-23 2010-08-10 Samsung Electronics Co., Ltd. Apparatus for compressing instruction word for parallel processing VLIW computer and method for the same

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7774581B2 (en) 2007-03-23 2010-08-10 Samsung Electronics Co., Ltd. Apparatus for compressing instruction word for parallel processing VLIW computer and method for the same

Similar Documents

Publication Publication Date Title
US4858104A (en) Preceding instruction address based branch prediction in a pipelined processor
EP0220684A2 (en) Data processing system
US20030125925A1 (en) Batch editor for netlists described in a hardware description language
US6611956B1 (en) Instruction string optimization with estimation of basic block dependence relations where the first step is to remove self-dependent branching
JP3130828B2 (en) Assembly processing method
JPH0281228A (en) Address determining system for branch instruction in assembler
JPS62226231A (en) Processor
CN101295239A (en) Instruction execution method of Java card virtual machine
WO2000022513A1 (en) Endian transformation
JPH0527142B2 (en)
JPH07234793A (en) Optimizing device for conditional branch
JP3000878B2 (en) Assembler processing method
US20070169035A1 (en) Method and system for configuring the language of a computer program
JPH02191042A (en) Interruption control system
JPH06119203A (en) Debugging line deleting device
JPH04139535A (en) Operand data access system
JPS61145643A (en) Variable word length instruction processing system
JP2570407B2 (en) Programmable controller
JPH01140236A (en) Inverse compile system for program
JPH1124939A (en) Program conversion method
JPH04101226A (en) Interpreter type language processing system
JPH047746A (en) Machine word compiling program system
JPH0922307A (en) Sequencer
JPH05334094A (en) Assembler
JPH1196017A (en) Programmable controller system and its program preparing method