JP2539070B2 - Compiler processor - Google Patents

Compiler processor

Info

Publication number
JP2539070B2
JP2539070B2 JP2060548A JP6054890A JP2539070B2 JP 2539070 B2 JP2539070 B2 JP 2539070B2 JP 2060548 A JP2060548 A JP 2060548A JP 6054890 A JP6054890 A JP 6054890A JP 2539070 B2 JP2539070 B2 JP 2539070B2
Authority
JP
Japan
Prior art keywords
pointer
processing
variable
area
instructions
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
JP2060548A
Other languages
Japanese (ja)
Other versions
JPH03260836A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2060548A priority Critical patent/JP2539070B2/en
Publication of JPH03260836A publication Critical patent/JPH03260836A/en
Application granted granted Critical
Publication of JP2539070B2 publication Critical patent/JP2539070B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 〔概要〕 計算機における、ポインタ機能を持つプログラミング
言語のコンパイラの最適化処理に関し、 ポインタ最適化対象の検出を、効率よく処理し、転出
効率の良いポインタ最適化処理方法を目的とし、 ポインタ変数によってデータを指示する機能を有する
所定の言語によって表されたプログラムを構成する複数
の言票から、同一領域の同一の内容を該ポインタ変数を
介して参照する2言票について、所定の最適化処理を行
うに際し、同一の該ポインタ変数で指示する構造体の同
一変数名の変数を参照する2言票を検出し、当該2言票
の中間の実行順序にある他の言票で、当該ポインタ変数
で指示する構造体の変数を定義する処理があることを検
出した場合に、該他の言票で定義する該変数の領域と、
該2言票で参照する該変数の領域との重なりを、該両変
数の属する構造体内の、相対位置と領域長とを、該両変
数について比較することにより識別し、該両領域の重な
りが無い場合に該2言票について該最適化を行うように
構成する。
The present invention relates to optimization processing of a compiler of a programming language having a pointer function in a computer, and a pointer optimization processing method that efficiently processes detection of a pointer optimization target and that has good transfer efficiency. For the purpose, two words that refer to the same content in the same area through the pointer variable from a plurality of words that form a program expressed in a predetermined language having a function of pointing data by the pointer variable, When performing a predetermined optimization process, two statements that refer to a variable having the same variable name in the structure pointed to by the same pointer variable are detected, and another statement in an intermediate execution order of the two statements is detected. In the case where it is detected that there is a process of defining a variable of a structure pointed to by the pointer variable, an area of the variable defined by the other statement,
The overlap with the variable area referred to in the two statements is identified by comparing the relative position and the area length in the structure to which both variables belong to, and the overlap of the two areas is identified. If not, the optimization is performed on the two votes.

〔産業上の利用分野〕[Industrial applications]

本発明は、計算機における、ポインタ機能を持つプロ
グラミング言語のコンパイラで、ポインタの最適化を行
うための処理方法に関する。
The present invention relates to a processing method for optimizing pointers in a computer programming language compiler having a pointer function.

〔従来の技術〕[Conventional technology]

計算機のプログラミング言語で、例えば公知のC言語
のようにデータの指示のためのポインタ機能を持つ言語
の場合に、その言語で記述された原始プログラムを処理
するコンパイラでは、原始プログラムを翻訳処理して生
成する目的プログラムの性能を改善するために、いわゆ
る最適化処理を行う。そのような最適化処理の一部であ
る、ポインタの最適化として、ポインタを介するデータ
参照を、直接にデータを参照する形に変換する等によっ
て、プログラムの実行時間を短縮する最適化がある。
In the case of a computer programming language, such as the well-known C language, which has a pointer function for pointing data, a compiler that processes a source program written in that language translates the source program. So-called optimization processing is performed to improve the performance of the generated target program. As the optimization of the pointer, which is a part of such optimization processing, there is an optimization that shortens the execution time of the program by converting a data reference via the pointer into a form of directly referring to the data.

第2図は前記のような処理を行う計算機の構成例を示
し、処理装置で実行される例えばC言語のコンパイラ1
は、C言語で書かれた原始プログラム3を入力して、解
析し、翻訳して、所要の処理装置で実行するための目的
プログラム4を生成する。
FIG. 2 shows an example of the configuration of a computer that performs the above-mentioned processing. For example, a C language compiler 1 executed by the processing device.
Inputs a source program 3 written in C language, analyzes and translates the source program 3 to generate a target program 4 to be executed by a required processing device.

そのためにコンパイラ1では、制御部5が翻訳処理の
ための初期設定等を行って原始プログラム3のプログラ
ム文を順次読み込み、解析処理部6がプログラム文の字
句、構文、式の解析を行って、対応する中間言語の言票
に変換して、中間言語プログラム7を生成する。
Therefore, in the compiler 1, the control unit 5 performs initial settings for translation processing and sequentially reads the program sentences of the source program 3, and the analysis processing unit 6 analyzes the lexical phrase, the syntax, and the expression of the program sentence, The intermediate language program 7 is generated by converting it into a corresponding language of the intermediate language.

中間言語プログラム7は、以後の翻訳処理を効率よく
実行できるように定められた中間言語で表現されたプロ
グラムであって、複数の言票から構成され、各言票によ
って各種プログラム文等に対応する各種の命令等を所定
の形式で表すように構成する。
The intermediate language program 7 is a program expressed in an intermediate language defined so that the subsequent translation processing can be efficiently executed, and is composed of a plurality of words, and each word corresponds to various program statements and the like. It is configured to represent various commands and the like in a predetermined format.

次に最適化処理部8が中間言語プログラム7について
最適化を行う。最適化には公知のように、DO文等で指定
される繰り返しループのプログラムについて不変式をル
ープの外に出したり、ループ内の乗算を加算に変更した
りする最適化や、共通式を検出して単純な参照に変換す
る等の共通式の除去による最適化処理を行う。
Next, the optimization processing unit 8 optimizes the intermediate language program 7. As is well known in the optimization, optimizations such as putting out an invariant expression outside the loop or changing multiplication in the loop to addition for a loop program specified by a DO statement, and detecting common expressions Then, the optimization processing is performed by removing the common expression such as converting into a simple reference.

このような最適化を行った中間言語プログラムについ
て、オブジェクト生成部9が記憶領域の割り付けと変換
処理を行って、目的プログラム4を出力する。
With respect to the intermediate language program thus optimized, the object generator 9 allocates a storage area and performs conversion processing, and outputs the target program 4.

前記の最適化処理部8の、共通式の除去等によって、
前記のようなポインタの最適化も行われるが、ポインタ
の最適化の適用が可能な対象を決定するための処理方法
として、動的解析法と静的解析法が知られている。両解
析法の処理を第5図に例示するプログラムを処理する場
合を例として説明する。
By the removal of the common expression of the optimization processing unit 8 and the like,
Although the pointer optimization as described above is also performed, a dynamic analysis method and a static analysis method are known as processing methods for determining a target to which the pointer optimization can be applied. The processing of both analysis methods will be described by taking the case of processing the program illustrated in FIG. 5 as an example.

第5図(a)において、左端に説明のために表示する
行番号を参照して、行の「struct strl」は、それに
続く中括弧内がデータの構造体の定義であって、定義さ
れる構造体の型の名前をstrlとすることを示し、この構
造体は〜行の中括弧内に示す要素からなる。即ち要
素は、float型で名前がf1のデータと、char型で名前がc
1のデータと、int型で名前がi1のデータとからなる。最
後の中括弧の外のv1は構造体データの名前である。
In FIG. 5 (a), referring to the line number displayed for explanation on the left end, the "struct strl" of the line is defined by the definition of the data structure in braces following it. Indicates that the structure type name is strl, and the structure consists of the elements shown in braces on the ~ line. That is, the element is float type data with name f1 and char type with name c
It consists of 1 data and int type data with the name i1. V1 outside the last curly brace is the name of the structure data.

〜行も、前記と同様の方法で別の構造体を定義す
るものである。なお、要素の定義中の行はchar型で名
前がc1の配列であって、配列要素の個数が5であること
を表す。
The ~ line also defines another structure in the same manner as described above. It should be noted that the line in the definition of the element is an array of char type and the name is c1 and indicates that the number of array elements is 5.

行は「*p」で「ポインタ変数pによって指す先の
データ」を意味し、それが構造体の型str1のデータであ
ること、即ちポインタ変数pはstr1型構造体のデータを
指示するポインタであることを宣言し、行も同様にし
てポインタ変数qについて宣言する。
The line is "* p", which means "the data pointed to by the pointer variable p", and that it is the data of the structure type str1, that is, the pointer variable p is a pointer that points to the data of the str1 type structure. Declare that there is, and similarly declare the row for the pointer variable q.

、、、、行は何れも代入文で、例えば行
は変数pを、「&v1」で表す「変数v1のアドレス値」に
定義する。又、行等の「p→f1」の形式の表示は「ポ
インタ変数pが指示する構造体の、要素f1」等を表すも
のとする。
,,, lines are all assignment statements, and for example, the line defines the variable p as "address value of variable v1" represented by "&v1". Further, the display in the form of “p → f1” such as a line represents “the element f1 of the structure pointed to by the pointer variable p” and the like.

第5図(b)も同様であるが、行の「void *p」
は、ポインタ変数pが指示するデータの型は限定されな
いことを示す。又、行、行で「p」を修飾する
「(struct str1*)」は、この場合のpの指示するデ
ータが構造体の型str1であることを示す。
The same applies to FIG. 5 (b), but the line "void * p"
Indicates that the type of data pointed to by the pointer variable p is not limited. In addition, "(struct str1 *)" that modifies "p" between lines indicates that the data pointed to by p in this case is the structure type str1.

例えば第5図(a)又は(b)で共通式を参照してい
る行と行が最適化可能かを識別するために、動的解
析法で処理する場合には、言票の実行をシミュレートす
る形でたどって、共通式で参照している内容が行から
行までの間で変更されていないことを識別して共通式
を判定するので、第5図(a)、(b)何れの場合も両
言票が共通式を持つと認識される。
For example, in the case of processing by the dynamic analysis method in order to identify the row that refers to the common expression in FIG. 5 (a) or (b) and whether the row can be optimized, the execution of the vote is simulated. The common expression is determined by recognizing that the contents referred to by the common expression are not changed from line to line in the same manner as in FIG. 5 (a) and (b). In the case of, both votes are recognized as having a common expression.

他方、静的解析法の場合には、各ポインタ変数が指示
する可能性のあるデータを、処理対象のプログラム全体
について調べておき、例えば指示する可能性のあるデー
タに重複のある他のポインタ変数で指示する変数が両言
票の中間で定義されている場合には、共通式では無いも
のとする。従って、(a)の場合は、、行でポイン
タ変数pとqは異なる型のデータを指示することが明示
されているので、行における定義は問題にならずに、
と行は共通式を持つと認識される。
On the other hand, in the case of the static analysis method, the data that each pointer variable may point to is checked for the entire program to be processed, and another pointer variable that has a duplication in the data that may point to If the variable indicated by is defined in the middle of both words, it is not a common expression. Therefore, in the case of (a), it is specified that the pointer variables p and q point to different types of data in the line, so the definition in the line does not matter,
And lines are recognized as having a common expression.

しかし、第5図(b)の例では、プログラム全体の静
的関係では、ポインタ変数pの指示するデータの型は限
定されず、及び行により、pとqが同じ変数v2のア
ドレス値を持つ可能性があるので、と行の中間の
行でqの指示する変数が定義されていることから、と
行で参照される変数f1は異なる可能性があるものとし
て、両行を共通式を持つとは認識しない。
However, in the example of FIG. 5B, the type of data pointed to by the pointer variable p is not limited in the static relationship of the entire program, and p and q have the same address value of the variable v2 depending on the line. Since the variable pointed to by q is defined in the middle row between and, it is possible that the variable f1 referenced in and may be different. Does not recognize.

以上のようにして、共通式と認識した場合には、第5
図(a)又は(b)において、例えば行の言票を、
「s=r」の形の単純な参照に変換して最適化すること
ができる。
As described above, when the common expression is recognized, the fifth
In Figure (a) or (b), for example,
It can be converted to a simple reference of the form "s = r" for optimization.

〔発明が解決しようとする課題〕[Problems to be Solved by the Invention]

以上の動的解析法及び静的解析法の説明から推測でき
るように、動的解析法は比較的洩れ無く最適化対象を認
識することができるが、一言票ごとに実行を追うような
処理が必要なので、比較的長い処理時間を要し、又各処
理単位ごとにポインタの指示の可能性を表示するための
ビットベクトル等を設けるので作業領域も大きくなると
いう問題があり、他方静的解析法では処理時間は比較的
短く、作業領域も小さいが、最適化可能の認識洩れが比
較的多いという問題がある。
As can be inferred from the above explanation of the dynamic analysis method and the static analysis method, the dynamic analysis method can recognize the optimization target with relatively no omission, but the processing that follows the execution for each word Requires a relatively long processing time, and since a bit vector for displaying the possibility of pointing with a pointer is provided for each processing unit, there is a problem that the work area also becomes large. On the other hand, static analysis In the method, the processing time is relatively short and the work area is small, but there is a problem that there are relatively many omissions of recognition that optimization is possible.

本発明は、ポインタ最適化対象の検出で、処理効率が
良く、妥当な検出効率を有するポインタ最適化処理方法
を目的とする。
It is an object of the present invention to detect a pointer optimization target, have a high processing efficiency, and have a proper detection efficiency.

〔課題を解決するための手段〕[Means for solving the problem]

第1図は、本発明の構成を示す処理の流れ図である。 FIG. 1 is a flow chart of processing showing the configuration of the present invention.

図はポインタ最適化処理方法の構成であって、ポイン
タ変数によってデータを指示する機能を有する所定の言
語によって表されたプログラムを構成する複数の言票か
ら、同一領域の同一の内容を該ポインタ変数を介して参
照する2言票について、所定の最適化処理を行うに際
し、処理ステップ10で同一の該ポインタ変数で指示する
構造体の同一変数名の変数を参照する2言票を検出し、
処理ステップ11で当該2言票の中間の実行順序にある他
の言票で、当該ポインタ変数で指示する構造体の変数を
定義する処理があることを検出した場合に、処理ステッ
プ12で該他の言票で定義する該変数の領域と、該2言票
で参照する該変数の領域との重なりを、該両変数の属す
る構造体内の、相対位置と領域長とを、該両変数につい
て比較することにより識別し、該両領域の重なりが無い
場合に処理ステップ13で該2言票について該最適化を行
う。
The figure shows the structure of a pointer optimization processing method, in which the same contents of the same area are selected from a plurality of words constituting a program expressed in a predetermined language having a function of instructing data by a pointer variable. When performing a predetermined optimization process with respect to the two words referred to via, the two words referring to the variable having the same variable name in the structure pointed to by the same pointer variable are detected in processing step 10,
When it is detected in the processing step 11 that there is processing for defining the variable of the structure pointed to by the pointer variable in another statement in the middle execution order of the two statements, the other step is executed in the processing step 12. Comparing the area of the variable defined in the above statement with the area of the variable referenced in the two statements, the relative position and the area length in the structure to which the two variables belong, and comparing the two variables. If the two areas do not overlap, the optimization is performed on the two words in processing step 13.

〔作用〕[Action]

本処理方法により、共通式の候補と、他の定義言票と
の関係について、ポインタが指示する可能性のある変数
を調べるのではなく、ポインタが指している先の領域の
重なりの有無を、指示する構造体内における、変数の領
域の相対位置と長さとの比較によって調べて、最適化処
理の適用可否の識別をするので、比較的短い処理時間、
及び小さい作業領域を使用して、比較的洩れなく、最適
化可能対象を検出することができる。
With this processing method, regarding the relationship between the common expression candidates and other definition words, instead of checking the variables that the pointer may point to, the presence or absence of overlap of the area pointed to by the pointer is checked. A comparatively short processing time, because it is determined by comparing the relative position and length of the variable region in the designated structure to determine whether or not the optimization process is applicable.
And small working areas can be used to detect optimizable targets relatively leak-free.

〔実施例〕〔Example〕

第1図は、例えば第2図の最適化処理部8による処理
の一部であり、最適化対象候補の共通式の認識のため
に、前記の動的又は静的解析法に代わる処理とし、中間
言語プログラム7を走査して処理ステップ10で同一の該
ポインタ変数で指示する構造体の同一変数名の変数を参
照する2言票を検出すると、処理ステップ11で当該2言
票の中間の実行順序にある他の言票で、当該ポインタ変
数で指示するデータを定義している可能性のある処理が
あるか走査し、該当するものが無ければ両者は共通式を
参照するとして処理ステップ13で最適化を行う。
FIG. 1 is a part of the processing by the optimization processing unit 8 in FIG. 2, for example, in order to recognize the common expression of the optimization target candidates, the processing is an alternative to the above dynamic or static analysis method, When the intermediate language program 7 is scanned and two words that refer to the variable having the same variable name of the structure pointed to by the same pointer variable are detected in the processing step 10, the intermediate execution of the two words is executed in the processing step 11. If there is a process that may define the data pointed to by the pointer variable in other words in order, and if there is no corresponding process, both parties refer to a common expression and processing step 13 Optimize.

該当する可能性のある中間の言票を検出した場合に
は、処理ステップ12で当該他の言票で定義する変数の領
域と、後の言票で参照する変数の領域との重なりを、両
変数の属する構造体内の、相対位置と領域長とを、該両
変数について比較することにより識別し、重なりが無い
場合のみ、処理ステップ13でこの2言票について前記の
ような最適化を行う。処理ステップ12で重なりがあると
判定した場合には、こゝで予定した最適化の対象となら
ない。
If an intermediate vocabulary that may be applicable is detected, the overlap of the variable area defined in the other vocabulary and the variable area referred to in the subsequent vocabulary in step 12 is performed. The relative position and the region length in the structure to which the variable belongs are identified by comparing the two variables, and only when there is no overlap, the above-mentioned optimization is performed on these two statements in processing step 13. If it is determined in processing step 12 that there is an overlap, it is not the target of the optimization scheduled here.

第3図は、第1図の処理ステップ12の詳細な処理例を
示す処理の流れ図であり、先ず処理ステップ21で、最適
化候補の両参照言票の中間で変数を定義する言票と、そ
の後で参照している言票とについて、ポインタが指示す
るデータが構造体の要素かを判定し、構造体の要素でな
ければ処理ステップ22でそのデータの型が同じか識別
し、同じであれば「重なる」とし、型が異なれば「重な
らない」とする。なお少なくとも一方が1バイトの構成
の型のデータであれば、常に「重なる」と判定する。
FIG. 3 is a flow chart of the processing showing a detailed processing example of the processing step 12 of FIG. 1. First, in processing step 21, a statement defining a variable in the middle of both reference words of optimization candidates, It is determined whether the data pointed to by the pointer is the element of the structure with respect to the speech referred to thereafter, and if it is not the element of the structure, it is identified in processing step 22 whether the data type is the same, If they are different, they are not overlapped. It should be noted that if at least one of the types of data has a structure of 1 byte, it is always determined as "overlap".

ポインタの指示するデータが構造体の要素の場合に
は、処理ステップ23へ分岐して、ポインタ変数が同じで
あれば、処理ステップ24でそのポインタ変数で指すのが
同じ型の構造体か識別する(指示する先の構造体の型
は、第5図(b)の例の行のような宣言、又は行の
右辺括弧内の修飾等から識別できる)。
If the data pointed to by the pointer is an element of the structure, the process branches to processing step 23, and if the pointer variables are the same, it is determined in processing step 24 whether the pointer variable points to a structure of the same type. (The type of the structure to be pointed to can be identified by a declaration such as the line in the example of FIG. 5B, or a modification in the parentheses on the right side of the line).

こゝで構造体が異なる場合には、この処理の段階では
異なる両構造体の置かれる相対位置は定まらないので、
ポインタの指すデータは「重なる」と判定する。しか
し、同じ構造体とすれば、両ポインタで指す要素の置か
れる相対位置を、その構造体の宣言から求めることがで
きるので、処理ステップ25で次のようにして両要素の位
置を比較することによって、重なりの有無を判定する。
If the structures are different here, the relative positions of the different structures will not be determined at this stage of processing, so
The data pointed to by the pointer is determined to "overlap". However, if the same structure is used, the relative position where the elements pointed by both pointers are placed can be obtained from the declaration of the structure, so in processing step 25 the positions of both elements are compared as follows. The presence or absence of overlap is determined by.

即ち、そのポインタ変数が指示する構造体について、
参照される変数の構造体内の変位と変数の領域の長さと
を、定義される変数のそれらと比較する。その結果、変
位の小さい方の変位値をα、長さをlとし、他方の変位
値をβとして、 α+l≦β であれば、「重ならない」と判定し、そうでなければ
「重なる」とする。
That is, regarding the structure pointed to by the pointer variable,
The displacement of the referenced variable in the structure and the length of the variable's region are compared to those of the defined variable. As a result, if the displacement value of the smaller displacement is α, the length is l, and the other displacement value is β, and α + l ≦ β, then it is determined that “no overlap”, and if not, “overlap”. To do.

第4図は(a)のプログラムにおける、「p→I1」と
「p→I2」との比較の例で、ポインタ変数pが指示する
構造体が、(b)に示すような構造を有する場合に両変
数は「重ならない」と判定される。
FIG. 4 is an example of comparison between “p → I1” and “p → I2” in the program of (a), and the structure pointed to by the pointer variable p has the structure shown in (b). Both variables are judged to be “not overlapping”.

処理ステップ23でポインタ変数が異なる場合には、処
理ステップ26で所定の処理指定を見て安全サイドの判定
をするか否かで処理を分ける。こゝで安全サイドの判定
とは、プログラムに特に規制を設けていない場合に、よ
り多くの場合を「重なる」と判定するようにする処理で
ある。一方安全サイドでない判定とは、「宣言と異なる
型を指示するように使用されているポインタと他のポイ
ンタとで同じ領域を指示することはない(そのようなプ
ログラムは記述しない)」ことを前提として、「重な
る」判定の条件を狭めた処理である。
When the pointer variables are different in processing step 23, the processing is divided in processing step 26 depending on whether or not the predetermined processing designation is taken and the safety side is judged. Here, the determination on the safety side is a process of determining “overlap” in more cases when there is no particular regulation in the program. On the other hand, the judgment that is not on the safe side is based on the assumption that "the pointer used to point to a type different from the declaration does not point to the same area as another pointer (such a program is not written)". Is a process in which the condition of the “overlap” determination is narrowed.

従って、安全サイドの場合は、処理ステップ27で同じ
構造体か識別して、同じ構造体であれば処理ステップ25
で前記のように、構造体内の相対位置と長さを比較して
重なりを判定し、同じ構造体でなければ処理ステップ28
で、ポインタで指示する先の両要素の型を識別して、型
が同じであれば「重なる」、型が異なる場合のみ「重な
らない」と判定する。しかし、安全サイドでない判定の
場合には、処理ステップ29で判定して同じ構造体の場合
は前記と同様に処理するが、構造体が異なれば直ちに
「重ならない」とする。
Therefore, in the case of the safety side, it is identified in the processing step 27 whether the structures are the same, and if the structures are the same, the processing step 25 is performed.
Then, as described above, the relative position and the length in the structure are compared to determine the overlap, and if they are not the same structure, the processing step 28
Then, the types of both elements pointed to by the pointers are identified, and if the types are the same, "overlap" is determined, and only if the types are different, "no overlap" is determined. However, if it is determined that the structure is not on the safe side, the determination is made in processing step 29, and if the structures are the same, the same processing is performed as described above, but if the structures are different, it is immediately determined that “no overlap”.

〔発明の効果〕〔The invention's effect〕

以上の説明から明らかなように本発明によれば、計算
機における、ポインタ機能を持つプログラミング言語の
コンパイラの最適化処理において、ポインタ最適化対象
の検出を、効率よく処理できるので、少ない処理コスト
で、実行効率の優れた目的プログラムを生成することが
可能になるという著しい工業的効果がある。
As is clear from the above description, according to the present invention, in the optimization process of the compiler of the programming language having the pointer function in the computer, the detection of the pointer optimization target can be efficiently processed, so that the processing cost is low, There is a remarkable industrial effect that it is possible to generate a target program with excellent execution efficiency.

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

第1図は本発明の構成を示す処理の流れ図、 第2図は計算機の構成例を示すブロック図、 第3図は本発明の重なり判定処理の流れ図、 第4図はデータの位置と長さの比較を説明する図、 第5図はプログラム例を説明する図である。 図において、 1はコンパイラ、3は原始プログラム、4は目的プログ
ラム、5は制御部、6は解析処理部、7は中間言語プロ
グラム、8は最適化処理部、9はオブジェクト生成部、
10〜13、21〜29は処理ステップを示す。
FIG. 1 is a flow chart of processing showing the configuration of the present invention, FIG. 2 is a block diagram showing a configuration example of a computer, FIG. 3 is a flow chart of overlap determination processing of the present invention, and FIG. 4 is the position and length of data. And FIG. 5 is a diagram for explaining an example of the program. In the figure, 1 is a compiler, 3 is a source program, 4 is a target program, 5 is a control unit, 6 is an analysis processing unit, 7 is an intermediate language program, 8 is an optimization processing unit, 9 is an object generation unit,
10 to 13 and 21 to 29 indicate processing steps.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】ポインタ変数によって構造体のデータを指
示する機能を有する所定の言語によって表されたソース
プログラムを解釈して、計算機で実行する形式のオブジ
ェクトプログラムを生成するコンパイラ処理装置に於い
て、 前記ソースプログラムを構成する複数の命令のうち、構
造体へのポインタを用いて、同一の構造体内の同じ領域
を操作する2つの命令を、2つの命令のうち後者の命令
を高速の直接命令に置き換える最適化処理の対象として
選定し、 前記ポインタ変数で指示する構造体の一部の領域を変更
する命令が、前記2つの命令の間にあるか否かを判定
し、 有る場合には、該構造体の一部を変更する命令の変更対
象の領域の開始位置と長さ、及び前記2つの命令が操作
する領域の開始位置と長さに基づいて、該構造体の一部
を変更する命令の変更対象の領域と、前記2つの命令が
操作する領域と重なるか否かを判定し、重ならない場合
のみ、前記2つの命令の後者の命令を高速の直接命令に
置き換える最適化処理を行うように制御することを特徴
とするコンパイラ処理装置。
1. A compiler processing apparatus for interpreting a source program represented by a predetermined language having a function of pointing structure data by a pointer variable, and generating an object program of a format to be executed by a computer. Of the plurality of instructions forming the source program, two instructions for operating the same area in the same structure by using a pointer to the structure are used, and the latter of the two instructions is converted into a high-speed direct instruction. It is determined whether or not there is an instruction that is selected as a target of the replacement optimization processing and that changes a partial area of the structure pointed by the pointer variable, between the two instructions. A part of the structure based on the start position and length of the area to be changed by the instruction that changes a part of the structure, and the start position and length of the area operated by the two instructions An optimization process for determining whether or not the area to be changed of the instruction to be changed and the area to be operated by the two instructions overlap, and only when the areas do not overlap, the latter instruction of the two instructions is replaced with a high-speed direct instruction. A compiler processing device characterized by controlling so as to perform the following.
JP2060548A 1990-03-12 1990-03-12 Compiler processor Expired - Fee Related JP2539070B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2060548A JP2539070B2 (en) 1990-03-12 1990-03-12 Compiler processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2060548A JP2539070B2 (en) 1990-03-12 1990-03-12 Compiler processor

Publications (2)

Publication Number Publication Date
JPH03260836A JPH03260836A (en) 1991-11-20
JP2539070B2 true JP2539070B2 (en) 1996-10-02

Family

ID=13145453

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2060548A Expired - Fee Related JP2539070B2 (en) 1990-03-12 1990-03-12 Compiler processor

Country Status (1)

Country Link
JP (1) JP2539070B2 (en)

Also Published As

Publication number Publication date
JPH03260836A (en) 1991-11-20

Similar Documents

Publication Publication Date Title
JP2539070B2 (en) Compiler processor
JP3318051B2 (en) Translation processing method
JPS5922140A (en) Interactive compiling system
JPH0379741B2 (en)
JP3141945B2 (en) Compiling device
JPH0795273B2 (en) Partial expansion processing method of sum calculation in compiler
JPH05143356A (en) Compiler device
JPH02222032A (en) Optimization system for addition/subtraction instruction
JPH04248624A (en) Program conversion processor
JPH0567140A (en) Machine translation device
JPH0950429A (en) Pointer vectorization system in compiler
JPH05204705A (en) Processing method for detecting undefined parameter
JPS6297031A (en) Matching system for bit number of mantissa part
JPH0612259A (en) Compiler processing system
JPH04106626A (en) Program translation processor
JPH0423076A (en) Preprocessing system for hardware automatic design system
JPH06214800A (en) Optimum processing system of object program
JPS63132335A (en) Executing system for computer language processing system
JPS63280337A (en) Data conversion system
JPH08161179A (en) Method for executing one sentence
JPH02109135A (en) Do form array input conversion system
Usj et al. A Conversational Processor for a Structuring Language
JPS62166432A (en) Control system for program translation
JPH06208470A (en) Objective code optimizing device
JPH01209542A (en) Logical verification device

Legal Events

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