JP2537788B2 - Program cost evaluation method - Google Patents
Program cost evaluation methodInfo
- Publication number
- JP2537788B2 JP2537788B2 JP61008420A JP842086A JP2537788B2 JP 2537788 B2 JP2537788 B2 JP 2537788B2 JP 61008420 A JP61008420 A JP 61008420A JP 842086 A JP842086 A JP 842086A JP 2537788 B2 JP2537788 B2 JP 2537788B2
- Authority
- JP
- Japan
- Prior art keywords
- statement
- cost
- loop
- program
- terminal
- 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
Links
- 238000011156 evaluation Methods 0.000 title claims description 8
- 238000012545 processing Methods 0.000 claims description 25
- 238000004458 analytical method Methods 0.000 claims description 4
- 230000010365 information processing Effects 0.000 claims description 4
- 238000000034 method Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000013519 translation Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 238000003672 processing method Methods 0.000 description 2
- YASYVMFAVPKPKE-UHFFFAOYSA-N acephate Chemical compound COP(=O)(SC)NC(C)=O YASYVMFAVPKPKE-UHFFFAOYSA-N 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Executing Machine-Instructions (AREA)
- Debugging And Monitoring (AREA)
- Devices For Executing Special Programs (AREA)
Description
【発明の詳細な説明】 〔概要〕 プログラムの実行時の性能を,オブジェクトリストの
文当りのコスト評価で行なう。その際DOループ端末文を
ネストの深さに応じた実行回数でコストを累積し,正確
な見積りを可能にする。DETAILED DESCRIPTION OF THE INVENTION [Outline] The performance at the time of execution of a program is evaluated by the cost per statement of an object list. At that time, the cost is accumulated by the number of executions of the DO loop terminal statement according to the nesting depth, enabling accurate estimation.
本発明は情報処理システムにおけるプログラムの動的
解析処理方式に関するものであり,特にFORTRANやPL/I
などのプログラムのコスト評価方式に関する。The present invention relates to a dynamic analysis processing method of a program in an information processing system, and particularly FORTRAN and PL / I
Etc. regarding the cost evaluation method of the program.
〔従来の技術〕 従来,たとえばプログラム中で時間が長くかかる部分
をチューニング(最適化)により改良するため,あるい
はルートテストなどをおこなうために,プログラムの実
行時の動作を解析し,結果を利用し易い形で提供する手
段が,種々考えられている。[Prior Art] Conventionally, for example, in order to improve a portion of a program that takes a long time by tuning (optimization), or to perform a route test or the like, an operation at the time of execution of the program is analyzed and the result is used. Various means for providing in an easy form have been considered.
そのような手段の1つとして,プログラム実行時にそ
のプログラム各,文,実行回数,文当たりのコスト(た
とえば実行時間)をデータとして作成し,プログラムの
性能評価を可能にするものがある。この場合,コンパイ
ラが生成するオブジェクトリストから各文当たりのコス
トを見積もる方法がとられる。この見積りは,オブジェ
クトリストに現れた命令列にしたがってコストを累算し
てゆくものである。As one of such means, there is one that makes it possible to evaluate the performance of a program by creating each program, statement, execution count, and cost per statement (execution time) as data when the program is executed. In this case, the cost per statement is estimated from the object list generated by the compiler. This estimate is to accumulate costs according to the instruction sequence appearing in the object list.
ところでプログラムには、一連の文を繰り返し実行す
る処理がしばしば現れる。FORTRANでは、このような繰
り返し実行を、DO文によって簡潔に記述することができ
る。DO文の形式を次に示す。By the way, a process that repeatedly executes a series of statements often appears in a program. In FORTRAN, such repeated execution can be described simply by a DO statement. The format of the DO statement is shown below.
DO n k=i1,i2,i3 ここでnは文番号、kは制御変数、i1は変数の初期
値、i2は変数の最終値、i3は増分値を示す。なおi3は1
の場合省略することができる。このDO文は、DO文から文
番号nまでのプログラムを、k=i1からk=i2まで、1
回実行するごとにkの値をi3ずつ増加させながら繰り返
し実行することを意味する。k>i2となったとき繰り返
し実行は停止され、文番号nの文の次の文に制御が移さ
れる。文番号nの文はDO端末文と呼ばれ、通常次のよう
にCONTINUE文が置かれる。このCONTINUE文には処理上の
効果は何もない。DO n k = i 1 , i 2 , i 3 where n is the sentence number, k is the control variable, i 1 is the initial value of the variable, i 2 is the final value of the variable, and i 3 is the increment value. I 3 is 1
Can be omitted. This DO statement is for programs from DO statement to statement number n, from k = i 1 to k = i 2 , 1
This means that the value of k is increased by i 3 each time it is executed, and it is repeatedly executed. When k> i 2 , the repetitive execution is stopped and the control is transferred to the statement next to the statement of the statement number n. The statement of statement number n is called a DO terminal statement, and a CONTINUE statement is usually placed as follows. This CONTINUE statement has no processing effect.
このようにDO文により繰り返し実行されるプログラム
部分は、DOループと呼ばれる。また1つのDOループ中の
処理に他のDOループを入れ子(ネスト)として含むこと
ができる。このような入れ子構造のDOループを多重DOル
ープといい、次に例(a),(b)を示す。 The part of the program that is repeatedly executed by the DO statement is called a DO loop. Further, the processing in one DO loop can include another DO loop as a nest. A DO loop having such a nested structure is called a multiple DO loop, and examples (a) and (b) are shown below.
ここで例(b)の場合、DO端末文(CONTINUE)は多重
の各DOループのDO文によって共有されており、それぞれ
のDOループにおいて実行される。 Here, in the case of the example (b), the DO terminal statement (CONTINUE) is shared by the DO statements of the multiple DO loops, and is executed in each DO loop.
プログラム中の文当たりのコストを評価する場合,DO
ループの端末文(CONTINUE)は,多重DOループの複数の
DO文により共有されていれば、各内側のDO文の実行回数
はすぐ外側のDO文のDOループの実行回数に等しくなる。
つまり外側のDOループが複数回実行されるとそのDOルー
プに入れ子として含まれている下位のDO分も同じ複数回
実行されるので、その入れ子となっている下位のDO分に
より繰り返し実行される内側のDOループの実際の実行回
数は、外側のDOループの実行回数を掛けた回数となる。
そのため共有DO端末文のコスト見積りは各DOループのネ
ストの深さ(レベル)および各DOループの実行回数に依
存させなければ正しい評価を行うことができない。When evaluating the cost per sentence in the program, DO
The terminal statement (CONTINUE) of the loop is used for multiple DO loops.
If shared by DO statements, the number of executions of each inner DO statement will be equal to the number of executions of the DO loop of the immediately outer DO statement.
In other words, if the outer DO loop is executed multiple times, the lower DOs contained as nests in that DO loop will also be executed multiple times, so it will be repeatedly executed by the lower DOs that are nested. The actual number of executions of the inner DO loop is the number of times multiplied by the number of executions of the outer DO loop.
Therefore, the cost estimate of the shared DO terminal statement cannot be evaluated correctly unless it depends on the nesting depth (level) of each DO loop and the number of executions of each DO loop.
たとえば,次のような2重のDOループの例 では,外側のDOループでのDO端末文(CONTINUE)の実行
回数は5回,そして内側DOループでのDO端末文の実行回
数はDOループ単位では4回であるが,外側DOループの実
行回数が5回あるため,(5×4)の20回となる。For example, the following double DO loop example Then, the number of executions of the DO terminal statement (CONTINUE) in the outer DO loop is 5, and the number of executions of the DO terminal statement in the inner DO loop is 4 in the DO loop unit, but the number of executions of the outer DO loop. Since there are 5 times, it becomes 20 times of (5 × 4).
しかし従来は、複数のDOループでDO端末文が共有され
ていても、各ネストごとに正確にコスト見積りをするこ
とが出来なかった。その理由は、コンパイラが生成する
オブジェクトでコスト見積りを行っているからであり、
オブジェクトの命令では、各ループのネストの命令列
か、またはループが終わって後処理しているエピローグ
部分(ループの終了処理)の命令列かの判断をするのが
難しいため、単純に次の文までの命令列を集計している
だけであった。However, in the past, even if the DO terminal statement was shared by multiple DO loops, the cost could not be estimated accurately for each nest. The reason is that the cost is estimated by the object generated by the compiler,
It is difficult for the object instruction to judge whether it is the instruction sequence of the nest of each loop or the instruction sequence of the epilogue part (loop end processing) that is post-processed after the loop ends, so simply use the following statement It was only summing up the command sequence up to.
そのため、一文当たりのコストに誤差が生じるうえ
に、それに実行回数を掛けるとさらに誤差が広がり、出
力される解析情報が不正確であるため、そのプログラム
の動的解析情報が実質的に使えない状態であった。Therefore, in addition to the error in the cost per sentence, multiplying it by the number of executions further spreads the error, and the output analysis information is inaccurate, so the dynamic analysis information of the program cannot be practically used. Met.
その結果、プログラム中のループをベクトルプロセッ
サでベクトル処理化する場合、プログラムの実行結果に
よりベクトル処理方法を変更するなどしてベクトル処理
化部分を改善するチューニング(修正)を行おうとして
も、プログラムの性能評価が正確にできないことから、
チューニングの効果をなかなか上げることができない、
という問題があった。As a result, when the loop in the program is vectorized by the vector processor, even if the tuning (correction) is performed to improve the vector processing part by changing the vector processing method according to the execution result of the program, Since the performance evaluation cannot be performed accurately,
The effect of tuning cannot be improved easily,
There was a problem.
本発明は,多重のDOループにより共有されるDO端末文
に対するコスト見積りを,DOループの多重度や実行回数
に基づいて正確に算出できるようにするものである。The present invention enables a cost estimate for a DO terminal statement shared by multiple DO loops to be accurately calculated based on the multiplicity and execution count of the DO loop.
第1図に本発明の原理的構成を示す。 FIG. 1 shows the basic configuration of the present invention.
図において,10は情報処理システム,11はプログラム実
行部,12はプログラム解析処理部,13はDO文別コスト算出
部,14はカウンタ,15はDO文別コスト記憶部,16はDO文実
行回数算出部,17はDO文実行回数記憶部,18はDO端末文総
コスト算出部,19はプログラム情報を表す。In the figure, 10 is an information processing system, 11 is a program execution unit, 12 is a program analysis processing unit, 13 is a DO statement cost calculation unit, 14 is a counter, 15 is a DO statement cost storage unit, and 16 is a DO statement execution count. A calculation unit, 17 is a DO statement execution frequency storage unit, 18 is a DO terminal sentence total cost calculation unit, and 19 is program information.
プログラム実行部11は,解析対象のプログラムを実行
し,その実行時間をカウンタ14により検出可能にする。The program execution unit 11 executes the program to be analyzed, and the execution time can be detected by the counter 14.
プログラム解析処理部12は,プログラム実行部11の動
作状態をプログラム情報19に基づいて解析し,プログラ
ムのトレース,実行回数,文当りのコスト算出等を行
う。ただし,ここでは,本発明が対象とするDO端末文の
コスト評価機能についてのみ説明される。The program analysis processing unit 12 analyzes the operating state of the program execution unit 11 based on the program information 19, and performs the program trace, the number of executions, the cost per sentence, and the like. However, here, only the cost evaluation function of the DO terminal statement that is the subject of the present invention will be described.
DO文別コスト算出部13は,多重DOループの場合,その
各ネストレベルのDO文単位でのコストを算出し,それぞ
れDO文別コスト記憶部15に記憶する。コストは,カウン
タ14の実行時間から求められる。In the case of a multiple DO loop, the DO statement cost calculation unit 13 calculates the cost in units of DO statements at each nest level, and stores the cost in the DO statement cost storage unit 15. The cost is obtained from the execution time of the counter 14.
DO文実行回数算出部16は,外側DOループのループ実行
に伴って行われる内側DOループのネストレベルごとのDO
文実行回数(ネストが深くなるほど,DO文実行回数は増
大する)を算出し,DO文実行回数記憶部17に記憶する。The DO statement execution count calculation unit 16 determines the DO for each nesting level of the inner DO loop that is performed along with the loop execution of the outer DO loop.
The statement execution count (the deeper the nesting, the more the DO statement execution count increases) is calculated and stored in the DO statement execution count storage unit 17.
DO端末文総コスト算出部18は,DO文別コスト記憶部15
と,DO文実行回数記憶部17との各データを各ネストレベ
ルのDO文ごとに乗算して,その総和を求め,各DO文によ
り共有されるDO端末文の総コストを見積もる。The DO terminal sentence total cost calculation unit 18 includes a DO sentence cost storage unit 15
And each data in the DO statement execution count storage unit 17 are multiplied for each DO statement at each nesting level, the total sum is obtained, and the total cost of the DO terminal statement shared by each DO statement is estimated.
本発明によれば,任意多重のDO文により共有されるDC
端末文は,まず各ネストのDO文ごとに切分けて個々に見
積りされる。このとき各DO文ごとのコストには,そのDO
文のループ実行回数分が累積される。According to the present invention, a DC shared by an arbitrary multiplex DO statement
The terminal statement is divided into each DO statement of each nest and estimated individually. At this time, the cost for each DO statement is
The number of times the statement is executed is accumulated.
次に,内側DOループが外側DOループのループ実行の結
果として処理の繰り返しを行うDO文実行回数が,各ネス
トのレベル(DO文位置)ごとに算出される。Next, the number of DO statement executions in which the inner DO loop repeats the processing as a result of the outer DO loop execution is calculated for each nest level (DO statement position).
このようにして得られた各ループごとのDO端末文のコ
ストにそのネストレベルのDO文実行回数を掛け合わせ,
その結果の和をDO端末文を共有するDO文(DOループ)に
ついてとることにより,DO端末文の総コストが得られ
る。The cost of the DO terminal statement for each loop obtained in this way is multiplied by the number of executions of the DO statement at the nest level,
By taking the sum of the results for the DO statement (DO loop) that shares the DO terminal statement, the total cost of the DO terminal statement can be obtained.
第2図に多重DOループの例を示す。 Figure 2 shows an example of multiple DO loops.
図において,(a)は多重DOループのソースプログラ
ムで,ネスト1,ネスト2,ネスト3,…の方向にネストが深
くなっている(内側DOループへ向う)。またl1,l2,l3,
…はDOループの実行回数,e1,e2,e3,…はDO文の実行回
数,dはDO端末文を共有するDO文の繰り返しが終了した回
数を表わしている。In the figure, (a) is a multi-DO loop source program, and the nest is deep in the direction of nest 1, nest 2, nest 3, ... (toward the inner DO loop). Also l 1 , l 2 , l 3 ,
... indicates the number of executions of the DO loop, e 1 , e 2 , e 3 , ... indicates the number of executions of the DO statement, and d represents the number of times the repetition of the DO statement sharing the DO terminal statement is completed.
ここでDOループの実行回数l1,l2,l3,・・・は、DO文
内の処理をDO文に記述された式の規定に従って繰り返し
実行する回数を意味し、DO文の実行回数e1,e2,e3,・・
・は、そのようなDO文自体を実行する回数を意味する。
つまり、あるDO文を1回実行するときそのDO文のDOルー
プはDO文が規定している回数だけ繰り返し実行される。
DO文自体は、そのDO文が入れ子になっている場合、外側
のDOループが1回実行されるごとに1回実行されるか
ら、あるDO文の実行回数は外側のDOループの実行回数と
同じになり、さらにDO文のDOループの実際の実行回数は
DOループ自体に規定されている繰り返しの回数に外側の
DOループの実行回数を乗じた回数になる。したがって第
2図の(a)の例において、ネスト1のDO文では、e1=
1,l1=3となり、ネスト2のDO文では、e2=3,l2=3×
4=12となり、ネスト3のDO文では、e3=12,l3=12×
5=60となる。Here, the number of executions of the DO loop, l 1 , l 2 , l 3 , ... means the number of times that the processing in the DO statement is repeatedly executed according to the rules of the expression described in the DO statement. e 1 , e 2 , e 3 , ・ ・
-Means the number of times such a DO statement itself is executed.
That is, when a certain DO statement is executed once, the DO loop of that DO statement is repeatedly executed the number of times specified by the DO statement.
When a DO statement is nested, the DO statement itself is executed once for each execution of the outer DO loop. Therefore, the execution count of a certain DO statement is equal to the execution count of the outer DO loop. It becomes the same, and the actual number of executions of the DO loop of the DO statement is
Outside the number of iterations specified in the DO loop itself
It is the number of times the DO loop is executed. Therefore, in the example of FIG. 2A, in the DO statement of nest 1, e 1 =
1, l 1 = 3, so in the DO statement of nest 2, e 2 = 3, l 2 = 3 ×
4 = 12, and in the DO statement of nest 3, e 3 = 12, l 3 = 12 ×
5 = 60.
またDO端末文を共有するDO文の繰り返しが終了した回
数dは、各ネストのDO文がDOループの繰り返しを終了し
てループから脱出する際の終了処理の実行回数を意味す
る。Further, the number of times d of repetition of the DO statement sharing the DO terminal statement means the number of executions of termination processing when each DO statement of each nest finishes repeating the DO loop and exits from the loop.
DO文の実行回数は、DO端末文を共有する多重DOループ
において、DO端末文のコストを正確に評価するために必
要となる。それはあるネストにおけるDO端末文のコスト
は、そのネストのDO文単位のDO端末コストにDO文の実行
回数を乗算したものになるからである。このようにして
各DOループごとにDO端末文のコストを求め、さらにそれ
らのDOループごとのコストの総和を演算することにより
共有DO端末文の全コストが得られる。The number of times the DO statement is executed is necessary to accurately evaluate the cost of the DO terminal statement in the multiple DO loop that shares the DO terminal statement. This is because the cost of a DO terminal statement in a given nest is the DO terminal cost of the DO statement unit in that nest multiplied by the number of times the DO statement is executed. In this way, the cost of the DO terminal sentence is calculated for each DO loop, and the total cost of the shared DO terminal sentence is obtained by calculating the sum of the costs of these DO loops.
DO端末文を共有するDO文の繰り返しが終了した回数
は、上記した共有DO端末文の全コスト中で、各ネストの
DOループの終了処理部分のコストを正確に算出するため
に用いられる。この回数が不正確であれば、DO端末文の
コスト評価に誤差が出る。特にループの繰り返しが数万
回から数千万回にも及ぶ計算では大きな影響を受け、DO
ループ部分のプログラム性能を正確に評価することが困
難になって、チューニングによる改善効果を上げにくい
場合がある。それは、チューニングではコストが高いプ
ログラム単位に着目し、さらにそのプログラム単位中で
コストの高い文に着目して改善が図られるが、一般にDO
ループの実行回数が多い所がコストが高くなるのでそこ
の改善が図られやすい。しかしDOループの性能評価が不
正確であると、プログラムをチューニングしても実行時
間の短縮効果が正しく表れないからである。The number of times a DO statement that shares a DO terminal statement is repeated is calculated as follows:
It is used to accurately calculate the cost of the end processing part of the DO loop. If this number is incorrect, there will be an error in the cost evaluation of the DO terminal statement. Especially, the calculation of loop iterations from tens of thousands to tens of millions of times is greatly affected, and DO
It may be difficult to accurately evaluate the program performance of the loop portion, and it may be difficult to improve the improvement effect by tuning. In tuning, attention is focused on the program unit with a high cost, and the statement with a high cost in that program unit is also considered for improvement.
The cost is higher where the loop is executed many times, so it is easy to improve the cost. However, if the performance evaluation of the DO loop is inaccurate, the effect of shortening the execution time will not appear correctly even if the program is tuned.
DO文の実行回数や、DOループの実行回数、DO端末文を
共有するDO文の繰り返しが終了した回数は、コンパイラ
がソースプログラムの翻訳処理時にカウンタを設けてそ
れぞれの実行回数をカウントするか、あるいはオブジェ
クトプログラムを生成する際にカウンタを挿入し、オブ
ジェクトプログラムの実行時にカウントさせる。The number of times the DO statement is executed, the number of times the DO loop is executed, and the number of times the iteration of the DO statement that shares the DO terminal statement is completed, the compiler provides a counter during the translation process of the source program, Alternatively, a counter is inserted when the object program is generated and is counted when the object program is executed.
第2図の(b),(a)のソースプログラムをコンパ
イラで翻訳して得たオブジェクトリスト上の命令列を模
式化して示したもので,,,・・・、は命令、
c1,c2,c3,・・・,c6はDO文単位でのループ部分のDO端末
文コストを表し、c7はDO文単位でのループから脱出する
終了処理部分のDO端末文コストを表している。The instruction sequences on the object list obtained by translating the source programs of (b) and (a) of FIG. 2 with a compiler are schematically shown.
c 1, c 2, c 3 , ···, c 6 represents a DO terminal statement cost loop portions of a DO statement basis, DO terminals sentence end processing section c 7 is to escape from the loop in the DO sentences It represents the cost.
図示の例では,命令はDO端末文,命令,,は
ループからの脱出を判定する分岐命令である。In the illustrated example, the instruction is a DO terminal statement, an instruction, and a branch instruction for determining exit from the loop.
たとえばネスト3のDO文は,命令から命令までを
l3回実行し,次に分岐命令からネスト2のDO文へ移行
する。このときネスト3のDO文単位のループ部分DO端末
文コストc4を算出し、記憶する。For example, the DO statement of nest 3 is from instruction to instruction
l Execute 3 times, then move from branch instruction to DO statement of nest 2. At this time, the loop portion DO terminal statement cost c 4 of the DO statement unit of nest 3 is calculated and stored.
以下同様にして、ネスト2、ネスト1の各DOループに
ついてDO端末文コストc5,c6を算出し記憶する。また各D
Oループに共通な終了処理部分のDO端末文コストc7につ
いて別に算出し記憶する。Similarly, the DO terminal statement costs c 5 and c 6 are calculated and stored for each DO loop of nest 2 and nest 1. Also each D
The DO terminal sentence cost c 7 of the end processing part common to the O loop is separately calculated and stored.
他方、各DO文の実行回数e1,e2,e3,・・・とループの
終了処理の全回数dを求めることにより、DO端末文のコ
ストは次式で与えられる。On the other hand, by obtaining the execution counts e 1 , e 2 , e 3 , ... Of each DO statement and the total number d of end processing of the loop, the cost of the DO terminal statement is given by the following equation.
DO端末文コスト=…+c4・e3+c5・e2 +c6・e1+c7・d 〔実施例〕 第3図は,本発明が適用可能な多重DOループを含むプ
ログラム例を示したものである。図(a)は3重のDOル
ープを含むFORTRANプログラム,図(b)はそのオブジ
ェクトリストである。各DOループは3つの分岐命令BCR
からそれぞれDO端末文へ向うk,j,iのループとして示さ
れている。これらに基づくDO文別のDO端末文コストは,c
4,c5,c6で求められる。DO terminal statement cost = ... + c 4 · e 3 + c 5 · e 2 + c 6 · e 1 + c 7 · d EXAMPLES Figure 3, the present invention showed a program example including the applicable multiple DO loops It is a thing. Figure (a) is a FORTRAN program containing triple DO loops, and Figure (b) is its object list. Each DO loop has 3 branch instructions BCR
Are shown as loops of k, j, i from each to the DO terminal sentence. The DO terminal statement cost for each DO statement based on these is c
Calculated as 4 , c 5 and c 6 .
第4図は,第1図に基づく本発明の1実施例構成によ
るプログラム解析処理部12の処理フローを示したもので
ある。図において,131はDO文別コスト算出部13内に置か
れるSUMレジスタ,15はDO文別コスト記憶部,151はコスト
スタッカ,152はスタックポインタである。以下ないし
で示す手順で動作を説明する。FIG. 4 shows a processing flow of the program analysis processing unit 12 according to the first embodiment of the present invention based on FIG. In the figure, 131 is a SUM register placed in the DO statement cost calculation section 13, 15 is a DO statement cost storage section, 151 is a cost stacker, and 152 is a stack pointer. The operation will be described below with reference to steps.
プログラム中のDO端末文を検出する。他の実行文の
場合には,その処理を行なう。Detect DO terminal statements in the program. If it is another executable statement, that processing is performed.
DO端末文が検出されたとき,SUMレジスタ131を,SUM
=0にクリアする。When a DO terminal statement is detected, set the SUM register 131 to SUM
Clear to = 0.
文を1行読込む。 Read a line of text.
DOループに続く“次の文”が現れたときにはを実
行するが,他の場合には次のを実行する。Executes when the "next statement" following the DO loop appears, but otherwise executes the next.
その文が実行文であれば次のを実行し,他の場合
にはへ戻る。If the statement is an executable statement, execute the following, otherwise return to.
実行命令の場合,その命令コストを求め,SUMレジス
タ131の内容に加算して,その命令コストを累積する。
すなわち, SUM=SUM+命令コスト さらにその文が分岐命令であった場合にはを実行
し,他の場合にはへ戻る。In the case of an execution instruction, the instruction cost is calculated, added to the contents of the SUM register 131, and the instruction cost is accumulated.
That is, SUM = SUM + instruction cost If the statement is a branch instruction, is executed, and otherwise returns to.
分岐命令を検出したとき,SUMレジスタ131の内容
を,現在のスタックポインタ152が指しているコストス
タッカ151の位置に格納し,次にスタックポインタ152を
1位置だけ進める。その後,へ戻る。When a branch instruction is detected, the contents of the SUM register 131 are stored in the position of the cost stacker 151 pointed to by the current stack pointer 152, and then the stack pointer 152 is advanced by one position. Then return to.
でDOループ外の次の文が現れたとき,スタックポ
インタ152を,DO端末文が共有されている数だけ順次戻
し,その範囲の各命令コスト累積値を用いて,共有端末
文のコストを算出する。When the next statement outside the DO loop appears, the stack pointer 152 is sequentially returned by the number of shared DO terminal statements, and the cost of each shared terminal statement is calculated using the cumulative instruction cost value in that range. To do.
本発明は,任意の主プログラム,副プログラムに適用
することができる。たとえば主,副プログラムがともに
FORTRANプログラムの場合には,主プログラムに本発明
のプログラム解析処理部12を初期設定する文と呼出す文
とを,翻訳時に挿入する機能を用意しておけばよい。し
かし,主プログラムがFORTRAN以外の言語を用いたプロ
グラムであった場合には,上記の翻訳時における初期設
定および呼出しの文挿入は行なわず,予め,ユーザによ
りその主プログラム中に同様な文を追加させておけば,F
ORTRANの副プログラムに本発明のプログラム解析処理部
を使用させることが可能である。The present invention can be applied to any main program and sub program. For example, both main and sub programs
In the case of a FORTRAN program, a function for inserting a statement for initializing the program analysis processing unit 12 of the present invention and a statement to be called at the time of translation may be prepared in the main program. However, when the main program is a program using a language other than FORTRAN, the initialization and call statement insertion at the time of translation are not performed, and the user adds a similar statement to the main program in advance. If you let me, F
It is possible to cause the sub-program of ORTRAN to use the program analysis processing unit of the present invention.
本発明によれば,DO端末文に対するコスト見積りを正
確に行なうことができる。これにより,プログラム改良
のための性能評価を適確に行なうことが可能となり,ま
たベクトルプロセッサによるベクトル処理化を図るため
のチューニングにおいて,良好な目安を得ることができ
る。According to the present invention, it is possible to accurately estimate the cost for a DO terminal statement. As a result, it is possible to accurately perform performance evaluation for program improvement, and it is possible to obtain a good guideline in tuning for vector processing by the vector processor.
第1図は本発明の原理的構成図,第2図は本発明の作用
を説明するための処理例説明図,第3図は多重DOループ
を含むプログラムの具体例の説明図,第4図は本発明の
1実施例による処理フローの説明図である。 第1図中, 10:情報処理システム 11:プログラム実行部 12:プログラム解析処理部 13:DO文別コスト算出部 16:DO文実行回数算出部 18:DO端末文総コスト算出部FIG. 1 is a block diagram of the principle of the present invention, FIG. 2 is an explanatory diagram of a processing example for explaining the operation of the present invention, FIG. 3 is an explanatory diagram of a concrete example of a program including a multiple DO loop, and FIG. FIG. 4 is an explanatory diagram of a processing flow according to an embodiment of the present invention. In FIG. 1, 10: information processing system 11: program execution unit 12: program analysis processing unit 13: DO statement cost calculation unit 16: DO statement execution count calculation unit 18: DO terminal statement total cost calculation unit
Claims (1)
析処理部(12)をそなえた情報処理システム(10)にお
いて, 上記プログラム解析処理部(12)は,実行中のプログラ
ムがDO端末文を共有する多重DOループを含む場合,その
各DOループのDO文単位にループを回る際のDO端末文のコ
スト(c1,c2,…,c6)と各DO文がループを脱出する際に
共通に行う終了処理のコスト(c7)とを算出するDO文別
コスト算出部(13)と,上記各DO文ごとの実行回数
(e1,e2,e3,…)を求めるDO文実行回数算出部(16)
と,上記各算出されたDO文単位のループを回る際のDO端
末文コスト(c1,c2,…,c6)に当該DO文の実行回数を乗
算し,また各DO文がループを脱出する際に行う共通の終
了処理のコスト(c7)に各DO文の実行回数の和(d)を
乗算し,その結果の総和を求めるDO端末文総コスト算出
部(18)とをそなえて,多重DOループに共有されるDO端
末文のコストを得ることを特徴とするプログラムのコス
ト評価方式。1. An information processing system (10) comprising a program analysis processing unit (12) for performing dynamic analysis of a program, wherein the program analysis processing unit (12) shares a DO terminal statement with a running program. When multiple DO loops are included, the cost of the DO terminal statement (c 1 , c 2 , ..., c 6 ) when the loop goes around the DO statement unit of each DO loop, and when each DO statement exits the loop A DO statement cost calculation unit (13) that calculates the cost (c 7 ) of the termination process that is commonly performed, and a DO statement that determines the number of executions (e 1 , e 2 , e 3 , ...) For each DO statement Execution count calculator (16)
And the DO terminal statement cost (c 1 , c 2 , ..., c 6 ) when going through each of the calculated DO statement loops is multiplied by the number of times the DO statement is executed, and each DO statement makes a loop. It also has a DO terminal statement total cost calculation unit (18) that multiplies the sum (d) of the execution counts of each DO statement by the cost (c 7 ) of the common termination processing performed when exiting, and obtains the sum of the results. The cost evaluation method for programs is characterized in that the cost of the DO terminal statement shared by multiple DO loops is obtained.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP61008420A JP2537788B2 (en) | 1986-01-17 | 1986-01-17 | Program cost evaluation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP61008420A JP2537788B2 (en) | 1986-01-17 | 1986-01-17 | Program cost evaluation method |
Publications (2)
Publication Number | Publication Date |
---|---|
JPS62165245A JPS62165245A (en) | 1987-07-21 |
JP2537788B2 true JP2537788B2 (en) | 1996-09-25 |
Family
ID=11692631
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP61008420A Expired - Fee Related JP2537788B2 (en) | 1986-01-17 | 1986-01-17 | Program cost evaluation method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2537788B2 (en) |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS616722A (en) * | 1984-06-20 | 1986-01-13 | Fujitsu Ltd | Method for calculating execution cost of sentence |
-
1986
- 1986-01-17 JP JP61008420A patent/JP2537788B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPS62165245A (en) | 1987-07-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Harrold et al. | Selecting and using data for integration testing | |
Lokuciejewski et al. | A fast and precise static loop analysis based on abstract interpretation, program slicing and polytope models | |
EP0214751B1 (en) | A method for vectorizing and compiling object code | |
KR100188499B1 (en) | Interprocedural data-flow analysis | |
US20150293794A1 (en) | Processing method for a multicore processor and multicore processor | |
JPH0814817B2 (en) | Automatic vectorization method | |
US7694288B2 (en) | Static single assignment form pattern matcher | |
Gustafsson et al. | A tool for automatic flow analysis of C-programs for WCET calculation | |
Ponder et al. | Inaccuracies in program profilers | |
JP2537788B2 (en) | Program cost evaluation method | |
Dunsmore | Software metrics: an overview of an evolving methodology | |
KR100943887B1 (en) | How to estimate execution time for dynamic compilation of hotspot methods | |
Gustafsson | The worst case execution time tool challenge 2006 | |
Vanbroekhoven et al. | Transformation to dynamic single assignment using a simple data flow analysis | |
US11307883B2 (en) | Optimization of the execution time of a computer program by determining the implementation of a function according to range of input parameters and accuracy | |
Scaife et al. | Empirical parallel performance prediction from semantics-based profiling | |
Petersen et al. | Experimental evaluation of some data dependence tests | |
JPH0346863B2 (en) | ||
Pfeiffer | Automatic differentiation in PROSE | |
JP2001125782A (en) | Device and method for measuring software quality and recording medium therefor | |
Kirner et al. | Consideration of optimizing compilers in the context of WCET analysis | |
Johnson | Algorithm 988: AMGKQ: an efficient implementation of adaptive multivariate Gauss-Kronrod quadrature for simultaneous integrands in Octave/MATLAB | |
JPS6214243A (en) | Program cost estimation method | |
JP6834457B2 (en) | Emulation performance calculation device, emulation performance calculation system, emulation performance calculation method, and emulation performance calculation program | |
Mikac et al. | Big Integer Data Types-Usage and Performance Comparison |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
LAPS | Cancellation because of no payment of annual fees |