JPH09288581A - Device and method for generating object - Google Patents

Device and method for generating object

Info

Publication number
JPH09288581A
JPH09288581A JP9841596A JP9841596A JPH09288581A JP H09288581 A JPH09288581 A JP H09288581A JP 9841596 A JP9841596 A JP 9841596A JP 9841596 A JP9841596 A JP 9841596A JP H09288581 A JPH09288581 A JP H09288581A
Authority
JP
Japan
Prior art keywords
branch
syntax
branch destination
determination
index table
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP9841596A
Other languages
Japanese (ja)
Other versions
JP3599888B2 (en
Inventor
Yutaka Ota
裕 太田
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP9841596A priority Critical patent/JP3599888B2/en
Publication of JPH09288581A publication Critical patent/JPH09288581A/en
Application granted granted Critical
Publication of JP3599888B2 publication Critical patent/JP3599888B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30061Multi-way branch instructions, e.g. CASE

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To improve the efficiency of an object code for the mechanical instruction of multi-branch judgement syntax in a high-grade language. SOLUTION: Prescribed information is collected by a multi-branch judgement syntax information collecting means 1, it is judged by a branch destination table preparation judging means 3 whether or not a branch destination table is to be prepared by the collected information, and it is judged by an index table preparation judging means 5 whether or not an index table is to be prepared by the information collected by the multi-branch judgement syntax information collecting means 1. Concerning the multi-branch judgement syntax for which the preparation of the index table is judged, an optimizing processing means 7 performs optimizing processing so as to stepwisely show the branch destinations with the branch destination table for registering only the mutually different branch destinations among the branch destinations of respective branches of the multi-branch judgement syntax and the index table showing the indexes of branch destinations of the respective branches in this multi-branch judgement syntax.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、コンピュータシス
テムにて用いられるオブジェクト生成装置及びその方法
に関し、特に、多分岐判断構文を有する高級言語を機械
命令(オブジェクト)に変換する際に、オブジェクト効
率を向上させることのできるオブジェクト生成装置及び
その方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an object generation apparatus and method used in a computer system, and more particularly, to object efficiency when converting a high-level language having a multi-branch judgment syntax into machine instructions (objects). The present invention relates to an object generation apparatus and method that can be improved.

【0002】[0002]

【従来の技術】高級言語の多分岐判断構文のオブジェク
ト生成については従来からコンパイラで様々な方法が試
みられている。数学的には、多分岐の比較の対象となる
定数の値をすべて集めて一つの集合とすると、ある変数
に格納された値がその集合の中の一つに一致しているか
どうかを調べる問題は、検索アルゴリズムに帰着する。
検索にはさまざまな数学的アルゴリズムが存在するた
め、検索に対応する機械命令を出力する多分岐判断構文
のオブジェクト生成も、さまざまな方式が考えられる。
2. Description of the Related Art Conventionally, various methods have been attempted by a compiler for object generation of a high-level language multi-branch decision syntax. Mathematically, if all the values of constants that are the targets of multi-branch comparison are collected into one set, the problem of checking whether the value stored in a variable matches one of the sets Results in a search algorithm.
Since various mathematical algorithms exist for retrieval, various methods can be considered for object generation of a multi-branch decision syntax that outputs a machine instruction corresponding to the retrieval.

【0003】検索のアルゴリズムを多分岐判断構文のオ
ブジェクト生成に応用する場合、検索の結果、変数に格
納された値が集合の中にあったかどうかの情報の他に、
分岐すべき分岐先アドレスの情報も得られるような機械
命令を出力しなければならない。
When the search algorithm is applied to the object generation of the multi-branch judgment syntax, in addition to the information as to whether the value stored in the variable is in the set as a result of the search,
A machine instruction must be output so that information on the branch destination address to be branched can be obtained.

【0004】検索と分岐先アドレスの決定の両方を同時
に行い、実行速度効率、オブジェクト効率の両方を損な
わない機械命令を出力するため、従来では多分岐判断構
文のオブジェクトを生成する際の最適化処理の方法とし
て、比較命令と条件分岐命令をすべて出力する方法(以
下、比較命令列を用いた最適化処理と記す)や、範囲を
限定して分岐先テーブルを出力する方法(以下、分岐先
テーブルを用いた最適化処理と記す)といったものが利
用されている。各分岐の比較の対象となる定数が連続し
た整数値である場合は、範囲を限定して分岐先テーブル
を出力する方法の方がより効率的な機械命令を出力する
ことが出来る。
Conventionally, an optimization process for generating an object having a multi-branch decision syntax is performed in order to perform both the search and the determination of the branch destination address at the same time and output a machine instruction that does not impair both the execution speed efficiency and the object efficiency. As a method of outputting all comparison instructions and conditional branch instructions (hereinafter referred to as optimization processing using a comparison instruction sequence) or a method of outputting a branch destination table with a limited range (hereinafter referred to as branch destination table). Is used as an optimization process) is used. When the constant to be compared in each branch is a continuous integer value, the method of outputting the branch destination table by limiting the range can output a more efficient machine instruction.

【0005】一般的なオブジェクト生成装置のブロック
図を図4に示す。このオブジェクト生成装置は、高級言
語100に記述された字句の置き換えを行うマクロ展開
部210と、高級言語100の文法の解析を行う構文解
析部220と、この解析された高級言語100から高級
言語の種類に依存しないコードである中間コードを生成
する中間コード生成部230と、この生成された中間コ
ードの各種の最適化を行う中間コード最適部240と、
この最適化された中間コードからアセンブラコード(機
械命令)を生成するアセンブラコード生成部250と、
この生成されたアセンブラコードをオブジェクトコード
(機械語)300に翻訳するアセンブラコードコンパイ
ル部260と、を備えるものである。
A block diagram of a general object generation apparatus is shown in FIG. This object generation apparatus includes a macro expansion unit 210 that replaces a lexical phrase described in a high-level language 100, a syntax analysis unit 220 that analyzes a grammar of the high-level language 100, and a high-level language from the analyzed high-level language 100. An intermediate code generation unit 230 that generates an intermediate code that is a type-independent code; an intermediate code optimization unit 240 that performs various optimizations of the generated intermediate code;
An assembler code generation unit 250 that generates an assembler code (machine instruction) from the optimized intermediate code;
An assembler code compiling unit 260 for translating the generated assembler code into an object code (machine language) 300.

【0006】ここで、中間コード最適化部240におけ
る最適化処理には、上述した多分岐判断構文の最適化処
理が含まれる。この多分岐判断構文とは、所定の条件に
より分岐する先が2以上の構文であり、代表的なものと
して、ある整数型の変数に格納された値により、指定さ
れた定数と一致した場合にその定数ラベルへ分岐する構
文であるC言語のswitch文を挙げることができ
る。以下、多分岐判断構文として、C言語のswitc
h文を例に取りC言語からのオブジェクトの生成方法に
ついて説明する。
Here, the optimization processing in the intermediate code optimization unit 240 includes the above-described optimization processing of the multi-branch judgment syntax. This multi-branch judgment syntax is a syntax that branches to two or more according to a predetermined condition. As a typical example, when the value stored in a certain integer type variable matches a specified constant, An example is a C language switch statement, which is a syntax for branching to the constant label. Hereafter, as a multi-branch judgment syntax, C language switchc
A method of generating an object from the C language will be described taking the h sentence as an example.

【0007】まず、比較命令列を用いた最適化処理につ
いて説明する。この最適化処理は、最も簡潔な方法で、
整数型の変数に格納された値を、指定されたすべての定
数と次々に比較して行き、一致した場合にその定数ラベ
ルの実行式文に相当する機械命令列へ分岐するような機
械命令を出力する方法である。指定されたどの定数も一
致しなかった場合はdefaultラベルの実行式文に
相当する機械命令列へ分岐するような機械命令を出力す
る。この比較命令列を用いた最適化処理は中間コード生
成部230にて行われる中間コードの生成の過程で行っ
てもよいが(すなわち、最適化処理として取り扱わずに
中間コードの生成処理として取り扱うこともできる
が)、ここでは以下の説明の便宜上最適化処理として取
り扱う。
First, the optimization process using the comparison instruction sequence will be described. This optimization process is the simplest method,
The value stored in the integer type variable is compared with all the specified constants one after another, and if they match, the machine instruction that branches to the machine instruction sequence corresponding to the execution statement of the constant label is executed. This is the method of output. If none of the specified constants match, a machine instruction for branching to the machine instruction sequence corresponding to the execution statement of the default label is output. The optimization process using the comparison instruction sequence may be performed in the process of generating the intermediate code performed by the intermediate code generation unit 230 (that is, it is handled as the intermediate code generation process instead of the optimization process). However, for convenience of explanation below, it will be treated as an optimization process.

【0008】この比較命令列を用いた最適化処理にて最
適化された中間コードについてのアセンブラコードの典
型例を以下に示す。
A typical example of the assembler code for the intermediate code optimized by the optimization process using this comparison instruction sequence is shown below.

【0009】tst rw10 jz,L0 cp rw10,1 jz,L1 cp rw10,2 jz,L2 jL3 L0:機械命令列0 L1:機械命令列1 L2:機械命令列2 L3:機械命令列3 この出力機械命令の性能については次のようになる。整
数型の変数に格納された値が、指定された定数を確率的
に均等に取り得るものと仮定すると、switch文に
入ってから一致した定数ラベルへ分岐までに要する平均
実行時間は、 (Tbcc* n)/2 である。但し、Tbccは比較命令と条件分岐命令の2
命令に要する実行時間、nは指定された定数ラベルの総
個数である。
Tst rw10 jz, L0 cp rw10,1 jz, L1 cp rw10,2 jz, L2 jL3 L0: machine instruction sequence 0 L1: machine instruction sequence 1 L2: machine instruction sequence 2 L3: machine instruction sequence 3 This output machine The instruction performance is as follows. Assuming that the values stored in the integer type variables can take the specified constants stochastically evenly, the average execution time required to branch to the matching constant label after entering the switch statement is (Tbcc * n) / 2. However, Tbcc is 2 of comparison instruction and conditional branch instruction.
The execution time required for an instruction, n is the total number of designated constant labels.

【0010】また、一致した定数ラベルへ分岐する処理
に対応する部分の機械命令の静的なオブジェクトサイズ
は、 (Sbcc* n)+Sbra である。但し、Sbccは比較命令と条件分岐命令の2
命令の命令長、Sbraは無条件分岐の命令長である。
従って、平均実行時間、静的オブジェクトサイズともに
nの増加に伴なって増加する。
The static object size of the machine instruction of the part corresponding to the process of branching to the matched constant label is (Sbcc * n) + Sbra. However, Sbcc is 2 of comparison instruction and conditional branch instruction.
The instruction length of the instruction, Sbra, is the instruction length of the unconditional branch.
Therefore, both the average execution time and the static object size increase as n increases.

【0011】図5に示すC言語のswitch文につい
て、比較命令列を用いた最適化処理方法でオブジェクト
生成を行った結果を図6に示した。
FIG. 6 shows the result of object generation for the C language switch statement shown in FIG. 5 by the optimization processing method using the comparison instruction sequence.

【0012】次に、分岐先テーブルを用いた最適化処理
について説明する。指定された定数が連続している場合
には、分岐先テーブルを作成し、そのテーブルを参照す
る機械命令を出力するこの最適化処理が利用できる。
Next, the optimization process using the branch destination table will be described. When the specified constants are continuous, this optimization process of creating a branch destination table and outputting a machine instruction that refers to the table can be used.

【0013】まず、整数型の変数に格納された値が、指
定された定数の中の最小値と最大値の間に含まれている
かを調べる命令列を出力する。その間に含まれない場合
は、defaultラベルの実行式文に相当する機械命
令列へ分岐するような命令列を出力する。その間に含ま
れていた場合は、整数型の変数に格納された値から、指
定された定数の中の最小値を減算し、その結果の値をイ
ンデックスとして分岐先テーブルから対応する分岐先を
取り出す命令列を出力する。
First, an instruction string for checking whether the value stored in the integer type variable is included between the minimum value and the maximum value of the designated constants is output. If it is not included between them, the instruction sequence that branches to the machine instruction sequence corresponding to the execution statement of the default label is output. If it is included between them, the minimum value in the specified constant is subtracted from the value stored in the integer type variable, and the corresponding branch destination is fetched from the branch destination table using the resulting value as an index. Output a sequence of instructions.

【0014】なお、インデックスとは、テーブルに格納
されたデータのうち、何番目のデータを示すかを意味す
る値である。又、分岐先テーブルには、指定された定数
の中の最小値とそれぞれのインデックスを加えた値に相
当する定数ラベルへの分岐先アドレスが格納されている
データの列である。
The index is a value indicating which number of data is stored in the table. The branch destination table is a column of data in which the branch destination address to the constant label corresponding to the value obtained by adding the minimum value of the designated constants and the respective indexes is stored.

【0015】この分岐先テーブルを用いた最適化処理に
て最適化された中間コードについてのアセンブラコード
の典型例を以下に示す。
A typical example of the assembler code for the intermediate code optimized by the optimization process using this branch destination table is shown below.

【0016】S50000: dw L0−L50000 dw L1−L50000 dw L2−L50000 cp rw10,2 j ugt,L3 ld rw10,(rw10* 2+S50000) L50000:tjp rw10 L0:機械命令列0 L1:機械命令列1 L2:機械命令列2 L3:機械命令列3 上記のS0ラベルは、分岐先テーブルの先頭アドレスを
示す。分岐先テーブルには順番に、定数0,1,2,に
対応する定数ラベルへの分岐先アドレスが格納されてい
る。
S50000: dw L0-L50000 dw L1-L50000 dw L2-L50000 cp rw10,2 j ugt, L3 ld rw10, (rw10 * 2 + S50000) L50000: tjp rw10 L0: machine instruction sequence 1 L2: : Machine instruction sequence 2 L3: Machine instruction sequence 3 The S0 label indicates the start address of the branch destination table. In the branch destination table, branch destination addresses to constant labels corresponding to constants 0, 1, 2 are stored in order.

【0017】この出力機械命令の性能については次のよ
うになる。整数型の変数に格納された値が、指定された
定数を確率的に均等に取り得るものと仮定すると、sw
itch文に入ってから一致した定数ラベルへ分岐まで
に要する平均実行時間は、 Tbcc+Tld+Tjmp である。但し、Tbccは比較命令と条件分岐命令の2
命令に要する実行時間、Tldは分岐先テーブルからア
ドレスデータをロードするのに要する時間、Tjmpは
PC相対分岐に要する時間である。
The performance of this output machine instruction is as follows. Assuming that the values stored in the integer type variables can take the specified constants stochastically, sw
The average execution time required from the entry of the hit statement to the branch to the matched constant label is Tbcc + Tld + Tjmp. However, Tbcc is 2 of comparison instruction and conditional branch instruction.
The execution time required for the instruction, Tld is the time required to load the address data from the branch destination table, and Tjmp is the time required for the PC relative branch.

【0018】また、一致した定数ラベルへ分岐する処理
に対応する部分の機械命令の静的なオブジェクトサイズ
は、 Sbcc+Sld+Sjmp+(Saddr* n) である。但し、Sbccは比較命令と条件分岐命令の2
命令の命令長、Sldは分岐先テーブルからアドレスデ
ータをロードする命令の命令長、SjmpはPC相対分
岐命令の命令長、Saddrは分岐先アドレスに必要な
バイト数で、(Saddr* n)は分岐先テーブルのデ
ータサイズを表す。
The static object size of the machine instruction corresponding to the process of branching to the matched constant label is Sbcc + Sld + Sjmp + (Saddr * n). However, Sbcc is 2 of comparison instruction and conditional branch instruction.
The instruction length of the instruction, Sld is the instruction length of the instruction that loads the address data from the branch destination table, Sjmp is the instruction length of the PC relative branch instruction, Saddr is the number of bytes required for the branch destination address, and (Saddr * n) is the branch Indicates the data size of the destination table.

【0019】図6に示すC言語のswitch文につい
て、分岐先テーブルを用いた最適化処理方法でオブジェ
クト生成を行った結果を図7に示した。
FIG. 7 shows the result of object generation for the C language switch statement shown in FIG. 6 by the optimization processing method using the branch destination table.

【0020】[0020]

【発明が解決しようとする課題】しかしながら、従来の
多分岐判断構文のオブジェクト生成方法においては、出
力機械命令の動的実行速度効率の向上を重点においてき
たため、出力機械命令のオブジェクト効率の向上が不十
分である。とくに分岐先テーブルを出力する場合、すべ
ての分岐についての分岐先アドレスのテーブルを出力す
るのは、オブジェクトサイズが増加する恐れがある。
However, in the conventional object generation method of the multi-branch decision syntax, the emphasis is placed on the improvement of the dynamic execution speed efficiency of the output machine instruction. Therefore, the improvement of the object efficiency of the output machine instruction is achieved. Is insufficient. Particularly when outputting the branch destination table, outputting the table of the branch destination addresses for all the branches may increase the object size.

【0021】多分岐判断構文の例として、図8のような
C言語のswitch文を取り上げ、分岐先テーブルを
用いて最適化処理を行った結果を図9に示す。図8のよ
うに分岐の数が多いにも関わらず、分岐先の種類の数が
少ない場合であっても、インデックスを各々持つため、
オブジェクトの効率が悪かった。例えば、オブジェクト
を格納するための装置(メモリ装置等)の容量に制限が
ある等の理由の出力機械命令のオブジェクト効率を重視
する場合は、従来のオブジェクト生成方法だけでは不十
分であった。
As an example of the multi-branch judgment syntax, a switch statement in C language as shown in FIG. 8 is taken, and the result of optimization processing using the branch destination table is shown in FIG. Even if the number of types of branch destinations is small, even though the number of branches is large as shown in FIG.
The object was inefficient. For example, when the object efficiency of the output machine instruction is emphasized because the capacity of the device (memory device or the like) for storing the object is limited, the conventional object generation method alone is insufficient.

【0022】本発明は上記事情に鑑みて成されたもので
あり、その目的とするところは、高級言語の多分岐判断
構文のコンパイル結果である機械命令のオブジェクトコ
ードの効率を図ることのできるオブジェクト生成装置及
びその方法を提供することにある。
The present invention has been made in view of the above circumstances, and an object thereof is an object capable of improving the efficiency of an object code of a machine instruction which is a compilation result of a multi-branch judgment syntax of a high-level language. It is to provide a generation device and a method thereof.

【0023】[0023]

【課題を解決するための手段】上記目的を達成するた
め、第1の発明の特徴は、高級言語から生成された中間
コードに対して最適化を行う中間コード最適化部と、こ
の最適化された中間コードから生成されたアセンブラコ
ードのコンパイルを行いオブジェクトコードを生成する
アセンブラコードコンパイル部とを備えたオブジェクト
コード生成装置において、前記中間コード最適化部は、
多分岐判断構文の中間コードに対し、前記多分岐判断構
文の各分岐の分岐先のうち、互いに異なる分岐先のみが
登録される分岐先テーブルと、前記多分岐判断構文の各
分岐の分岐先のインデックスが登録されるインデックス
テーブルと、を具備させ、前記分岐先を段階的に示すよ
うにすることである。ここで、前記中間コード最適化部
は、前記多分岐判断構文に関する情報を収集する多分岐
判断構文情報収集手段と、この多分岐判断構文情報収集
手段にて収集された情報により分岐先テーブルを作成す
るか否かの判断を行う分岐先テーブル作成判断手段と、
この分岐先テーブル作成判断手段にて分岐先テーブルを
作成すると判断された多分岐判断構文に対し、前記多分
岐判断構文情報収集手段にて収集された情報によりイン
デックステーブルを作成するか否かの判断を行うインデ
ックステーブル作成判断手段と、このインデックステー
ブル作成判断手段にてインデックステーブルを作成する
と判断された多分岐判断構文に対して、前記多分岐判断
構文の各分岐の分岐先のうち、互いに異なる分岐先のみ
が登録される分岐先テーブルと、前記多分岐判断構文の
各分岐の分岐先のインデックスを示すインデックステー
ブルと、により分岐先を段階的に示すように最適化処理
を行う第1の最適化処理手段と、を備えることが好まし
い。
To achieve the above object, the features of the first invention are an intermediate code optimizing unit for optimizing an intermediate code generated from a high-level language, and And an assembler code compiling unit that compiles an assembler code generated from the intermediate code to generate an object code, wherein the intermediate code optimizing unit includes:
With respect to the intermediate code of the multi-branch judgment syntax, among the branch destinations of the respective branches of the multi-branch judgment syntax, only branch destination tables different from each other are registered, and a branch destination of each branch of the multi-branch judgment syntax. And an index table in which indexes are registered so that the branch destination is indicated step by step. Here, the intermediate code optimizing unit creates a branch destination table based on the multi-branch judgment syntax information collecting means for collecting information on the multi-branch judgment syntax and the information collected by the multi-branch judgment syntax information collecting means. Branch destination table creation determination means for determining whether or not to do,
With respect to the multi-branch determination syntax determined to create the branch destination table by the branch destination table creation determination means, it is determined whether the index table is created based on the information collected by the multi-branch determination syntax information collection means. And a multi-branch determination syntax determined to create an index table by the index table creation determination means for performing the branch table different from the branch destination of each branch of the multi-branch determination syntax. A first optimization in which an optimization process is performed so as to show the branch destination stepwise by a branch destination table in which only the destination is registered and an index table showing the index of the branch destination of each branch of the multi-branch determination syntax. And a processing means.

【0024】また、前記分岐先テーブル作成判断手段に
て分岐先テーブルを作成しないと判断された多分岐判断
構文に対して比較命令列を用いた最適化処理を行う第2
の最適化処理手段と、前記インデックステーブル作成判
断手段にてインデックステーブルを作成しないと判断さ
れた多分岐判断構文に対して分岐先テーブルを用いた最
適化処理を行う第3の最適化処理手段と、をさらに備え
ることが好ましい。
Further, the branch destination table creation determining means performs an optimization process using a comparison instruction sequence for the multi-branch determination syntax determined not to create the branch destination table.
Optimization processing means, and third optimization processing means for performing optimization processing using the branch destination table for the multi-branch determination syntax determined not to create an index table by the index table creation determination means. It is preferable to further include

【0025】上記目的を達成するため、第2の発明の特
徴は、高級言語から生成された中間コードに対して最適
化を行い、この最適化された中間コードから生成された
アセンブラコードのコンパイルを行いオブジェクトコー
ドを生成するオブジェクトコード生成方法において、前
記最適化の際に、多分岐判断構文の中間コードに対し、
前記多分岐判断構文の各分岐の分岐先のうち、互いに異
なる分岐先のみが登録された分岐先テーブルと、前記多
分岐判断構文の各分岐の分岐先のインデックスが登録さ
れるインデックステーブルと、を具備させ、前記分岐先
を段階的に示すようにする最適化処理を行うことであ
る。
To achieve the above object, a feature of the second invention is that optimization is performed on intermediate code generated from a high-level language, and assembler code generated from this optimized intermediate code is compiled. In the object code generation method for generating an object code by performing the optimization, for the intermediate code of the multi-branch judgment syntax,
Among the branch destinations of each branch of the multi-branch determination syntax, only a branch destination table different from each other is registered, and an index table in which the index of the branch destination of each branch of the multi-branch determination syntax is registered. That is, the optimization processing is performed so that the branch destination is shown stepwise.

【0026】ここで、前記最適化の際に多分岐判断構文
の中間コードに対し、前記多分岐判断構文に関する情報
を収集する多分岐判断構文情報収集ステップと、この多
分岐判断構文情報収集ステップにて収集された情報によ
り分岐先テーブルを作成するか否かの判断を行う分岐先
テーブル作成判断ステップと、この分岐先テーブル作成
判断ステップにて分岐先テーブルを作成すると判断され
た多分岐判断構文に対し、前記多分岐判断構文情報収集
ステップにて収集された情報によりインデックステーブ
ルを作成するか否かの判断を行うインデックステーブル
作成判断ステップと、このインデックステーブル作成判
断ステップにてインデックステーブルを作成すると判断
された多分岐判断構文に対して、前記多分岐判断構文の
各分岐の分岐先のうち、互いに異なる分岐先のみが登録
される分岐先テーブルと、前記多分岐判断構文の各分岐
の分岐先のインデックスを示すインデックステーブルと
を具備させ分岐先を段階的に示すようにする最適化処理
を行う最適化処理ステップと、を含むことが好ましい。
Here, a multi-branch judgment syntax information collecting step for collecting information on the multi-branch judgment syntax for the intermediate code of the multi-branch judgment syntax at the time of the optimization, and a multi-branch judgment syntax information collecting step. The branch destination table creation determination step that determines whether or not to create the branch destination table based on the information collected by the branch destination table and the multi-branch determination syntax that is determined to create the branch destination table in this branch destination table creation determination step On the other hand, an index table creation determination step of determining whether to create an index table based on the information collected in the multi-branch determination syntax information collection step, and a determination of creating an index table in this index table creation determination step The multi-branch judgment syntax that has been An optimization process for providing a branch destination stepwise by providing a branch destination table in which only different branch destinations are registered and an index table showing an index of the branch destination of each branch of the multi-branch judgment syntax It is preferable to include the optimization processing step of performing

【0027】[0027]

【発明の実施の形態】以下、本発明に係るオブジェクト
生成装置及びその方法の実施の形態について、図面を参
照しながら説明する。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiments of an object generating apparatus and method according to the present invention will be described below with reference to the drawings.

【0028】第1の実施形態 図1は本実施形態に係るオブジェクト生成装置のブロッ
ク図を示したものである。このオブジェクト生成装置
は、図4にて説明した中間コード最適化部240のう
ち、多分岐判断構文最適化部241の構成を示したもの
である。この多分岐判断構文最適化部241は、多分岐
判断構文に関する情報を収集する多分岐判断構文情報収
集手段1と、この多分岐判断構文情報収集手段1にて収
集された情報により分岐先テーブルを作成するか否かの
判断を行う分岐先テーブル作成判断手段3と、この分岐
先テーブル作成判断手段3にて分岐先テーブルを作成す
ると判断された多分岐判断構文に対し、多分岐判断構文
情報収集手段1にて収集された情報によりインデックス
テーブルを作成するか否かの判断を行うインデックステ
ーブル作成判断手段5と、このインデックステーブル作
成判断手段5にてインデックステーブルを作成すると判
断された多分岐判断構文に対して、多分岐判断構文の各
分岐の分岐先のうち、互いに異なる分岐先のみが登録さ
れる分岐先テーブルと、前記多分岐判断構文の各分岐の
分岐先のインデックスを示すインデックステーブルと、
により分岐先を段階的に示すように最適化処理を行う最
適化処理手段7と、を備えるものである。
First Embodiment FIG. 1 is a block diagram of an object generating apparatus according to this embodiment. This object generation device shows the configuration of the multi-branch decision syntax optimization unit 241 in the intermediate code optimization unit 240 described in FIG. The multi-branch decision syntax optimizing unit 241 creates a branch destination table based on the multi-branch decision syntax information collecting means 1 for collecting information on the multi-branch decision syntax information and the information collected by the multi-branch decision syntax information collecting means 1. Multi-branch decision syntax information collection for branch destination table creation determination means 3 for determining whether or not to create, and multi-branch decision syntax information for which the branch destination table creation determination means 3 determines to create a branch destination table An index table creation judging means 5 for judging whether or not to create an index table based on the information collected by the means 1, and a multi-branch judgment syntax judged to create the index table by the index table creation judging means 5. On the other hand, among the branch destinations of each branch of the multi-branch judgment syntax, only the branch destination table different from each other is registered, and And index table indicating an index of a branch destination of the branch of a multi-branch decision syntax,
The optimization processing means 7 for performing the optimization processing so that the branch destination is indicated stepwise.

【0029】多分岐判断構文情報収集手段1は、以降の
各手段における判断に用いるための各種の情報を収集す
る。ここで、情報とは、例えば、分岐判断構文の定数ラ
ベルの総数や、その各ラベルの定数値に関するものであ
る。分岐先テーブル作成判断手段3は、分岐先テーブル
を作成するか否かの判断を行う。ここで、この判断は、
従来のオブジェクト生成装置でも様々な方法が試みられ
ているが、基本的な基準としては、オブジェクト効率優
先の機械命令を出力したければ、 {(Sbcc* n)+Sbra}−{Sbcc+Sld
+Sjmp+(Saddr* n)}=(Sbcc−Sa
ddr)* n−(Sbcc+Sld+Sjmp−Sbr
a) の正負によって分岐先テーブルを作成するか否かを決定
できる。また、実行速度効率優先の機械命令を出力した
ければ、 {(Tbcc* n)/2}−{Tbcc+Tld+Tj
mp} の正負によって分岐先テーブルを作成するか否かの判断
を行うことができる。
The multi-branch judgment syntax information collecting means 1 collects various kinds of information to be used for judgment in each of the following means. Here, the information is, for example, the total number of constant labels of the branch determination syntax or the constant value of each label. The branch destination table creation determination means 3 determines whether to create a branch destination table. Here, this judgment is
Various methods have been tried in the conventional object generation device, but as a basic criterion, if a machine instruction with object efficiency priority is to be output, {(Sbcc * n) + Sbra}-{Sbcc + Sld
+ Sjmp + (Saddr * n)} = (Sbcc-Sa
ddr) * n- (Sbcc + Sld + Sjmp-Sbr
Whether or not to create the branch destination table can be determined by the sign of a). Further, if it is desired to output a machine instruction of execution speed efficiency priority, {(Tbcc * n) / 2}-{Tbcc + Tld + Tj
Whether or not the branch destination table is created can be determined based on whether the mp} is positive or negative.

【0030】インデックステーブル作成判断手段5は、
分岐先テーブルを作成すると判断された多分岐判断構文
に対して、多分岐判断構文情報収集手段1にて収集され
た情報によりインデックステーブルを作成するか否かの
判断を行う。
The index table creation judging means 5 is
With respect to the multi-branch determination syntax determined to create the branch destination table, it is determined whether to create the index table based on the information collected by the multi-branch determination syntax information collecting means 1.

【0031】ここで、多分岐判断構文にて指定された定
数ラベルのうち、複数の定数ラベルが同じ分岐先アドレ
スをもつ場合は、分岐先テーブルに登録される分岐先ア
ドレスの中に同じデータが現れることになる。次のよう
なswitch文を例にして説明を行う。
Here, if a plurality of constant labels have the same branch destination address among the constant labels designated by the multi-branch determination syntax, the same data is stored in the branch destination addresses registered in the branch destination table. Will appear. The following switch statement will be described as an example.

【0032】 switch(num){ case0:case2:case4: 実行式文0; case1:case3:case5: 実行式文1; default: 実行式文D; } まず、これを従来の分岐先テーブルを用いた方法で機械
命令を出力すると次のようになる。
Switch (num) {case0: case2: case4: execution expression statement 0; case1: case3: case5: execution expression statement 1; default: execution expression statement D;} First, a conventional branch destination table is used. The machine command output by the method is as follows.

【0033】S50000: dw L0−L50000 dw L1−L50000 dw L0−L50000 dw L1−L50000 dw L0−L50000 dw L1−L50000 cp rw10,5 j ugt,LD ld rw10,(rw10* 2+S50000) L50000:tjp rw10 L0:機械命令列0 L1:機械命令列1 LD:機械命令列D この出力機械命令の性能はすでに述べたように静的オブ
ジェクトサイズは、 Sbcc+Sld+Sjmp+(Saddr* n) であり、平均実行時間は、 Tbcc+Tld+Tjmp である。上記の場合、分岐先テーブルには2種類の分岐
先アドレスしかない。
[0033] S50000: dw L0-L50000 dw L1-L50000 dw L0-L50000 dw L1-L50000 dw L0-L50000 dw L1-L50000 cp rw10,5 j ugt, LD ld rw10, (rw10 * 2 + S50000) L50000: tjp rw10 L0 : Machine instruction sequence 0 L1: Machine instruction sequence 1 LD: Machine instruction sequence D As for the performance of this output machine instruction, the static object size is Sbcc + Sld + Sjmp + (Saddr * n), and the average execution time is Tbcc + Tld + Tjmp. Is. In the above case, the branch destination table has only two types of branch destination addresses.

【0034】次に、分岐先テーブル及びインデックステ
ーブルを用いた最適化処理により、分岐先テーブルは2
種類の分岐先テーブルだけのテーブルとし、各定数ラベ
ルに対するテーブルとしては、分岐先テーブルへのイン
デックスを登録したテーブルへの参照を利用するようし
た場合には、出力機械命令は次のようになる。
Next, the branch destination table is converted into 2 by the optimization processing using the branch destination table and the index table.
If only a branch destination table of a type is used and a reference to a table in which an index to the branch destination table is registered is used as a table for each constant label, the output machine instruction will be as follows.

【0035】cp rw10,5 j ugt,LD ld rb10,(rw10+S50001) extz rw10 ld rw10,(rw10* 2+S50000) L50000:tjp rw10 S50001: db0 db1 db0 db1 db0 db1 S50000: dw L0−L50000 dw L1−L50000 L0:機械命令列0 L1:機械命令列1 LD:機械命令列D この出力機械命令の性能は次のようになる。静的オブジ
ェクトサイズは、 Sbcc+Sld+Sldb+Sjmp+(Sddr*
kind)+n である。但し、Sldbはインデックステーブルから1
バイトデータをロードする命令の命令長、kindは定
数ラベルの分岐先のうち、異なった分岐先の種類を示す
数である。分岐先の種類が255以下ならばインデック
スの値は1バイトで済むため、オブジェクトサイズは指
定された定数ラベルの数と1バイトを掛けたものとな
る。平均実行時間は、 Tbcc+Tld+Tldb+Tjmp である。但し、Tldbはインデックステーブルから1
バイトデータをロードする命令に要する実行時間であ
る。
[0035] cp rw10,5 j ugt, LD ld rb10, (rw10 + S50001) extz rw10 ld rw10, (rw10 * 2 + S50000) L50000: tjp rw10 S50001: db0 db1 db0 db1 db0 db1 S50000: dw L0-L50000 dw L1-L50000 L0 : Machine instruction sequence 0 L1: Machine instruction sequence 1 LD: Machine instruction sequence D The performance of this output machine instruction is as follows. Static object size is Sbcc + Sld + Sldb + Sjmp + (Sddr *
kind) + n. However, Sldb is 1 from the index table.
The instruction length of the instruction for loading the byte data, kind, is a number indicating a different branch destination type among the branch destinations of the constant label. If the type of branch destination is 255 or less, the value of the index is 1 byte, so the object size is the number of specified constant labels times 1 byte. The average execution time is Tbcc + Tld + Tldb + Tjmp. However, Tldb is 1 from the index table.
This is the execution time required for an instruction to load byte data.

【0036】分岐先テーブルのみを用いた場合と分岐先
テーブル及びインデックステーブルを用いた場合の性能
について比較して見ると、(分岐先テーブルのみの場合
の実行時間)−(分岐先テーブル及びインデックステー
ブルを用いた場合の実行時間)であるから、={Tbc
c+Tld+Tldb+Tjmp}−{Tbcc+Tl
d+Tjmp}=Tldbとなり、実行時間ではわずか
に悪くなるが、この値は定数ラベルの数や、異なった分
岐先の種類などに依存しない。オブジェクトサイズで
は、 (分岐先テーブルを用いた最適化処理のオブジェクトサイズ)−(分岐先テー ブル及びインデックステーブルを用いた最適化処理のオブジェクトサイズ) ={Sbcc+Sld+Sldb+Sjmp+(Saddr* kind)+n} −{Sbcc+Sld+Sjmp+(Saddr* n)} =Sldb+kind−(Saddr−1)* (n−kind) となる。これは正にも負にもなり得るが、kindに比
べてnが非常に大きい場合はnが大きければ大きいほど
オブジェクトサイズが削減されることになる。
Comparing the performances when using only the branch destination table and when using the branch destination table and the index table, (execution time when only the branch destination table)-(branch destination table and index table) = (Tbc)
c + Tld + Tldb + Tjmp}-{Tbcc + Tl
d + Tjmp} = Tldb, which slightly deteriorates in execution time, but this value does not depend on the number of constant labels or the types of different branch destinations. In the object size, (object size of optimization process using branch destination table)-(object size of optimization process using branch destination table and index table) = {Sbcc + Sld + Sldb + Sjmp + (Saddr * kind) + n}-{Sbcc + Sld + Sjmp + (Saddr * n)} = Sldb + kind- (Saddr-1) * (n-kind). This can be positive or negative, but if n is much larger than kind, the larger n is, the smaller the object size will be.

【0037】(分岐先テーブルのみの場合のオブジェク
トサイズ)<(分岐先テーブル及びインデックステーブ
ルを用いた場合のオブジェクトサイズ)となる条件をk
indについて解くと、 kind<{(Saddr−1)* n−Sldb}/S
addr という解を得る。分岐先の種類kindが、定数ラベル
の総数nに対して上式の条件を満たす場合、分岐先テー
ブルのみのような機械命令を出力した方がオブジェクト
サイズが有利になる。
The condition of (object size in case of only branch destination table) <(object size in case of using branch destination table and index table) is k
Solving for ind, kind <{(Saddr-1) * n-Sldb} / S
We get the solution of addr. When the kind of branch target kind satisfies the condition of the above expression with respect to the total number n of constant labels, it is more advantageous for the object size to output the machine instruction only for the branch target table.

【0038】最適化処理手段7は、インデックステーブ
ル作成判断手段5にてインデックステーブルを作成する
と判断された多分岐判断構文に対して分岐先テーブル及
びインデックステーブルを用いた最適化処理を行う。以
下、この分岐先テーブル及びインデックステーブルを用
いた最適化処理を説明する。
The optimization processing means 7 performs the optimization processing using the branch destination table and the index table for the multi-branch determination syntax determined by the index table creation determination means 5 to create the index table. The optimization process using the branch destination table and the index table will be described below.

【0039】多分岐判断構文の例として、図8に示した
のようなC言語のswitch文を取り上げ、本手段に
より最適化処理を行った結果を図3に示す。図示の如
く、多分岐判断構文の各分岐の分岐先のうち、互いに異
なる分岐先のみが登録される分岐先テーブルと、多分岐
判断構文の各分岐の分岐先のインデックスが登録される
インデックステーブルとにより分岐先を段階的に示すよ
うにしてある。このような最適化処理を行うことで、所
定の場合にはオブジェクトのサイズを小さくすることが
できるのである。
As an example of the multi-branch judgment syntax, the C language switch statement as shown in FIG. 8 is taken and the result of the optimization processing by this means is shown in FIG. As shown in the figure, among branch destinations of each branch of the multi-branch judgment syntax, only branch destinations different from each other are registered, and an index table in which indexes of branch destinations of each branch of the multi-branch judgment syntax are registered. The branch destination is indicated stepwise by. By performing such optimization processing, the size of the object can be reduced in a predetermined case.

【0040】本実施形態によれば、自動的に分岐先テー
ブル及びインデックステーブルを用いた場合のオブジェ
クト生成装置及びその方法を実施することにより、オブ
ジェクト効率の向上が実現する。
According to this embodiment, the object efficiency is improved by automatically implementing the object generating apparatus and the method when the branch destination table and the index table are used.

【0041】また、本実施形態のオブジェクト生成装置
はC言語のswitch文だけでなく、多分岐判断構文
をもつ言語のコンパイラで使用することができる。
The object generating apparatus of this embodiment can be used not only in the C language switch statement but also in a language compiler having a multi-branch judgment syntax.

【0042】第2の実施形態 上記第1の実施形態においては、インデックステーブル
を作成すると判断された多分岐判断構文のみに対して最
適化のための処理を行う説明を行ったが、分岐先テーブ
ル作成判断手段3及びインデックステーブル作成判断手
段5の判断によって最適化処理の内容を変えるようにす
ることもできる。この場合の処理のフローチャートを図
2に示す。このフローチャートを用いて本実施形態に係
るオブジェクト生成装置の動作を説明する。
Second Embodiment In the first embodiment described above, the description is given of the process for optimizing only the multi-branch judgment syntax determined to create the index table. It is also possible to change the contents of the optimization process according to the judgments of the creation judgment means 3 and the index table creation judgment means 5. A flowchart of the processing in this case is shown in FIG. The operation of the object generation device according to the present embodiment will be described using this flowchart.

【0043】まず、定数ラベルの総数と各ラベルの定数
値の情報収集を行う(ステップS101)。続いて、こ
の情報収集により、分岐先テーブルの作成が可能か否か
の判断を行う(ステップS102)。この判断は、上述
の分岐先テーブル作成判断手段3で説明したような手法
により判断を行うことができる。これにより、分岐先テ
ーブルの作成を行うと判断しない場合には、比較命令列
を用いた最適化処理を行う(ステップS103)。この
最適化処理の説明は上述したので、ここでは省略する。
First, information on the total number of constant labels and the constant value of each label is collected (step S101). Then, it is determined whether or not the branch destination table can be created by this information collection (step S102). This judgment can be made by the method described in the branch destination table creation judging means 3 described above. Accordingly, if it is not determined that the branch destination table is created, the optimization process using the comparison instruction sequence is performed (step S103). Since the description of this optimization processing has been given above, it is omitted here.

【0044】続いて、分岐先テーブルの作成が可能と判
断された場合には、多分岐判断構文のラベルと分岐先の
対応付けを行う(ステップS104)。この対応付けに
より、分岐先の種類の個数を調べてインデックステーブ
ルの作成が可能か否かの判断を行う(ステップS10
5)。この判断は、上述のインデックステーブル作成判
断手段5で説明したような手法により判断を行うことが
できる。これにより、分岐先テーブルの作成を行うと判
断しない場合には、分岐先テーブルを用いた最適化処理
を行う(ステップS106)。この最適化処理の説明は
上述したので、ここでは省略する。
Subsequently, when it is determined that the branch destination table can be created, the label of the multi-branch determination syntax is associated with the branch destination (step S104). With this association, the number of types of branch destinations is checked to determine whether the index table can be created (step S10).
5). This judgment can be made by the method described in the index table creation judging means 5 described above. Thus, if it is not determined that the branch destination table is created, the optimization processing using the branch destination table is performed (step S106). Since the description of this optimization processing has been given above, it is omitted here.

【0045】続いて、インデックステーブルの作成が可
能と判断された場合には、分岐先テーブル及びインデッ
クステーブルを用いた最適化処理を行う(ステップS1
07)。
Subsequently, when it is judged that the index table can be created, an optimization process using the branch destination table and the index table is performed (step S1).
07).

【0046】このように、本実施形態によれば、自動的
に最適なオブジェクトを生成することができる。また、
本実施形態では高級言語の多分岐判断構文の最適化が強
力になるため、出力機械命令のオブジェクト効率が向上
する。
As described above, according to this embodiment, the optimum object can be automatically generated. Also,
In this embodiment, the optimization of the multi-branch decision syntax of the high-level language becomes strong, so that the object efficiency of the output machine instruction is improved.

【0047】これにより、コンパイラの出力結果の機械
命令をROMに記録した場合、ROMの使用量が削減で
きるなどの利点がある。
As a result, when the machine instruction output from the compiler is recorded in the ROM, there is an advantage that the amount of ROM used can be reduced.

【0048】[0048]

【発明の効果】以上説明してきたように、本発明に係る
オブジェクト生成装置及びその方法によれば、高級言語
の多分岐判断構文のコンパイル結果である機械命令のオ
ブジェクトコードの効率を図ることができる。
As described above, according to the object generating apparatus and the method thereof according to the present invention, the efficiency of the object code of the machine instruction which is the compilation result of the multi-branch judgment syntax of the high-level language can be improved. .

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

【図1】本発明に係るオブジェクト生成装置の多分岐判
断構文最適化部を示すブロック図である。
FIG. 1 is a block diagram showing a multi-branch decision syntax optimization unit of an object generation device according to the present invention.

【図2】本発明に係るオブジェクト生成方法の多分岐判
断構文最適化の処理フローを示す図である。
FIG. 2 is a diagram showing a processing flow of multi-branch judgment syntax optimization of the object generation method according to the present invention.

【図3】図8のswitch文を本発明の方式でコンパ
イルした結果である。
FIG. 3 is a result of compiling the switch statement of FIG. 8 by the method of the present invention.

【図4】一般的なオブジェクト生成装置を示すブロック
図である。
FIG. 4 is a block diagram showing a general object generation device.

【図5】多分岐判断構文の一例であるC言語のswit
ch文である。
FIG. 5 is a C language switch that is an example of a multi-branch determination syntax.
It is a ch sentence.

【図6】図5のswitch文をCコンパイラでコンパ
イルした結果の一例である。
6 is an example of a result of compiling the switch statement of FIG. 5 with a C compiler.

【図7】図5のswitch文をCコンパイラでコンパ
イルした結果の一例である。
7 is an example of a result of compiling the switch statement of FIG. 5 with a C compiler.

【図8】本実施形態を説明するために用いた多分岐判断
構文である。
FIG. 8 is a multi-branch determination syntax used to describe the present embodiment.

【図9】図8のswitch文を従来の方式でコンパイ
ルした結果の一例である。
9 is an example of a result of compiling the switch statement of FIG. 8 by a conventional method.

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

1 多分岐判断構文情報収集手段 3 分岐先テーブル作成手段 5 インデックステーブル作成手段 7 最適化処理手段 11 中間コード 13 最適化済中間コード 100 高級言語 200 オブジェクトコード生成部 210 マクロ展開部 220 構文解析部 230 中間コード生成部 240 中間コード最適化部 241 多分岐判断構文最適化部 250 アセンブラコード生成部 260 アセンブラコードコンパイル部 300 オブジェクトコード 1 multi-branch determination syntax information collection means 3 branch destination table creation means 5 index table creation means 7 optimization processing means 11 intermediate code 13 optimized intermediate code 100 high-level language 200 object code generation section 210 macro expansion section 220 syntax analysis section 230 Intermediate code generation unit 240 Intermediate code optimization unit 241 Multi-branch decision syntax optimization unit 250 Assembler code generation unit 260 Assembler code compilation unit 300 Object code

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 高級言語から生成された中間コードに対
して最適化を行う中間コード最適化部と、 この最適化された中間コードから生成されたアセンブラ
コードのコンパイルを行いオブジェクトコードを生成す
るアセンブラコードコンパイル部とを備えたオブジェク
トコード生成装置において、 前記中間コード最適化部は、多分岐判断構文の中間コー
ドに対し、 前記多分岐判断構文の各分岐の分岐先のうち、互いに異
なる分岐先のみが登録される分岐先テーブルと、 前記多分岐判断構文の各分岐の分岐先のインデックスが
登録されるインデックステーブルと、 を具備させ、前記分岐先を段階的に示すようにする最適
化処理を行うことを特徴とするオブジェクト生成装置。
1. An intermediate code optimizing unit for optimizing intermediate code generated from a high-level language, and an assembler for compiling an assembler code generated from this optimized intermediate code to generate an object code. In the object code generation device including a code compiling unit, the intermediate code optimizing unit, with respect to the intermediate code of the multi-branch judgment syntax, among branch destinations of each branch of the multi-branch judgment syntax, only branch destinations different from each other A branch destination table in which is registered, and an index table in which the index of the branch destination of each branch of the multi-branch determination syntax is registered, and the optimization processing is performed so as to indicate the branch destination stepwise. An object generation device characterized by the above.
【請求項2】 前記中間コード最適化部は、 前記多分岐判断構文に関する情報を収集する多分岐判断
構文情報収集手段と、 この多分岐判断構文情報収集手段にて収集された情報に
より分岐先テーブルを作成するか否かの判断を行う分岐
先テーブル作成判断手段と、 この分岐先テーブル作成判断手段にて分岐先テーブルを
作成すると判断された多分岐判断構文に対し、前記多分
岐判断構文情報収集手段にて収集された情報によりイン
デックステーブルを作成するか否かの判断を行うインデ
ックステーブル作成判断手段と、 このインデックステーブル作成判断手段にてインデック
ステーブルを作成すると判断された多分岐判断構文に対
して、前記多分岐判断構文の各分岐の分岐先のうち、互
いに異なる分岐先のみが登録される分岐先テーブルと、
前記多分岐判断構文の各分岐の分岐先のインデックスを
示すインデックステーブルと、により分岐先を段階的に
示すように最適化処理を行う第1の最適化処理手段と、 を備えることを特徴とする請求項1記載のオブジェクト
生成装置。
2. The intermediate code optimizing unit collects information on the multi-branch judgment syntax, and multi-branch judgment syntax information collecting means, and a branch destination table based on the information collected by the multi-branch judgment syntax information collecting means. Branch destination table creation determination means for determining whether or not to create a branch destination table, and the multi-branch determination syntax information collection for the multi-branch determination syntax determined to create the branch destination table by the branch destination table creation determination means. Index table creation judging means for judging whether or not to create an index table based on the information collected by the means, and the multi-branch judgment syntax judged to create the index table by the index table creation judging means A branch destination table in which only different branch destinations are registered among the branch destinations of each branch of the multi-branch determination syntax,
An index table showing an index of a branch destination of each branch of the multi-branch determination syntax, and a first optimization processing means for performing an optimization process so as to show the branch destination stepwise by the index table. The object generation device according to claim 1.
【請求項3】 前記オブジェクト生成装置は、 前記分岐先テーブル作成判断手段にて分岐先テーブルを
作成しないと判断された多分岐判断構文に対して比較命
令列を用いた最適化処理を行う第2の最適化処理手段
と、 前記インデックステーブル作成判断手段にてインデック
ステーブルを作成しないと判断された多分岐判断構文に
対して分岐先テーブルを用いた最適化処理を行う第3の
最適化処理手段と、 をさらに備えることを特徴とする請求項2記載のオブジ
ェクト生成装置。
3. The object generation device performs an optimization process using a comparison instruction sequence for a multi-branch determination syntax determined by the branch destination table creation determination means not to create a branch destination table. Optimization processing means, and third optimization processing means for performing optimization processing using a branch destination table for the multi-branch determination syntax determined not to create an index table by the index table creation determination means. The object generating apparatus according to claim 2, further comprising:
【請求項4】 高級言語から生成された中間コードに対
して最適化を行い、この最適化された中間コードから生
成されたアセンブラコードのコンパイルを行いオブジェ
クトコードを生成するオブジェクトコード生成方法にお
いて、 前記最適化の際に、多分岐判断構文の中間コードに対
し、 前記多分岐判断構文の各分岐の分岐先のうち、互いに異
なる分岐先のみが登録された分岐先テーブルと、 前記多分岐判断構文の各分岐の分岐先のインデックスが
登録されるインデックステーブルと、 を具備させ、前記分岐先を段階的に示すようにする最適
化処理を行うことを特徴とするオブジェクト生成方法。
4. An object code generation method for optimizing an intermediate code generated from a high-level language and compiling an assembler code generated from this optimized intermediate code to generate an object code. At the time of optimization, for the intermediate code of the multi-branch decision syntax, among the branch destinations of each branch of the multi-branch decision syntax, a branch destination table in which only different branch destinations are registered, and the multi-branch decision syntax An object generation method, comprising: an index table in which an index of a branch destination of each branch is registered; and performing an optimization process for gradually indicating the branch destination.
【請求項5】 前記最適化の際に多分岐判断構文の中間
コードに対し、 前記多分岐判断構文に関する情報を収集する多分岐判断
構文情報収集ステップと、 この多分岐判断構文情報収集ステップにて収集された情
報により分岐先テーブルを作成するか否かの判断を行う
分岐先テーブル作成判断ステップと、 この分岐先テーブル作成判断ステップにて分岐先テーブ
ルを作成すると判断された多分岐判断構文に対し、前記
多分岐判断構文情報収集ステップにて収集された情報に
よりインデックステーブルを作成するか否かの判断を行
うインデックステーブル作成判断ステップと、 このインデックステーブル作成判断ステップにてインデ
ックステーブルを作成すると判断された多分岐判断構文
に対して、前記多分岐判断構文の各分岐の分岐先のう
ち、互いに異なる分岐先のみが登録される分岐先テーブ
ルと、前記多分岐判断構文の各分岐の分岐先のインデッ
クスを示すインデックステーブルとを具備させ分岐先を
段階的に示すようにする最適化処理を行う最適化処理ス
テップと、 を含むことを特徴とする請求項4記載のオブジェクト生
成方法。
5. A multi-branch judgment syntax information collecting step for collecting information on the multi-branch judgment syntax for an intermediate code of the multi-branch judgment syntax at the time of the optimization, and a multi-branch judgment syntax information collecting step. For the branch destination table creation determination step that determines whether to create a branch destination table based on the collected information, and the multi-branch determination syntax that is determined to create a branch destination table in this branch destination table creation determination step An index table creation determination step of determining whether to create an index table based on the information collected in the multi-branch determination syntax information collection step, and an index table creation determination step of determining an index table creation For the multi-branch decision syntax, An optimization process is performed in which a branch destination table in which only different branch destinations are registered and an index table indicating the index of the branch destination of each branch of the multi-branch determination syntax are provided to show the branch destination stepwise. The object generation method according to claim 4, further comprising: an optimization processing step.
JP9841596A 1996-04-19 1996-04-19 Object generation apparatus and method Expired - Lifetime JP3599888B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9841596A JP3599888B2 (en) 1996-04-19 1996-04-19 Object generation apparatus and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9841596A JP3599888B2 (en) 1996-04-19 1996-04-19 Object generation apparatus and method

Publications (2)

Publication Number Publication Date
JPH09288581A true JPH09288581A (en) 1997-11-04
JP3599888B2 JP3599888B2 (en) 2004-12-08

Family

ID=14219199

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9841596A Expired - Lifetime JP3599888B2 (en) 1996-04-19 1996-04-19 Object generation apparatus and method

Country Status (1)

Country Link
JP (1) JP3599888B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008102574A (en) * 2006-10-17 2008-05-01 Nomura Research Institute Ltd Program execution system
JP2009110113A (en) * 2007-10-26 2009-05-21 Mitsubishi Electric Corp Program converter, program, and program conversion method
WO2014132668A1 (en) * 2013-03-01 2014-09-04 株式会社 東芝 Branch decision structure optimization processing device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008102574A (en) * 2006-10-17 2008-05-01 Nomura Research Institute Ltd Program execution system
JP2009110113A (en) * 2007-10-26 2009-05-21 Mitsubishi Electric Corp Program converter, program, and program conversion method
WO2014132668A1 (en) * 2013-03-01 2014-09-04 株式会社 東芝 Branch decision structure optimization processing device
JP2014194759A (en) * 2013-03-01 2014-10-09 Toshiba Corp Processing apparatus for optimizing multiple branch decision syntax
US9715374B2 (en) 2013-03-01 2017-07-25 Kabushiki Kaisha Toshiba Multi-branch determination syntax optimization apparatus

Also Published As

Publication number Publication date
JP3599888B2 (en) 2004-12-08

Similar Documents

Publication Publication Date Title
JP2755154B2 (en) Program conversion processing device and program conversion processing method
US7784039B2 (en) Compiler, compilation method, and compilation program
US5606697A (en) Compiler system for language processing program
US5920723A (en) Compiler with inter-modular procedure optimization
JP3327818B2 (en) Program conversion device and recording medium
JPH11212797A (en) Program conversion method, program converter and medium for storing program conversion program
US5596732A (en) Method of optimizing instruction sequence of compiler
US7373641B2 (en) Method, computer unit and program for converting a program
JPH09288581A (en) Device and method for generating object
US8161466B2 (en) Method of pre-processing conditional region
US20040194073A1 (en) Optimization based on simulated linking
JP4019361B2 (en) Parallelization conversion system, parallelization conversion method, program, and compiler
JP2956591B2 (en) Method and apparatus for parallelizing a loop having a conditional jump out of the loop
JPH09160784A (en) Paralleled compiling system
JP2003067195A (en) Optimization compile method and optimization compile device
JP2001265605A (en) Instruction string optimization method for compiler, compiler device, recording medium and program
JPH05303500A (en) Pointer vectorizing system
JPH05324344A (en) Argument processing optimization method at the time of calling function
JP2827979B2 (en) Assembler processing apparatus and assembler processing method
JPH05189243A (en) Compiling processor for operation with condition
JP2555011B2 (en) Vector data processing method
JPH0342728A (en) Deciding system for reservation word
WO1997007452A1 (en) Programmable compiler
JPH0659904A (en) Method for analyzing term in program
JPH05313909A (en) Compiler system containing intermediate code line evolving function

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040518

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040720

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040831

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040915

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

Free format text: PAYMENT UNTIL: 20070924

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20080924

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20080924

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090924

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090924

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100924

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110924

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20110924

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120924

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120924

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130924

Year of fee payment: 9

EXPY Cancellation because of completion of term