JPH0232425A - Constant optimizing system - Google Patents
Constant optimizing systemInfo
- Publication number
- JPH0232425A JPH0232425A JP18286488A JP18286488A JPH0232425A JP H0232425 A JPH0232425 A JP H0232425A JP 18286488 A JP18286488 A JP 18286488A JP 18286488 A JP18286488 A JP 18286488A JP H0232425 A JPH0232425 A JP H0232425A
- Authority
- JP
- Japan
- Prior art keywords
- constant
- hash value
- source program
- hash
- hash table
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000005457 optimization Methods 0.000 claims abstract description 30
- 238000000034 method Methods 0.000 claims description 14
- 238000010586 diagram Methods 0.000 description 2
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明は定数最適方式に関し、特にコンパイラの目的プ
ログラム生成過程における定数最適化方式に関する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a constant optimization method, and more particularly to a constant optimization method in the target program generation process of a compiler.
従来、この種の定数最適化方式では、定数を割りつける
際に割り付ける定数をすでに割り付けられた定数と次か
ら次に比較していき、同一の定数がすでにあるときには
割り付ける定数を割り付けずにすでに割り付けられた定
数を用いるようにしていた。Conventionally, in this type of constant optimization method, when allocating a constant, the constant to be allocated is compared with the already allocated constant one after another, and if the same constant already exists, the constant to be allocated is not allocated and the constant is already allocated. I was trying to use the given constant.
上述した従来の定数最適化方式では、割り付ける定数が
すでに割り付けられた定数と同一の定数であるか否かを
サーチするときに、割り付ける定数を割り付けられた定
数と次から次に比較していたので、サーチに時間がかか
るという欠点がある。In the conventional constant optimization method described above, when searching whether a constant to be allocated is the same as a constant that has already been allocated, the constant to be allocated is compared with the allocated constant one after another. , the disadvantage is that it takes time to search.
本発明の目的は、上述の点に鑑み、ハツシュテーブルを
用いることにより、高速な定数最適化を行う定数最適化
方式を提供することにある。In view of the above points, an object of the present invention is to provide a constant optimization method that performs constant optimization at high speed by using a hash table.
本発明の定数最適化方式は、ソースプログラム中の定数
を割り付ける際に同一の定数がすでに割り付けられてい
るならば定数を割り付けずにすでに割り付けられている
定数を用いる定数最適化方式において、定数とそのハツ
シュ値とを格納するハツシュテーブルと、ソースプログ
ラム中に定数が現れたときに現れた定数のハツシュ値を
求めて前記ハツシュテーブルをサーチして同一のハツシ
ュ値があればそのハツシュ値に対応して格納された定数
を用いる定数最適化手段とを有する。The constant optimization method of the present invention is a constant optimization method in which when allocating a constant in a source program, if the same constant has already been allocated, the constant is not allocated and the already allocated constant is used. Search the hash table to store the hash value and the hash table for the hash value of the constant that appears when the constant appears in the source program. and constant optimization means using correspondingly stored constants.
本発明の定数最適化方式では、ハツシュテーブルが定数
とそのハツシュ値とを格納し、定数最適化手段がソース
プログラム中に定数が現れたときに現れた定数のハツシ
ュ値を求めてハツシュテーブルをサーチして同一のハツ
シュ値があればそのハツシュ値に対応して格納された定
数を用いる。In the constant optimization method of the present invention, the hash table stores constants and their hash values, and the constant optimization means calculates the hash values of the constants that appear when the constants appear in the source program and stores them in the hash table. If the same hash value is found, the stored constant corresponding to that hash value is used.
次に、本発明について図面を参照して詳細に説明する。 Next, the present invention will be explained in detail with reference to the drawings.
第1図は、本発明の一実施例の定数最適化方式の構成を
示すブロック図である0本実施例の定数最適化方式は、
入力となるソースプログラム1と、コンパイラ2と、コ
ンパイラ2に含まれる定数最適化手段3と、定数最適化
手段3により使用されるハツシュテーブル4と、コンパ
イラ2が生成するオブジェクトモジュール5とから構成
されている。FIG. 1 is a block diagram showing the configuration of a constant optimization method according to an embodiment of the present invention.
Consisting of a source program 1 as an input, a compiler 2, a constant optimization means 3 included in the compiler 2, a hash table 4 used by the constant optimization means 3, and an object module 5 generated by the compiler 2. has been done.
第2図を参照すると、定数最適化手段3における処理は
、ハッシュ値算出ステップ31と、ハツシュテーブルサ
ーチステップ32と、同一ハツシュ値有無判定ステップ
33と、ハッシュテーブル内定数使用ステップ34と、
定数割付はステップ35と、ハツシュテーブル登録ステ
ップ36とからなる。Referring to FIG. 2, the processing in the constant optimization means 3 includes a hash value calculation step 31, a hash table search step 32, an identical hash value determination step 33, a hash table constant use step 34,
Constant allocation consists of step 35 and hash table registration step 36.
次に、このように構成された本実施例の定数最適化方式
の動作について説明する。Next, the operation of the constant optimization method of this embodiment configured as described above will be explained.
ソースプログラム1を用いてコンパイラ2を起動すると
、コンパイラ2はソースプログラムlを翻訳し始める。When the compiler 2 is started using the source program 1, the compiler 2 starts translating the source program l.
ソースプログラム1の翻訳中に定数が現れた場合には、
定数最適化手段3が起動される。If a constant appears during translation of source program 1,
Constant optimization means 3 is activated.
起動された定数最適化手段3は、現れた定数のハツシュ
値を求め(ステップ31)、求めたハツシュ値を基にハ
ツシュテーブル4をサーチする(ステップ32)。次に
、定数最適化手段3は、ハツシュテーブル4内に同一の
ハツシュ値があるか否かを判定しくステップ33)、同
一のハツシュ値があった場合にはハツシュテーブル4内
のハツシュ値に対応する定数を用いる(ステップ34)
、同一のハツシュ値がない場合には現れた定数を割り付
けて(ステップ35)、求めたハツシュ値と現れた定数
とをハツシュテーブル4に登録する(ステップ36)。The activated constant optimization means 3 calculates the hash value of the constant that appears (step 31), and searches the hash table 4 based on the calculated hash value (step 32). Next, the constant optimization means 3 determines whether or not there is the same hash value in the hash table 4 (step 33), and if there is the same hash value, the hash value in the hash table 4 is determined. (Step 34)
If the same hash value does not exist, the constant that appears is assigned (step 35), and the obtained hash value and the constant that appears are registered in the hash table 4 (step 36).
定数最適化手段3により、定数が現れるたびに以上の動
作が繰り返されることにより、高速な定数の最適化が行
われ、最終的にオブジェクトモジュール5が生成される
。The constant optimization means 3 repeats the above operations every time a constant appears, thereby performing constant constant optimization at high speed and finally generating an object module 5.
以上説明したように本発明は、定数の最適化を行うとき
にハツシュテーブルを用いることにより、同一の定数の
高速なサーチを行うことができ、ひいては高速な定数最
適化を行うことができるという効果がある。As explained above, by using a hash table when optimizing constants, the present invention can perform a high-speed search for the same constant, which in turn enables high-speed constant optimization. effective.
第1図は本発明の一実施例の定数最適化方式の構成を示
すブロック図、
第2図は第1図中の定数最適化手段における処理を示す
流れ図である。
図において、
l・・・ソースプログラム、
2・・・コンパイラ、
3・・・定数最適化手段、
4・・・ハッシュテーブル、
5・・・オブジェクトモジュールである。FIG. 1 is a block diagram showing the configuration of a constant optimization method according to an embodiment of the present invention, and FIG. 2 is a flowchart showing processing in the constant optimization means in FIG. In the figure, 1: source program, 2: compiler, 3: constant optimization means, 4: hash table, 5: object module.
Claims (1)
がすでに割り付けられているならば定数を割り付けずに
すでに割り付けられている定数を用いる定数最適化方式
において、 定数とそのハッシュ値とを格納するハッシュテーブルと
、 ソースプログラム中に定数が現れたときに現れた定数の
ハッシュ値を求めて前記ハッシュテーブルをサーチして
同一のハッシュ値があればそのハッシュ値に対応して格
納された定数を用いる定数最適化手段と を有することを特徴とする定数最適化方式。[Claims] In a constant optimization method in which when allocating a constant in a source program, if the same constant has already been allocated, the constant is not allocated and the already allocated constant is used, the constant and its hash value a hash table for storing constants; and a hash table for searching the hash table for the hash value of the constant that appears when the constant appears in the source program, and if the same hash value is found, the hash value is stored corresponding to that hash value. 1. A constant optimization method, comprising a constant optimization means using a constant.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP18286488A JPH0232425A (en) | 1988-07-22 | 1988-07-22 | Constant optimizing system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP18286488A JPH0232425A (en) | 1988-07-22 | 1988-07-22 | Constant optimizing system |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH0232425A true JPH0232425A (en) | 1990-02-02 |
Family
ID=16125776
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP18286488A Pending JPH0232425A (en) | 1988-07-22 | 1988-07-22 | Constant optimizing system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH0232425A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014041617A (en) * | 2012-08-23 | 2014-03-06 | Lsis Co Ltd | Error detection device and error detection method of programming language |
-
1988
- 1988-07-22 JP JP18286488A patent/JPH0232425A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2014041617A (en) * | 2012-08-23 | 2014-03-06 | Lsis Co Ltd | Error detection device and error detection method of programming language |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2596869B2 (en) | Concept dictionary management device | |
US5077654A (en) | Virtual machine system which translates virtual address from a selected virtual machine into real address of main storage | |
US10884982B2 (en) | Hash-based mount point lookup in virtual file systems | |
JPH0232425A (en) | Constant optimizing system | |
CN112506813B (en) | Memory management method and system | |
JPH0594311A (en) | Machine language translation program | |
JPH0358235A (en) | Hierarchy control system for task | |
JPS60254342A (en) | Controlling method of resources in using | |
JPS63146130A (en) | Knowledge unit management system | |
JP3007356B2 (en) | Compiling device | |
JPS63271525A (en) | Data processor | |
JP2669148B2 (en) | Job control language creation method | |
JPH0371342A (en) | Reserved word deciding system | |
JPH02183867A (en) | Table retrieving method | |
JPH05289867A (en) | Multibranch branching control system | |
JPH01305435A (en) | Load module optimizing system | |
JPS62125438A (en) | Virtual input and output device | |
JPS61168009A (en) | Numerical control device | |
JPH0540787A (en) | System for increasing speed for apex retrieval by name in tree structure | |
JPS6382532A (en) | Converting system from logical address to real address | |
JPH02109166A (en) | Retrieving device for character string | |
JPH07175709A (en) | Object oriented distributed processor and its control method | |
JPH02267632A (en) | Retranslation processing system | |
JPH0232468A (en) | Character string data retrieving system | |
KR970059964A (en) | A fast information access method using redundant data structure and hashing function and sequential link list |