JP3313859B2 - Redundant remover - Google Patents

Redundant remover

Info

Publication number
JP3313859B2
JP3313859B2 JP31328993A JP31328993A JP3313859B2 JP 3313859 B2 JP3313859 B2 JP 3313859B2 JP 31328993 A JP31328993 A JP 31328993A JP 31328993 A JP31328993 A JP 31328993A JP 3313859 B2 JP3313859 B2 JP 3313859B2
Authority
JP
Japan
Prior art keywords
cost
expression
operand
variable
detected
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.)
Expired - Fee Related
Application number
JP31328993A
Other languages
Japanese (ja)
Other versions
JPH07168719A (en
Inventor
宣輝 富永
旭 田中
旬子 入交
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.)
Panasonic Corp
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial Co 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 Panasonic Corp, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP31328993A priority Critical patent/JP3313859B2/en
Publication of JPH07168719A publication Critical patent/JPH07168719A/en
Application granted granted Critical
Publication of JP3313859B2 publication Critical patent/JP3313859B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、高級言語で書かれたソ
ースプログラムを機械語プログラムに翻訳するコンパイ
ラに備えられ、処理対象となるプログラムから冗長とな
る演算式を除去する冗長式除去装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a redundant expression removing apparatus provided in a compiler for translating a source program written in a high-level language into a machine language program, for removing redundant arithmetic expressions from a program to be processed. .

【0002】[0002]

【従来の技術】近年、C言語などの高級言語でプログラ
ムを記述し、プログラムの開発効率を高めることが盛ん
に行われている。これら高級言語で記述されたソースプ
ログラムは様々なコンパイラを使用することによってコ
ンピュータが理解可能な機械語プログラムに翻訳され
る。
2. Description of the Related Art In recent years, it has been actively practiced to write programs in a high-level language such as the C language to increase the efficiency of program development. The source programs described in these high-level languages are translated into machine language programs that can be understood by a computer by using various compilers.

【0003】コンパイラは、最終的に作成する機械語プ
ログラムの実行時間をより短く、メモリサイズをより小
さくするため(最終的に作成する機械語プログラムの実
行時間、あるいは、メモリサイズを一括してコストと呼
ぶ。)、プログラマか作成したソースプログラム、ある
いは、コンパイラが内部処理を行うために作成した中間
言語プログラムに対して様々な処理を施している。この
ようにコストを低減させる方法のひとつにプログラム中
から、冗長な演算式を削除する方法がある。このような
冗長な演算式(この演算式を冗長式と呼ぶ。)の削除を
行うため、従来のコンパイラは、様々な削除方法によっ
て冗長式の除去を行う冗長式除去装置を備えている。冗
長式除去装置について説明する前に、使用する用語につ
いて以下に定義する。 ・演算 例えば、100*x+2、x/200+yのように、変
数、定数、および演算子から構成されるプログラムのコ
ードをいう。 ・演算式 例えば、y=130、y=100*x+2、y=x/2
00+10のように、等号の左側に変数が存在し、また
右側に演算が存在する式である。 ・変数の定義 例えば、a=b+c、s=100*2のように、演算に
よって、変数の中身を設定することである。 ・変数の使用 演算の被演算子に変数を使用することである。 ・スタック変数 スタック領域のメモリ上に置く変数のことである。 ・静的変数 スタック領域外の特定のアドレスのメモリ上に置く変数
のことである。 ・レジスタ変数 レジスタ上に置く変数のことである。 第1に、共通部分式の削除を行う冗長式除去装置につい
て説明する。共通部分式の削除とは、全く同一の演算を
行う演算が、プログラム中に複数個存在する場合、それ
らのうちの1つだけを残して、他のものを全て削除する
処理をいう。図10は、共通部分式の削除を行う冗長式
除去装置の構成図である。
The compiler is designed to shorten the execution time of the machine language program finally created and reduce the memory size (the execution time of the machine language program finally created or the cost of the memory size is reduced collectively). Various processes are performed on a source program created by a programmer or an intermediate language program created by a compiler to perform internal processing. One of the methods for reducing costs in this way is to delete redundant arithmetic expressions from a program. In order to delete such a redundant operation expression (this operation expression is referred to as a redundant expression), a conventional compiler is provided with a redundant expression removing device for removing the redundant expression by various deletion methods. Before describing the redundant elimination device, the terms used are defined below. Operation This refers to a program code composed of variables, constants, and operators, for example, 100 * x + 2, x / 200 + y. Operational expressions For example, y = 130, y = 100 * x + 2, y = x / 2
An expression with variables on the left side of the equal sign and operations on the right side, such as 00 + 10. Definition of Variables To set the contents of variables by calculation, for example, a = b + c and s = 100 * 2. -Use of variables The use of variables as operands in operations. -Stack variables These are variables placed on the memory in the stack area. -Static variables These are variables that are stored in the memory at a specific address outside the stack area.・ Register variables Variables placed on registers. First, a redundant-type elimination device that deletes a common sub-expression will be described. Deletion of a common subexpression refers to a process of, when there are a plurality of operations performing exactly the same operation in a program, deleting all but one of them except for one of them. FIG. 10 is a configuration diagram of a redundant-type removing device that deletes a common sub-expression.

【0004】共通部分式の削除を行う冗長式除去装置
(図中の共通部分式の削除を行う装置)は、演算出現場
所検出部22と、結果使用場所検出部23と、被演算子
書き換え部24と、演算式除去部25と、処理対象保持
部26とで構成される。演算出現場所検出部22は、被
演算子が全く同一の演算を、処理対象保持部26に保持
されているプログラムから全て検出する。具体的には、
演算出現場所検出部22は、処理対象保持部26に保持
されているプログラム中の、全ての演算の演算子、被演
算子を比較し(被演算子が変数である場合、その変数の
中身を比較に用いる。)、被演算子が同一の演算を全て
検出する。検出後、演算出現場所検出部22は、その演
算が等号の右辺に存在する演算式の位置を、演算式除去
部25に通知する(この演算式を共通部分式と呼
ぶ。)。また、検出した演算によって定義される変数を
検出し、これらの変数で、第1番目に位置する変数(こ
の変数を指定変数と呼ぶ。)を被演算子書き換え部24
に出力し、2番目以降に位置する変数(これの変数を削
除変数と呼ぶ。)を結果使用場所検出部23に出力す
る。
A redundant expression elimination device for deleting a common sub-expression (a device for deleting a common sub-expression in the figure) includes an operation appearance location detection unit 22, a result usage location detection unit 23, and an operand rewriting unit. 24, an arithmetic expression removing unit 25, and a processing target holding unit 26. The operation appearance location detection unit 22 detects all operations having exactly the same operand from the program stored in the processing target storage unit 26. In particular,
The operation appearance location detection unit 22 compares the operators and operands of all the operations in the program stored in the processing target storage unit 26 (when the operand is a variable, the contents of the variable are compared). This is used for comparison.), And the operands detect all the same operations. After the detection, the calculation appearance location detection unit 22 notifies the calculation expression removal unit 25 of the position of the calculation expression whose calculation exists on the right side of the equal sign (this calculation expression is referred to as a common subexpression). In addition, variables defined by the detected operation are detected, and among these variables, the variable located at the first position (this variable is referred to as a designated variable) is read by the operand rewriting unit 24.
, And the variables located at the second and subsequent positions (these variables are called deletion variables) are output to the result use location detection unit 23.

【0005】結果使用場所検出部23は、前記演算出現
場所検出部22から削除変数を受け取り、削除変数が、
被演算子として用いられているような演算(この演算を
書き換え演算式と呼ぶ。)を検出して、検出した位置
を、被演算子書き換え部24に通知する。被演算子書き
換え部24は、演算出現場所検出部22から指定変数を
受け取り、結果使用場所検出部23から知らされた位置
の書き換え演算式で、被演算子として使用されている削
除変数を、指定変数に書き換える。
[0005] The result use location detection unit 23 receives the deletion variable from the calculation appearance location detection unit 22 and
An operation that is used as an operand (this operation is called a rewrite operation expression) is detected, and the detected position is notified to the operand rewrite unit 24. The operand rewriting unit 24 receives the specified variable from the operation appearance location detecting unit 22 and specifies the deleted variable used as the operand in the rewriting operation expression of the position notified from the result usage location detecting unit 23. Rewrite to a variable.

【0006】演算式除去部25は、演算出現場所検出部
22から知らされた位置の演算式を削除する。処理対象
保持部26は、処理対象となるプログラムを保持する。
尚、保持されるプログラムは、プログラマによって記述
されたソースコードで記述されていてもよいし、コンパ
イラが内部処理の都合上生成した内部コードで記述され
ていてもよい。
The operation expression removing unit 25 deletes the operation expression at the position notified from the operation appearance location detection unit 22. The processing target holding unit 26 holds a program to be processed.
The retained program may be described by a source code described by a programmer, or may be described by an internal code generated by a compiler for the sake of internal processing.

【0007】以上のように構成された共通部分式の除去
を行う冗長式除去装置が、図11に示すようなプログラ
ムに対して共通部分式の削除を行う。先ず、演算出現場
所検出部22が、矢符a1、a2、a3に示す演算を検
出する。次に結果使用場所検出部23が、削除変数であ
るx1、y1が被演算子として使用されている演算(図
中の矢符b1、b2に示す演算)を検出する。検出後、
被演算子書き換え部24は、矢符b1、b2の演算の被
演算子を、図12の矢符c1、c2のように指定変数x
に書き換える。その結果、このプログラムは、図12に
示すように書き換えられる。
[0007] The redundant-type elimination apparatus configured to remove the common sub-expression deletes the common sub-expression from the program shown in FIG. First, the operation appearance location detection unit 22 detects the operation indicated by the arrows a1, a2, and a3. Next, the result use location detection unit 23 detects an operation (operation indicated by arrows b1 and b2 in the figure) in which x1 and y1 that are deletion variables are used as operands. After detection,
The operand rewriting unit 24 converts the operands of the operations of the arrows b1 and b2 into the designated variable x as indicated by the arrows c1 and c2 in FIG.
Rewrite to As a result, this program is rewritten as shown in FIG.

【0008】第2に値の伝搬を行う冗長式除去装置につ
いて説明する。値の伝搬とは、演算で、被演算子として
使用されている変数を、同じ値を持つ変数あるいは定数
に書き換えて、その被演算子として使用されている変数
の演算式を、プログラム中から削除することである。図
13は、値の伝搬を行う冗長式除去装置の構成図であ
る。
[0008] Second, a description will be given of a redundant type removing apparatus for transmitting a value. Value propagation means that in an operation, a variable used as an operand is replaced with a variable or constant having the same value, and the operation expression of the variable used as the operand is deleted from the program. It is to be. FIG. 13 is a configuration diagram of a redundant-type removing device that propagates a value.

【0009】値の伝搬を行う冗長式除去装置(図中の値
の伝搬を行う装置)は、代入出現場所検出部32と、結
果使用場所検出部33と、被演算子書き換え部34と、
代入除去部35と、処理対象保持部36とで構成され
る。代入出現場所検出部32は、変数を定数に代入する
演算式、あるいは、変数に変数を代入する演算式を、処
理対象保持部36に保持されているプログラムから全て
検出し、演算式の位置を、代入除去部35に通知する。
更に検出した演算式によって定義される変数(この変数
をも削除変数と呼ぶ。)を検出して、被演算子書き換え
部34に出力する。また、上記の演算式で、等号の右辺
に存在する変数、定数(これらを指定代入数と呼ぶ。)
を被演算子書き換え部34に出力する。
The redundant expression elimination device that propagates the value (the device that propagates the value in the figure) includes a substitution occurrence location detection unit 32, a result use location detection unit 33, an operand rewriting unit 34,
It is composed of an assignment removing unit 35 and a processing target holding unit 36. The substitution occurrence location detection unit 32 detects all the arithmetic expressions for substituting variables into constants or the arithmetic expressions for substituting variables into variables from the program stored in the processing target storage unit 36, and determines the position of the arithmetic expression. , To the substitution removing unit 35.
Further, it detects a variable defined by the detected arithmetic expression (this variable is also referred to as a deleted variable) and outputs it to the operand rewrite unit 34. In the above equation, variables and constants existing on the right side of the equal sign (these are called designated substitution numbers)
Is output to the operand rewriting unit 34.

【0010】結果使用場所検出部33は、代入出現場所
検出部32から削除変数を受け取り、削除変数が、被演
算子として用いられているような演算(この演算を書き
換え演算式と呼ぶ。)を検出して、検出した位置を、被
演算子書き換え部34に通知する。被演算子書き換え部
34は、代入出現場所検出部32から指定代入数を受け
取り、結果使用場所検出部33から知らされた位置の書
き換え演算式で、被演算子として使用されている削除変
数を、指定代入数に書き換える。
The result use location detection unit 33 receives the deletion variable from the substitution appearance location detection unit 32, and performs an operation in which the deletion variable is used as an operand (this operation is called a rewrite operation expression). The detected position is notified to the operand rewriting unit 34. The operand rewrite unit 34 receives the designated number of substitutions from the substitution appearance location detection unit 32, and replaces the deletion variable used as the operand in the rewrite operation expression at the position notified from the result use location detection unit 33 with: Rewrite with the specified number of substitutions.

【0011】代入除去部35は、結果使用場所検出部3
3から知らされた位置の演算式を削除する。処理対象保
持部36は、処理対象保持部26と同様に、処理対象と
なるプログラムを保持する。以上のように構成された値
の伝搬を行う冗長式除去装置が、図14に示すようなプ
ログラムに対して値の伝搬を行う。先ず代入出現場所検
出部32が、矢符d1に示す演算式を検出し、次に結果
使用場所検出部33が、矢符e1、e2に示す演算を検
出する。検出後、被演算子書き換え部24は、矢符e
1、e2の演算の被演算子を、図15の矢符f1、f2
のように指定代入数4000に書き換える。その結果、
このプログラムは、図15に示すように書き換えられ
る。
The substitution removing unit 35 includes the result use place detecting unit 3.
3 deletes the arithmetic expression at the position notified. The processing target holding unit 36 holds a program to be processed, like the processing target holding unit 26. The redundant expression removing device configured to propagate a value configured as described above propagates a value to a program as shown in FIG. First, the substitution appearance location detection unit 32 detects the operation formula indicated by the arrow d1, and then the result use location detection unit 33 detects the operation indicated by the arrow e1, e2. After the detection, the operand rewriting unit 24 outputs an arrow e
The operands of the operations of e1 and e2 are represented by arrows f1 and f2 in FIG.
Is rewritten to the designated substitution number 4000. as a result,
This program is rewritten as shown in FIG.

【0012】[0012]

【発明が解決しようとする課題】しかしながら上記従来
技術によれば、共通部分式の削除および値の伝搬を行う
冗長式除去装置は、処理対象となる演算の被演算子が、
定数、レジスタ変数、スタック変数、静的変数の何れか
に該当するかを調べることなく被演算子の書き換えを行
っていたので、書き換えによってかえってコストが高く
なってしまうことがあるという問題点があった。
However, according to the above-mentioned prior art, a redundant expression elimination device for deleting a common sub-expression and propagating a value requires an operand of an operation to be processed,
Since the operand was rewritten without checking whether it was a constant, a register variable, a stack variable, or a static variable, there was a problem that the rewriting would actually increase the cost. Was.

【0013】また、ターゲットマシンのプロセッサが、
インデックスおよびオフセット付きの間接アドレス参
照、オフセット付きの間接アドレス参照等、アドレッシ
ングモードを使用することができる場合、コンパイラ
は、これらのアドレッシングモードを、有効に活用でき
るような演算の書き換えが行えないので、コストの低減
が充分に図れていないという問題点があった。
Further, the processor of the target machine is
If an addressing mode such as an indirect address reference with an index and an offset and an indirect address reference with an offset can be used, the compiler cannot rewrite an operation that can effectively utilize these addressing modes. There was a problem that the cost was not sufficiently reduced.

【0014】例えば、図11、図14に示したプログラ
ムで、変数xはスタック領域に置かれるスタック変数で
あり、変数x1、y1はレジスタ上に置かれるレジスタ
変数であるとする。一般にスタック変数は、スタック領
域のメモリをアクセスする必要があり、レジスタ変数よ
りコストが高い。そのため、レジスタ変数x1、y1が
使用されている演算をスタック変数xに書き換えると、
書き換えによってプログラム全体のコストは高くなるこ
ともある。また、機械語命令において、16ビット以上
の定数値を被演算子とする演算は、その被演算子を機械
語命令のオペランドに記述する必要があり、レジスタ、
メモリを被演算子とする演算に比べてコストが高いこと
が多い。そのため、図7の変数xを、16ビット以上の
定数値に書き換えた場合、書き換えによってプログラム
全体のコストは高くなることもある。
For example, in the programs shown in FIGS. 11 and 14, a variable x is a stack variable placed in a stack area, and variables x1 and y1 are register variables placed on registers. In general, stack variables require access to the memory in the stack area and are more expensive than register variables. Therefore, if the operation using the register variables x1 and y1 is rewritten to the stack variable x,
Rewriting can increase the cost of the entire program. In a machine language instruction, an operation using a constant value of 16 bits or more as an operand requires that the operand be described in the operand of the machine language instruction.
In many cases, the cost is higher than an operation using a memory as an operand. Therefore, when the variable x in FIG. 7 is rewritten to a constant value of 16 bits or more, the rewriting may increase the cost of the entire program.

【0015】また、図16(a)は、C言語のポインタ
変数を用いて、アドレスの計算を記述したプログラムの
一部であり、図16(b)は、これらの変数の資源割り
付けの結果である。また、ターゲットマシンのプロセッ
サは、2オペランド形式のプロセッサであるが、図16
(c)に示すようなアドレスレジスタ間接参照も行え
る。このようにアドレッシングモードを利用できるよう
な状況でも、コンパイラが行う書き換えは、2オペラン
ド形式のプロセッサに対する書き換えであり、図16
(c)のアドレッシングモードの機械語命令と対応させ
るように、演算を書き換えることはできない。そのた
め、コンパイラは、このようなアドレスレジスタ間接参
照を行う機械語命令を、機械語プログラムの翻訳の過程
において用いることはできず、その分だけプログラムの
コストは高くなる。
FIG. 16A shows a part of a program in which address calculation is described using pointer variables in C language, and FIG. 16B shows a result of resource allocation of these variables. is there. Although the processor of the target machine is a two-operand type processor, FIG.
Address register indirect reference as shown in FIG. As described above, even in a situation where the addressing mode can be used, the rewriting performed by the compiler is a rewriting for a two-operand type processor.
The operation cannot be rewritten to correspond to the machine language instruction in the addressing mode (c). Therefore, the compiler cannot use such a machine language instruction for performing indirect address register reference in the process of translating the machine language program, and the cost of the program increases accordingly.

【0016】本発明は、上記問題点に鑑み、演算の被演
算子を書き換える前に、その書き換えが有効であるか否
かを判定し、書き換えが有効であるならば、被演算子を
書き換え、書き換えによって不要となる演算式を除去
し、更にアドレッシングモードが、有効利用されるよう
に演算を書き換える冗長式除去装置を提供することを目
的とする。
In view of the above problems, the present invention determines whether rewriting is valid before rewriting an operand of an operation, and rewrites the operand if rewriting is valid. It is an object of the present invention to provide a redundant expression elimination device that eliminates an arithmetic expression that becomes unnecessary by rewriting and rewrites an operation so that the addressing mode is effectively used.

【0017】[0017]

【課題を解決するための手段】上記課題を解決するため
に本発明の冗長式除去装置は、コンパイラに備えられ、
プログラム保持手段に保持されているプログラムの演算
を書き換えて、書き換え後、冗長な演算式を除去する冗
長式除去装置であって、プログラム保持手段のプログラ
ムから演算子、被演算子が同一の演算を全て検出し、当
該演算によって定義されている全ての変数を検出して、
検出した演算と変数とを含む演算式の位置を記憶する演
算検出手段と、演算検出手段が検出した変数のうち2番
目以降に位置する変数が、被演算子として使用されてい
る演算を全て検出する被演算子検出手段と、演算式の型
と、演算式の型がこれらの型に該当する演算式のコスト
とを記憶するコスト記憶手段と、被演算子検出手段が検
出した演算式の型でコスト記憶手段を検索し、当該演算
式の型に対応するコストを取り出す第1のコスト取出手
段と、被演算子検出手段が検出した演算式の被演算子
に、演算検出手段が検出した変数のうち1番目に位置す
る変数を用いた場合の演算式の型でコスト記憶手段を検
索し、当該演算式の型に対応するコストを取り出す第2
のコスト取出手段と、第1のコスト取出手段が取り出し
たコストと、第2のコスト取出手段が取り出したコスト
とを比較する比較手段と、比較手段が比較した結果、第
2のコスト取出手段が取り出したコストが小さければ、
被演算子検出手段が検出した演算で、被演算子として使
用されている変数のプログラム中の位置を、演算検出手
段が1番目に検出した変数に書き換える書き換え手段
と、被演算子検出手段が検出した全ての演算中の変数
を、書き換え手段が書き換えた場合、被演算子検出手段
が検出した演算で被演算子として使用されていた変数
と、その変数が定義されていた演算とを含む演算式を、
プログラム中から除去する除去手段とを備えている。
In order to solve the above-mentioned problems, a redundant expression elimination apparatus according to the present invention is provided in a compiler,
A redundant expression eliminator for rewriting an operation of a program held in a program holding unit and removing a redundant operation expression after the rewriting, wherein a same operation is performed by the program of the program holding unit using the same operator and operand. Detect all, detect all variables defined by the operation,
An operation detecting means for storing the position of the operation expression including the detected operation and the variable, and the second and subsequent variables among the variables detected by the operation detecting means detect all the operations used as operands Operand detecting means, a type of an arithmetic expression, and cost storage means for storing the cost of the arithmetic expression corresponding to the type of the arithmetic expression, and a type of the arithmetic expression detected by the operand detecting means. The first cost extracting means for retrieving the cost corresponding to the type of the operation expression by searching the cost storage means, and the variable detected by the operation detecting means in the operand of the arithmetic expression detected by the operand detecting means. Out of the cost storage means by the type of the arithmetic expression in the case of using the variable located at the first position, and extracting the cost corresponding to the type of the arithmetic expression.
The cost taking means, the cost means taken out by the first cost taking means, and the cost means taken out by the second cost taking means, and the comparing means make a comparison. If the cost is small,
In the operation detected by the operand detection means, the rewriting means for rewriting the position of the variable used as the operand in the program with the variable detected first by the operation detection means, and the operand detection means If the rewriting means rewrites all the variables in the operation, the operation expression including the variable used as the operand in the operation detected by the operand detection means and the operation in which the variable was defined To
Removing means for removing from the program.

【0018】また、第1のコスト取出手段は、取り出し
たコストの総和を求め、第2のコスト取出手段は、取り
出したコストの総和を求めて、比較手段は、第1のコス
ト取出手段が求めたコストの総和と、第2のコスト取出
手段が求めたコストの総和とを比較してもよい。また、
比較手段は、第1のコスト取出手段が取り出した個別の
コストと、第2のコスト取出手段が取り出した個別のコ
ストとを比較してもよい。
Further, the first cost extracting means obtains the sum of the extracted costs, the second cost extracting means obtains the total of the extracted costs, and the comparing means obtains the total of the extracted costs. The total cost may be compared with the total cost obtained by the second cost extracting means. Also,
The comparing means may compare the individual costs extracted by the first cost extracting means with the individual costs extracted by the second cost extracting means.

【0019】[0019]

【0020】[0020]

【0021】た、コンパイラに備えられ、プログラム
保持手段に保持されているプログラムの演算を書き換え
て、書き換え後、冗長な演算式を除去する冗長式除去装
置であって、プログラム保持手段に保持されているプロ
グラムから、変数に定数を代入する演算式、及び、変数
に変数の値を代入する演算式を全て検出する演算式検出
手段と、演算式検出手段が検出した演算式の等号の左側
に存在する変数が、被演算子として使用される演算式を
プログラム保持手段から全て検出する被演算子検出手段
と、演算式の型と、演算式の型がこれらの型に該当する
演算式のコストとを記憶するコスト記憶手段と、被演算
子検出手段が検出した演算式の型でコスト記憶手段を検
索し、当該演算式の型に対応するコストを取り出す第1
のコスト取出手段と、被演算子検出手段が検出した演算
式の被演算子に、演算式検出手段が検出した変数のうち
1番目に位置する変数を用いた場合の演算式の型でコス
ト記憶手段を検索し、当該演算式の型に対応するコスト
を取り出す第2のコスト取出手段と、第1のコスト取出
手段が取り出したコストと、第2のコスト取出手段が取
り出したコストとを比較する比較手段と、第1のコスト
取出手段が取り出したコストと、第2のコスト取出手段
が検出したコストとを比較する比較手段と、比較手段が
比較した結果、第2のコスト取出手段が取り出したコス
トが小さければ、被演算子検出手段が検出した演算で被
演算子として使用されている変数のプログラム中の位置
を、演算式検出手段が検出した変数あるいは定数に書き
換える書き換え手段と、被演算子検出手段が検出した全
ての演算中の変数を、書き換え手段が書き換えた場合、
被演算子検出手段が検出した演算で被演算子として使用
されていた変数が等号の左側に存在する演算式であり、
かつ、演算式検出手段が検出した演算式を、プログラム
中から除去する除去手段とを備えている。
[0021] Also, provided to the compiler, it rewrites the operation of the program held in the program holding means, after rewriting, a redundant type removing apparatus for removing redundant operation expression is held in the program holding means An arithmetic expression that substitutes a constant for a variable, an arithmetic expression detection unit that detects all the arithmetic expressions that assign the value of a variable to a variable, and the left side of the equal sign of the arithmetic expression detected by the arithmetic expression detection unit The variables present in the operands detect the operands used as operands from the program holding means, and the types of the operands and the operands of the operands corresponding to these types. A cost storage unit that stores the cost and a cost storage unit that is searched by the type of the arithmetic expression detected by the operand detection unit, and fetches a cost corresponding to the type of the arithmetic expression.
And cost storage in the form of an arithmetic expression when the first variable of the variables detected by the arithmetic expression detection means is used as the operand of the arithmetic expression detected by the operand detection means. The second cost extracting means for retrieving the means and extracting the cost corresponding to the type of the arithmetic expression, the cost extracted by the first cost extracting means, and the cost extracted by the second cost extracting means are compared. The comparison unit compares the cost extracted by the first cost extraction unit with the cost detected by the second cost extraction unit, and the comparison unit compares the cost detected by the second cost extraction unit. If the cost is small, the rewriting means for rewriting the position in the program of the variable used as the operand in the operation detected by the operand detection means to the variable or constant detected by the arithmetic expression detection means And the case where the variable in all operations were detected operands detecting means, rewriting rewriting means,
The variable used as the operand in the operation detected by the operand detection means is an arithmetic expression present on the left side of the equal sign,
And a removing unit for removing, from the program, the arithmetic expression detected by the arithmetic expression detecting unit.

【0022】また、第1のコスト取出手段は、取り出し
たコストの総和を求め、第2のコスト取出手段は、取り
出したコストの総和を求めて、比較手段は、第1のコス
ト取出手段が求めたコストの総和と、第2のコスト取出
手段が求めたコストの総和とを比較するようにしてもよ
い。また、比較手段は、第1のコスト取出手段が取り出
した個別のコストと、第2のコスト取出手段が取り出し
た個別のコストとを比較するようにしてもよい。
Further, the first cost taking means finds the sum of the taken out costs, the second cost taking out means finds the total of the taken out costs, and the comparing means finds the sum of the taken out costs. The total sum of the costs obtained and the total sum of the costs obtained by the second cost extracting means may be compared. The comparing means may compare the individual costs extracted by the first cost extracting means with the individual costs extracted by the second cost extracting means.

【0023】[0023]

【0024】た、コンパイラに備えられ、プログラム
保持手段に保持されているプログラムの演算を書き換え
て、書き換え後、冗長な演算式を除去する冗長式除去装
置であって、プログラム保持手段のプログラムから、ポ
インタである変数が定義されている演算式を検出し、検
出した演算および変数が含まれる演算式の位置を記憶す
る演算検出手段と、演算検出手段が検出した変数が、被
演算子として使用されている演算式を全て検出する被演
算子検出手段と、1つの機械語命令で実行可能な演算式
であり、かつ、ポインタに使用される被演算子、インデ
ックスに使用される被演算子、およびオフセットに使用
される被演算子のうち、少なくとも2つの被演算子を含
むものの型と、当該演算式の型に対応する演算式のコス
トとを記憶するコスト記憶手段と、被演算子検出手段が
検出した演算式で、コスト記憶手段を検索し、当該演算
式に対応する演算式のコストを取り出す第1のコスト取
出手段と、被演算子検出手段が検出した演算式の被演算
子に、前記演算検出手段が検出した演算を当てはめた場
合の演算式の型で、コスト記憶手段を検索し、当該演算
式に対応するコストを取り出す第2のコスト取出手段
と、第1のコスト取出手段が取り出したコストと、第2
のコスト取出手段が取り出したコストとを比較する比較
手段と、比較手段が比較した結果、第2のコスト取出手
段が取り出したコストが小さければ、被演算子検出手段
が検出した演算式で、被演算子として使用されている変
数のプログラム中の位置を、演算検出手段が検出した演
算に書き換える書き換え手段と、被演算子検出手段が検
出した全ての演算式中の変数を、書き換え手段が書き換
えた場合、演算検出手段が検出した演算を含む演算式
を、プログラム中から除去する除去手段とを備えてい
る。
[0024] Also, provided to the compiler, it rewrites the operation of the program held in the program holding means, after rewriting, a redundant type removing apparatus for removing redundant arithmetic expression, the program in the program holding means An operation detecting means for detecting an operation expression in which a variable which is a pointer is defined, and storing the position of the operation expression including the detected operation and the variable, and using the variable detected by the operation detection means as an operand. Operand detection means for detecting all of the operation expressions being performed, an operation expression that can be executed by one machine language instruction, and is used for a pointer, an operand used for an index, And a type for storing the type of the operand including at least two of the operands used for the offset and the cost of the operation expression corresponding to the type of the operation expression. A first cost extracting means for searching the cost storage means with the arithmetic expression detected by the operand detection means and extracting the cost of the arithmetic expression corresponding to the arithmetic expression; A second cost extraction for retrieving the cost storage means and retrieving the cost corresponding to the arithmetic expression in the form of the arithmetic expression when the operation detected by the arithmetic detection means is applied to the operand of the detected arithmetic expression. Means, the cost taken out by the first cost taking out means, and the second cost taking out means.
The comparison means for comparing the cost extracted by the cost extraction means with the cost extraction means, and as a result of the comparison, if the cost extracted by the second cost extraction means is small, the operation expression The rewriting means rewrites the position in the program of the variable used as the operator to the operation detected by the operation detection means, and the rewriting means rewrites the variables in all the arithmetic expressions detected by the operand detection means. In this case, a removing means is provided for removing, from the program, an arithmetic expression including the arithmetic operation detected by the arithmetic detecting unit.

【0025】また、第1のコスト取出手段は、取り出し
たコストの総和を求め、第2のコスト取出手段は、取り
出したコストの総和を求めて、比較手段は、第1のコス
ト取出手段が求めたコストの総和と、第2のコスト取出
手段が求めたコストの総和とを比較するようにしてもよ
い。また、比較手段は、第1のコスト取出手段が取り出
した個別のコストと、第2のコスト取出手段が取り出し
た個別のコストとを比較するようにしてもよい。
Further, the first cost taking means finds the sum of the taken out costs, the second cost taking out means finds the total of the taken out costs, and the comparing means finds the sum of the taken out costs. The total sum of the costs obtained and the total sum of the costs obtained by the second cost extracting means may be compared. The comparing means may compare the individual costs extracted by the first cost extracting means with the individual costs extracted by the second cost extracting means.

【0026】[0026]

【0027】[0027]

【0028】[0028]

【0029】[0029]

【作用】上記の手段により本発明の冗長式除去装置にお
いて、プログラム保持手段のプログラムに対して、演算
検出手段が作動し、演算子、被演算子が同一の演算が全
て検出され、当該演算によって定義されている全ての変
数を検出されて、検出した演算と変数とを含む演算式の
位置が記憶される。演算検出手段が検出した変数のうち
2番目以降に位置する変数に対して、被演算子検出手段
が作動し、被演算子として使用されている演算が全て検
出される。コスト記憶手段には、演算式の型と、演算式
の型がこれらの型に該当する演算式のコストとが記憶さ
れ、当該コスト記憶手段に対して、第1のコスト取出手
段によって、被演算子検出手段が検出した演算式の型に
よる検索が行われ、当該演算式の型に対応するコストを
取り出される。またコスト記憶手段に対して、第2のコ
スト取出手段によって、被演算子検出手段が検出した演
算式の被演算子に、演算検出手段が検出した変数のうち
1番目に位置する変数を用いた場合の演算式の型で検索
が行われ、当該演算式の型に対応するコストを取り出さ
れる。取り出し後、第1のコスト取出手段が取り出した
コストと、第2のコスト取出手段が取り出したコストと
で、比較手段によって比較が行われる。比較手段が比較
した結果、第2のコスト取出手段が取り出したコストが
小さければ、被演算子検出手段が検出した演算で、被演
算子として使用されている変数のプログラム中の位置
が、書き換え手段によって、演算検出手段が1番目に検
出した変数に書き換えられる。被演算子検出手段が検出
した全ての演算中の変数を、書き換え手段が書き換えた
場合、被演算子検出手段が検出した演算で被演算子とし
て使用されていた変数と、その変数が定義されていた演
算とを含む演算式とが、除去手段によってプログラム中
から除去される。
According to the above-mentioned means, in the redundant expression elimination apparatus of the present invention, the operation detecting means operates on the program of the program holding means, and all the operations having the same operator and operand are detected. All the defined variables are detected, and the positions of the arithmetic expressions including the detected operations and the variables are stored. The operand detection means operates on the variables located after the second among the variables detected by the operation detection means, and all the operations used as the operands are detected. The cost storage means stores the types of the arithmetic expressions and the costs of the arithmetic expressions corresponding to the types of the arithmetic expressions, and the cost storage means A search is performed based on the type of the arithmetic expression detected by the child detecting means, and the cost corresponding to the type of the arithmetic expression is extracted. In the cost storage means, the second cost extraction means uses the first variable among the variables detected by the operation detection means as the operand of the arithmetic expression detected by the operand detection means. The search is performed using the type of the arithmetic expression in the case, and the cost corresponding to the type of the arithmetic expression is extracted. After the taking out, the cost taken out by the first cost taking out means and the cost taken out by the second cost taking out means are compared by the comparing means. As a result of the comparison by the comparing means, if the cost extracted by the second cost extracting means is small, the position in the program of the variable used as the operand in the operation detected by the operand detecting means is replaced by the rewriting means. Thus, the variable is rewritten to the first variable detected by the operation detecting means. When the rewriting means rewrites all variables in the operation detected by the operand detection means, the variable used as the operand in the operation detected by the operand detection means and the variable are defined. And an operation expression including the calculated operation are removed from the program by the removal means.

【0030】[0030]

【0031】[0031]

【0032】[0032]

【実施例】本発明の一実施例の冗長式除去装置について
説明を行う。この冗長式除去装置は、C言語のように、
変数を用いてアドレス計算が記述できる高級言語のコン
パイラに備えられ、コンパイラが、ソースプログラムの
字句解析、構文解析および意味解析が行われ、また、そ
れぞれの変数の中身が、プログラム中のそれぞれの演算
式においてどれだけの値になっているかが解析された後
に起動される。処理対象となるプログラムは、コンパイ
ラが、字句解析、構文解析および意味解析を行った後に
解析結果として出力する中間言語プログラムである。こ
の冗長式除去装置の構成を図1に示す。
DESCRIPTION OF THE PREFERRED EMBODIMENTS A redundant type removing apparatus according to an embodiment of the present invention will be described. This redundant-type eliminator, like C language,
Provided in a high-level language compiler that can describe address calculation using variables, the compiler performs lexical analysis, syntax analysis, and semantic analysis of the source program, and the contents of each variable are each operation in the program. Fired after parsing how many values are in the expression. The program to be processed is an intermediate language program that is output as an analysis result after the compiler performs lexical analysis, syntax analysis, and semantic analysis. FIG. 1 shows the configuration of this redundant type removing device.

【0033】冗長式除去装置10は、制御部1、演算生
成位置検出部3、値使用位置検出部4、コスト記憶部
5、アドレッシングコスト記憶部6、コスト取出部7、
第1の書き換えコスト取出部8、第2の書き換えコスト
取出部9、第3の書き換えコスト取出部10、比較部1
1、第1の書き換え部12、第1の演算式除去部13、
第2の書き換え部14、第2の演算式除去部15、第3
の書き換え部16、第3の演算式除去部17、および処
理対象保持部18で構成される。
The redundant expression elimination device 10 includes a control unit 1, an operation generation position detection unit 3, a value use position detection unit 4, a cost storage unit 5, an addressing cost storage unit 6, a cost extraction unit 7,
A first rewriting cost extracting section 8, a second rewriting cost extracting section 9, a third rewriting cost extracting section 10, a comparing section 1
1, a first rewriting unit 12, a first arithmetic expression removing unit 13,
The second rewriting unit 14, the second arithmetic expression removing unit 15, the third
, A third arithmetic expression removing unit 17, and a processing target holding unit 18.

【0034】制御部1は、演算生成位置検出部3、値使
用位置検出部4、コスト取出部7、第1の書き換えコス
ト取出部8、第2の書き換えコスト取出部9、第3の書
き換えコスト取出部10、比較部11を順に起動する。
演算生成位置検出部3は、演算出現位置検出部3aと、
代入出現位置検出部3bと、ポインタ演算式検出部3c
とからなる。
The control unit 1 includes a calculation generation position detecting unit 3, a value use position detecting unit 4, a cost extracting unit 7, a first rewriting cost extracting unit 8, a second rewriting cost extracting unit 9, and a third rewriting cost. The extraction unit 10 and the comparison unit 11 are activated in order.
The calculation generation position detection unit 3 includes a calculation appearance position detection unit 3a,
Substitution occurrence position detection unit 3b and pointer operation expression detection unit 3c
Consists of

【0035】演算出現位置検出部3aは、被演算子が全
く同一の演算を、処理対象保持部21に保持されている
プログラムから全て検出する。具体的には、演算出現位
置検出部3aは、処理対象保持部18に保持されている
プログラム中の、全ての演算の演算子、被演算子を比較
し(被演算子が変数である場合、その変数の中身を比較
に用いる。)、同一の演算を全て検出する。検出後、演
算出現位置検出部3aは、その演算が等号の右辺に存在
する演算式のうち、1番目に位置する演算式を(この演
算式を指定演算式と呼ぶ。)、コスト取出部7に出力す
る。次に2番目以降に位置する演算式の位置を、第1の
演算式除去部13に通知する(この演算式を共通部分式
と呼ぶ。)。また、検出した演算式によって定義される
変数を検出し、これらの変数で、第1番目に位置する変
数(この変数を指定変数と呼ぶ。)を第1の書き換えコ
スト取出部8に出力し、2番目以降に位置する変数(こ
の変数を削除変数と呼ぶ。)を第1の値使用位置検出部
4aに出力する。
The operation appearance position detecting section 3a detects all the operations having exactly the same operand from the program stored in the processing target storing section 21. Specifically, the operation appearance position detection unit 3a compares the operators and operands of all the operations in the program stored in the processing target storage unit 18 (when the operand is a variable, The contents of the variable are used for comparison.), And all the same operations are detected. After the detection, the calculation appearance position detection unit 3a calculates the first calculation formula (this calculation formula is referred to as a designated calculation formula) among the calculation formulas whose calculation is on the right side of the equal sign, and extracts the cost. 7 is output. Next, the positions of the second and subsequent arithmetic expressions are notified to the first arithmetic expression removing unit 13 (this arithmetic expression is called a common sub-expression). In addition, it detects variables defined by the detected arithmetic expression, and outputs a variable located at the first position (this variable is referred to as a designated variable) to the first rewriting cost extracting unit 8. The variable located after the second (this variable is called a deleted variable) is output to the first value use position detection unit 4a.

【0036】代入出現位置検出部3bは、変数に定数を
代入する演算式、あるいは、変数に変数の値を代入する
演算式を、処理対象保持部18に保持されているプログ
ラムから全て検出し、検出した演算式の位置を、第2の
演算式除去部15に通知する。更に検出した演算式によ
って代入される変数(本実施例において、この変数をも
削除変数と呼ぶ。)を検出して、第2の値使用位置検出
部4bおよび第2の書き換えコスト取出部9に出力す
る。また、上記の演算式で、等号の右辺に存在する変
数、定数(本実施例では、これらも指定代入数と呼
ぶ。)を第2の書き換えコスト取出部9に出力する。
The substitution appearance position detection unit 3b detects all the arithmetic expressions for substituting constants for variables or the arithmetic expressions for substituting variable values for variables from the program stored in the processing target storage unit 18, The position of the detected arithmetic expression is notified to the second arithmetic expression removing unit 15. Further, a variable substituted by the detected arithmetic expression (this variable is also referred to as a deleted variable in this embodiment) is detected and sent to the second value use position detecting unit 4b and the second rewriting cost extracting unit 9. Output. Further, in the above arithmetic expression, the variable and the constant (these are also referred to as designated substitution numbers) existing on the right side of the equal sign are output to the second rewriting cost extracting unit 9.

【0037】ポインタ演算式検出部3cは、ポインタ変
数が定義される演算式を、処理対象保持部21に保持さ
れているプログラムから全て検出する。具体的には、ポ
インタ演算式検出部3cは、処理対象保持部18に保持
されているプログラム中の演算式のうち、等号の左側に
ポインタ変数が存在する演算式を全て検出する。検出
後、ポインタ演算式検出部3cは、検出したポインタ変
数を第3の値使用位置検出部4cに出力し、そのポイン
タ変数を定義する演算(この演算をポインタ演算と呼
び、ポインタ演算とポインタ変数とを含む演算式をポイ
ンタ演算式と呼ぶ。)を検出して、第3の書き換えコス
ト取出部10に出力する。最後に検出した演算式の位置
を第3の演算式除去部17に通知する。
The pointer arithmetic expression detection unit 3c detects all the arithmetic expressions defining the pointer variables from the program stored in the processing target storage unit 21. Specifically, the pointer arithmetic expression detection unit 3c detects all the arithmetic expressions in which the pointer variable exists on the left side of the equal sign, among the arithmetic expressions in the program held in the processing target holding unit 18. After the detection, the pointer operation expression detecting unit 3c outputs the detected pointer variable to the third value use position detecting unit 4c, and performs an operation for defining the pointer variable (this operation is called a pointer operation, the pointer operation and the pointer variable Is referred to as a pointer operation expression.), And is output to the third rewrite cost extracting unit 10. Finally, the position of the arithmetic expression detected is notified to the third arithmetic expression removing unit 17.

【0038】値使用位置検出部4は、第1の値使用位置
検出部4aと、第2の値使用位置検出部4bと、第3の
値使用位置検出部4cとからなる。第1の値使用位置検
出部4aは、演算出現位置検出部3aから削除変数を受
け取り、削除変数が、被演算子として用いられているよ
うな演算式(本実施例において、この演算を書き換え演
算式と呼ぶ。)を全て検出する。検出後、第1の値使用
位置検出部4aは、プログラム中の、共通部分式から書
き換え演算式までの領域に、その演算式で、被演算子と
して使用されている変数が、定義されているかどうかを
確認し、定義されていなければ、書き換え演算式を第1
の書き換えコスト取出部8に出力する。
The value using position detecting section 4 comprises a first value using position detecting section 4a, a second value using position detecting section 4b, and a third value using position detecting section 4c. The first value use position detection unit 4a receives the deletion variable from the operation appearance position detection unit 3a, and uses an operation expression in which the deletion variable is used as an operand (in this embodiment, this operation is rewritten by an operation Expressions) are all detected. After the detection, the first value use position detecting unit 4a determines whether a variable used as an operand in the arithmetic expression is defined in a region from the common subexpression to the rewrite arithmetic expression in the program. Check if it is not defined, and rewrite the first
Is output to the rewriting cost extracting unit 8.

【0039】第2の値使用位置検出部4bは、代入出現
位置検出部3bから削除変数を受け取り、削除変数が、
被演算子として用いられているような演算式(本実施例
において、この演算をも書き換え演算式と呼ぶ。)を全
て検出して、第2の書き換えコスト取出部9に出力す
る。第3の値使用位置検出部4cは、ポインタ演算式検
出部3cからポインタ変数を受け取り、ポインタ変数
が、被演算子として用いられているような演算式(本実
施例において、この演算をも書き換え演算式と呼ぶ。)
を全て検出する。検出後、第3の値使用位置検出部4c
は、プログラム中の、ポインタ変数から書き換え演算式
までの領域に、その演算で、被演算子として使用されて
いる変数が、定義されているかどうかを確認し、定義さ
れていなければ、書き換え演算式を第3の書き換えコス
ト取出部10に出力する。
The second value use position detection unit 4b receives the deletion variable from the substitution appearance position detection unit 3b, and
It detects all the arithmetic expressions used as operands (this operation is also called a rewrite arithmetic expression in this embodiment) and outputs it to the second rewrite cost extracting unit 9. The third value use position detecting unit 4c receives the pointer variable from the pointer arithmetic expression detecting unit 3c, and calculates the arithmetic expression in which the pointer variable is used as the operand (in this embodiment, this arithmetic operation is also rewritten. This is called an arithmetic expression.)
Are all detected. After the detection, the third value use position detector 4c
Checks whether the variable used as the operand in the operation is defined in the area from the pointer variable to the rewrite operation expression in the program, and if it is not defined, Is output to the third rewriting cost extracting unit 10.

【0040】コスト記憶部5は、演算式の型と、その演
算式の型に該当する演算式のコストを記憶する。本実施
例において、上記の演算式の型が定められる5つの項目
が存在し、これらの項目は、コスト取出部7、第1の書
き換えコスト取出部8が検索を行うための検索項目とな
る。またコスト記憶部5は、これらの検索項目の組み合
わせに対応するコストを記憶する。図2は、ターゲット
マシンが2オペランド方式で、Second to f
irst方式(2番目のオペランドを1番目のオペラン
ドに作用する方式)と呼ばれているものの一例を示した
ものである。上述の検索項目とは、演算子の種類の項
目、演算の型の項目、演算子の右側の被演算子(第1の
被演算子と呼ぶ)の項目、演算子の左側の被演算子(第
2の被演算子と呼ぶ)の項目、及び演算結果の格納場所
の項目という5つの項目である。上記の演算子の種類の
項目には、加算、減算、乗算、除算等、演算子等の種類
が示されている。演算の型の項目には、8bit整数型か、
16bit整数型、32bit整数型、単精度浮動小数点型、倍精
度浮動小数点型等、演算の型が示されている。第1、第
2の被演算子の種類には、被演算子が、定数、静的変
数、ポインタを格納する静的変数、スタック変数、ポイ
ンタを格納するスタック変数、レジスタ変数、ポインタ
を格納するレジスタ変数等、変数の型が示されている。
演算結果の格納場所の項目には、静的変数、ポインタを
格納する静的変数、スタック変数、ポインタを格納する
スタック変数、レジスタ変数、ポインタを格納するレジ
スタ変数等、変数の型が示されている。コストの項目に
は、これらの検索項目の条件に該当する機械語命令のク
ロック数、あるいは、メモリサイズが記録されている。
尚、図2において、ポインタを格納している変数は、下
の項目にポインタと記載している。
The cost storage unit 5 stores the type of an arithmetic expression and the cost of the arithmetic expression corresponding to the type of the arithmetic expression. In the present embodiment, there are five items for which the types of the above arithmetic expressions are determined, and these items are search items for the cost extracting unit 7 and the first rewriting cost extracting unit 8 to perform a search. The cost storage unit 5 stores costs corresponding to combinations of these search items. FIG. 2 shows that the target machine is a two-operand system and the second to f
This shows an example of what is called the first method (method in which the second operand acts on the first operand). The above-mentioned search items include an item of an operator type, an item of an operation type, an item of an operand (referred to as a first operand) on the right side of the operator, and an operand on the left side of the operator ( And a storage location for the operation result. The items of the above-described types of operators indicate types of operators, such as addition, subtraction, multiplication, and division. The operation type item is an 8-bit integer type,
The operation types such as 16-bit integer type, 32-bit integer type, single-precision floating-point type, and double-precision floating-point type are shown. In the first and second types of operands, the operand stores constants, static variables, static variables storing pointers, stack variables, stack variables storing pointers, register variables, and pointers. Variable types, such as register variables, are shown.
The item of the storage location of the operation result indicates a variable type such as a static variable, a static variable for storing a pointer, a stack variable, a stack variable for storing a pointer, a register variable, a register variable for storing a pointer, and the like. I have. In the item of cost, the number of clocks of the machine language instruction or the memory size corresponding to the conditions of these search items is recorded.
In FIG. 2, the variable storing the pointer is described as a pointer in the lower item.

【0041】アドレッシングコスト記憶部6は、第3の
書き換えコスト取出部10が検索を行うための、アドレ
ッシングモードを用いた機械語命令のコストを記憶す
る。図3にアドレッシングコスト記憶部6の一例を示
す。アドレッシングコスト記憶部6の構成は、コスト記
憶部5に類似している。異なるのは、アドレッシングコ
スト記憶部6には、第2の演算子の項目と、第2の演算
子の右側に存在する被演算子(第3の被演算子)の項目
とが存在し、7つの検索項目の組み合わせに該当するコ
ストを記憶する。
The addressing cost storage unit 6 stores the cost of a machine language instruction using an addressing mode for the third rewriting cost extracting unit 10 to perform a search. FIG. 3 shows an example of the addressing cost storage unit 6. The configuration of the addressing cost storage unit 6 is similar to the cost storage unit 5. The difference is that the addressing cost storage unit 6 has an item of the second operator and an item of the operand (third operand) existing on the right side of the second operator. The cost corresponding to the combination of the two search items is stored.

【0042】コスト取出部7は、演算出現位置検出部3
aが検出した指定演算式でコスト記憶部5を検索し、当
該演算式に対応する機械語命令のコストを取り出して比
較部11に出力する。具体的には、コスト取出部7は、
指定演算式を演算出現位置検出部3aから受け取り、受
け取った指定演算式で被演算子として使用されている変
数の型を調べ、第1、第2の被演算子が、定数である
か、静的変数であるか、ポインタを格納する静的変数で
あるか、スタック変数であるか、ポインタを格納するス
タック変数であるか、レジスタ変数であるか、ポインタ
を格納するレジスタ変数であるかを調べる。これらを調
べた後、コスト取出部7は、演算結果の格納場所が、静
的変数であるか、ポインタを格納する静的変数である
か、スタック変数であるか、ポインタを格納するスタッ
ク変数であるか、レジスタ変数であるか、ポインタを格
納するレジスタ変数であるかを調べる。これらの調査結
果に基づいて、コスト記憶部5を検索し、該当するコス
トを取り出して比較部11に出力する。
The cost fetching unit 7 includes the calculation appearance position detecting unit 3
The cost storage unit 5 is searched with the designated arithmetic expression detected by a, and the cost of the machine language instruction corresponding to the arithmetic expression is extracted and output to the comparison unit 11. Specifically, the cost extracting unit 7
The designated operation expression is received from the operation appearance position detection unit 3a, the type of the variable used as the operand in the received designated operation expression is checked, and it is determined whether the first and second operands are constants. Whether it is a static variable, a static variable that stores a pointer, a stack variable, a stack variable that stores a pointer, a register variable, or a register variable that stores a pointer . After examining these, the cost extracting unit 7 determines whether the storage location of the operation result is a static variable, a static variable storing a pointer, a stack variable, or a stack variable storing a pointer. Check whether it is a register variable, or a register variable that stores a pointer. Based on the results of these investigations, the cost storage unit 5 is searched, and the corresponding costs are extracted and output to the comparison unit 11.

【0043】第1の書き換えコスト取出部8は、演算出
現位置検出部3aから指定変数を受け取り、第1の値使
用位置検出部4aから書き換え演算式を受け取って、書
き換え演算式中の削除変数を、指定変数に書き換え、書
き換えた演算式でコスト記憶部5を検索し、演算式のコ
ストを取り出して比較部11に出力する。例えば、変数
aが指定変数であり、変数bが削除変数、演算式「d=
b+3」が書き換え演算式である場合、第1の書き換え
コスト取出部8は、演算式「d=b+3」を、演算式
「d=a+3」に書き換えてコスト記憶部5を検索し、
コストを取り出して、比較部11に出力する。第1の書
き換えコスト取出部8が行うコストの検索の方法は、コ
スト取出部7と同じであるので説明を省略する。
The first rewriting cost extracting unit 8 receives the designated variable from the operation appearance position detecting unit 3a, receives the rewriting operation expression from the first value use position detecting unit 4a, and deletes the deletion variable in the rewriting operation expression. Then, the cost storage unit 5 is searched with the rewritten arithmetic expression, and the cost of the arithmetic expression is extracted and output to the comparison unit 11. For example, the variable a is a designated variable, the variable b is a deletion variable, and the operation expression “d =
If “b + 3” is a rewrite operation expression, the first rewrite cost extraction unit 8 searches the cost storage unit 5 by rewriting the operation expression “d = b + 3” to the operation expression “d = a + 3”,
The cost is extracted and output to the comparison unit 11. The method of searching for the cost performed by the first rewriting cost fetching unit 8 is the same as that of the cost fetching unit 7, and therefore the description is omitted.

【0044】第2の書き換えコスト取出部9は、代入出
現位置検出部3bから削除変数、指定代入数を受け取
り、第2の値使用位置検出部4bから書き換え演算式を
受け取って、その削除変数が、ポインタを格納している
か否かを判定し、もし格納していれば、書き換え演算式
中の削除変数を、指定代入数に書き換え、書き換えた演
算式でコスト記憶部5を検索し、書き換えた演算式に対
応するコストを取り出して比較部11に出力する。例え
ば、変数3が指定代入数であり、変数bが削除変数、演
算式「a=b+c」が書き換え演算式である場合、第1
の書き換えコスト取出部8は、演算「a=b+c」を、
演算「a=3+c」に書き換えてコスト記憶部5を検索
し、コストを取り出して、比較部11に出力する。第2
の書き換えコスト取出部9が行うコストの検索の方法
は、コスト取出部7と同じ方法であるので説明を省略す
る。
The second rewrite cost extracting unit 9 receives the deletion variable and the designated number of substitutions from the substitution appearance position detection unit 3b, receives the rewrite operation expression from the second value use position detection unit 4b, and determines whether the deletion variable is It is determined whether or not the pointer is stored. If the pointer is stored, the deleted variable in the rewrite operation expression is rewritten to the designated substitution number, and the cost storage unit 5 is searched and rewritten by the rewritten operation expression. The cost corresponding to the operation expression is extracted and output to the comparison unit 11. For example, when the variable 3 is the designated substitution number, the variable b is a deletion variable, and the operation expression “a = b + c” is a rewrite operation expression, the first
The rewriting cost extraction unit 8 of the formula “a = b + c”
The cost is rewritten to the operation “a = 3 + c”, the cost storage unit 5 is searched, and the cost is extracted and output to the comparison unit 11. Second
The method of retrieving the cost performed by the rewriting cost extracting section 9 is the same as that of the cost extracting section 7, and thus the description is omitted.

【0045】第3の書き換えコスト取出部10は、ポイ
ンタ演算式検出部3cからポインタ変数、ポインタ演算
を受け取り、第3の値使用位置検出部4cから書き換え
演算式を受け取って、書き換え演算式中の削除変数を、
ポインタ演算に書き換え、書き換えた演算でアドレッシ
ングコスト記憶部6を検索し、その演算に対応するアド
レッシングモードの機械語命令のコストを取り出して比
較部11に出力する。例えば、変数bが指定代入数であ
り、指定演算が「a+2」、書き換え演算式が「d=b
+c」である場合、第1の書き換えコスト取出部8は、
書き換え演算式「d=b+c」を、演算「d=a+2+
c」に書き換えてアドレッシングコスト記憶部6を検索
し、コストを取り出して、比較部11に出力する。コス
トの検索の方法は、コスト取出部7と同じである。
The third rewriting cost extracting unit 10 receives the pointer variable and the pointer operation from the pointer operation expression detecting unit 3c, receives the rewriting operation expression from the third value use position detecting unit 4c, and Delete variable
The operation is rewritten as a pointer operation, the addressing cost storage unit 6 is searched by the rewritten operation, the cost of the machine language instruction in the addressing mode corresponding to the operation is extracted and output to the comparison unit 11. For example, the variable b is the designated substitution number, the designated operation is “a + 2”, and the rewrite operation expression is “d = b
+ C ”, the first rewriting cost extracting unit 8
The rewrite operation expression “d = b + c” is converted into the operation “d = a + 2 +
The addressing cost storage unit 6 is searched by rewriting to “c”, and the cost is extracted and output to the comparison unit 11. The cost retrieval method is the same as that of the cost extracting unit 7.

【0046】比較部11は、コスト取出部7、第1のコ
スト書き換え取出部8、第2のコスト書き換え取出部
9、第3のコスト書き換え取出部10が取り出したコス
トを受け取り、それぞれの比較を行う。コスト取出部
7、第1のコスト書き換え取出部8からコストを受け取
れば、比較部11は、それぞれを比較する。比較した結
果、第1の書き換えコスト取出部8が取り出したコスト
が小さければ、第1の書き換え部12を起動する。同様
に第2のコスト書き換え取出部9、第3の書き換えコス
ト取出部10からコストを受け取れば、比較部11は、
それらをコスト取出部7から受け取ったコストと比較
し、もし、第2の書き換えコスト取出部9、第3の書き
換えコスト取出部10が取り出したコストが小さけれ
ば、第2の書き換え部14、第3の書き換え部16を起
動する。
The comparing unit 11 receives the costs extracted by the cost extracting unit 7, the first cost rewriting extracting unit 8, the second cost rewriting extracting unit 9, and the third cost rewriting extracting unit 10, and compares the costs. Do. Upon receiving the costs from the cost extracting unit 7 and the first cost rewriting extracting unit 8, the comparing unit 11 compares them. As a result of the comparison, if the cost extracted by the first rewriting cost extracting unit 8 is small, the first rewriting unit 12 is activated. Similarly, if the costs are received from the second cost rewriting and extracting unit 9 and the third rewriting cost extracting unit 10, the comparing unit 11
These are compared with the costs received from the cost retrieving unit 7, and if the costs retrieved by the second rewriting cost retrieving unit 9 and the third rewriting cost retrieving unit 10 are small, the second rewriting unit 14, the third rewriting cost Is started up.

【0047】第1の書き換え部12は、演算出現位置検
出部3aから指定変数を受け取り、第1の値使用位置検
出部4aが検出した書き換え演算式中の削除変数のプロ
グラム上の位置を、指定変数に書き換える。第1の演算
式除去部13は、第1の書き換え部12が全ての削除変
数を指定変数に書き換えた場合、演算出現位置検出部3
aから知らされた位置の演算式を、プログラムから削除
する。
The first rewriting unit 12 receives the designated variable from the operation appearance position detection unit 3a, and specifies the program position of the deletion variable in the rewrite operation expression detected by the first value use position detection unit 4a. Rewrite to a variable. When the first rewriting unit 12 rewrites all the deleted variables to the designated variables, the first operation expression removing unit 13
The arithmetic expression at the position notified from a is deleted from the program.

【0048】第2の書き換え部14は、代入出現位置検
出部3bから削除変数を受け取り、第2の値使用位置検
出部4bが検出した書き換え演算式中の削除変数のプロ
グラム上の位置を、指定代入数に書き換える。第2の演
算式除去部15は、第2の書き換え部14が全ての削除
変数を指定変数に書き換えた場合、代入出現位置検出部
3bから知らされた位置の演算式を、プログラムから削
除する。
The second rewriting unit 14 receives the deletion variable from the substitution appearance position detection unit 3b, and specifies the program position of the deletion variable in the rewrite operation expression detected by the second value use position detection unit 4b. Rewrite with the number of substitutions. When the second rewriting unit 14 rewrites all the deletion variables to the designated variables, the second calculation expression removal unit 15 deletes the calculation expression at the position notified from the substitution appearance position detection unit 3b from the program.

【0049】第3の書き換え部16は、演算出現位置検
出部3aからポインタ演算を受け取り、第3の値使用位
置検出部4cが検出した書き換え演算式中のポインタ変
数のプログラム上の位置を、ポインタ演算に書き換え
る。第3の演算式除去部17は、第3の書き換え部16
が全ての削除変数を指定変数に書き換えた場合、ポイン
タ演算式検出部3cから知らされた位置のポインタ演算
式をプログラムから削除する。
The third rewriting unit 16 receives the pointer operation from the operation appearance position detection unit 3a, and determines the program position of the pointer variable in the rewrite operation expression detected by the third value use position detection unit 4c by the pointer. Rewrite the operation. The third arithmetic expression removing unit 17 includes a third rewriting unit 16
Rewrites all the delete variables to the designated variables, the pointer arithmetic expression at the position notified from the pointer arithmetic expression detection unit 3c is deleted from the program.

【0050】処理対象保持部18は、処理対象となるプ
ログラムを保持する。保持されるプログラムは、コンパ
イラが内部処理の都合上生成した内部コードで記述され
ている。尚、保持されるプログラムは、プログラマによ
って記述されたソースコードで記述されていてもよい。
以上のように構成された冗長式除去装置の動作を、{例
1}〜{例3}までの例を用いて説明する。
The processing target holding unit 18 holds a program to be processed. The retained program is described by an internal code generated by the compiler for internal processing. The held program may be described by a source code described by a programmer.
The operation of the redundant-type removing device configured as described above will be described using examples of {Example 1} to {Example 3}.

【0051】{例1}図4のように、プログラム中に、
全く同一の演算を行う演算が、複数個存在する場合の動
作 (1)演算出現位置検出部3aは、処理対象保持部18
に保持されている図7に示すプログラムから、指定演算
式「g=f+400」を検出し、指定変数gを検出す
る。また、演算「f+400」と同一の演算を等号の右
側に持つ演算式「h=f+400」を検出し、削除変数
hを検出する。
{Example 1} As shown in FIG.
Operation when there are a plurality of operations that perform exactly the same operation (1) The operation appearance position detection unit 3 a
7 is detected from the program shown in FIG. 7 and the specified variable g is detected. Further, an operation expression “h = f + 400” having the same operation as the operation “f + 400” on the right side of the equal sign is detected, and a deletion variable h is detected.

【0052】(2)第1の値使用位置検出部4aは、演
算出現位置検出部3aから削除変数hを受け取り、削除
変数hが、被演算子として用いられているような書き換
え演算式「*a=h*70」を検出する。 (3)コスト取出部7は、値使用位置検出部4aが検出
した書き換え演算式「*a=h*70」でコスト記憶部
5を検索し、当該演算に対応する機械語命令のコストを
取り出して比較部11に出力する。
(2) The first value use position detection unit 4a receives the deletion variable h from the operation appearance position detection unit 3a, and the rewrite operation expression “*” in which the deletion variable h is used as an operand. a = h * 70 "is detected. (3) The cost extraction unit 7 searches the cost storage unit 5 with the rewrite operation expression “* a = h * 70” detected by the value use position detection unit 4a, and extracts the cost of the machine language instruction corresponding to the operation. And outputs it to the comparison unit 11.

【0053】(5)第1の書き換えコスト取出部8は、
演算出現位置検出部3aから指定変数gを受け取り、第
1の値使用位置検出部4aから書き換え演算式「*a=
h*70」を受け取って、書き換え演算式中の削除変数
hを、指定変数gに書き換え、書き換えた演算式「*a
=g*40」でコスト記憶部5を検索し、演算式のコス
トを取り出して比較部11に出力する。
(5) The first rewriting cost extracting unit 8
The designated variable g is received from the calculation appearance position detection unit 3a, and the rewriting operation expression “* a =
h * 70 ”, the deleted variable h in the rewrite operation expression is rewritten to the designated variable g, and the rewritten operation expression“ * a
= G * 40 ", the cost storage unit 5 is searched, and the cost of the arithmetic expression is extracted and output to the comparison unit 11.

【0054】(6)比較部11は、コスト取出部7、第
1のコスト書き換え取出部8が取り出したコストを受け
取り、それぞれの比較を行う。この場合、第1の書き換
えコスト取出部8から受け取ったコストが小さいので、
第1の書き換え部12を起動する。 (7)第1の書き換え部12は、演算出現位置検出部3
aから指定変数gを受け取り、第1の値使用位置検出部
4aが検出した書き換え演算式「*a=h*70」の削
除変数hを、指定変数gに書き換える。
(6) The comparing unit 11 receives the costs extracted by the cost extracting unit 7 and the first cost rewriting and extracting unit 8, and compares the costs. In this case, since the cost received from the first rewriting cost extracting unit 8 is small,
The first rewriting unit 12 is started. (7) The first rewriting unit 12 performs the calculation appearance position detection unit 3
The specified variable g is received from a, and the deleted variable h of the rewrite operation expression “* a = h * 70” detected by the first value use position detection unit 4a is rewritten to the specified variable g.

【0055】(8)第1の演算式除去部13は、第1の
書き換え部12の書き換え後、演算出現位置検出部3a
から知らされた位置の演算式「h=f+400」を、プ
ログラムから削除する。以上のような動作によって、図
4に示したプログラムは、図5に示すプログラムに書き
換えられる。 {例2}図6のようにプログラム中に、変数を変数に代
入する演算式、定数を変数に代入する演算式が存在する
場合の動作 (1)代入出現位置検出部3bは、図6に示すプログラ
ムから、変数に定数を代入する演算式「f=20」を検
出する。
(8) The first arithmetic expression removing unit 13 sets the arithmetic appearance position detecting unit 3a after rewriting by the first rewriting unit 12.
The arithmetic expression “h = f + 400” at the position notified from is deleted from the program. By the above operation, the program shown in FIG. 4 is rewritten to the program shown in FIG. {Example 2} Operation in the case where an arithmetic expression for assigning a variable to a variable and an arithmetic expression for assigning a constant to a variable exist in the program as shown in FIG. 6 (1) The assignment appearance position detection unit 3b is configured as shown in FIG. From the program shown, an arithmetic expression “f = 20” for substituting a constant for a variable is detected.

【0056】(2)第2の値使用位置検出部4bは、代
入出現位置検出部3bから削除変数を受け取り、削除変
数が、被演算子として用いられているような書き換え演
算式「g=f+*a」を検出して、第2の書き換えコス
ト取出部9に出力する。 (3)コスト取出部7は、値使用位置検出部4bが検出
した書き換え演算式「g=f+*a」でコスト記憶部5
を検索し、演算式に対応する機械語命令のコストを取り
出して比較部11に出力する。
(2) The second value use position detection unit 4b receives the deletion variable from the substitution appearance position detection unit 3b, and the rewrite operation expression “g = f +” in which the deletion variable is used as an operand. * A ”is detected and output to the second rewriting cost extracting unit 9. (3) The cost extraction unit 7 uses the rewrite operation expression “g = f ++ a” detected by the value use position detection unit 4b to store the cost in the cost storage unit 5.
Is retrieved, and the cost of the machine language instruction corresponding to the operation expression is extracted and output to the comparison unit 11.

【0057】(4)第2の書き換えコスト取出部9は、
代入出現位置検出部3bから削除変数「f」、指定代入
数「20」を受け取り、第2の値使用位置検出部4bか
ら書き換え演算式「g=f+*a」を受け取って、演算
式「g=f+*a」を「g=20+*a」に書き換え、
書き換え後の演算式に対応する機械語命令のコストを取
り出して比較部11に出力する。
(4) The second rewriting cost extracting unit 9
The deletion variable “f” and the designated substitution number “20” are received from the substitution appearance position detection unit 3b, the rewrite operation expression “g = f ++ a” is received from the second value use position detection unit 4b, and the operation expression “g” is received. = F ++ a "to" g = 20 ++ a "
The cost of the machine language instruction corresponding to the rewritten arithmetic expression is extracted and output to the comparison unit 11.

【0058】(5)比較部11は、コスト取出部7、第
2のコスト書き換え取出部9が取り出したコストを受け
取り、それぞれの比較を行う。この場合、第2のコスト
書き換え取出部9が取り出したコストが小さいので第2
の書き換え部14を起動する。 (6)第2の書き換え部14は、代入出現位置検出部3
bから指定代入数「20」を受け取り、第2の値使用位
置検出部4bが検出した書き換え演算式中の削除変数
「f」を、指定代入数「20」に書き換える。
(5) The comparing section 11 receives the costs extracted by the cost extracting section 7 and the second cost rewriting and extracting section 9 and compares them. In this case, the cost taken out by the second cost rewriting / extracting section 9 is small.
Is started. (6) The second rewriting unit 14 performs the substitution appearance position detection unit 3
When the designated substitution number “20” is received from b, the deletion variable “f” in the rewrite operation expression detected by the second value use position detection unit 4b is rewritten to the designated substitution number “20”.

【0059】(7)第2の演算式除去部15は、第2の
書き換え部14の書き換え後、代入出現位置検出部3b
から知らされた位置の指定演算式「f=20」を、プロ
グラムから削除する。冗長式除去装置が、このような処
理を行った場合、図6に示したプログラムは、図7に示
すように書き換えられる。 {例3}図8のように、プログラム中にポインタ変数で
書かれた変数を用いてアドレスを計算し、計算したアド
レスの内容を変数に代入している記述が存在する場合 (1)ポインタ演算式検出部3cは、図8に示すプログ
ラムから、ポインタ演算式「d=c+400」、「d1
=c*400」を検出する。
(7) After rewriting by the second rewriting unit 14, the second arithmetic expression removing unit 15 sets the substitution appearance position detecting unit 3b
Is deleted from the program. When the redundant type removing device performs such processing, the program shown in FIG. 6 is rewritten as shown in FIG. {Example 3} As shown in FIG. 8, when there is a description that calculates an address using a variable written as a pointer variable in a program and assigns the contents of the calculated address to the variable (1) Pointer operation The expression detection unit 3c calculates the pointer operation expressions “d = c + 400” and “d1
= C * 400 ".

【0060】(2)第3の値使用位置検出部4cは、ポ
インタ演算式検出部3cからポインタ変数「d」、「d
1」を受け取り、ポインタ演算式「a=*(b+
d)」、「a=*(b+d1)」を検出する。 (3)コスト取出部7は、第3の値使用位置検出部4c
が検出した書き換え演算式「a=*(b+d)」、「a
=*(b+d1)」でコスト記憶部5を検索し、当該演
算式に対応する機械語命令のコストを取り出して比較部
11に出力する。
(2) The third value use position detecting section 4c receives the pointer variables "d" and "d" from the pointer arithmetic expression detecting section 3c.
1 ”and the pointer operation expression“ a = * (b +
d) "and" a = * (b + d1) ". (3) The cost extracting unit 7 is a third value use position detecting unit 4c.
Rewrite arithmetic expressions “a = * (b + d)”, “a
= * (B + d1) ", retrieves the cost of the machine language instruction corresponding to the arithmetic expression, and outputs it to the comparing unit 11.

【0061】(4)第3の書き換えコスト取出部10
は、ポインタ演算式検出部3cから指定変数d、d1、
指定演算「c+400」、「c*400」を受け取り、
第3の値使用位置検出部4cから書き換え演算式「a=
*(b+d)」、「a=*(b+d1)」を受け取っ
て、書き換え演算式中の削除変数d、d1を、指定演算
「c+400」、「c*400」に書き換え、書き換え
た演算式「a=*(b+c+400)」、「a=*(b
+c*400)」でコスト記憶部5を検索し、その演算
に対応するアドレッシングモードの機械語命令のコスト
を取り出して比較部11に出力する。
(4) Third Rewriting Cost Extraction Unit 10
Are designated variables d, d1,.
Receiving the designated operation “c + 400”, “c * 400”,
The third value use position detection unit 4c outputs the rewrite operation expression “a =
* (B + d) "and" a = * (b + d1) ", and delete variables d and d1 in the rewrite operation formula are rewritten to the designated operations" c + 400 "and" c * 400 ", and the rewritten operation expression" a = * (B + c + 400) "," a = * (b
+ C * 400) ", retrieves the cost of the machine language instruction in the addressing mode corresponding to the operation, and outputs it to the comparing unit 11.

【0062】(5)比較部11は、コスト取出部7、第
3のコスト書き換え取出部10が取り出したコストを受
け取り、それぞれの比較を行う。比較した結果、第3の
書き換えコスト取出部8が取り出したコストが小さいの
で、第3の書き換え部10を起動する。 (6)第3の書き換え部16は、演算出現位置検出部3
aからポインタ演算「c+400」、「c*400」を
受け取り、第3の値使用位置検出部4cが検出した書き
換え演算式中の指定変数を、ポインタ演算に書き換え
る。
(5) The comparing unit 11 receives the costs extracted by the cost extracting unit 7 and the third cost rewriting extracting unit 10, and compares the costs. As a result of the comparison, the cost extracted by the third rewriting cost extracting unit 8 is small, so the third rewriting unit 10 is activated. (6) The third rewriting unit 16 includes the calculation appearance position detection unit 3
The pointer operations “c + 400” and “c * 400” are received from “a”, and the designated variable in the rewrite operation expression detected by the third value use position detection unit 4c is rewritten to the pointer operation.

【0063】(7)第3の演算式除去部17は、第3の
書き換え部16の書き換え後、演算出現位置検出部3a
から知らされた位置の指定演算式「d=c+400」、
「d1=c*400)」をプログラムから削除する。こ
のような処理を行った場合、図8に示したプログラム
は、図9に示すように書き換えられる。尚、本発明の冗
長式除去装置の構成は、上記の構成に限定されるもので
はなく、演算出現位置検出部3aが検出した演算のう
ち、2番目以降に位置する演算を含む演算式(冗長式)
についての演算式の型でコスト記憶部5を検索し、当該
演算式の型に対応するコストを取り出す冗長式コスト取
出部と、コスト取出部7が取り出したコストと、冗長式
コスト取出部が取り出したコストとの和を求める算出部
とを備え、比較手段は、算出部が求めたコストの和と、
第1、2、3の書き換えコスト取出部8、9、10が取
り出したコストとを比較して、書き換え、冗長式の除去
を行うか否かを決定してもよい。
(7) After the third rewriting unit 16 rewrites, the third operation expression removing unit 17
, The designated arithmetic expression "d = c + 400"
"D1 = c * 400)" is deleted from the program. When such processing is performed, the program shown in FIG. 8 is rewritten as shown in FIG. Note that the configuration of the redundant expression removing device of the present invention is not limited to the above-described configuration. formula)
The cost storage unit 5 is searched with the type of the operation expression of the redundant expression, and the redundant cost extraction unit for extracting the cost corresponding to the type of the operation expression, the cost extracted by the cost extraction unit 7, and the redundant cost extraction unit And a calculating unit for calculating the sum of the costs calculated by the calculating unit.
The cost may be compared with the cost extracted by the first, second, and third rewriting cost extracting units 8, 9, and 10 to determine whether to perform the rewriting and the removal of the redundant expression.

【0064】また、コスト取出部7、第1、2、3の書
き換えコスト取出部8、9、10は、取り出したコスト
の総和を求め、比較部11は、こうして求めたコストの
総和を比較して、書き換え、冗長式の除去を行うか否か
を決定してもよい。また、冗長式コスト取出部は、演算
出現位置検出部3aが検出した演算のうち、2番目以降
に位置する演算を含む演算式についての演算式の型でコ
スト記憶部5を検索し、当該演算式の型に対応するコス
トを取り出し、コスト取出部7、第1、2、3の書き換
えコスト取出部8、9、10は、取り出したコストの総
和を求め、算出部は、コスト取出部7が取り出したコス
トの総和と、冗長式コスト取出部が取り出したコストと
の和を求めて、コスト取出部7は、算出部が求めたコス
トの和と、第1、2、3の書き換えコスト取出部8、
9、10が取り出したコストの総和とを比較して、書き
換え、冗長式の除去を行うか否かを決定してもよい。
The cost fetching unit 7, the first, second, and third rewriting cost fetching units 8, 9, and 10 calculate the sum of the fetched costs, and the comparison unit 11 compares the sum of the costs thus obtained. Thus, it may be determined whether or not to rewrite or remove the redundant expression. Further, the redundant expression cost extraction unit searches the cost storage unit 5 with the type of the operation expression including the operation located after the second among the operations detected by the operation appearance position detection unit 3a, and The cost corresponding to the type of the formula is extracted, the cost extracting unit 7, the first, second, and third rewriting cost extracting units 8, 9, and 10 calculate the sum of the extracted costs. The cost fetching unit 7 calculates the sum of the fetched cost and the cost fetched by the redundant cost fetching unit, and the cost fetching unit 7 calculates the sum of the cost obtained by the calculation unit and the first, second, and third rewriting cost fetching units 8,
9, 9 and 10 may be compared with the sum of the extracted costs to determine whether to perform rewriting and remove redundant expressions.

【0065】[0065]

【発明の効果】以上説明してきたように、本発明の冗長
式除去装置によれば、処理対象となる演算の被演算子
が、定数、レジスタ変数、スタック変数、静的変数のど
れに該当するかを調べ、書き換え前後のコストを比較し
た後に被演算子の書き換えを行うので、演算の書き換え
が有効な場合のみ演算を書き換えることができるという
効果がある。
As described above, according to the redundant expression elimination device of the present invention, the operand of the operation to be processed corresponds to any one of a constant, a register variable, a stack variable, and a static variable. Since the operator is rewritten after comparing the costs before and after the rewriting, the operation can be rewritten only when the rewriting of the operation is valid.

【0066】また、ターゲットマシンのプロセッサが、
インデックスおよびオフセット付きの間接アドレス参
照、オフセット付きの間接アドレス参照等、アドレッシ
ングモードを使用することができる場合、これらのアド
レッシングモードを、有効に活用できるような演算の書
き換えが行うので、コストの低減を充分に図ることがで
きるという効果がある。
Also, the processor of the target machine is
When addressing modes such as indirect address reference with index and offset, indirect address reference with offset, etc. can be used, rewriting of operations that can effectively use these addressing modes is performed, thus reducing costs. There is an effect that it can be sufficiently achieved.

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

【図1】本発明の一実施例における冗長式除去装置の装
置10の構成を示す図である。
FIG. 1 is a diagram showing a configuration of a redundant removal device 10 according to an embodiment of the present invention.

【図2】コスト記憶部5の内容を示す図である。FIG. 2 is a diagram showing contents of a cost storage unit 5;

【図3】アドレッシングコスト記憶部6の内容を示す図
である。
FIG. 3 is a diagram showing contents of an addressing cost storage unit 6;

【図4】処理対象のプログラムを示す図であるFIG. 4 is a diagram showing a program to be processed;

【図5】冗長式除去装置によって書き換えられたプログ
ラムを示す図である。
FIG. 5 is a diagram showing a program rewritten by a redundant-type removing device.

【図6】処理対象のプログラムを示す図であるFIG. 6 is a diagram showing a program to be processed;

【図7】冗長式除去装置によって書き換えられたプログ
ラムを示す図である。
FIG. 7 is a diagram showing a program rewritten by the redundant-type removing device.

【図8】処理対象のプログラムを示す図であるFIG. 8 is a diagram showing a program to be processed;

【図9】冗長式除去装置によって書き換えられたプログ
ラムを示す図である。
FIG. 9 is a diagram showing a program rewritten by the redundancy-type removing device.

【図10】従来の共通部分式の削除を行う冗長式除去装
置の構成を示す図である。
FIG. 10 is a diagram showing a configuration of a conventional redundant-type removing device that deletes a common sub-expression.

【図11】処理対象のプログラムを示す図であるFIG. 11 is a diagram showing a program to be processed;

【図12】従来の冗長式除去装置によって書き換えられ
たプログラムを示す図である。
FIG. 12 is a diagram showing a program rewritten by a conventional redundancy-type removing device.

【図13】従来の値の伝搬を行う冗長式除去装置の構成
を示す図である。
FIG. 13 is a diagram showing a configuration of a conventional redundant-type removing apparatus that propagates a value.

【図14】処理対象のプログラムを示す図であるFIG. 14 is a diagram showing a program to be processed;

【図15】従来の冗長式除去装置によって書き換えられ
たプログラムを示す図である。
FIG. 15 is a diagram showing a program rewritten by a conventional redundant-type removing device.

【図16】プログラムとアドレッシングモードとの対応
を示す図である。
FIG. 16 is a diagram showing a correspondence between a program and an addressing mode.

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

1 制御部 3a 演算出現位置検出部 3b 代入出現位置検出部 3c ポインタ演算式検出部 4a 第1の値使用位置検出部 4b 第2の値使用位置検出部 4c 第3の値使用位置検出部 5 コスト記憶部 6 アドレッシングコスト記憶部 7 コスト取出部 8 第1の書き換えコスト取出部 9 第2の書き換えコスト取出部 10 第3の書き換えコスト取出部 11 比較部 12 第1の書き換え部 13 第1の演算式除去部 14 第2の書き換え部 15 第2の演算式除去部 16 第3の書き換え部 17 第3の演算式除去部 18 処理対象保持部 DESCRIPTION OF SYMBOLS 1 Control part 3a Operation appearance position detection part 3b Substitution appearance position detection part 3c Pointer operation expression detection part 4a First value use position detection part 4b Second value use position detection part 4c Third value use position detection part 5 Cost Storage unit 6 Addressing cost storage unit 7 Cost extracting unit 8 First rewriting cost extracting unit 9 Second rewriting cost extracting unit 10 Third rewriting cost extracting unit 11 Comparison unit 12 First rewriting unit 13 First arithmetic expression Removal unit 14 Second rewrite unit 15 Second operation expression removal unit 16 Third rewrite unit 17 Third operation expression removal unit 18 Processing target holding unit

フロントページの続き (56)参考文献 特開 平1−214936(JP,A) 特開 平4−181432(JP,A) 特開 平5−53822(JP,A) 特開 平6−119184(JP,A) 高山久司・他,「retargeta bleコンパイラにおけるpatter n matchingによる最適なコー ド生成」情報処理学会第28回(昭和59年 前期)全国大会講演論文集(第1分 冊),日本,社団法人情報処理学会・発 行,1984年 5月28日,pp.335− 336,(ただし日付は、情報館受入日) Masataka Sassa,e t.al.,”Optimal sho rt−circuit Evaluat ion of Boolean Exp ressions”,情報処理学会第28 回(昭和59年前期)全国大会講演論文集 (第1分冊),日本,社団法人情報処理 学会・発行,1984年 5月28日,pp. 337−338,(ただし、日付は情報館受入 日) A.V.エイホ、J.D.ウルマン・ 共著、土居範久・訳,「情報処理シリー ズ7 コンパイラ」,日本,株式会社培 風館・発行,1986年 3月30日,初版, pp.366−369,435−442 A.V.エイホ(外2名)・著、原田 賢一・訳,「コンパイラ▲II▼ −原 理・技法・ツール−」,日本,株式会社 サイエンス社・発行,1990年10月10日, 初版,pp.632−634,645,722−725, 729−734 中田育男,「コンピュータ−サイエン ス・ライブラリー コンパイラ」,日 本,産業図書株式会社・発行,1981年 9月10日,初版,pp.217 (58)調査した分野(Int.Cl.7,DB名) G06F 9/45 G06F 9/06 JSTファイル(JOIS) CSDB(日本国特許庁) INSPEC(DIALOG)Continuation of front page (56) References JP-A-1-214936 (JP, A) JP-A-4-181432 (JP, A) JP-A-5-53822 (JP, A) JP-A-6-119184 (JP) , A) Hisashi Takayama, et al., "Optimal Code Generation by Pattern Matching in Retarable Bleil Compiler" Proc. Of the 28th (1st half of 1984) National Convention of Information Processing Society of Japan (1st volume), Japan, Association of Japan Published by The Information Processing Society of Japan, May 28, 1984, pp. 335-336, (however, the date is the date of receipt of the information center) Masataka Sassa, et. al. , "Optimal Short-Circuit Evaluation of Boolean Expresions", Proc. May 28, pp. 337-338 (however, the date is the date of receipt of the information center). V. Eiho, J.A. D. Ullman, co-authored, Norihisa Doi, translation, "Information Processing Series 7 Compiler", Japan, published by Baifukan Co., Ltd., March 30, 1986, first edition, pp. 366-369, 435-442 V. Aiho (Two others), author, Kenichi Harada, translation, "Compiler II-Hara, Technique, Tool-", Japan, Science Co., Ltd., published, October 10, 1990, first edition, pp. 632-634, 645, 722-725, 729-734 Ikuo Nakata, "Computer-Science Library Compiler", Japan, Sangyo Tosho Co., Ltd., published, September 10, 1981, first edition, pp. 217 (58) Field surveyed (Int.Cl. 7 , DB name) G06F 9/45 G06F 9/06 JST file (JOIS) CSDB (Japan Patent Office) INSPEC (DIALOG)

Claims (9)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】コンパイラに備えられ、プログラム保持手
段に保持されているプログラムの演算を書き換えて、書
き換え後、冗長な演算式を除去する冗長式除去装置であ
って、 プログラム保持手段のプログラムから演算子、被演算子
が同一の演算を全て検出し、当該演算によって定義され
ている全ての変数を検出して、検出した演算と変数とを
含む演算式の位置を記憶する演算検出手段と、 演算検出手段が検出した変数のうち2番目以降に位置す
る変数が、被演算子として使用されている演算を全て検
出する被演算子検出手段と、 演算式の型と、演算式の型がこれらの型に該当する演算
式のコストとを記憶するコスト記憶手段と、 被演算子検出手段が検出した演算式の型でコスト記憶手
段を検索し、当該演算式の型に対応するコストを取り出
す第1のコスト取出手段と、 被演算子検出手段が検出した演算式の被演算子に、演算
検出手段が検出した変数のうち1番目に位置する変数を
用いた場合の演算式の型でコスト記憶手段を検索し、当
該演算式の型に対応するコストを取り出す第2のコスト
取出手段と、 第1のコスト取出手段が取り出したコストと、第2のコ
スト取出手段が取り出したコストとを比較する比較手段
と、 比較手段が比較した結果、第2のコスト取出手段が取り
出したコストが小さければ、被演算子検出手段が検出し
た演算で、被演算子として使用されている変数のプログ
ラム中の位置を、演算検出手段が1番目に検出した変数
に書き換える書き換え手段と、 被演算子検出手段が検出した全ての演算中の変数を、書
き換え手段が書き換えた場合、被演算子検出手段が検出
した演算で被演算子として使用されていた変数と、その
変数が定義されていた演算とを含む演算式を、プログラ
ム中から除去する除去手段とを備えることを特徴とする
冗長式除去装置。
1. A redundant expression elimination device provided in a compiler for rewriting an operation of a program held in a program holding unit, and removing a redundant operation expression after the rewriting. An operation detecting means for detecting all operations in which a child and an operand are the same, detecting all variables defined by the operation, and storing the position of an operation expression including the detected operation and the variable; Among the variables detected by the detecting means, the second and subsequent variables are used in the operand detecting means for detecting all the operations used as the operands, the type of the arithmetic expression, and the type of the arithmetic expression. A cost storage means for storing the cost of the arithmetic expression corresponding to the type; and a cost storage means for searching the cost storage means by the type of the arithmetic expression detected by the operand detection means, and extracting the cost corresponding to the type of the arithmetic expression The first cost extraction means, and the type of the arithmetic expression when the first variable of the variables detected by the arithmetic detection means is used as the operand of the arithmetic expression detected by the operand detection means. A second cost extracting means for searching the cost storage means and extracting a cost corresponding to the type of the operation expression, a cost extracted by the first cost extracting means, and a cost extracted by the second cost extracting means. As a result of comparison between the comparing means and the comparing means, if the cost fetched by the second cost fetching means is small, in the program of the variable used as the operand in the operation detected by the operand detecting means, A rewriting means for rewriting the position of the operator to the variable detected first by the operation detecting means; and an operand detecting means when the rewriting means rewrites all variables in the operation detected by the operand detecting means. A variable expression removing device for removing, from a program, an arithmetic expression including a variable used as an operand in an operation detected by the method and an operation in which the variable is defined. .
【請求項2】第1のコスト取出手段は、取り出したコス
トの総和を求め、第2のコスト取出手段は、取り出した
コストの総和を求めて、比較手段は、第1のコスト取出
手段が求めたコストの総和と、第2のコスト取出手段が
求めたコストの総和とを比較することを特徴とする請求
項1記載の冗長式除去装置。
2. The first cost taking means finds the sum of the costs taken out, the second cost taking means finds the sum of the costs taken out, and the comparing means makes the sum of the costs taken out by the first cost taking means. 2. The redundant type removing apparatus according to claim 1, wherein the total cost calculated by said second cost extracting means is compared with the total cost calculated by said second cost extracting means.
【請求項3】比較手段は、第1のコスト取出手段が取り
出した個別のコストと、第2のコスト取出手段が取り出
した個別のコストとを比較することを特徴とする請求項
1記載の冗長式除去装置。
3. The redundancy according to claim 1, wherein the comparing means compares the individual costs extracted by the first cost extracting means with the individual costs extracted by the second cost extracting means. Type removal device.
【請求項4】コンパイラに備えられ、プログラム保持手
段に保持されているプログラムの演算を書き換えて、書
き換え後、冗長な演算式を除去する冗長式除去装置であ
って、 プログラム保持手段に保持されているプログラムから、
変数に定数を代入する演算式、及び、変数に変数の値を
代入する演算式を全て検出する演算式検出手段と、 演算式検出手段が検出した演算式の等号の左側に存在す
る変数が、被演算子として使用される演算式をプログラ
ム保持手段から全て検出する被演算子検出手段と、 演算式の型と、演算式の型がこれらの型に該当する演算
式のコストとを記憶するコスト記憶手段と、 被演算子検出手段が検出した演算式の型でコスト記憶手
段を検索し、当該演算式の型に対応するコストを取り出
す第1のコスト取出手段と、 被演算子検出手段が検出した演算式の被演算子に、演算
式検出手段が検出した変数のうち1番目に位置する変数
を用いた場合の演算式の型でコスト記憶手段を検索し、
当該演算式の型に対応するコストを取り出す第2のコス
ト取出手段と、 第1のコスト取出手段が取り出したコストと、第2のコ
スト取出手段が取り出したコストとを比較する比較手段
と、 第1のコスト取出手段が取り出したコストと、第2のコ
スト取出手段が検出したコストとを比較する比較手段
と、 比較手段が比較した結果、第2のコスト取出手段が取り
出したコストが小さければ、被演算子検出手段が検出し
た演算で被演算子として使用されている変数のプログラ
ム中の位置を、演算式検出手段が検出した変数あるいは
定数に書き換える書き換え手段と、 被演算子検出手段が検出した全ての演算中の変数を、書
き換え手段が書き換えた場合、被演算子検出手段が検出
した演算で被演算子として使用されていた変数が等号の
左側に存在する演算式であり、かつ、演算式検出手段が
検出した演算式を、プログラム中から除去する除去手段
とを備えることを特徴とする冗長式除去装置。
4. A redundant expression eliminator provided in a compiler for rewriting an operation of a program held in a program holding unit and removing a redundant arithmetic expression after the rewriting, wherein the redundant expression elimination device is provided in the program holding unit. From the program
An arithmetic expression that substitutes a constant for a variable, an arithmetic expression detector that detects all the arithmetic expressions that substitute the value of the variable for the variable, and a variable that exists on the left side of the equal sign of the arithmetic expression detected by the arithmetic expression detector , An operand detecting means for detecting from the program holding means all the arithmetic expressions used as operands, the types of the arithmetic expressions, and the costs of the arithmetic expressions corresponding to these types are stored. Cost storage means, first cost extraction means for searching the cost storage means by the type of the arithmetic expression detected by the operand detection means, and extracting the cost corresponding to the type of the arithmetic expression; The cost storage means is searched by the type of the arithmetic expression when the first variable among the variables detected by the arithmetic expression detection means is used as the operand of the detected arithmetic expression,
Second cost extracting means for extracting the cost corresponding to the type of the arithmetic expression, comparing means for comparing the cost extracted by the first cost extracting means with the cost extracted by the second cost extracting means, A comparing unit that compares the cost extracted by the first cost extracting unit with the cost detected by the second cost extracting unit. If the comparison unit determines that the cost extracted by the second cost extracting unit is small, Rewriting means for rewriting the program position of a variable used as an operand in the operation detected by the operand detection means to a variable or constant detected by the arithmetic expression detection means; If the rewriting means rewrites all the variables in the operation, the variable used as the operand in the operation detected by the operand detection means exists on the left side of the equal sign. A redundant expression removing device, comprising: a removing unit that removes, from the program, an operating expression that is an arithmetic expression that is detected by the arithmetic expression detecting unit.
【請求項5】第1のコスト取出手段は、取り出したコス
トの総和を求め、第2のコスト取出手段は、取り出した
コストの総和を求めて、比較手段は、第1のコスト取出
手段が求めたコストの総和と、第2のコスト取出手段が
求めたコストの総和とを比較することを特徴とする請求
記載の冗長式除去装置。
5. The first cost taking means calculates the sum of the taken out costs, the second cost taking out means obtains the sum of the taken out costs, and the comparing means obtains the sum of the taken out costs. 5. The apparatus according to claim 4, wherein the total cost is compared with the total cost obtained by the second cost extracting means.
【請求項6】比較手段は、第1のコスト取出手段が取り
出した個別のコストと、第2のコスト取出手段が取り出
した個別のコストとを比較することを特徴とする請求項
記載の冗長式除去装置。
6. The comparison means for comparing the individual costs extracted by the first cost extraction means with the individual costs extracted by the second cost extraction means.
4. The redundant removing device according to 4 .
【請求項7】コンパイラに備えられ、プログラム保持手
段に保持されているプログラムの演算を書き換えて、書
き換え後、冗長な演算式を除去する冗長式除去装置であ
って、 プログラム保持手段のプログラムから、ポインタである
変数が定義されている演算式を検出し、検出した演算お
よび変数が含まれる演算式の位置を記憶する演算検出手
段と、 演算検出手段が検出した変数が、被演算子として使用さ
れている演算式を全て検出する被演算子検出手段と、 1つの機械語命令で実行可能な演算式であり、かつ、ポ
インタに使用される被演算子、インデックスに使用され
る被演算子、およびオフセットに使用される被演算子の
うち、少なくとも2つの被演算子を含むものの型と、当
該演算式の型に対応する演算式のコストとを記憶するコ
スト記憶手段と、 被演算子検出手段が検出した演算式で、コスト記憶手段
を検索し、当該演算式に対応する演算式のコストを取り
出す第1のコスト取出手段と、 被演算子検出手段が検出した演算式の被演算子に、前記
演算検出手段が検出した演算を当てはめた場合の演算式
の型で、コスト記憶手段を検索し、当該演算式に対応す
るコストを取り出す第2のコスト取出手段と、 第1のコスト取出手段が取り出したコストと、第2のコ
スト取出手段が取り出したコストとを比較する比較手段
と、 比較手段が比較した結果、第2のコスト取出手段が取り
出したコストが小さければ、被演算子検出手段が検出し
た演算式で、被演算子として使用されている変数のプロ
グラム中の位置を、演算検出手段が検出した演算に書き
換える書き換え手段と、 被演算子検出手段が検出した全ての演算式中の変数を、
書き換え手段が書き換えた場合、演算検出手段が検出し
た演算を含む演算式を、プログラム中から除去する除去
手段とを備えることを特徴とする冗長式除去装置。
7. A redundant expression elimination device provided in a compiler for rewriting an operation of a program stored in a program holding unit and removing a redundant arithmetic expression after the rewriting. An operation detecting means for detecting an arithmetic expression in which a variable which is a pointer is defined, and storing a position of the detected arithmetic operation and an arithmetic expression including the variable; and a variable detected by the operation detecting means being used as an operand. Operand detection means for detecting all of the arithmetic expressions, and an arithmetic expression which can be executed by one machine language instruction and which is used for a pointer, an operand used for an index, and Cost of storing the type of the operand including at least two operands among the operands used for the offset, and the cost of the operation expression corresponding to the type of the operation expression Storage means, first cost extracting means for retrieving the cost storage means with the arithmetic expression detected by the operand detection means and extracting the cost of the arithmetic expression corresponding to the arithmetic expression, and detecting by the operand detecting means Second cost extracting means for retrieving the cost storage means and retrieving the cost corresponding to the arithmetic expression by using the type of the arithmetic expression in the case where the arithmetic operation detected by the arithmetic detecting means is applied to the operand of the calculated arithmetic expression And comparing means for comparing the cost taken out by the first cost taking out means and the cost taken out by the second cost taking out means. As a result of comparison by the comparing means, the cost taken out by the second cost taking out means becomes If it is smaller, rewriting means for rewriting the position in the program of a variable used as an operand in the arithmetic expression detected by the operand detection means to the operation detected by the operation detection means; The variables in all the arithmetic expressions detected by the child detection means are
A redundant expression removing device, comprising: removing means for removing, from a program, an arithmetic expression including an arithmetic operation detected by an arithmetic detecting device when the rewriting device has rewritten.
【請求項8】第1のコスト取出手段は、取り出したコス
トの総和を求め、第2のコスト取出手段は、取り出した
コストの総和を求めて、比較手段は、第1のコスト取出
手段が求めたコストの総和と、第2のコスト取出手段が
求めたコストの総和とを比較することを特徴とする請求
記載の冗長式除去装置。
8. The first cost taking means calculates the sum of the taken out costs, the second cost taking out means obtains the sum of the taken out costs, and the comparing means obtains the sum of the taken out costs. 8. The redundant-type elimination apparatus according to claim 7, wherein the total sum of the costs calculated is compared with the total sum of the costs obtained by the second cost extracting means.
【請求項9】比較手段は、第1のコスト取出手段が取り
出した個別のコストと、第2のコスト取出手段が取り出
した個別のコストとを比較することを特徴とする請求項
記載の冗長式除去装置。
9. The comparing means compares the individual cost extracted by the first cost extracting means with the individual cost extracted by the second cost extracting means.
8. The redundant removing device according to 7 .
JP31328993A 1993-12-14 1993-12-14 Redundant remover Expired - Fee Related JP3313859B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP31328993A JP3313859B2 (en) 1993-12-14 1993-12-14 Redundant remover

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP31328993A JP3313859B2 (en) 1993-12-14 1993-12-14 Redundant remover

Publications (2)

Publication Number Publication Date
JPH07168719A JPH07168719A (en) 1995-07-04
JP3313859B2 true JP3313859B2 (en) 2002-08-12

Family

ID=18039430

Family Applications (1)

Application Number Title Priority Date Filing Date
JP31328993A Expired - Fee Related JP3313859B2 (en) 1993-12-14 1993-12-14 Redundant remover

Country Status (1)

Country Link
JP (1) JP3313859B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000284970A (en) * 1999-03-29 2000-10-13 Matsushita Electric Ind Co Ltd Program converting device and processor
JP4494361B2 (en) * 2006-03-31 2010-06-30 三菱電機株式会社 Ladder program optimization device and optimization program
GB201804948D0 (en) * 2018-03-27 2018-05-09 Nchain Holdings Ltd Computer implemented system and method

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
A.V.エイホ(外2名)・著、原田賢一・訳,「コンパイラ▲II▼ −原理・技法・ツール−」,日本,株式会社サイエンス社・発行,1990年10月10日,初版,pp.632−634,645,722−725,729−734
A.V.エイホ、J.D.ウルマン・共著、土居範久・訳,「情報処理シリーズ7 コンパイラ」,日本,株式会社培風館・発行,1986年 3月30日,初版,pp.366−369,435−442
Masataka Sassa,et.al.,"Optimal short−circuit Evaluation of Boolean Expressions",情報処理学会第28回(昭和59年前期)全国大会講演論文集(第1分冊),日本,社団法人情報処理学会・発行,1984年 5月28日,pp.337−338,(ただし、日付は情報館受入日)
中田育男,「コンピュータ−サイエンス・ライブラリー コンパイラ」,日本,産業図書株式会社・発行,1981年 9月10日,初版,pp.217
高山久司・他,「retargetableコンパイラにおけるpattern matchingによる最適なコード生成」情報処理学会第28回(昭和59年前期)全国大会講演論文集(第1分冊),日本,社団法人情報処理学会・発行,1984年 5月28日,pp.335−336,(ただし日付は、情報館受入日)

Also Published As

Publication number Publication date
JPH07168719A (en) 1995-07-04

Similar Documents

Publication Publication Date Title
US6131189A (en) System and method to efficiently represent aliases and indirect memory operations in static single assignment form during compilation
KR100311585B1 (en) System and method for optimizing template object files
US4656583A (en) Method for improving global common subexpression elimination and code motion in an optimizing compiler
EP0273130B1 (en) Reassociation process for code optimization
US5142681A (en) APL-to-Fortran translators
EP0806725B1 (en) Method and apparatus for early insertion of assembler code for optimization
KR100555116B1 (en) In-line database for receiver type in object-oriented systems
US6966055B2 (en) Optimizing post-link code
JPH10228382A (en) Compiling system
US6810519B1 (en) Achieving tight binding for dynamically loaded software modules via intermodule copying
JP3130446B2 (en) Program conversion device and processor
US6347318B1 (en) Method, system, and apparatus to improve performance of tree-based data structures in computer programs
Rieu-Helft et al. How to get an efficient yet verified arbitrary-precision integer library
JP3437932B2 (en) Code generation method and apparatus for array range check, and versioning method and apparatus
US6077314A (en) Method of, system for, and computer program product for providing improved code motion and code redundancy removal using extended global value numbering
US6202203B1 (en) Method of, system for, and computer program product for providing global value numbering
US6035124A (en) Method of, system for, and computer program product for providing extended global value numbering
JP3313859B2 (en) Redundant remover
JP2856663B2 (en) Optimization method and apparatus for defining visible boundaries in compiled code
JP2817786B2 (en) Simulation apparatus and simulation method
US11635947B2 (en) Instruction translation support method and information processing apparatus
Housel et al. A methodology for machine language decompilation
JP3461185B2 (en) Method and apparatus for registering source code line number to load module
JP2778025B2 (en) Learning Co-occurrence Dictionary
JP3324542B2 (en) Virtual machine

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees