JPH04308936A - Text optimizing system - Google Patents

Text optimizing system

Info

Publication number
JPH04308936A
JPH04308936A JP9968391A JP9968391A JPH04308936A JP H04308936 A JPH04308936 A JP H04308936A JP 9968391 A JP9968391 A JP 9968391A JP 9968391 A JP9968391 A JP 9968391A JP H04308936 A JPH04308936 A JP H04308936A
Authority
JP
Japan
Prior art keywords
text
texts
output
input
block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP9968391A
Other languages
Japanese (ja)
Inventor
Kuniko Yamamoto
山本 久仁子
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP9968391A priority Critical patent/JPH04308936A/en
Publication of JPH04308936A publication Critical patent/JPH04308936A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To improve the application ratio of the optimization of the same value relation by rearranging an intermediate text at the time of optimizing the text. CONSTITUTION:This system is equipped with an input text block dividing means 1 which inputs the intermediate text for one basic block from an input text storing file 8, in-block text depending relation analyzing means 2 which analyzes a depending relation between the texts from the definition referring relation of the data in the text, text rearranging means 3 which rearranges the text so that an interval between the texts having the depending relation can be the minimum, and text outputting means 4 which outputs the rearranged text to an output text storing file 9. The application ratio of the optimization of the same value relation is improved in order to improve an object efficiency.

Description

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

【0001】0001

【産業上の利用分野】本発明は、コンパイラシステムに
おける、テキスト最適化方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a text optimization method in a compiler system.

【0002】0002

【従来の技術】従来、コンパイラシステムにおける最適
化方式には、主に中間テキストに対する最適化、機械語
に対する最適化があり、各々多種多様に行われてきてい
るが、双方の最適化を関係付けて、さらに最適化効率を
向上するという手法は、各々の最適化に比べて、あまり
行われていない。「同値関係の最適化」は、あるデータ
を参照する機械語生成時に、それ以前に同じデータを定
義または参照したときにレジスタに格納された値がその
まま残っていることを解析して、そのデータをメモリか
らロードして使用する代わりに直接そのレジスタを使用
するというものであるが、従来、同値関係の最適化が適
用されるか否かは、データ参照時の状態で決まるもので
あった。
[Prior Art] Conventionally, optimization methods in compiler systems mainly include optimization for intermediate text and optimization for machine language, and each has been performed in a wide variety of ways. Compared to each type of optimization, methods for further improving optimization efficiency are less common. "Optimization of equivalence relations" is a process that analyzes when generating machine language that refers to certain data, and analyzes that the values stored in registers when the same data was previously defined or referenced remain unchanged. Instead of loading the data from memory and using it, the register is used directly, but conventionally, whether or not equivalence relation optimization was applied was determined by the state at the time the data was referenced.

【0003】0003

【発明が解決しようとする課題】前述のような従来の同
値関係の最適化では、データ参照の機械語を生成すると
きに、初めてそのデータの値がレジスタに格納されてい
るか否かを解析するという、いわば偶然の機会を待って
いるだけであった。したがって、中間テキストの並びに
よって、同値関係の最適化の効果が悪くなるという欠点
があった。
[Problem to be Solved by the Invention] In the conventional optimization of equivalence relations as described above, when generating machine language for data reference, it is first analyzed whether the value of the data is stored in a register or not. So to speak, I was just waiting for a chance opportunity. Therefore, there is a drawback that the effect of optimizing equivalence relations is deteriorated due to the arrangement of intermediate texts.

【0004】0004

【課題を解決するための手段】本発明のテキスト最適化
方式は、コンパイラシステムにおいて、入力テキスト格
納ファイルから、分岐テキスト/ラベルテキストの間の
一直線に制御が移る範囲内の中間テキストを入力して、
メモリ上に展開し、テキストテーブルによって入力順に
テキストをチェーニングする入力テキストブロック分割
手段と、展開テキスト内のデータの定義参照関係から、
テキストの依存関係を解析し、テキスト依存関係テーブ
ルによってその依存関係、およびテキストの出力間隔を
表すブロック内テキスト依存関係解析手段と、ブロック
内の依存関係のあるテキスト間の出力間隔の総和が最小
になるように、テキストの出力順序を並べ換えるテキス
ト並べ換え手段と、メモリ上で並べ換えられたテキスト
を順々に出力中間テキスト格納ファイルに出力するテキ
スト出力手段とを有している。
[Means for Solving the Problems] The text optimization method of the present invention inputs intermediate text within a range where control is transferred in a straight line from an input text storage file to a branch text/label text in a compiler system. ,
From the input text block dividing means that expands on memory and chains text in the input order using a text table, and the defined reference relationship of data in the expanded text,
An intra-block text dependency analysis means that analyzes text dependencies and expresses the dependencies and text output intervals using a text dependency table, and minimizes the sum of the output intervals between dependent texts within a block. The present invention includes a text rearranging means for rearranging the output order of texts, and a text output means for sequentially outputting the rearranged texts on the memory to an output intermediate text storage file.

【0005】[0005]

【実施例】次に、本発明について図面を参照して詳細に
説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be explained in detail with reference to the drawings.

【0006】図1は本発明の実施例を表す図である。図
1を参照すると、本発明のテキスト最適化方式の一実施
例は、入力テキストブロック分割手段1、ブロック内テ
キスト依存関係解析手段2、テキスト並べ換え手段3、
テキスト出力手段4、展開テキスト5、テキストテーブ
ル6、テキスト依存関係テーブル7、入力テキスト格納
ファイル8、および出力テキスト格納ファイル9から構
成される。
FIG. 1 is a diagram showing an embodiment of the present invention. Referring to FIG. 1, an embodiment of the text optimization method of the present invention includes an input text block dividing means 1, an intra-block text dependency analysis means 2, a text rearranging means 3,
It is composed of a text output means 4, an expanded text 5, a text table 6, a text dependency relationship table 7, an input text storage file 8, and an output text storage file 9.

【0007】入力テキストブロック分割手段1は、入力
テキスト格納ファイル8から1テキストずつテキストを
入力し、分岐テキストを入力したらそのテキストまで、
ラベルテキストを入力したらその直前のテキストまでを
メモリ上に展開する(展開テキスト5)。このとき同時
に、1テキストに対して、図2に示すようなテキストテ
ーブル6を1個ずつ作り、メモリ上の展開テキスト5の
アドレス、入力順(最終的には出力順)の前後のテキス
トに対するテキストテーブル6のアドレス、および何番
目のテキストであるかの値(テキスト番号)を設定して
おく。また、ブロックの最後に仮想テキストを想定し、
それに対して上記と同じように(ただし展開テキストア
ドレスは設定しなくてよい)テキストテーブル6を生成
しておく。
The input text block dividing means 1 inputs text one text at a time from the input text storage file 8, and when a branch text is input, up to that text,
After inputting the label text, the text up to the immediately preceding text is expanded in memory (Developed text 5). At the same time, one text table 6 as shown in FIG. 2 is created for each text, and the addresses of the expanded text 5 in memory and the text for the text before and after the input order (ultimately the output order) are created. The address of table 6 and the value of the text number (text number) are set in advance. It also assumes virtual text at the end of the block,
On the other hand, a text table 6 is generated in the same manner as above (however, the expanded text address does not need to be set).

【0008】ブロック内テキスト依存関係解析手段2は
、展開テキスト5に対して、テキストに現れる変数デー
タの定義参照関係により、テキストの依存関係を解析す
る。テキストTと、それ以前のテキストPとの依存関係
には、以下の2通りがある。
The intra-block text dependency relationship analysis means 2 analyzes text dependency relationships for the developed text 5 based on defined reference relationships of variable data appearing in the text. There are two types of dependencies between text T and previous text P:

【0009】■テキストPでアクセスしたデータDを、
テキストTが参照している。
■Data D accessed by text P,
Referenced by text T.

【0010】■テキストPでアクセスしたデータDを、
テキストTが定義している。この依存関係は、図2に示
すようなテキスト依存関係テーブル7で、テキストテー
ブル6をチェーニングすることによって表す。チェーニ
ングの方法は、上記■■の依存関係に対して各々以下の
とおりである。
■Data D accessed by text P,
Text T defines. This dependency relationship is expressed by chaining the text tables 6 in a text dependency relationship table 7 as shown in FIG. The chaining method is as follows for each of the above dependence relationships.

【0011】■テキスト依存関係テーブル7を使って、
テキストTとテキストPのテキストテーブル6をチェー
ニングする。このチェーンは、テキストPとテキストT
の出力間隔をできるだけ小さくするためのものである。 このとき、データDの種類によって依存関係の重み付け
をし、重みを依存関係テーブル7に設定する。
■Using the text dependency table 7,
The text table 6 of text T and text P is chained. This chain consists of text P and text T
This is to make the output interval as small as possible. At this time, the dependency relationships are weighted according to the type of data D, and the weights are set in the dependency relationship table 7.

【0012】 (メモリデータ) <(メモリ、テンポラリ以外のデータ)<(テンポラリ
データ) また同時に、チェーニングした二つのテキストテーブル
6のテキスト番号の差(テキスト距離)もテキスト依存
関係テーブル7に設定しておく。(以降、チェーニング
された二つのテキストにおいて、前のテキストに対して
後ろのテキストを「後続依存テキスト」、後ろのテキス
トに対して前のテキストを「先行依存テキスト」と呼ぶ
。)■テキスト依存関係テーブル7を使って、テキスト
PからテキストTへ、テキストテーブル6をチェーニン
グする。このチェーンは、テキストTの前に必ずテキス
トPを出力しなければならないことのみを表すものであ
る。したがって、■のようにテキスト距離を設定する必
要はない。(以降、チェーニングされた二つのテキスト
において、前のテキストに対して後ろのテキストを「後
続必須テキスト」、後ろのテキストに対して前のテキス
トを「先行必須テキスト」と呼ぶ。)チェーニングの処
理は、ブロック内のテキストを出力順にたどって、テキ
ストTと、テキストTがアクセスしているデータDをア
クセスしているテキストT以前の最も近くのテキストP
との間で行う。ブロック内のすべてのテキストに対して
上記の処理が終わったら、最後の仮想テキストに対する
テキストテーブル6と、後続依存テキストも後続必須テ
キストももたないブロック内のテキストすべてのテキス
トテーブル6との間で、上記■■のチェーニング処理を
行う。
(Memory data) < (memory, non-temporary data) < (temporary data) At the same time, the difference in text numbers (text distance) between the two chained text tables 6 is also set in the text dependency table 7. put. (Hereafter, in two chained texts, the text that follows the previous text is called the "successful dependent text" and the text that precedes the text that follows is called the "preceding dependent text.") ■Text dependency relationship Text table 6 is chained from text P to text T using table 7. This chain only represents that text P must be output before text T. Therefore, there is no need to set the text distance as in ■. (Hereafter, in two chained texts, the text that follows the previous text is called the "required subsequent text" and the text that precedes the text that follows is called the "required preceding text.") The chaining process is , following the texts in the block in the output order, find the text T and the data D that the text T is accessing, the nearest text P before the text T that is accessing the text T.
It is done between. After the above processing has been completed for all the texts in the block, between the text table 6 for the last virtual text and the text table 6 for all the texts in the block that have no subsequent dependent or required text. , perform the chaining process described in ■■ above.

【0013】テキスト並べ換え手段3は、最終的には、
テキスト依存関係テーブル7に設定されているテキスト
距離の総和が最小になるように、テキストを並べ換える
ことを目的とする。まず、テキストをテキスト出力順終
点アドレスで示されるテキストテーブル6(最後の仮想
テキストに対するテキストテーブル6)から、出力順チ
ェーンの逆順にたどって、対象テキストTを更新しなが
ら、以下の処理を繰り返し行う。 処理3.1:対象テキストTを処理済とする。 処理3.2:■対象テキストTの先行依存テキストPが
1個で、■テキストPの後続必須テキストおよび後続依
存テキストがすべて処理済で、■テキストTとテキスト
Pのテキスト距離が1、ならば何もしない。 処理3.3:■対象テキストTの先行依存テキストPが
1個で、■テキストPの後続必須テキストおよび後続依
存テキストがすべて処理済で、■テキストTとテキスト
Pのテキスト距離が1でない、ならば、テキストPのテ
キスト番号をテキストTのテキスト番号−1とし、テキ
ストTのテキストテーブル6から出力順テキストチェー
ンを逆にたどり、テキストPの直前のテキストテーブル
6までの各テーブルのテキスト番号を1ずつカウントダ
ウンし、最後にテキストTと出力順で直前のテキストT
’の間に、テキストPを出力するように、テキストT,
T’,Pの各々のテキストテーブル6の出力順テキスト
チェーンを更新する。 処理3.4:■対象テキストTの先行依存テキストPが
2個以上で、■テキストPの後続必須テキストおよび後
続依存テキストがすべて処理済、ならば、テキストPを
、 (1)テキストPの後続依存テキストの重みの総和の大
きい順 (2)(1)が同じなら、テキストPの先行依存テキス
トの重みの総和の小さい順 にPi(i=1,2…)とし、テキストTとテキストP
iのテキスト距離がiになるように、処理3.3と同様
のことを行う。(1)も(2)も同じ場合は、テキスト
Pの先行依存テキストに対する(1)の大きい順、(2
)の小さい順と、同じでなくなるまで繰り返し評価し、
Piを順序付ける。 処理3.5 ■対象テキストTの依存先行テキストP(個数は任意)
の後続必須テキストおよび後続依存テキストの中に、未
処理テキストがある、ならば、テキストPの内、処理済
テキストに対してのみ、処理3.4と同様のことを行う
[0013] The text rearranging means 3 finally
The purpose is to rearrange texts so that the sum of text distances set in the text dependency table 7 is minimized. First, the text is traced in the reverse order of the output order chain from the text table 6 (text table 6 for the last virtual text) indicated by the text output order end address, and the following process is repeated while updating the target text T. . Process 3.1: Target text T is treated as processed. Process 3.2: ■ If there is one preceding dependent text P of target text T, ■ All subsequent required texts and subsequent dependent texts of text P have been processed, and ■ The text distance between text T and text P is 1. do nothing. Process 3.3: ■ There is one preceding dependent text P of target text T, ■ All subsequent required texts and subsequent dependent texts of text P have been processed, and ■ The text distance between text T and text P is not 1. For example, set the text number of text P to the text number of text T - 1, trace the output order text chain in reverse from text table 6 of text T, and set the text number of each table up to text table 6 immediately before text P by 1. countdown, and finally text T and the previous text T in the output order
' so that the text P is output between the text T,
The output order text chain of each text table 6 of T' and P is updated. Processing 3.4: ■ If there are two or more preceding dependent texts P of target text T, and ■ All subsequent required texts and subsequent dependent texts of text P have been processed, then text P, (1) Successor to text P If (2) and (1) are the same in descending order of the sum of weights of the dependent texts, set Pi (i=1, 2...) in order of descending sum of weights of preceding dependent texts of text P, and text T and text P
The same thing as Process 3.3 is performed so that the text distance of i becomes i. If (1) and (2) are the same, then (2)
) in ascending order until they are no longer the same,
Order Pi. Processing 3.5 ■ Dependent preceding text P of target text T (number is arbitrary)
If there is unprocessed text among the subsequent essential text and subsequent dependent text, the same process as in process 3.4 is performed only on the processed text of text P.

【0014】出力順チェーンをすべてたどり、以上の処
理を行うと、ブロック内テーブルのテキスト距離の総和
は、可能な範囲で最小となる。
[0014] When all output order chains are followed and the above processing is performed, the sum of the text distances of the intra-block tables is minimized within the possible range.

【0015】テキスト出力手段4は、テキストテーブル
6をテキスト出力順起点ポインタから順にたどり、各々
のテーブルの展開テキストアドレスでなされる展開テキ
スト5を、順々に出力テキスト格納ファイル9に出力す
る。
The text output means 4 sequentially traces the text tables 6 from the text output order starting point pointer and sequentially outputs the expanded text 5 formed by the expanded text address of each table to the output text storage file 9.

【0016】本テキスト最適化方式による、ソースプロ
グラム→中間テキスト→依存関係図→最適化後依存関係
図→最適化後中間テキストのテキスト並べ換え手段3の
例を図3に示す。
FIG. 3 shows an example of the text rearrangement means 3 of source program→intermediate text→dependency diagram→optimized dependency diagram→optimized intermediate text according to the present text optimization method.

【0017】[0017]

【発明の効果】以上説明したように、コンパイラシステ
ムにおいて、中間テキストの最適化時に、テキストがア
クセスするデータの定義参照関係を解析し、同じデータ
に対する定義−参照、参照−参照のテキストの間隔を最
小限にすることによって、機械語生成時の同値関係の最
適化の適用率を向上し、オブジェクト効率をよくする。
As explained above, in the compiler system, when optimizing intermediate text, the definition reference relationship of data accessed by text is analyzed, and the intervals between definition-reference and reference-reference text for the same data are reduced. By minimizing, the application rate of optimization of equivalence relations during machine language generation is improved and object efficiency is improved.

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

【図1】本発明の一実施例を示す図、FIG. 1 is a diagram showing an embodiment of the present invention;

【図2】図1の一実施例におけるデータの関連を示す図
FIG. 2 is a diagram showing data relationships in one embodiment of FIG. 1;

【図3】本発明を適用した結果のソースプログラム→中
間テキスト→依存関係図→最適化後依存関係図→最適化
後中間テキストのテキスト並べ換え手段の例を示す図で
ある。
FIG. 3 is a diagram illustrating an example of text rearrangement means for source program→intermediate text→dependency diagram→after-optimization dependency diagram→after-optimization intermediate text as a result of applying the present invention.

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

1…入力テキストブロック分割手段、2…ブロック内テ
キスト依存関係解析手段 3…テキスト並べ換え手段、 4…テキスト出力手段、 5…展開テキスト、 6…テキストテーブル、 7…テキスト依存関係テーブル、 8…入力テキスト格納ファイル、 9…出力テキスト格納ファイル。
1...Input text block dividing means, 2...Intra-block text dependency analysis means 3...Text rearrangement means, 4...Text output means, 5...Development text, 6...Text table, 7...Text dependency relationship table, 8...Input text Storage file, 9...Output text storage file.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】  コンパイラシステムにおいて、入力テ
キスト格納ファイルから、分岐テキスト/ラベルテキス
トの間の一直線に制御が移る範囲内の中間テキストを入
力して、メモリ上に展開し、テキストテーブルによって
入力順にテキストをチェーニングする入力テキストブロ
ック分割手段と、展開テキスト内のデータの定義参照関
係から、テキストの依存関係を解析し、テキスト依存関
係テーブルによってその依存関係、およびテキストの出
力間隔を表すブロック内テキスト依存関係解析手段と、
ブロック内の依存関係のあるテキスト間の出力間隔の総
和が最小になるように、テキストの出力順序を並べ換え
るテキスト並べ換え手段と、メモリ上で並べ換えられた
テキストを順々に出力中間テキスト格納ファイルに出力
するテキスト出力手段とを有する、テキスト最適化方式
Claim 1: In a compiler system, intermediate text within a range where control is transferred in a straight line between branch text/label text is input from an input text storage file, expanded in memory, and written in the order of input using a text table. Analyze the text dependencies from the defined reference relationships of the data in the expanded text and the intra-block text dependencies that represent the dependencies and output intervals of the text using a text dependency table. analysis means,
A text sorting means that rearranges the output order of texts so that the sum of output intervals between dependent texts in a block is minimized, and texts that have been sorted in memory are sequentially output to an output intermediate text storage file. A text optimization method comprising a text output means for outputting text.
JP9968391A 1991-04-05 1991-04-05 Text optimizing system Pending JPH04308936A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9968391A JPH04308936A (en) 1991-04-05 1991-04-05 Text optimizing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9968391A JPH04308936A (en) 1991-04-05 1991-04-05 Text optimizing system

Publications (1)

Publication Number Publication Date
JPH04308936A true JPH04308936A (en) 1992-10-30

Family

ID=14253838

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9968391A Pending JPH04308936A (en) 1991-04-05 1991-04-05 Text optimizing system

Country Status (1)

Country Link
JP (1) JPH04308936A (en)

Similar Documents

Publication Publication Date Title
US4821181A (en) Method for converting a source program of high level language statement into an object program for a vector processor
US5146594A (en) Method of producing object program based on interprocedural dataflow analysis of a source program
EP0099262A2 (en) Method of transforming high level language statements into multiple lower level language instruction sets
JPH06103463B2 (en) Code generation method
KR100417398B1 (en) Method for processing instruction block repeat of dsp
JP3318051B2 (en) Translation processing method
JPH04308936A (en) Text optimizing system
US5671431A (en) Method for processing user program on a parallel computer system by inserting a tag during compiling
JP2820184B2 (en) Load module unit test support device
JP2585793B2 (en) Compiler system
US5854919A (en) Processor and its operation processing method for processing operation having bit width exceeding data width of bit storage unit
Wiedmann Efficiency in the APL environment—a full arsenal for attacking CPU hogs
Morasca et al. Validation of concurrent Ada™ programs using symbolic execution
JP2564904B2 (en) Program optimization processing method
JP2601541B2 (en) FORTRAN input / output list processing method
CN114491158A (en) Data analysis method, device, equipment and storage medium
JPH0417031A (en) System for optimizing propagation of constant value
JPS63276629A (en) Sorting system for record in file
JPH11161500A (en) Method for generating object program for reforming execution time dependent analysis
JPH01205331A (en) Large-scale program link system
JPH07141198A (en) Method for optimizing compiling
JPH05120105A (en) File data input/output system
JPS62204340A (en) Data processor
JPS63201833A (en) Reference settling system for unsettled label
JPH0460721A (en) Language processing system directed to object