JPH0719210B2 - Compiling device - Google Patents
Compiling deviceInfo
- Publication number
- JPH0719210B2 JPH0719210B2 JP59059165A JP5916584A JPH0719210B2 JP H0719210 B2 JPH0719210 B2 JP H0719210B2 JP 59059165 A JP59059165 A JP 59059165A JP 5916584 A JP5916584 A JP 5916584A JP H0719210 B2 JPH0719210 B2 JP H0719210B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- program
- function
- shared
- array
- 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 - Lifetime
Links
Landscapes
- Devices For Executing Special Programs (AREA)
Description
【発明の詳細な説明】 〔発明の技術分野〕 本発明は、コンパイル装置に関し、特にコンパイラ生成
データ中の重複を排除してデータ量を圧縮するコンパイ
ル装置に関する。TECHNICAL FIELD OF THE INVENTION The present invention relates to a compiling device, and more particularly to a compiling device that eliminates duplication in compiler-generated data and compresses the amount of data.
ソースプログラムのコンパイル処理では、オブジェクト
プログラムとともに多数のデータが一緒に生成される
が、生成されるデータの量は最近増加する傾向にある。
これはオブジェクトプログラムを効率的なものにするた
めのデータが増えていることが原因となっている。In the compilation process of the source program, a large amount of data is generated together with the object program, but the amount of generated data tends to increase recently.
This is because there is more data to make object programs more efficient.
たとえば最近のプログラムに対する高速化要求に伴い、
コンパイル処理の段階で種々の最適化が行われている。
たとえばソースプログラム中の関数演算の被演算子の値
が既知の場合に、コンパイラ処理段階で先行して演算を
実行してしまい、変換表や演算結果を定数として与える
ことが行われる。この場合演算の種類は任意であり、論
理演算や、加減乗除、平方根、三角関係などの演算が適
用可能である。For example, with the recent demand for speeding up programs,
Various optimizations are performed at the stage of compilation processing.
For example, when the value of the operand of the function operation in the source program is known, the operation is executed in advance at the compiler processing stage, and the conversion table and the operation result are given as constants. In this case, the type of operation is arbitrary, and logical operations, operations such as addition, subtraction, multiplication, division, square root, and triangular relationship can be applied.
ところでコンパイラは、プログラム単位でコンパイル処
理を実行することから、データのプログラム単位ごとに
独立して生成される。そのため、各プログラム単位間で
データの重複が生じる可能性がある。By the way, since the compiler executes the compilation process in program units, it is independently generated for each program unit of data. Therefore, duplication of data may occur between program units.
第1図はその説明図であり、R1,R2はプログラム、sin,
cos,tanはプログラム中の関数、A,B,Cはそれぞれの関数
の演算結果のデータ、a,b,cはデータA,B,Cに対するポイ
ンタであり、各プログラム内での相対アドレス値で表さ
れている。図示の例では、プログラムR1,R2のデータ間
に、関数sinおよびtanのコンパイラ生成データA,Cの重
複が生じている。FIG. 1 is an explanatory diagram thereof, where R 1 and R 2 are programs, sin,
cos, tan is the function in the program, A, B, C is the data of the operation result of each function, a, b, c are the pointers to the data A, B, C, and are the relative address values in each program. Is represented. In the illustrated example, the compiler generated data A and C of the functions sin and tan are duplicated between the data of the programs R 1 and R 2 .
ここで、コンパイラの生成データについて、sinを例に
説明する。Here, the data generated by the compiler will be described using sin as an example.
関数sinは角度を表す数値を入力として、その角度の正
弦値を出力する関数である。関数が呼び出される度に計
算をして値を算出する方法もあるが、同じ角度を入力と
して何度も呼び出される場合に全く同じ演算を何度も行
う必要があり処理効率が悪い。The function sin is a function that inputs a numerical value representing an angle and outputs a sine value of the angle. There is also a method of calculating the value each time the function is called, but when the same angle is input and the function is called many times, the exact same calculation needs to be performed many times, resulting in poor processing efficiency.
そこで、入力される値(sinの場合は角度)に対して予
め関数の値を計算したものを配列の形式で保持し、関数
呼出があった場合に、入力された角度(もしくは、入力
された角度に何らかの演算を施したもの)を添字(イン
デックス)として配列をアクセスすることで、高速に関
数の値を求めることが可能となる。Therefore, the value of the function is calculated in advance for the input value (in the case of sin) is stored in the form of an array, and when the function is called, the input angle (or the input value) By accessing the array with the subscript (index) of the angle obtained by performing some calculation), the value of the function can be obtained at high speed.
また、入力される値に対する関数の値を全て保持するの
が現実的でない場合などは、演算に使用される定数デー
タを所定量用意する。Further, when it is not practical to hold all the values of the function with respect to the input values, a predetermined amount of constant data used for the calculation is prepared.
この様にコンパイラは、関数の値そのもの、または関数
の値を求めるのに使用される定数データ等を生成する。In this way, the compiler generates the value of the function itself or constant data used to obtain the value of the function.
このように、従来のコンパイル処理では、コンパイラ出
力データのデータ量が増大していることから大きな記憶
領域が必要となり、また冗長な重複データを含む点でデ
ータ効率が悪いという問題があった。As described above, in the conventional compilation processing, a large storage area is required because the data amount of the compiler output data is increased, and there is a problem that the data efficiency is poor in that redundant redundant data is included.
本発明の目的は、コンパイラ出力データの冗長性を改善
し、必要とされる記憶領域の大きさを削減する手段を提
供することにあり、その構成は、ソースプログラムをプ
ログラム単位でコンパイル処理してオブジェクトプログ
ラムを生成するコンパイル処理部と,該生成された各オ
ブジェクトプログラム中のデータに共用属性を表す情報
を付与する共用化変換部と、該共用属性情報を付与され
たデータに基づいた重複なしの定数データ配列,及び,
プログラムから該定数データ配列への参照を可能とする
ための該定数データ配列と前記共用属性情報を付与され
たデータとの参照テーブルとを作成する連係編集処理部
とを備えたことを特徴とするものである。An object of the present invention is to provide a means for improving the redundancy of output data of a compiler and reducing the size of a required storage area. The structure is such that a source program is compiled in program units. A compile processing unit that generates an object program, a sharing conversion unit that adds information indicating a shared attribute to the data in each of the generated object programs, and a duplication based on the data to which the shared attribute information is added without duplication. A constant data array, and
It is characterized by further comprising a linking edit processing unit for creating a reference table of the constant data array and the data to which the shared attribute information is added so that the program can refer to the constant data array. It is a thing.
以下に、本発明の詳細を実施例にしたがって説明する。 Hereinafter, details of the present invention will be described according to examples.
第2図は本発明装置の概要図である。図中、1はソース
プログラム、2はコンパイル処理部、3はオブジェクト
プログラム、4は共用化変換部、5は連係編集部、6は
出力プログラム、7は共用データ配列、8は参照テーブ
ルを表す。FIG. 2 is a schematic diagram of the device of the present invention. In the figure, 1 is a source program, 2 is a compile processing unit, 3 is an object program, 4 is a sharing conversion unit, 5 is a link editing unit, 6 is an output program, 7 is a shared data array, and 8 is a reference table.
ソースプログラム1は本体プログラムとサブルーチンな
どのように複数のプログラム単位で構成されており、コ
ンパイル処理部2は、それらのプログラム単位を順次コ
ンパイル処理して、オブジェクトプログラム3として出
力する。オブジェクトプログラム3は、便宜上第1図に
示されているようなプログラムP1,P2からなるものとす
る。The source program 1 is composed of a plurality of program units such as a main program and a subroutine, and the compile processing unit 2 sequentially compiles these program units and outputs them as an object program 3. The object program 3 is assumed to be composed of programs P 1 and P 2 as shown in FIG. 1 for convenience.
コンパイル処理部で出力されるオブジェクトプログラム
は、後の連係処理において、外部参照等を解決するため
に、入力点等を記号で表している。本実施例において
は、関数名も同様に記号で表す。In the object program output by the compile processing unit, input points and the like are represented by symbols in order to resolve external references and the like in later linkage processing. In this embodiment, the function name is also represented by a symbol.
共用化変換部4は、共用化対象のデータA,B,Cに共用デ
ータ属性を与えるために、演算あるいは関数の名前にコ
ンパイル処理部2では使用されない特別の記号を付加し
てたとえば#記号を用いて次のように表す。The sharing conversion unit 4 adds a special symbol not used in the compile processing unit 2 to the name of the operation or function in order to give the shared data attribute to the data A, B, C to be shared, and adds a # symbol, for example. It is expressed as follows.
sin→sin# cos→cos# tan→tan# この様に属性を付与することにより、次の連係編集部の
処理において、どのデータが共用化対象データであるか
を容易に認識することができる。sin → sin # cos → cos # tan → tan # By adding attributes in this way, it is possible to easily recognize which data is the sharing target data in the processing of the next link editing unit.
連係編集部5は、共用化変換部4から出力された共用化
対象データを編集して重複なしの共用データ配列7を作
成し、そしてプログラムP1,P2からの参照を可能にする
ための参照テーブル8を作成する。The link editing unit 5 edits the sharing target data output from the sharing conversion unit 4 to create a shared data array 7 without duplication, and enables the reference from the programs P 1 and P 2 . The reference table 8 is created.
第3図は、参照テーブル8を用いてプログラムP1,P2か
ら共用データ配列7を参照する方法を示している。参照
テーブル8は、プログラムP1,P2中の全ての共用化デー
タの名前sin#,cos#,tan#と共用データ配列7中の対
応するデータのアドレスとを参照させたものである。FIG. 3 shows a method of referring to the shared data array 7 from the programs P 1 and P 2 using the reference table 8. The reference table 8 refers to the names sin #, cos #, tan # of all shared data in the programs P 1 and P 2 and the addresses of the corresponding data in the shared data array 7.
プログラムP1,P2からデータを参照する場合には、その
関数または演算の名前に#記号を付加したものをキーと
して参照テーブル8を検索し、対応する名前を見出した
とき、その欄のポインタa′,b′,c′,…から共用デー
タ配列7中の目的のデータを読み出す。When referring to data from programs P 1 and P 2 , the reference table 8 is searched using the function or operation name with the # symbol added as a key, and when the corresponding name is found, the pointer of that column The target data in the shared data array 7 is read from a ', b', c '...
以上のように、本発明によれば、コンパイラ生成データ
の共用化により、プログラム単位数が多いほど、また共
用化対象データの数が多いほど重複削減効果が上がるた
め、プログラムサイズの圧縮率を高めることができる。As described above, according to the present invention, since the compiler-generated data is shared, the duplicate reduction effect increases as the number of program units increases and the number of data to be shared increases, so that the compression rate of the program size is increased. be able to.
第1図は従来方式によるコンパイラ出力データの説明
図、第2図は本発明装置の概要図、第3図は共用データ
配列の参照方法の説明図である。 図中、1はソースプログラム、2はコンパイル処理部、
3はオブジェクトプログラム、4は共用化変換部、5は
連係編集部、6は出力プログラム、7は共用データ配
列、8は参照テーブルを表す。FIG. 1 is an explanatory diagram of compiler output data according to the conventional method, FIG. 2 is a schematic diagram of the device of the present invention, and FIG. 3 is an explanatory diagram of a method for referring to a shared data array. In the figure, 1 is a source program, 2 is a compile processing unit,
3 is an object program, 4 is a sharing conversion unit, 5 is a link editing unit, 6 is an output program, 7 is a shared data array, and 8 is a reference table.
───────────────────────────────────────────────────── フロントページの続き (72)発明者 宇那手 美恵 神奈川県川崎市中原区上小田中1015番地 富士通株式会社内 (56)参考文献 特開 昭58−64552(JP,A) 特開 昭59−20051(JP,A) ・「OS−VS連係編集プログラムおよ びローダーVS1リリース7VS2リリー ス3.8」、1982年7月、日本アイ・ビ ー・エム株式会社P.45、49 ・コンピュータ.サイエンス.ライブラ リー「コンパイラ」S.58.6.10、産業 図書P.215−217 ─────────────────────────────────────────────────── ─── Continuation of the front page (72) Mie Unate Mie Unate 1015 Kamiodanaka, Nakahara-ku, Kawasaki City, Kanagawa Prefecture, Fujitsu Limited (56) References JP-A-58-64552 (JP, A) JP-A-59 -20051 (JP, A)-"OS-VS link editing program and loader VS1 release 7 VS2 release 3.8", July 1982, IBM Japan, Ltd. 45, 49 ・ Computer. Science. Library “Compiler” S. 58.6.10, Industrial Book P. 215−217
Claims (1)
パイル処理してオブジェクトプログラムを生成するコン
パイル処理部と、 該生成された各オブジェクトプログラム中のデータに共
用属性を表す情報を付与する共用化変換部と、 該共用属性情報を付与されたデータに基づいた重複なし
の定数データ配列,及び,プログラムから該定数データ
配列への参照を可能とするための該定数データ配列と前
記共用属性情報を付与されたデータとの参照テーブルと
を作成する連係編集処理部と を備えたことを特徴とするコンパイル装置。1. A compile processing unit that compiles a source program in program units to generate an object program, and a sharing conversion unit that adds information indicating a shared attribute to the data in each generated object program. A constant data array without duplication based on the data provided with the shared attribute information, and the constant data array and the data provided with the shared attribute information for enabling the program to refer to the constant data array And a reference edit table for creating a reference table and a compile device.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP59059165A JPH0719210B2 (en) | 1984-03-27 | 1984-03-27 | Compiling device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP59059165A JPH0719210B2 (en) | 1984-03-27 | 1984-03-27 | Compiling device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS60204039A JPS60204039A (en) | 1985-10-15 |
| JPH0719210B2 true JPH0719210B2 (en) | 1995-03-06 |
Family
ID=13105493
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP59059165A Expired - Lifetime JPH0719210B2 (en) | 1984-03-27 | 1984-03-27 | Compiling device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0719210B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109977067B (en) * | 2019-03-22 | 2022-12-02 | 记忆科技(深圳)有限公司 | Shared variable allocation method and device based on heterogeneous multi-core controller |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS5864552A (en) * | 1981-10-14 | 1983-04-16 | Hitachi Ltd | Data processing method |
-
1984
- 1984-03-27 JP JP59059165A patent/JPH0719210B2/en not_active Expired - Lifetime
Non-Patent Citations (2)
| Title |
|---|
| ・「OS−VS連係編集プログラムおよびローダーVS1リリース7VS2リリース3.8」、1982年7月、日本アイ・ビー・エム株式会社P.45、49 |
| ・コンピュータ.サイエンス.ライブラリー「コンパイラ」S.58.6.10、産業図書P.215−217 |
Also Published As
| Publication number | Publication date |
|---|---|
| JPS60204039A (en) | 1985-10-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR20040063837A (en) | Method and system for recording macros in a language independent syntax | |
| JP3246438B2 (en) | Variable target compilation processing method, its processing device, storage medium for its program, and storage medium for conversion table | |
| Reilly | Concise encyclopedia of computer science | |
| CN111143038A (en) | RISC-V architecture microprocessor kernel information model modeling and generating method | |
| JPH0719210B2 (en) | Compiling device | |
| NO952247L (en) | System for recovery of relationships in a database in case of errors | |
| US5745749A (en) | Method and system of file version clustering of object blocks using a compiler and database and having a predetermined value | |
| CN118227138A (en) | A method and system for realizing computational compilation optimization based on error-free transformation | |
| JP3033091B2 (en) | Automatic translation method from digital circuit data to logic simulation description language | |
| Jones | A survey of automatic coding techniques for digital computers | |
| Wasserman et al. | A balanced view of MUMPS | |
| JP2669387B2 (en) | Database driven automatic program generation system | |
| Hopper | From Programmer to Computer | |
| Metcalf | Aspects of FORTRAN in large-scale programming | |
| JPH04167134A (en) | Bit transcription system | |
| CN118036517A (en) | Logic synthesis method and adder architecture generation method, device, equipment and medium | |
| Metcalf | Talk given at the CERN School of Computing Zinal, Switzerland, 1982 | |
| Crawford et al. | Engineering a program optimizer | |
| JPH05225283A (en) | Gate logic generation method | |
| JPS61128333A (en) | Program formation system | |
| MONICA | INTERNATIONAL by DEVELOPMENT INC. 111 BDC CORPORATION | |
| Dodd | 5ICSE: Some observations | |
| Murali et al. | An integrated framework for quality scientific software development | |
| Berschback | Annotated Microprogramming Bibliography | |
| JPS61206041A (en) | Extension method for program language |