Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPH0776926B2 - Loop control processing method - Google Patents
[go: Go Back, main page]

JPH0776926B2 - Loop control processing method - Google Patents

Loop control processing method

Info

Publication number
JPH0776926B2
JPH0776926B2 JP3031186A JP3031186A JPH0776926B2 JP H0776926 B2 JPH0776926 B2 JP H0776926B2 JP 3031186 A JP3031186 A JP 3031186A JP 3031186 A JP3031186 A JP 3031186A JP H0776926 B2 JPH0776926 B2 JP H0776926B2
Authority
JP
Japan
Prior art keywords
loop
processing
processing step
program
sibling
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
JP3031186A
Other languages
Japanese (ja)
Other versions
JPS62187940A (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 JP3031186A priority Critical patent/JPH0776926B2/en
Publication of JPS62187940A publication Critical patent/JPS62187940A/en
Publication of JPH0776926B2 publication Critical patent/JPH0776926B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)
  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 〔概 要〕 計算機システムの原プログラムを翻訳して、各プログラ
ムループの初期制御条件が所定条件の場合に、ループの
実行を回避するようにする目的プログラムを生成する場
合の処理方法。実行回避の判定処理を複数のループにつ
いて一括して行える条件のループを検出し、それらの個
々の判定処理を削除する。この方式により、目的プログ
ラムの命令ステップを減少して、実行効率を改善するこ
とができる。
DETAILED DESCRIPTION [Summary] When an original program of a computer system is translated to generate an object program that avoids loop execution when the initial control condition of each program loop is a predetermined condition Processing method. A loop having a condition that allows execution avoidance determination processing to be performed collectively for a plurality of loops is detected, and the individual determination processing is deleted. With this method, it is possible to reduce the instruction steps of the target program and improve the execution efficiency.

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

本発明は、計算機システムの原プログラムを翻訳して、
目的プログラムを生成する場合における、ループ制御の
処理方法に関する。
The present invention translates an original program of a computer system,
The present invention relates to a loop control processing method when an object program is generated.

FORTRANプログラミング言語等で記述された原プログラ
ムは、公知のいわゆるコンパイラ等によって翻訳するこ
とにより、所要の計算機システムで実行される目的プロ
グラムを生成する。
An original program written in the FORTRAN programming language or the like is translated by a known so-called compiler or the like to generate a target program to be executed by a required computer system.

目的プログラムには、一般に原プログラムで陽に指定し
ていない各種のチェック等が附加されるが、それらは必
要最小限にしてプログラムの実行効率を高めることが望
まれる。
Generally, various checks that are not explicitly specified in the original program are added to the target program, but it is desirable to minimize them and improve the execution efficiency of the program.

〔従来の技術と発明が解決しようとする問題点〕[Problems to be solved by conventional technology and invention]

FORTRAN等のプログラミング言語には、公知のように例
えばDO文で始まるプログラムループ(以下においてDOル
ープという)の記述機能があり、プログラム中に多用さ
れる。
As is well known, a programming language such as FORTRAN has a description function of a program loop (hereinafter referred to as a DO loop) that starts with a DO statement, and is often used in programs.

DOループは、その制御パラメータとして指定される初期
値、終値、及び増分値を使用して、指定制御変数の値を
初期値から増分値置きに、終値を越えない値まで変化
し、制御変数の各値ごとにDOループ内のプログラムを1
回実行することを繰り返すものである。
The DO loop uses the initial value, the closing value, and the increment value specified as its control parameters to change the value of the specified control variable from the initial value to the increment value at a value that does not exceed the closing value, 1 program in the DO loop for each value
It is to repeat execution once.

こゝで、FORTRAN等のプログラミング言語の言語仕様と
して、DOループの制御パラメータが、該ループの実行を
終了する条件の場合、即ち制御パラメータの初期値が終
値を越えている場合(増分値>0の場合は初期値>終
値、増分値<0の場合は初期値<終値)には、そのDOル
ープを1回も実行せずに回避することになっている。
Here, as a language specification of a programming language such as FORTRAN, when the control parameter of the DO loop is a condition for ending the execution of the loop, that is, when the initial value of the control parameter exceeds the final value (increment value> 0 In the case of, the initial value> the final price, and in the case of the increment value <0, the initial value <the final value). Therefore, the DO loop is to be avoided without being executed even once.

原プログラム作成者は、この仕様に従う制御によって、
DOループの実行要否が制御されることを予定してプログ
ラムを構成する場合があるので、所定の条件の場合には
DOループを回避して1回も実行しないように、目的プロ
グラムを構成する必要がある。
The original program creator, by the control according to this specification,
In some cases, the program may be configured to control whether or not the DO loop needs to be executed.
It is necessary to configure the target program so as to avoid the DO loop and never execute it.

そこで原プログラムの翻訳においては、DOループの制御
パラメータに変数が指定されていて、翻訳時に値が決定
しないために、前期回避条件の成否が判定できない場合
には、実行時に該DOループの開始において回避条件を判
定するように、判定処理を追加する。
Therefore, in the translation of the original program, if a variable is specified in the control parameter of the DO loop and the value is not determined at the time of translation, the success or failure of the avoidance condition cannot be determined at the beginning of the DO loop at execution. A determination process is added so as to determine the avoidance condition.

各判定処理は、例えば初期値と終値の大小判定の判定命
令と、その結果による分岐命令との2ステップからな
り、そのような命令ステップが、前記条件のDOループす
べてにそれぞれ前置され、常に実行されるので、目的プ
ログラムの実行ステップを増加する結果となっている。
Each determination process consists of two steps, for example, a determination instruction for determining the magnitude of the initial value and the final value, and a branch instruction according to the result. Such an instruction step is pre-positioned in each of the DO loops of the above condition, and is always As a result, the result is an increase in the number of execution steps of the target program.

〔問題点を解決するための手段〕[Means for solving problems]

第1図(a)は、本発明の構成を示すブロック図、第1
図(b)は本発明の処理の流れ図である。
FIG. 1A is a block diagram showing the configuration of the present invention,
FIG. 6B is a flow chart of the processing of the present invention.

第1図(a)の20は処理装置、21は翻訳処理部、22はル
ープ回避判定最適化処理部である。第1図(b)はルー
プ回避判定最適化処理部22の処理の流れを示し、1〜8
は処理ステップである。
In FIG. 1A, 20 is a processing device, 21 is a translation processing unit, and 22 is a loop avoidance determination optimization processing unit. FIG. 1B shows a flow of processing of the loop avoidance determination optimization processing unit 22, and
Is a processing step.

〔作 用〕[Work]

第1図(a)の処理装置20において実行される翻訳処理
部21は、記憶装置に保持される原プログラム23を翻訳し
て、目的プログラム24を生成する。次に本発明のループ
回避判定最適化処理部22は、目的プログラム24について
以下に述べる処理を実行して、最適化目的プログラム25
を出力する。
The translation processing unit 21 executed in the processing device 20 of FIG. 1A translates the original program 23 held in the storage device to generate the target program 24. Next, the loop avoidance determination optimization processing unit 22 of the present invention executes the processing described below with respect to the object program 24, and the optimization object program 25
Is output.

DOループは一般に1以上の多重レベルを持つ多重ループ
となっているので、回避判定の最適化処理においては、
処理ステップ1で先頭のDOループから調べて、多重レベ
ルの最も深い多重ループの最も内側のレベルにある、先
頭のDOループを検索して取り出す。
Since the DO loop is generally a multiple loop having multiple levels of 1 or more, in the avoidance determination optimization processing,
In the processing step 1, the head DO loop is searched, and the head DO loop at the innermost level of the deepest multiple loop of the multiple levels is searched and retrieved.

処理ステップ2において、取り出したDOループと同じ多
重レベルのDOループ(以下において兄弟ループという)
があるか検索し、兄弟ループがあれば処理ステップ3
で、所定の条件を満たす兄弟ループについて、それらの
回避判定処理を一括するように処理を変更する。
In processing step 2, the same multi-level DO loop as the retrieved DO loop (hereinafter referred to as sibling loop)
If there is a sibling loop, process step 3
Then, with respect to the sibling loops that satisfy the predetermined condition, the processing is changed so that the avoidance determination processings are integrated.

次の処理ステップ4において、1レベル外側の多重レベ
ルがあるか判定し、あれば外側のDOループとの関係にお
いて処理中のレベルのDOループが所定条件を満たすか
を、処理ステップ5で判定する。
In the next processing step 4, it is determined whether or not there is a multiple level outside by one level, and if there is, a determination is made in processing step 5 whether the DO loop of the level being processed satisfies a predetermined condition in relation to the outer DO loop. .

条件を満たせば、処理ステップ6において、その内側DO
ループの回避判定処理を削除する。
If the condition is met, in step 6 the inner DO
The loop avoidance determination process is deleted.

処理ステップ7において、次の処理対象とするDOループ
を検索し、処理すべきループであるば処理ステップ8を
経て処理シテップ2へ戻る。
In processing step 7, a DO loop to be processed next is searched, and if it is a loop to be processed, the processing loops through processing step 8 and returns to processing step 2.

処理ステップ7では、現処理DOループと同じか外側の現
レベルに最も近いレベルの、未処理の先頭DOループを取
り出すものとし、このようにして多重ループの最も外側
のDOループを処理すれば終了する。
In processing step 7, it is assumed that the unprocessed first DO loop of the same level as the currently processed DO loop or the closest level to the current level is taken out, and if the outermost DO loop of the multiple loop is processed in this way, the processing ends. To do.

以上の処理により、DOループの回避判定処理の挿入され
る個所が減少し、プログラムの実行効率が改善される。
By the above processing, the number of places where the DO loop avoidance determination processing is inserted is reduced, and the program execution efficiency is improved.

〔実施例〕〔Example〕

第1図(a)のループ回避判定最適化処理部22は、目的
プログラム24のDOループについて以下のように処理し
て、回避判定処理を減少した最適化目的プログラム25を
出力する。
The loop avoidance determination optimization processing unit 22 of FIG. 1 (a) processes the DO loop of the target program 24 as follows, and outputs the optimized target program 25 with reduced avoidance determination processing.

DOループは一般に1以上の多重レベルの多重ループと考
えて、回避判定の最適化処理は、最も多重度の深い多重
ループの最も内側のレベルのループから、外側へ順次処
理をしていく。
The DO loop is generally considered to be a multiple loop of one or more multiple levels, and the avoidance determination optimization process is performed sequentially from the innermost level loop of the multiple loop having the highest multiplicity to the outside.

第1図(b)の処理ステップ1で先頭のDOループから調
べて、上記に該当する最も内側のレベルにある、先頭の
ループを検索して取り出す。
In the processing step 1 of FIG. 1B, the first DO loop is searched, and the first loop at the innermost level corresponding to the above is searched and taken out.

処理ステップ2において、取り出したDOループの兄弟ル
ープがあるか検索し、兄弟ループがあれば処理ステップ
3で、所定の条件を満たす兄弟ループについて、それら
の回避判定処理を一括するように処理を変更する。
In processing step 2, it is searched whether there is a sibling loop of the extracted DO loop, and if there is a sibling loop, in processing step 3, the processing is changed so that the avoidance judgment processing of those sibling loops satisfying a predetermined condition is integrated. To do.

兄弟ループが無い場合には、直ちに処理ステップ4に進
み、後述の外側ループとの間における最適化処理を始め
る。
If there is no sibling loop, the process immediately proceeds to processing step 4, and optimization processing with an outer loop described later is started.

第2図は処理ステップ3の兄弟ループの処理の詳細の流
れを示す図である。
FIG. 2 is a diagram showing a detailed flow of processing of the sibling loop of processing step 3.

第1図(b)の処理ステップ2で兄弟ループを検出する
と、現処理ループを以下において先頭ループとし、第2
の処理ステップ10に進んで、次の兄弟ループを取り出
し、それが連続しているか判定し、連続していれば処理
ステップ11で先頭ループとの関係で所定条件を満たすか
判定する。
When a sibling loop is detected in processing step 2 of FIG. 1 (b), the current processing loop will be referred to as a leading loop below,
Processing step 10, the next sibling loop is taken out and it is determined whether or not it is continuous. If it is continuous, processing step 11 determines whether or not a predetermined condition is satisfied in relation to the head loop.

この判定は、例えば先頭ループの制御パラメータ(前記
の初期値、終値、増分値)と処理中のDOループの制御パ
ラメータとが同一であること、及び両ループともループ
内で、制御パラメータの変数を変更していないことを条
件とする。
For this determination, for example, the control parameters of the first loop (the above-mentioned initial value, final value, and increment value) and the control parameter of the DO loop being processed are the same, and in both loops, the variable of the control parameter is set. The condition is that it has not been changed.

この条件を満たせば、処理ステップ12において、このDO
ループの回避判定処理を削除した後、処理ステップ10へ
戻る。
If this condition is met, then in step 12 this DO
After deleting the loop avoidance determination process, the process returns to the process step 10.

このようにして処理ステップ10〜12のループが続き、処
理ステップ10で連続する兄弟ループが無いと判定した場
合には、処理ステップ13に進んで、先頭ループにおける
回避判定処理の回避時の分岐先を最後の兄弟ループの直
後に分岐するように変更する。
In this way, the loop of processing steps 10 to 12 continues, and when it is determined in processing step 10 that there is no continuous sibling loop, the processing proceeds to processing step 13 and the branch destination when avoiding the avoidance determination processing in the first loop. Changes to branch immediately after the last sibling loop.

処理ステップ14ですべての兄弟ループを処理したか判定
し、未処理であれば次の兄弟ループを新たな先頭ループ
として処理ステップ10へ戻り、未処理がなければこの処
理を終わって第1図(b)の処理ステップ4へ進む。
In processing step 14, it is judged whether or not all the sibling loops have been processed. If not processed, the next sibling loop is set as a new head loop and the process returns to processing step 10. If there is no unprocessed processing, this processing is terminated and the process shown in FIG. Go to process step 4) b).

又、処理ステップ11の判定で前記条件を満足しない場合
には、処理ステップ15へ分岐して、処理ステップ10〜12
のループは断たれる。処理ステップ15では、先頭ループ
の回避判定処理の分岐先を、現に取り出した最後の兄弟
ループの直前に分岐するように変更し、その兄弟ループ
を新たな先頭ループにして、処理ステップ10に戻る。
If the above conditions are not satisfied in the determination in processing step 11, the process branches to processing step 15 and processing steps 10 to 12 are executed.
Loop is broken. In processing step 15, the branch destination of the avoidance determination processing of the top loop is changed so as to branch immediately before the last fetched sibling loop, the sibling loop becomes a new top loop, and the process returns to processing step 10.

以上の処理により、兄弟ループについては、前記の条件
を満たして連続するループごとに1回のみの回避判定処
理を行うように、回避判定処理が減少される。
With the above processing, the avoidance determination processing is reduced for the sibling loop so that the avoidance determination processing is performed only once for each continuous loop that satisfies the above condition.

第1図(b)の処理ステップ4において、前記兄弟ルー
プの処理済のループの1レベル外側の多重レベルがある
か判定し、あれば外側のDOループとの関係において処理
中のレベルのDOループが所定条件を満たすかを、処理ス
テップ5で判定する。
In processing step 4 of FIG. 1 (b), it is judged whether there is a multiple level outside the processed loop of the sibling loop by one level, and if there is, a DO loop of the level being processed in relation to the outside DO loop. In step 5, it is determined whether or not satisfies the predetermined condition.

この判定は、例えば外側ループと内側ループの制御パラ
メータが同一であり、且つ外側ループの開始から内側ル
ープの開始までの間で、それら制御パラメータとなる変
数を変更する処理が無いことを条件とする。
This determination is, for example, on the condition that the control parameters of the outer loop and the inner loop are the same, and that there is no process for changing the variables that are the control parameters between the start of the outer loop and the start of the inner loop. .

内側ループに上記条件を満足するループがあれば、処理
ステップ6において、それらのループの回避判定処理を
削除する。
If there are loops that satisfy the above conditions in the inner loops, the avoidance determination processing for those loops is deleted in processing step 6.

処理ステップ7において、次の処理対象とするDOループ
を検索し、処理すべきループであれば処理ステップ8を
経て処理ステップ2へ戻る。
In processing step 7, a DO loop to be processed next is searched, and if it is a loop to be processed, the processing loops through processing step 8 and returns to processing step 2.

処理ステップ7では、現処理DOループと同じか又は外側
のレベルで、現レベルに最も近いレベルの、未処理の先
頭DOループを取り出すものとし、このようにして多重ル
ープの最も外側のDOループを処理すれば終了する。
In processing step 7, the unprocessed first DO loop, which is at the same level as or outside the current processing DO loop and is closest to the current level, is taken out, and thus the outermost DO loop of the multiple loop is extracted. Processing ends.

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

以上の説明から明らかなように、本発明によれば、計算
機システムの原プログラムを翻訳して目的プログラムを
生成する処理において、DOループの回避判定処理の挿入
される個所が減少するので、生成される目的プログラム
の実行効率が改善されるという著しい工業的効果があ
る。
As is clear from the above description, according to the present invention, in the process of translating the original program of the computer system to generate the target program, the number of places where the DO loop avoidance determination process is inserted is reduced, so that it is generated. There is a remarkable industrial effect that the execution efficiency of the target program is improved.

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

第1図(a)は本発明の実施例構成ブロック図、 第1図(b)は本発明の処理の流れ図、 第2図は兄弟ループ処理の流れ図 である。 図において 1〜8、10〜15は処理ステップ、 20は処理装置、21は翻訳処理部、 22はループ回避判定最適化処理部、 23は原プログラム、24は目的プログラム、 25は最適化目的プログラム を示す。 FIG. 1 (a) is a block diagram showing the configuration of an embodiment of the present invention, FIG. 1 (b) is a flowchart of the processing of the present invention, and FIG. 2 is a flowchart of sibling loop processing. In the figure, 1 to 8 and 10 to 15 are processing steps, 20 is a processing device, 21 is a translation processing unit, 22 is a loop avoidance determination optimization processing unit, 23 is an original program, 24 is a target program, and 25 is an optimization target program. Indicates.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】計算機システムの原プログラムを翻訳する
際に、ループを制御する変数の初期値と終値と増分で指
定される制御情報に基づき、ループを全く実行しないか
少なくとも1回は実行するかを判定してループの実行を
回避するための回避処理を付加したループのオブジェク
トプログラムを生成するコンパイラにおけるループ制御
処理方法であって、 同レベルにあり連続する複数のループについて、各複数
のループの制御情報が同じ場合には、1つの回避処理で
全てのループの実行を回避し、 多重化されたループについて、外側のループと内側のル
ープのそれぞれの制御情報が同じ場合には、内側のルー
プの回避処理は行わず、外側のループの回避処理のみを
行う ことを特徴とするループ制御処理方法。
1. When translating an original program of a computer system, whether to execute the loop at all or at least once based on control information specified by an initial value, a final value and an increment of a variable for controlling the loop. Is a loop control processing method in a compiler that generates an object program of a loop to which the avoidance processing for avoiding the execution of the loop is added, and for a plurality of continuous loops at the same level, When the control information is the same, execution of all loops is avoided by one avoidance process, and when the control information of the outer loop and the inner loop is the same for the multiplexed loop, the inner loop The loop control processing method is characterized by performing only the avoidance processing of the outer loop without performing the avoidance processing of.
JP3031186A 1986-02-14 1986-02-14 Loop control processing method Expired - Fee Related JPH0776926B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3031186A JPH0776926B2 (en) 1986-02-14 1986-02-14 Loop control processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3031186A JPH0776926B2 (en) 1986-02-14 1986-02-14 Loop control processing method

Publications (2)

Publication Number Publication Date
JPS62187940A JPS62187940A (en) 1987-08-17
JPH0776926B2 true JPH0776926B2 (en) 1995-08-16

Family

ID=12300235

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3031186A Expired - Fee Related JPH0776926B2 (en) 1986-02-14 1986-02-14 Loop control processing method

Country Status (1)

Country Link
JP (1) JPH0776926B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02219130A (en) * 1989-02-20 1990-08-31 Fujitsu Ltd Optimization processing system for loop avoiding branching

Also Published As

Publication number Publication date
JPS62187940A (en) 1987-08-17

Similar Documents

Publication Publication Date Title
JP4346316B2 (en) A method for aspect-oriented programming with multiple semantic levels
JPH0776926B2 (en) Loop control processing method
JPS63142431A (en) Pipeline control system
EP0633525B1 (en) Method for compilation of programming languages
JP3430635B2 (en) Constant reference optimization processor
JP2841403B2 (en) Loop optimization processing method
JPH1091591A (en) Parallel processing method for hierarchical multiprocessor
JPH0546404A (en) Branch instruction deletion optimization method
US5287509A (en) Multitasking system for in-procedure loops
JPS6297031A (en) Matching system for bit number of mantissa part
JP2564904B2 (en) Program optimization processing method
JPS6126692B2 (en)
JP3008890B2 (en) Processing control unit
JP2001075831A (en) Program processor, ic test system, program processing method and storage medium
JPH0447337B2 (en)
JPH0337201B2 (en)
JPH0512033A (en) Parallel compilation method
JPH05143352A (en) Microprocessor
JPS60254239A (en) Object file conversion control system
JPH05307473A (en) Automatic program generator
JPH0830457A (en) Inference method for production system
JP2000076224A (en) Vector operation method
JPH0573335A (en) Automatic in-line development system for program
JPH0588909A (en) System for optimizing object by assignment of argument for internal procedure call to register
JPS628230A (en) Program specialization system

Legal Events

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