JPH04312122A - Program producing device - Google Patents

Program producing device

Info

Publication number
JPH04312122A
JPH04312122A JP10677591A JP10677591A JPH04312122A JP H04312122 A JPH04312122 A JP H04312122A JP 10677591 A JP10677591 A JP 10677591A JP 10677591 A JP10677591 A JP 10677591A JP H04312122 A JPH04312122 A JP H04312122A
Authority
JP
Japan
Prior art keywords
instruction
instruction code
branch
optimization
code
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
JP10677591A
Other languages
Japanese (ja)
Inventor
Hiroko Kawachino
川内野 博子
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 JP10677591A priority Critical patent/JPH04312122A/en
Publication of JPH04312122A publication Critical patent/JPH04312122A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To attain the output of an object having a high executing cycle without changing the side of an instruction code when the optimization enable information, e.g. the branching instructions which have the different branchable ranges and different instructions executing cycles and have the same number of bytes of the instruction codes are present thereon. CONSTITUTION:An optimization information input 111 inputs the optimization enable information 301 through a code correction part 108. An optimization deciding part 112 desides where an instruction code is included or not in the branching range of the branching instructions of high executing cycles based on an absolute branching side address that undergone the connection/ arrangement processing with the information 301 and the symbol value inputted from a symbol solution part 107 and the branching side address. If so, an instruction conversion part 113 outputs the instruction code after converting it into another instruction code of the branching instruction of a high executing cycle.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明は、プログラム作成装置に
利用され、特に、言語処理プログラムであるリンカに関
し、アセンブル時またはコンパイル時に指定された、リ
ンカの配置単位であるセグメント単位にリロケータブル
なオブジェクトの配置を決定した後、オブジェクトが配
置されたアドレスを参照してオブジェクトプログラムの
一部を修正することにより実行可能なオブジェクトプロ
グラムを作成するプログラム作成装置に関する。
FIELD OF INDUSTRIAL APPLICATION The present invention is utilized in a program creation device, and in particular relates to a linker which is a language processing program, and in which relocatable objects are created in units of segments, which are allocation units of the linker, specified at the time of assembling or compiling. The present invention relates to a program creation device that creates an executable object program by modifying a part of the object program with reference to the address where the object is located after determining the location.

【0002】0002

【従来の技術】従来の言語処理プログラムにおける分岐
命令最適化には、コードサイズを短縮することを目的と
する処理方式がある。
2. Description of the Related Art There is a processing method for optimizing branch instructions in conventional language processing programs aimed at reducing code size.

【0003】分岐命令として、命令コードは短いが相対
距離に限りのある相対分岐命令と、命令コードは長いが
全アドレス空間に分岐できる絶対分岐命令がある場合の
例(1)を以下に示す。
An example (1) is shown below in which there are two types of branch instructions: a relative branch instruction that has a short instruction code but a limited relative distance, and an absolute branch instruction that has a long instruction code but can branch to the entire address space.

【0004】リロケータブルアセンブラあるいはコンパ
イラでは、1モジュール内を解析することにより判断で
きる範囲の最適化を行っている。すなわち、分岐先アド
レスと分岐元アドレスが1モジュール内の同一セグメン
トにある場合、または分岐先アドレス、分岐元アドレス
共にアセンブル時またはコンパイル時に既にアブソリュ
ートである場合に、相対距離を計算した結果、許される
相対距離内に収まるときは相対分岐命令のコードを出力
し、収まらなければ絶対分岐命令のコードを出力する。 これにより、言語処理プログラム使用者は、分岐先アド
レスと分岐元アドレスの相対距離を意識することなくプ
ログラムを作成することが可能となり、より短いコード
サイズを得ることが可能となる。
[0004] A relocatable assembler or compiler performs optimization within a range that can be determined by analyzing one module. In other words, if the branch destination address and the branch source address are in the same segment within one module, or if both the branch destination address and the branch source address are already absolute at the time of assembly or compilation, the result of calculating the relative distance is that it is allowed. If the distance falls within the relative distance, a relative branch instruction code is output; if not, an absolute branch instruction code is output. This allows the language processing program user to create a program without being aware of the relative distance between the branch destination address and the branch source address, making it possible to obtain a shorter code size.

【0005】また、前記の方式を利用した、アドレス空
間が拡大した場合の最適化処理方式としては、次の例(
2) が挙げられる。
[0005] The following example (
2).

【0006】例えば、下記の分岐命令が存在するとする
。 (a)  相対距離の範囲が短い相対分岐命令(相対距
離−128バイト〜+127 バイト以内、命令コード
サイズ:2バイト) (b)  相対距離の範囲が(a) よりも長い相対分
岐命令(相対距離−32768バイト〜+32767 
バイト以内、命令コードサイズ:3バイト) (c)  アドレス空間をある単位で分割した一つの分
割単位であるバンク内への絶対分岐命令(1ハンク64
Kバイト、命令コードサイズ:3バイト) (d)  全アドレス空間に分岐可能である絶対分岐命
令(命令コードサイズ:4バイト)
For example, suppose the following branch instruction exists. (a) Relative branch instruction with a short relative distance range (relative distance within -128 bytes to +127 bytes, instruction code size: 2 bytes) (b) Relative branch instruction with a longer relative distance range than (a) (relative distance -32768 bytes ~ +32767
(within byte, instruction code size: 3 bytes) (c) Absolute branch instruction into a bank, which is a unit of division into which the address space is divided (1 hunk 64
K bytes, instruction code size: 3 bytes) (d) Absolute branch instruction that can branch to all address spaces (instruction code size: 4 bytes)

【0007】このとき、リロケータブルアセンブラでは
前記の最適化処理方式と同様に、まず分岐先アドレスと
分岐元アドレスが1モジュール内の同一セグメントにあ
る場合、または分岐先アドレス、分岐元アドレス共にア
センブル時またはコンパイル時に既にアブソリュートで
ある場合に、相対距離を計算した結果、(a) の相対
距離内に入るならば(a) の分岐命令、(b) の相
対距離に入るならば(b) の分岐命令、そうでなけれ
ば(d) の絶対分岐命令のコードを出力する。
At this time, in the relocatable assembler, as in the optimization processing method described above, first, if the branch destination address and the branch source address are in the same segment within one module, or if both the branch destination address and the branch source address are If it is already absolute at the time of compilation, if the relative distance is within the relative distance of (a) as a result of calculating the relative distance, then the branch instruction of (a) is used, and if it is within the relative distance of (b), the branch instruction of (b) is used. , otherwise outputs the code of the absolute branch instruction (d).

【0008】図6はこの方式で最適化を行った場合の例
を示す。分岐命令603 は相対距離が100 バイト
であるため(a) の命令、分岐命令602 は相対距
離が 300バイトで−128バイト〜+127 バイ
トの範囲を越えてしまうが、−32768バイト〜+3
2767 バイトの範囲には入るので(b) の命令、
分岐命令601は相対距離が38000 バイトで(b
)の範囲も越えてしまうので、(d) の全アドレス空
間に分岐可能な絶対分岐命令を生成する。分岐命令60
4 は分岐元と分岐先がリロケータブルで、別モジュー
ルなので(d) の命令を、605 は同一モジュール
だが、配置単位であるセグメントが別なので、リンカで
どこに配置されるかが未定であるため、604 と同様
(d) の命令を生成する。
FIG. 6 shows an example of optimization using this method. Branch instruction 603 has a relative distance of 100 bytes, so instruction (a) and branch instruction 602 have a relative distance of 300 bytes and exceed the range of -128 bytes to +127 bytes, but -32768 bytes to +3
Since it falls within the range of 2767 bytes, the instruction (b)
The branch instruction 601 has a relative distance of 38000 bytes (b
), so an absolute branch instruction that can branch to the entire address space in (d) is generated. branch instruction 60
In 4, the branch source and destination are relocatable and are in separate modules, so the instruction in (d) is used in 605. In 605, the segment, which is the placement unit, is different, so where the linker will place it is undecided, so 604 Similarly, the instruction (d) is generated.

【0009】[0009]

【発明が解決しようとする課題】最近はソフトウェアの
機能が高機能化し、プログラム規模が拡大してきており
、従来のアドレス空間を拡大する方向に進んでいる。 そこで、言語処理プログラムとしては、前述した従来の
例(2) の最適化方式が有効となる。しかし、例(2
)の最適化方式では次のような課題が発生する。
[Problems to be Solved by the Invention] Recently, the functions of software have become more sophisticated and the scale of programs has expanded, and there is a trend toward expanding the conventional address space. Therefore, as a language processing program, the optimization method of conventional example (2) described above is effective. However, example (2
) optimization method causes the following problems.

【0010】例(2) の最適化方式により、生成され
る分岐命令は(a) 、(b) および(d) の三つ
であり、(c) のバンク内分岐命令は生成することが
できない。(a) は短い距離の分岐であり、(d) 
は64Kバイトを越えた長い分岐であることから、(b
) の中距離の相対分岐命令を生成する割り合いが高い
と思われる。
[0010] The optimization method in example (2) generates three branch instructions (a), (b), and (d), and the intra-bank branch instruction (c) cannot be generated. . (a) is a short distance branch and (d)
is a long branch exceeding 64K bytes, so (b
) seems to have a high rate of generating medium-distance relative branch instructions.

【0011】ところで、(b) の命令と(c) の命
令とを次の三つの観点から比較すると次の通りとなる。
By the way, the instruction (b) and the instruction (c) are compared from the following three points of view.

【0012】第一に、命令コードサイズは(b) も(
c) も等しい。
First, the instruction code size is (b) (
c) are also equal.

【0013】第二に実行サイクルの面では、(c) の
バンク内絶対分岐命令の方が速い。なぜならば、(c)
 はバンクの選択が既になされているので、プログラム
カウンタに指定された16ビットの分岐先アドレスを設
定するだけで良いが、(b) は現在のアドレスにオブ
ジェクト中の16ビットの相対距離を加えて分岐先アド
レスを計算した後、プログラムカウンタに設定しなけれ
ばならないからである。
Second, in terms of execution cycles, the intra-bank absolute branch instruction (c) is faster. Because (c)
In (b), the bank has already been selected, so all you need to do is set the 16-bit branch destination address specified in the program counter, but in (b), the 16-bit relative distance in the object is added to the current address. This is because the branch destination address must be calculated and then set in the program counter.

【0014】第三に分岐可能な範囲は、(b) は現在
のアドレスから−32768バイト〜+32767バイ
トであるのに対し、(c) は1バンク64キロバイト
内と異なるが、リロケータブルな記述をする場合には、
機能単位ごとにセグメントを分割する方式がとられ、ま
た一つの機能単位が64キロバイトをまたがって配置さ
れることは少ないことから、(b) の相対分岐命令が
ほとんど(c) のバンク内絶対分岐命令に置き換える
ことができると思われる。
Thirdly, the branchable range is -32768 bytes to +32767 bytes from the current address in (b), whereas in (c) it is within 64 kilobytes of one bank, but it is written in a relocatable manner. in case of,
Because segments are divided into functional units, and it is rare for a single functional unit to span 64 kilobytes, most of the relative branch instructions in (b) are used as intra-bank absolute branches in (c). It seems possible to replace it with a command.

【0015】以上のように、(b) と(c) の命令
を比較すると、分岐範囲は(c) の分岐範囲でほとん
どの命令がカバーされ、命令コードサイズは等しいのに
、実効サイクルは(b) の方が遅い。つまり、例(2
) の通り、アセンブラが最適化を行った結果、かえっ
て実行サイクルの遅い命令を多く生成してしまう課題が
発生する結果となる。
As described above, when comparing the instructions in (b) and (c), most of the instructions are covered by the branch range in (c), and the instruction code size is the same, but the effective cycle is ( b) is slower. In other words, example (2
), as a result of the assembler's optimization, the problem arises that it generates many instructions with a slow execution cycle.

【0016】本発明の目的は、前記の課題を解消するこ
とにより、前記の例(2) に示すような分岐命令が存
在する場合に、命令コードサイズを変更することなく、
より実行サイクルの速いオブジェクトを生成することが
できるプログラム作成装置を提供することにある。
[0016] An object of the present invention is to solve the above problem, so that when a branch instruction as shown in the above example (2) exists, without changing the instruction code size,
An object of the present invention is to provide a program creation device that can generate objects with faster execution cycles.

【0017】[0017]

【課題を解決するための手段】本発明は、リロケータブ
ルオブジェクトを入力する入力部と、モジュールの結合
を行う結合部と、結合されたモジュールをアドレス空間
に配置する配置部と、シンボルの参照関係の解決および
配置時に決定されたアドレスの修正を行うシンボル解決
部と、リロケータブルな命令コードをアブソリュートな
値に補正するコード補正部と、補正後のオブジェクトを
出力する出力部とを含むリンカ処理部を備えたプログラ
ム作成装置において、前記リンカ処理部は、命令コード
サイズは等しいが実行サイクルの遅い分岐命令のコード
が出ているという情報とそのコードが出ているアドレス
情報と分岐先アドレス情報とを入力する最適化情報入力
部と、入力した前記情報と前記シンボル解決部で既に値
が決定されたシンボル値とにより結合および配置処理を
行い当該命令コードが実行サイクルの速い方の分岐範囲
に入るかを判断する最適化判断部と、実行サイクルの速
い方の分岐範囲に入ると判断された場合に前記命令コー
ドをその命令コードに変換し前記出力部に対して出力す
る命令変換部とを含むことを特徴とする。
[Means for Solving the Problems] The present invention provides an input section for inputting relocatable objects, a coupling section for coupling modules, an arrangement section for arranging the coupled modules in an address space, and a reference relationship between symbols. It is equipped with a linker processing unit that includes a symbol resolution unit that corrects addresses determined during resolution and placement, a code correction unit that corrects relocatable instruction codes to absolute values, and an output unit that outputs the corrected object. In the program creation device, the linker processing unit inputs information that a branch instruction code having the same instruction code size but a slow execution cycle is issued, address information where the code is issued, and branch destination address information. The optimization information input unit performs a combination and placement process using the input information and the symbol value whose value has already been determined by the symbol resolution unit, and determines whether the instruction code falls within the branch range with the faster execution cycle. and an instruction conversion unit that converts the instruction code into the instruction code and outputs the instruction code to the output unit when it is determined that the instruction falls within the branch range with the faster execution cycle. shall be.

【0018】[0018]

【作用】最適化情報入力部は、命令コードサイズは等し
いが実行サイクルの遅い分岐命令のコードが出ていると
いう情報とそのコードが出ているアドレス情報と分岐先
アドレス情報とを入力する。最適化判断部は、この入力
された情報とシンボル解決部で既に値が決定されたシン
ボル値とにより、結合および配置処理を行い、当該コー
ドが実行サイクルの速い方の分岐範囲に入るかを判断す
る。そして、命令変換部は、実行サイクルの速い方の分
岐範囲に入ると判断された場合に前記命令コードをその
命令コードに変換し出力部に対して出力する。
[Operation] The optimization information input section inputs information that a branch instruction code having the same instruction code size but a slow execution cycle is issued, address information where the code is issued, and branch destination address information. The optimization judgment unit performs a combination and placement process using this input information and the symbol value whose value has already been determined by the symbol resolution unit, and judges whether the code in question falls within the branch range with the faster execution cycle. do. Then, the instruction converting section converts the instruction code into the instruction code when it is determined that the instruction falls within the branch range with the faster execution cycle, and outputs the converted instruction code to the output section.

【0019】従って、命令コードサイズを変更すること
なく、実行サイクルの速いオブジェクトを出力すること
が可能となる。
Therefore, it is possible to output an object with a fast execution cycle without changing the instruction code size.

【0020】[0020]

【実施例】以下、本発明の実施例について図面を参照し
て説明する。
Embodiments Hereinafter, embodiments of the present invention will be described with reference to the drawings.

【0021】図1は本発明の一実施例を示すブロック構
成図である。本実施例は、リロケータブルアセンブラや
コンパイラが出力するリロケータブルオブジェクト10
1 を入力する入力部104 と、モジュールの結合を
行う結合部105 と、結合されたモジュールをアドレ
ス空間に配置する配置部106 と、シンボルの参照関
係の解決および配置時に決定されたアドレスの修正を行
うシンボル解決部107 と、リロケータブルな命令コ
ードをアブソリュートな値に補正するコード補正部10
8 と、補正後のオブジェクト103 を出力する出力
部110 とを含むリンカ処理部102 を備えたプロ
グラム作成装置において、
FIG. 1 is a block diagram showing an embodiment of the present invention. This example describes relocatable objects 10 output by a relocatable assembler or compiler.
1, an input unit 104 that inputs 1, a combination unit 105 that combines modules, a placement unit 106 that places the combined modules in the address space, and resolves symbol reference relationships and corrects addresses determined at the time of placement. and a code correction unit 10 that corrects relocatable instruction codes to absolute values.
8 and a linker processing unit 102 including an output unit 110 that outputs the corrected object 103,

【0022】本発明の特徴と
するところの、リンカ処理部102 は、命令コードサ
イズは等しいが実行サイクルの遅い分岐命令のコードが
出ているという情報とそのコードが出ているアドレス情
報と分岐先アドレス情報とを入力する最適化情報入力部
111と、入力した前記情報とシンボル解決部107 
で既に値が決定されたシンボル値とにより当該命令コー
ドが実行サイクルの速い方の分岐範囲に入り得るか否か
を判断する最適化判断部112 と、実行サイクルの速
い方の分岐範囲に入り得ると判断された場合に前記命令
コードをその命令コードに変換し出力部110 に対し
て出力する命令変換部113 とを含んでいる。なお、
最適化情報入力部111 、最適化判断部112 およ
び命令変換部113 は最適化処理部109 を構成す
る。
A feature of the present invention is that the linker processing unit 102 generates information that a branch instruction code having the same instruction code size but a slow execution cycle is issued, address information where the code is issued, and the branch destination. an optimization information input unit 111 that inputs address information; and an optimization information input unit 111 that inputs address information; and the input information and symbol resolution unit 107;
an optimization determination unit 112 that determines whether the instruction code can enter the branch range with a faster execution cycle based on the symbol value whose value has already been determined; and an instruction conversion section 113 that converts the instruction code into the instruction code and outputs it to the output section 110 when it is determined that the instruction code is the instruction code. In addition,
The optimization information input section 111 , the optimization judgment section 112 , and the instruction conversion section 113 constitute an optimization processing section 109 .

【0023】次に、本実施例の動作について説明する。 まずリロケータブルオブジェクト101 から、複数フ
ァイルの結合に必要な情報を入力部104 が入力し、
結合部105 で結合処理を行う。次に、配置部106
 で、結合したまとまりをアドレス空間中に配置しアド
レスを決定する。 シンボル解決部107 では、シンボルの定義参照関係
を解決するとともに、配置部106 で決定されたアド
レスをもとに、値が不定であったシンボルの値を補正し
決定する。コード補正部108 では、入力部104 
からコード補正情報201 を入力して、オブジェクト
コード中でシンボルの値が不定だったために、決定され
なかった部分のコードの修正を行った後、出力部110
 を介してオブジェクト103 を出力する。
Next, the operation of this embodiment will be explained. First, the input unit 104 inputs information necessary for combining multiple files from the relocatable object 101, and
A combining unit 105 performs a combining process. Next, the arrangement section 106
Then, the combined group is placed in the address space and the address is determined. The symbol resolution unit 107 resolves the symbol definition reference relationship, and also corrects and determines the value of the symbol whose value is undefined based on the address determined by the placement unit 106. In the code correction section 108, the input section 104
After inputting the code correction information 201 from the object code and correcting the part of the code that was not determined because the symbol value was undefined in the object code, the output unit 110
The object 103 is output via.

【0024】コード補正情報201 は、図2に示す通
り、補正アドレス202 、補正タイプ203、補正サ
イズ204 、参照シンボル205 、および定数値2
06 を含んでいる。最適化の可能性を示す最適化可能
性情報301 は、コード補正情報201 の一つとし
て存在し、それは補正タイプ203 から判断されるも
のとする。
As shown in FIG. 2, the code correction information 201 includes a correction address 202, a correction type 203, a correction size 204, a reference symbol 205, and a constant value 2.
Contains 06. Optimization possibility information 301 indicating the possibility of optimization exists as one of the code correction information 201 and is determined from the correction type 203 .

【0025】コード補正部108 は、コード補正情報
201 が最適化可能性情報301 であるときに、最
適化可能性情報301 を最適化処理部109 に入力
し制御を移す。
When the code correction information 201 is the optimization possibility information 301 , the code correction section 108 inputs the optimization possibility information 301 to the optimization processing section 109 and transfers control thereto.

【0026】次に、制御を移された最適化処理部109
 の詳細な処理の内容を、分岐命令として〔従来の技術
〕の例(2) で述べた命令群が存在している場合を例
にとって説明する。リンカにおける最適化処理で関係す
るのは、そのうち(b) と(c) である。(b) 
と(c) の違いは、命令コードサイズは全く等しいが
、分岐範囲が異なる点と実行サイクルが(b) よりも
(c) の方が速い点である。 (b)  相対距離の範囲が長い相対分岐命令(相対距
離−32768バイト〜+32767 バイト以内命令
コードサイズ:3バイト実行サイクル:遅い) (c)  アドレス空間をある単位で分割した一つの分
割単位であるバンク内への絶対分岐命令(1バンク64
Kバイト命令コードサイズ:3バイト実行サイクル:速
い)
Next, the optimization processing section 109 to which control has been transferred
The detailed processing will be explained by taking as an example the case where the instruction group described in Example (2) of [Prior Art] exists as a branch instruction. Of these, (b) and (c) are relevant in the optimization process in the linker. (b)
The difference between (c) and (c) is that although the instruction code size is exactly the same, the branch range is different and the execution cycle is faster in (c) than in (b). (b) Relative branch instruction with a long range of relative distance (relative distance -32768 bytes to +32767 bytes or less Instruction code size: 3 bytes Execution cycle: slow) (c) One division unit in which the address space is divided into certain units Absolute branch instruction into bank (1 bank 64
KB instruction code size: 3 bytes Execution cycle: fast)

【0027】また、最適化情報入力部111 が入
力する最適化可能性情報301 の構成を図3に示す。 図2の補正タイプ203 に相当するフィールドは最適
化可能タイプ303 が設定されている。また、補正サ
イズ304 は、分岐命令の命令コードサイズ3バイト
なので「3」が設定されている。なお、302 は補正
アドレス、305 は参照シンボル、および306 は
定数値である。
FIG. 3 shows the structure of the optimization possibility information 301 inputted by the optimization information input section 111. The field corresponding to the correction type 203 in FIG. 2 is set to the optimizable type 303. Further, the correction size 304 is set to "3" because the instruction code size of the branch instruction is 3 bytes. Note that 302 is a correction address, 305 is a reference symbol, and 306 is a constant value.

【0028】以下、図4に示す流れ図に従って、最適化
処理の詳細を説明する。まず、最適化情報入力部111
 、最適化可能性情報301 のなかから、補正アドレ
ス302 と、参照シンボル305 と、定数値306
 とを読み出す (ステップ401)。最適化判断部1
12は、読み出した参照シンボル305 の最終的な確
定アドレスを、既にシンボル解決部で修正処理を行った
シンボルから取り出す (ステップ402)。次に、取
り出したシンボル値に定数値306 を加えて分岐先ア
ドレスを確定する (ステップ403)。そして、分岐
先アドレスの属するバンクと補正アドレス302 の属
するバンクとが等しいかを調べる (ステップ404)
。バンクが等しいかはアドレスの下位16ビットをマス
クした値を比較することによって調べられる。等しけれ
ば命令変換部113 でバンク内分岐命令(c) のオ
ブジェクトを生成して、出力部110 から出力し (
ステップ405)、等しくなければ元の相対分岐命令の
オブジェクトをそのまま出力部110 から出力する 
(ステップ406)。
The details of the optimization process will be explained below according to the flowchart shown in FIG. First, the optimization information input section 111
, the correction address 302 , the reference symbol 305 , and the constant value 306 from the optimization possibility information 301
(Step 401). Optimization judgment unit 1
12 extracts the final fixed address of the read reference symbol 305 from the symbol that has already been corrected by the symbol resolution unit (step 402). Next, a constant value 306 is added to the retrieved symbol value to determine the branch destination address (step 403). Then, it is checked whether the bank to which the branch destination address belongs and the bank to which the correction address 302 belongs are equal (step 404).
. Whether the banks are equal is checked by comparing the masked values of the lower 16 bits of the address. If they are equal, the instruction conversion unit 113 generates an object for intra-bank branch instruction (c), and outputs it from the output unit 110 (
Step 405), if they are not equal, the object of the original relative branch instruction is output as is from the output unit 110.
(Step 406).

【0029】図5にリンカがリンク処理とともに最適化
処理を行った結果、どの分岐命令が変換されたかを示す
。分岐命令503 が、図6のアセンブラの最適化では
(b) の相対分岐命令であったものから、(c) の
バンク内分岐命令に変更される。
FIG. 5 shows which branch instructions are converted as a result of the linker performing optimization processing along with link processing. In the assembler optimization of FIG. 6, the branch instruction 503 is changed from the relative branch instruction (b) to the intra-bank branch instruction (c).

【0030】以上の処理により、最適化可能性情報30
1 を入力することによって、命令コードサイズを変更
することなく、実行サイクルの速い分岐命令に変換して
オブジェクトを出力することが可能となる。
Through the above processing, the optimization possibility information 30
By inputting 1, it is possible to convert the instruction code into a branch instruction with a faster execution cycle and output the object without changing the instruction code size.

【0031】[0031]

【発明の効果】以上説明したように、本発明は、リンカ
において、最適化可能性情報を入力し、結合、配置処理
を行った後のアブソリュートな分岐元アドレスと分岐先
アドレスから実行サイクルの速い分岐命令の分岐範囲に
入るかを判断し、範囲に入ったならばそちらの命令コー
ドを出力することによって、命令コードサイズを変更す
ることなく、実行サイクルの速いオブジェクトを出力す
るので、速度性能のよりよいオブジェクトを提供できる
効果がある。
[Effects of the Invention] As explained above, the present invention enables a linker to input optimization possibility information, and to obtain a fast execution cycle from the absolute branch source address and branch destination address after performing combination and placement processing. By determining whether the branch instruction is within the branch range and outputting the instruction code if it is within the range, an object with a fast execution cycle is output without changing the instruction code size, improving speed performance. This has the effect of providing better objects.

【0032】特に、本発明によれば、リロケータブルア
センブラまたはコンパイラで、利用者が分岐先への距離
を意識しなくてもよいように分岐命令の最適化処理を行
ったために、実行サイクルの遅い分岐命令が多数出力さ
れてしまった場合に、リンカで最適化をすることよって
、実行サイクルの速い分岐命令に変換してオブジェクト
の性能を向上することができ、リロケータブルアセンブ
ラ、コンパイラ、リンカを通して、このような複数種類
の分岐命令を持つハードウェアの命令セットの特徴を十
分活かしたオブジェクトを出力することができ、その効
果は大である。
In particular, according to the present invention, a branch instruction with a slow execution cycle is When a large number of instructions are output, optimization with the linker can improve the performance of the object by converting them to branch instructions with faster execution cycles. It is possible to output an object that takes full advantage of the characteristics of the hardware instruction set, which has multiple types of branch instructions, which is very effective.

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

【図1】  本発明の一実施例を示すブロック構成図。FIG. 1 is a block configuration diagram showing an embodiment of the present invention.

【図2】  そのコード補正情報の構成図。FIG. 2 is a configuration diagram of the code correction information.

【図3】  その最適化可能性情報の構成図。FIG. 3 is a configuration diagram of the optimization possibility information.

【図4】  その最適化処理部の処理手順を示す流れ図
FIG. 4 is a flowchart showing the processing procedure of the optimization processing section.

【図5】  そのリンカ処理後の分岐命令の最適化の一
例を示す説明図。
FIG. 5 is an explanatory diagram showing an example of optimization of branch instructions after linker processing.

【図6】  従来例によるアセンブラ処理後の分岐命令
の最適化の一例を示す説明図。
FIG. 6 is an explanatory diagram showing an example of optimization of branch instructions after assembler processing according to a conventional example.

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

101     リロケータブルオブジェクト102 
    リンカ処理部 103     オブジェクト 104     入力部 105     結合部 106     配置部 107     シンボル解決部 108     コード補正部 109     最適化処理部 110     出力部 111     最適化情報入力部 112     最適化判断部 113     命令変換部 201     コード補正情報 202 、302     補正アドレス203   
  補正タイプ 204 、304     補正サイズ205 、30
5     参照シンボル206 、306     
定数値 301     最適化可能性情報 303     最適化可能タイプ 401 〜406     ステップ
101 Relocatable object 102
Linker processing section 103 Object 104 Input section 105 Combining section 106 Placement section 107 Symbol resolution section 108 Code correction section 109 Optimization processing section 110 Output section 111 Optimization information input section 112 Optimization judgment section 113 Instruction conversion section 201 Code correction information 202 , 302 Correction address 203
Correction type 204, 304 Correction size 205, 30
5 Reference symbols 206, 306
Constant value 301 Optimizability information 303 Optimizable type 401 to 406 Steps

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】  リロケータブルオブジェクトを入力す
る入力部と、モジュールの結合を行う結合部と、結合さ
れたモジュールをアドレス空間に配置する配置部と、シ
ンボルの参照関係の解決および配置時に決定されたアド
レスの修正を行うシンボル解決部と、リロケータブルな
命令コードをアブソリュートな値に補正するコード補正
部と、補正後のオブジェクトを出力する出力部とを含む
リンカ処理部を備えたプログラム作成装置において、前
記リンカ処理部は、命令コードサイズは等しいが実行サ
イクルの遅い分岐命令のコードが出ているという情報と
そのコードが出ているアドレス情報と分岐先アドレス情
報とを入力する最適化情報入力部と、入力した前記情報
と前記シンボル解決部で既に値が決定されたシンボル値
とにより結合および配置処理を行い当該命令コードが実
行サイクルの速い方の分岐範囲に入るかを判断する最適
化判断部と、実行サイクルの速い方の分岐範囲に入ると
判断された場合に前記命令コードをその命令コードに変
換し前記出力部に対して出力する命令変換部とを含むこ
とを特徴とするプログラム作成装置。
Claim 1: An input section for inputting relocatable objects, a coupling section for coupling modules, a placement section for locating the coupled modules in an address space, and an address determined at the time of resolution and placement of symbol reference relationships. A program creation device comprising a linker processing section including a symbol resolution section that corrects a relocatable instruction code to an absolute value, a code correction section that corrects a relocatable instruction code to an absolute value, and an output section that outputs a corrected object. The processing unit includes an optimization information input unit that inputs information that a branch instruction code having the same instruction code size but a slow execution cycle is issued, address information from which the code is issued, and branch destination address information; an optimization determination unit that performs a combination and placement process using the information obtained by the above-described information and the symbol value whose value has already been determined by the symbol resolution unit, and determines whether the instruction code falls within a branch range with a faster execution cycle; A program creation device comprising: an instruction conversion unit that converts the instruction code into the instruction code and outputs the instruction code to the output unit when it is determined that the cycle falls within a faster branch range.
JP10677591A 1991-04-10 1991-04-10 Program producing device Pending JPH04312122A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10677591A JPH04312122A (en) 1991-04-10 1991-04-10 Program producing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10677591A JPH04312122A (en) 1991-04-10 1991-04-10 Program producing device

Publications (1)

Publication Number Publication Date
JPH04312122A true JPH04312122A (en) 1992-11-04

Family

ID=14442282

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10677591A Pending JPH04312122A (en) 1991-04-10 1991-04-10 Program producing device

Country Status (1)

Country Link
JP (1) JPH04312122A (en)

Similar Documents

Publication Publication Date Title
EP1559012B1 (en) Method and apparatus for performing validation of program code conversion
JPH11242597A (en) Method for generation of flow graph of java byte code data
US5964861A (en) Method for writing a program to control processors using any instructions selected from original instructions and defining the instructions used as a new instruction set
US6175935B1 (en) Software debugging method and recording medium to which debugging program has been recorded
JPH09114676A (en) Program conversion method for microcomputer and microcomputer using the program
JP3047771B2 (en) Branch instruction processing method and apparatus
US8176361B2 (en) Data processing with protection against soft errors
JPH04312122A (en) Program producing device
JPH01118931A (en) Program conversion system
JPS5826584B2 (en) data processing equipment
JPH10320212A (en) Cache optimizing method
US8312432B2 (en) Method of adjusting timing difference between pre-corrected source program and post-corrected source program, compiler and information processor
JPH08234997A (en) Register allocation method
JP2956591B2 (en) Method and apparatus for parallelizing a loop having a conditional jump out of the loop
JPH05134880A (en) Digital computer
JPH06202903A (en) Cpu simulation and cpu simulator
JPH07192034A (en) Interpreter type simulation method
KR0169908B1 (en) Back-end of compiler using intermediate codes and tis method for generating assembly codes
JP2003022180A (en) Microcomputer and its operating method
JPH0588908A (en) Object output system for cross compiler
JPH09171467A (en) Emulation device and method therefor
JP2002323981A (en) Method and device for adjusting number of performance steps of object program, and recording medium with program stored
JP2005228047A (en) Language processing device and language processing program
JP2003186940A (en) Logical verification device
JPH0426748B2 (en)