JP2003131888A - Method of scheduling instruction between procedures - Google Patents

Method of scheduling instruction between procedures

Info

Publication number
JP2003131888A
JP2003131888A JP2001330107A JP2001330107A JP2003131888A JP 2003131888 A JP2003131888 A JP 2003131888A JP 2001330107 A JP2001330107 A JP 2001330107A JP 2001330107 A JP2001330107 A JP 2001330107A JP 2003131888 A JP2003131888 A JP 2003131888A
Authority
JP
Japan
Prior art keywords
instruction
compiler
procedures
data flow
scheduling
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
JP2001330107A
Other languages
Japanese (ja)
Inventor
Hiroshi Nonomura
野々村  洋
Hiromi Nagayama
ひろみ 永山
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2001330107A priority Critical patent/JP2003131888A/en
Publication of JP2003131888A publication Critical patent/JP2003131888A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To reduce pipeline installation at the time of executing an instruction extending to other procedures. SOLUTION: Compile processing for data flow information collection between procedures is performed or data flow information between procedures is generated from saving restoration rules of registers at the time of calling a function in advance, and instructions are scheduled by using the information, so that pipeline installation extending to other procedures is reduced.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明はコンパイラに関し、
手続き間にまたがる依存や資源競合を考慮して命令スケ
ジューリングを行うコンパイラに関する。
TECHNICAL FIELD The present invention relates to a compiler,
The present invention relates to a compiler that performs instruction scheduling in consideration of dependency across procedures and resource competition.

【0002】[0002]

【従来の技術】FORTRANやC言語などのコンパイラは、関
数内の命令について、各命令の使用する演算器やメモリ
アクセスユニットなどの命令実行に必要なマイクロプロ
セッサ内の資源(以後、単に資源と呼ぶ)の競合や、前の
命令の結果を後ろの命令が使うような、命令間の依存が
ある場合、前の命令が結果を出力するまでに必要な時間
(以降、レイテンシと呼ぶ)を考慮して、命令を並べ替え
ることにより、パイプラインストールの発生を低減する
命令スケジューリングと呼ばれる技術がある。これは P
hillip B. Gibbons, Steven S. Muchnick "Efficient I
nstruction Scheduling for a Pipelined Architectur
e" Procedings of the SIGPLAN symposiumon compiler
construction. 1896, pp.11-16. の論文などに示されて
いる。
2. Description of the Related Art For compilers such as FORTRAN and C language, for instructions in a function, resources in a microprocessor (hereinafter simply called resources) necessary for executing instructions such as an arithmetic unit and a memory access unit used by each instruction. ), Or when there is a dependency between instructions such that the result of the previous instruction is used by the latter instruction, the time required for the previous instruction to output the result
There is a technique called instruction scheduling that reduces the occurrence of pipeline stalls by rearranging instructions in consideration of (hereinafter, referred to as latency). This is P
hillip B. Gibbons, Steven S. Muchnick "Efficient I
nstruction Scheduling for a Pipelined Architectur
e "Procedings of the SIGPLAN symposiumon compiler
1896, pp.11-16.

【0003】[0003]

【発明が解決しようとする課題】命令スケジューリング
は、通常、分岐を含まない最小の命令列である、基本ブ
ロック内の命令についてのみか、もしくは複数の基本ブ
ロックにまたがって命令スケジューリングが行われる場
合もあるが、いずれも関数内の命令について資源の競合
や、命令間の依存関係によるレイテンシを考慮してスケ
ジューリングをおこなっており、関数にまたがる資源競
合やレイテンシは考慮されない。
Instruction scheduling is usually a minimum instruction sequence that does not include a branch, only for instructions in a basic block, or when instruction scheduling is performed over a plurality of basic blocks. However, in all cases, scheduling is performed in consideration of resource contention and latency due to inter-instruction dependency for instructions in a function, and resource contention and latency across functions are not considered.

【0004】[0004]

【課題を解決するための手段】上記課題解決のため、本
発明では命令スケジューリングを行う際に、プログラム
を走査して、手続き間の命令の依存関係や、各命令の使
用する資源を調べ、手続き間の命令列について、命令間
の依存や資源競合によるパイプラインストールが発生し
ないようスケジューリングを行うことにより、マイクロ
プロセッサの高速な動作が可能になる。
In order to solve the above problems, according to the present invention, when performing instruction scheduling, the program is scanned to check the inter-procedure instruction dependency and the resources used by each instruction, The high-speed operation of the microprocessor becomes possible by scheduling the inter-instruction sequence so that pipeline stall installation due to inter-instruction interdependence and resource competition does not occur.

【0005】[0005]

【発明の実施の形態】以下図面を参照しながら本発明の
一実施例について説明する。
BEST MODE FOR CARRYING OUT THE INVENTION An embodiment of the present invention will be described below with reference to the drawings.

【0006】図1は本発明によるコンパイラが仮装する
計算機システムの構成図である。図に示すように、計算
機システムは、CPU101、ディスプレイ装置102、キーボ
ード103、主記憶装置104、外部記憶装置107より構成さ
れている。主記憶装置104には、コンパイラ105とコンパ
イル過程で必要となる中間コード106が保持される。外
部記憶装置107には、ソースプログラム108、およびオブ
ジェクトプログラム109が保持される。コンパイル処理
は、CPU101がコンパイラ104を実行することにより行わ
れる。ユーザーはキーボード103よりコマンドをコンパ
イラ104に与え、ディスプレイ装置102はユーザーにコン
パイルの終了やエラーを知らせる。
FIG. 1 is a block diagram of a computer system provisionally mounted by a compiler according to the present invention. As shown in the figure, the computer system comprises a CPU 101, a display device 102, a keyboard 103, a main storage device 104, and an external storage device 107. The main memory 104 holds a compiler 105 and an intermediate code 106 required in the compilation process. The external storage device 107 holds a source program 108 and an object program 109. The compilation processing is performed by the CPU 101 executing the compiler 104. The user gives a command to the compiler 104 from the keyboard 103, and the display device 102 notifies the user of the end of compilation or an error.

【0007】図2は本発明を適用したコンパイラを用い
て、手続間スケジューリングを行うための手順を示した
ものである。複数のファイルからなるソースプログラム
108に対してステップ201によりデータフロー情報収集処
理を行いデータフロー情報202を得る。データフロー情
報の詳細に付いては、後で図4を使って説明する。次に
ステップ203において、先に取得したデータフロー情報2
02と、ソースプログラム108に対して、コンパイル処理
を行い、最適化したオブジェクトコード109を得る。
FIG. 2 shows a procedure for performing interprocedural scheduling using the compiler to which the present invention is applied. Source program consisting of multiple files
The data flow information collection process is performed on 108 in step 201 to obtain data flow information 202. Details of the data flow information will be described later with reference to FIG. Next, in step 203, the previously acquired data flow information 2
02 and the source program 108 are compiled to obtain the optimized object code 109.

【0008】図3は本発明によるコンパイル処理の流れ
を示したフローチャートである。コンパイラの処理は、
まずステップ201構文解析において、ソースプログラム1
08を読み出して、コンパイラ内部で処理可能な中間コー
ド106を生成する。構文解析処理については、例えば
「エイホ、セシィ、ウルマン著: コンパイラI」(サイエ
ンス社、1990年)30頁〜74頁に記載されているので、こ
こでは説明しない。次に、ステップ302においてソース
プログラム108に含まれる関数ごとのデータフロー解析
処理を行う。データフロー解析処理については、同じく
「エイホ、セシィ、ウルマン著: コンパイラII」(サイ
エンス社、1990年)741頁〜772頁に記載されているの
で、ここでは説明しない。次に、ステップ303に進み、
本発明の特徴的な処理のひとつである手続間データフロ
ー情報入力処理をおこない、現在コンパイル中の関数の
スケジューリングに必要な手続間データフロー情報202
をファイルから入力する。次に、ステップ304に進み、
本発明の特徴的処理の一つである手続き間命令スケジュ
ーリング処理を行う。ステップ203については、図5を
用いて詳しく説明する。次に、ステップ305に進み、本
発明の特徴的な処理のひとつである手続間データフロー
情報出力処理をおこない、現在コンパイル中の関数の手
続間データフロー情報202をファイルに出力する。次
に、ステップ204オブジェクトコード生成に進み、オブ
ジェクトコードを生成して終了する。オブジェクト生成
処理204については、同じく「エイホ、セシィ、ウルマ
ン著: コンパイラII」(サイエンス社、1990年)624頁〜7
07頁に記載されているので、ここでは詳しく説明しな
い。
FIG. 3 is a flow chart showing the flow of the compiling process according to the present invention. The compiler process is
First, in step 201 parsing, source program 1
08 is read and the intermediate code 106 that can be processed in the compiler is generated. The parsing process is described in, for example, "Compiler I" by Aho, Cessie, and Ullman: Compiler I (Science, 1990), pp. 30-74, and will not be described here. Next, in step 302, data flow analysis processing is performed for each function included in the source program 108. The data flow analysis processing is also described in "Compiler II, Aho, Cesi, Ullman: Science II" (Science Co., 1990), pages 741 to 772, and will not be described here. Then go to step 303,
The interprocedural dataflow information 202 necessary for scheduling the function currently being compiled is executed by performing interprocedural dataflow information input processing, which is one of the characteristic processes of the present invention.
From the file. Then go to step 304,
Interprocedural instruction scheduling processing, which is one of the characteristic processing of the present invention, is performed. Step 203 will be described in detail with reference to FIG. Next, in step 305, interprocedural dataflow information output processing, which is one of the characteristic processes of the present invention, is performed, and interprocedural dataflow information 202 of the function currently being compiled is output to a file. Next, in step 204, the object code is generated, the object code is generated, and the processing is terminated. Regarding the object generation processing 204, similarly, "Aho, Cecie, Ullman: Compiler II" (Science, 1990) pages 624-7
Since it is described on page 07, it will not be described in detail here.

【0009】図4は手続間データフロー情報の詳細図で
ある。データフロー情報は、レジスタ番号フィールド40
1、参照種別フィールド402、参照している命令が開始さ
れてから関数を終了するまでのサイクル数のフィールド
403と、参照が行われる中間語フィールド404を含んでい
る。これらの情報は、図9で説明するスケジュール表か
ら得られる。関数内に分岐があって、あるレジスタの最
初の参照や、最後の参照となり得る参照が複数ある場合
には、最初の参照については、最も早いタイミングで開
始される参照のみを、最後の定義、参照については、参
照している命令が開始されてから関数を終了するまでに
要するサイクル数が最も短い定義、参照のみを記録する
ものとする。
FIG. 4 is a detailed diagram of the interprocedural data flow information. Data flow information is in register number field 40
1, reference type field 402, field for the number of cycles from the start of the referenced instruction to the end of the function
403 and an intermediate language field 404 to which the reference is made. These pieces of information are obtained from the schedule table described in FIG. If there is a branch in the function and there are multiple references that can be the first reference of a register or the last reference, for the first reference, only the reference that starts at the earliest timing, the last definition, Regarding references, only the definition or reference that requires the shortest number of cycles from the start of the referenced instruction to the end of the function shall be recorded.

【0010】図5は、本発明の特徴的処理である、手続
き間命令スケジューリング処理の詳細図である。まず、
ステップ501において、各命令の依存関係を表す有向非
循環グラフである dag(directed acyclic graph) を生
成する。dag の生成方に付いては「エイホ、セシィ、ウ
ルマン著: コンパイラII」(サイエンス社、1990年)665
頁〜674頁に記載されているので、ここでは説明しな
い。つぎに、ステップ502に進み、dag の情報を元に、
命令スケジューリングを行う。命令スケジューリングの
手順に付いては、「中田 育男 著:コンパイラの構成と
最適化」(朝倉書店、1999年)358頁〜382頁に記載され
ているので、ここでは説明しない。なお、本発明の特徴
である、手続間命令スケジューリングは、dag生成の際
に、手続間データフロー情報202の情報を用いて生成す
ることによる、実現される。情報の利用法については、
図13で説明する。
FIG. 5 is a detailed diagram of an interprocedural instruction scheduling process, which is a characteristic process of the present invention. First,
In step 501, a directed acyclic graph (dag), which is a directed acyclic graph showing the dependency relationship of each instruction, is generated. Regarding the method of generating dag, "Aho, Cesi, Ullman: Compiler II" (Science, 1990) 665
Since it is described on pages 674 to 674, it is not explained here. Next, in step 502, based on the dag information,
Perform instruction scheduling. The instruction scheduling procedure is described in "Ikuo Nakata: Compiler Construction and Optimization" (Asakura Shoten, 1999), pages 358 to 382, and will not be described here. The interprocedural instruction scheduling, which is a feature of the present invention, is realized by generating the dag using the information of the interprocedural data flow information 202. For how to use the information,
This will be described with reference to FIG.

【0011】図6は、手続間スケジューリングを行うプ
ログラムの例である。ステップ603〜606において定義さ
れる関数fooをステップ608〜612で宣言される関数func
が、ステップ610に置いて呼び出している構造になって
いる。
FIG. 6 is an example of a program for performing interprocedural scheduling. The function foo defined in steps 603 to 606 is replaced with the function func declared in steps 608 to 612.
However, the structure is called in step 610.

【0012】図7は、図6に示したプログラムを、スケ
ジューリングを行うための中間語で表した例である。
FIG. 7 shows an example in which the program shown in FIG. 6 is represented by an intermediate language for performing scheduling.

【0013】図8は、図7の中間語のうち、関数 foo
に相当する、ステップ701〜704から生成したdagであ
る。dagの各ノードはプログラムの命令に対応してい
る。図中1001〜1006は、ステップ701〜704に対応するda
g ノードである。また、dagノード間には、依存関係が
あるものについて、依存元から依存先を示すエッジが張
られている。エッジの横に記述されている数値は、依存
関係のある命令間で、依存もとの命令が発行されてか
ら、依存先の命令が発行されるまでに必要なサイクル数
である。ここではスケジューリングの対象となる計算機
として次のような仮定をおく。 (1)1つの整数演算と1つのメモリ操作命令を同時に発行
できる。 (2)整数演算命令は、d = ADD s1, s2 (d=s1+s2のレジス
タ間演算、s2は定数も可)の形であり、2サイクルで完了
する。 (3)メモリ操作命令は d = LOAD addr (addr 番地からレ
ジスタdへのロード)またはSTORE addr = s (レジスタs
からaddr番地へのストア)の形であり、LOAD命令は3サイ
クル、STORE命令は1サイクルで終了する。 (4)同じレジスタからLOAD、STOREの順で処理が行われる
場合、STOREが開始できるのはLOAD開始後5サイクル後で
ある。
FIG. 8 shows the function foo among the intermediate words of FIG.
Which is the dag generated from steps 701 to 704. Each node of dag corresponds to the instruction of the program. In the figure, 1001 to 1006 are da corresponding to steps 701 to 704.
It is a g node. Further, between the dag nodes, edges having a dependency relationship are provided from the dependency source to the dependency destination. The numerical value described next to the edge is the number of cycles required between the instruction having the dependency and the instruction having the dependency, between the instructions having the dependency relationship. Here, the following assumption is made as a computer to be scheduled. (1) One integer operation and one memory operation instruction can be issued at the same time. (2) Integer operation instructions are in the form of d = ADD s1, s2 (register operation of d = s1 + s2, s2 can be a constant) and are completed in 2 cycles. (3) The memory operation instruction is d = LOAD addr (load from address addr to register d) or STORE addr = s (register s
To the addr address), the LOAD instruction completes in 3 cycles and the STORE instruction completes in 1 cycle. (4) When processing is performed in the order of LOAD and STORE from the same register, STORE can be started 5 cycles after the start of LOAD.

【0014】以降は、全てスケジュール対象の計算機は
同じ仮定の計算機であるものとする。
Hereinafter, it is assumed that the computers to be scheduled are computers of the same assumption.

【0015】図9は、上記仮定の計算機において図8の
dagよりスケジューリングを行った結果である、スケジ
ュール表である。このスケジュール表より、図4で説明
した手続間データフロー情報を得ることができる。例え
ば、r1の最初の定義はサイクル901のロード命令である
ことがわかるので、手続間データフロー情報エントリ40
5の情報を得ることができる。同様に、r1の最後の定義
はサイクル904の加算命令であることがわかるので、エ
ントリ406の情報が得られ、r1の最後の参照は、サイク
ル906のストア命令であることがわかるので、エントリ4
07の情報が得られる。
FIG. 9 is a block diagram of the computer of FIG.
It is a schedule table that is the result of scheduling from dag. From this schedule table, the inter-procedural data flow information described in FIG. 4 can be obtained. For example, since it is known that the first definition of r1 is the load instruction of cycle 901, the interprocedural data flow information entry 40
You can get information of 5. Similarly, since the last definition of r1 is found to be the add instruction of cycle 904, the information of entry 406 is obtained, and the last reference of r1 is found to be the store instruction of cycle 906, so entry 4
07 information is obtained.

【0016】以上の説明により、図6のプログラムの関
数fooをステップ201データフロー情報収集用コンパイル
処理において、コンパイルを行い、命令スケジューリン
グを行って図9のスケジュール表を得ることにより図4
の手続間データフロー情報を得ることを説明した。
From the above description, the function foo of the program of FIG. 6 is compiled in the step 201 data flow information collection compilation processing, and instruction scheduling is performed to obtain the schedule table of FIG.
Of obtaining inter-procedural data flow information.

【0017】次に、データフロー情報202を用いて、手
続間命令スケジューリングを行う方法について説明す
る。
Next, a method of performing interprocedural instruction scheduling using the data flow information 202 will be described.

【0018】図10は、図7のステップ705〜715の中間
語から、図4の手続間データフロー情報を用いて生成し
た関数funcのdagである。通常はcallから依存のある命
令との間に必要なサイクル数は、適当な仮定を置いてda
gを生成するが、本発明の手続間命令スケジューリング
法では、手続間データフロー情報の情報を用いる。ノー
ド1002のロード命令はr1への書き込みを行うため、この
命令が開始できるのは、図9のサイクル906のストア命
令開始後5サイクルたってからである。サイクル906のス
トア命令が開始されてから5サイクル後は、サイクル907
のリターン命令があるため、図10のdagにおいては、
コール命令1001のあと5-1=4サイクル後である。これは
図4の手続間データフロー情報のエントリ407の、関数
の全サイクル数からその参照が実行されるサイクル数を
引いたサイクル数のフィールドから得られる。
FIG. 10 is a dag of the function func generated from the intermediate language of steps 705 to 715 of FIG. 7 using the interprocedural data flow information of FIG. Normally, the number of cycles required from a call to a dependent instruction is da
Although g is generated, the interprocedural instruction scheduling method of the present invention uses information of interprocedural data flow information. Since the load instruction of the node 1002 writes to r1, this instruction can be started 5 cycles after the start of the store instruction of cycle 906 in FIG. Five cycles after the store instruction in cycle 906 starts, cycle 907
Since there is a return instruction of, in dag of FIG. 10,
5-1 = 4 cycles after the call instruction 1001. This is obtained from the field of the number of cycles in the entry 407 of the interprocedural data flow information in FIG. 4 which is the total number of cycles of the function minus the number of cycles in which the reference is executed.

【0019】図11は、図10のdagから関数funcのス
ケジューリングを行った結果のスケジュール表である。
FIG. 11 is a schedule table as a result of scheduling the function func from dag in FIG.

【0020】図12は、図9と図11のスケジューリン
グ結果を、実際に実行したときにかかるサイクル数のシ
ミュレート結果である。スケジュール表のとおり、関数
funcは10サイクルで実行されている。
FIG. 12 is a simulation result of the number of cycles required when the scheduling results of FIGS. 9 and 11 are actually executed. Function according to the schedule
func is executed in 10 cycles.

【0021】図13は、従来方式の例として、手続間デ
ータフロー情報を用いることなく、コール命令と依存の
ある命令の間には3サイクル必要であると仮定した場合
のdagである。図10と異なり、ノード1301〜1302間の
サイクル数が、3であると仮定されている。
As an example of the conventional method, FIG. 13 is a dag when it is assumed that three cycles are required between a call instruction and an instruction having a dependency without using interprocedural data flow information. Unlike FIG. 10, it is assumed that the number of cycles between the nodes 1301-1302 is three.

【0022】図14は、図13のdagにより命令スケジ
ュールを行った結果のスケジュール表である。サイクル
1404、1405の命令が、図11とは逆になっている。
FIG. 14 is a schedule table as a result of executing the instruction schedule by the dag of FIG. cycle
The commands 1404 and 1405 are the reverse of those in FIG.

【0023】図15は、図9と図14のスケジュール結
果を、実際に実行したときにかかるサイクル数のシミュ
レート結果である。サイクル1507のストア命令と、1512
のロード命令の間には、5サイクル必要なので、1サイク
ルの待ち時間が入り、図14のスケジュール結果より1
サイクル多くかかっている。
FIG. 15 is a simulation result of the number of cycles required when the schedule results of FIGS. 9 and 14 are actually executed. Store instruction in cycle 1507 and 1512
Since 5 cycles are required between the load instructions of, the waiting time of 1 cycle is included,
It takes a lot of cycles.

【0024】上記実施例では、手続間データフロー情報
202を生成するため、データフロー情報収集用コンパイ
ル処理201が必要であったが、本発明では簡易的なデー
タフロー情報を、あらかじめ用意することにより、精度
は多少落ちるが、手続き間のデータフロー情報を考慮し
た命令スケジューリングを行うことができる。たとえば
calleeセーブレジスタの、退避回復コードなどは、プロ
グラムの先頭と最後のどの位置に、どのレジスタの退避
回復コードが生成されるかが、コールの際のレジスタ退
避回復の規則により、かなり正確に予測できる場合があ
る。このときは、その情報を元に仮定した手続間データ
フロー情報をあらかじめ作成することにより、データフ
ロー情報収集用コンパイル処理201を省略することがで
きる。
In the above embodiment, interprocedural data flow information
The data flow information collection compilation process 201 is required to generate 202, but in the present invention, by preparing simple data flow information in advance, the accuracy may be slightly lowered, but the data flow information between procedures Can be used for instruction scheduling. For example
With regard to the save and restore code of the callee save register, which register save and restore code is generated at the beginning and end of the program can be predicted fairly accurately by the register save and restore rules at the time of a call. There are cases. At this time, the inter-procedural data flow information, which is assumed based on the information, is created in advance, so that the data flow information collecting compilation process 201 can be omitted.

【0025】図16は、callee saveレジスタの退避回
復コードの例である。ここでは、r6〜r8が、callee sav
e レジスタであるものと仮定して、関数中で使用される
callee save レジスタは、関数の先頭でレジスタ番号
の小さいものからスタック上に退避し(ステップ1604〜1
606)、関数の最後にレジスタ番号の大きいものからスタ
ックよりレジスタに回復する(ステップ1601〜1603)こと
が決まっているものと仮定する。なお、図では省略され
ているが、r6〜r8はプログラム中で使用されて、内容が
変更されているものとする。
FIG. 16 shows an example of the save / restore code of the callee save register. Here, r6 to r8 are callee sav
used in a function, assuming it is an e-register
The callee save register is saved on the stack starting from the one with the smallest register number at the beginning of the function (steps 1604-1
606), it is assumed that it is decided at the end of the function that the register with the largest register number is restored to the register from the stack (steps 1601 to 1603). Although not shown in the figure, it is assumed that r6 to r8 are used in the program and the contents are changed.

【0026】図17は、図16のような退避回復コード
が生成される場合の手続き間データフロー情報である。
ここでは、発行されてから関数が終了するまでのサイク
ル数はレジスタ退避回復の順番から知ることができる。
ここでは、レジスタ回復コードの情報のみを利用するも
のとして、回復コードの情報のみ生成してある。callee
save レジスタは、全て使われるものと仮定すれば、デ
ータフロー情報収集用コンパイル処理201を行うことな
く手続き間データフロー情報を得ることができる。以降
は、先に説明したように、コンパイル処理203を行え
ば、手続き間のデータフロー情報を考慮してパイプライ
ンストールを提言する命令スケジューリングを行うこと
ができる。
FIG. 17 shows interprocedural data flow information when the save / recover code shown in FIG. 16 is generated.
Here, the number of cycles from issuance to completion of the function can be known from the order of register save and recovery.
Here, assuming that only the information of the register recovery code is used, only the information of the recovery code is generated. callee
Assuming that all the save registers are used, interprocedural dataflow information can be obtained without performing the dataflow information collecting compilation process 201. After that, as described above, if the compiling process 203 is performed, it is possible to perform instruction scheduling that recommends pipeline stall in consideration of data flow information between procedures.

【0027】[0027]

【発明の効果】本発明によれば、手続き間にまたがる命
令実行時のパイプラインストールを低減することができ
る。
According to the present invention, it is possible to reduce pipeline stalls at the time of executing instructions that extend between procedures.

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

【図1】本発明の命令スケジューリングを行うコンパイ
ラが稼動する計算機システムの構成図。
FIG. 1 is a configuration diagram of a computer system in which a compiler that performs instruction scheduling according to the present invention operates.

【図2】本発明の命令スケジューリングを行うためのコ
ンパイル手順を示すフローチャート図。
FIG. 2 is a flowchart showing a compiling procedure for performing instruction scheduling according to the present invention.

【図3】本発明の命令スケジューリングを行うコンパイ
ラの処理の流れを示すフローチャート図。
FIG. 3 is a flowchart showing a processing flow of a compiler that performs instruction scheduling according to the present invention.

【図4】手続き間データフロー情報を示す図。FIG. 4 is a diagram showing inter-procedural data flow information.

【図5】手続き間命令スケジューリング処理の手順を示
すフローチャート図。
FIG. 5 is a flowchart showing a procedure of interprocedural instruction scheduling processing.

【図6】ソースプログラム例を示す図。FIG. 6 is a diagram showing an example of a source program.

【図7】ソースプログラム例を中間後で表記した図。FIG. 7 is a diagram showing an example of a source program after the middle.

【図8】関数fooのdagを示す図。FIG. 8 is a diagram showing a dag of a function foo.

【図9】関数fooを命令スケジューリングした結果のス
ケジュール表を示す図。
FIG. 9 is a diagram showing a schedule table as a result of instruction scheduling of a function foo.

【図10】手続き間データフロー情報を考慮した関数fu
ncのdagを示す図。
FIG. 10: Function fu considering inter-procedural data flow information
The figure which shows dag of nc.

【図11】図10のdagより命令スケジューリングした
結果のスケジュール表を示す図。
11 is a diagram showing a schedule table as a result of instruction scheduling from dag in FIG.

【図12】図10のスケジュール結果を実際に実行した
際のサイクル数をシミュレートした結果を示す図。
12 is a diagram showing a result of simulating the number of cycles when the schedule result of FIG. 10 is actually executed.

【図13】従来技術により作成した関数funcのdagを示
す図。
FIG. 13 is a diagram showing a dag of a function func created by a conventional technique.

【図14】図13のdagより命令スケジューリングした
結果のスケジュール表を示す図。
FIG. 14 is a diagram showing a schedule table as a result of instruction scheduling from dag in FIG.

【図15】図14のスケジュール結果を実際に実行した
際のサイクル数をシミュレートした結果を示す図。
FIG. 15 is a diagram showing a result of simulating the number of cycles when the schedule result of FIG. 14 is actually executed.

【図16】callee saveレジスタの退避回復コード例を
示す図。
FIG. 16 is a diagram showing an example of save and restore code of a callee save register.

【図17】callee saveレジスタの退避回復規則から生
成した手続き間データフロー情報を示す図。
FIG. 17 is a diagram showing interprocedural data flow information generated from the save / restore rules of the callee save register.

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

101…CPU、102…ディスプレイ装置、103…キーボー
ド、104…主記憶装置、105…外部記憶装置。
101 ... CPU, 102 ... Display device, 103 ... Keyboard, 104 ... Main storage device, 105 ... External storage device.

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 コンパイラにおいて、手続き間にまたが
るデータの依存および資源の競合を調べるステップと、
調べた結果を考慮して命令スケジューリングを行うステ
ップを持つ事を特徴とする命令スケジューリング方法。
1. A method of checking data dependency and resource conflict between procedures in a compiler,
An instruction scheduling method having a step of performing instruction scheduling in consideration of a result of examination.
【請求項2】 コンパイラにおいて、手続き間にまたが
るデータの依存や、資源の競合を手続き呼び出しの際の
規則から簡易的に予測するステップと、予測の結果に基
づいて命令スケジューリングを行う事ステップを持つ事
を特徴とする命令スケジューリング方法。
2. The compiler has a step of simply predicting data dependence and resource conflicts across procedures from rules at the time of procedure call, and a step of performing instruction scheduling based on the result of the prediction. An instruction scheduling method characterized by the above.
【請求項3】 コンパイラにおいて、手続間にまたがる
命令列で、パイプラインストールの発生を低減するよう
に命令が配置されていることを特徴とする命令スケジュ
ーリング方法。
3. An instruction scheduling method, wherein in a compiler, instructions are arranged so as to reduce the occurrence of pipeline stall in an instruction string that extends between procedures.
【請求項4】 請求項1または請求項2または請求項3
の命令スケジューリング方法を用いたコンパイラ。
4. Claim 1 or claim 2 or claim 3.
Compiler using the instruction scheduling method of.
【請求項5】 請求項3のコンパイラを格納した記録媒
体。
5. A recording medium storing the compiler according to claim 3.
JP2001330107A 2001-10-29 2001-10-29 Method of scheduling instruction between procedures Pending JP2003131888A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001330107A JP2003131888A (en) 2001-10-29 2001-10-29 Method of scheduling instruction between procedures

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001330107A JP2003131888A (en) 2001-10-29 2001-10-29 Method of scheduling instruction between procedures

Publications (1)

Publication Number Publication Date
JP2003131888A true JP2003131888A (en) 2003-05-09

Family

ID=19145887

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001330107A Pending JP2003131888A (en) 2001-10-29 2001-10-29 Method of scheduling instruction between procedures

Country Status (1)

Country Link
JP (1) JP2003131888A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2008090665A1 (en) * 2007-01-25 2010-05-13 日本電気株式会社 Program parallelization method and apparatus
US9207922B2 (en) 2013-01-28 2015-12-08 Samsung Electronics Co., Ltd. Compiling method and apparatus for scheduling block in pipeline
JP2017010077A (en) * 2015-06-16 2017-01-12 富士通株式会社 Computer, compiler program, link program and compilation method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2008090665A1 (en) * 2007-01-25 2010-05-13 日本電気株式会社 Program parallelization method and apparatus
US9207922B2 (en) 2013-01-28 2015-12-08 Samsung Electronics Co., Ltd. Compiling method and apparatus for scheduling block in pipeline
JP2017010077A (en) * 2015-06-16 2017-01-12 富士通株式会社 Computer, compiler program, link program and compilation method

Similar Documents

Publication Publication Date Title
US6718541B2 (en) Register economy heuristic for a cycle driven multiple issue instruction scheduler
JP3311462B2 (en) Compile processing unit
JP4042604B2 (en) Program parallelization apparatus, program parallelization method, and program parallelization program
US6289505B1 (en) Method, apparatus and computer programmed product for binary re-optimization using a high level language compiler
US5303357A (en) Loop optimization system
CN109272109B (en) Instruction scheduling method and device of neural network model
US7181730B2 (en) Methods and apparatus for indirect VLIW memory allocation
JP2002149416A (en) Method for optimizing program and compiler using the same
JPH11306026A (en) Code optimization device and method and computer readable recording medium recording code optimization program
US8458671B1 (en) Method and system for stack back-tracing in computer programs
JP2005129001A (en) Apparatus and method for program execution, and microprocessor
JP2003131888A (en) Method of scheduling instruction between procedures
CN113721899B (en) GPDSP-oriented lightweight high-efficiency assembly code programming method and system
JP3840149B2 (en) Compiler, arithmetic processing system, and arithmetic processing method
Dooley et al. Detecting and using critical paths at runtime in message driven parallel programs
JPH10320212A (en) Cache optimizing method
Newburn et al. Balancing Fine-and Medium-Grained Parallelism in Scheduling Loops for the XIMD Architecture.
Austin et al. Tetra: Evaluation of serial program performance on fine-grain parallel processors
Maccarone et al. Fuzzy mathematical morphology to analyse astronomical images
Gupta code Optimization as a side effect of instruction scheduling
JP3648402B2 (en) Compiling method and compiler apparatus
JPH11149380A (en) Compiler, program optimizing method and recording medium recording its processing program
JP3018783B2 (en) Compilation method
JP3566602B2 (en) Compilation method and recording medium recording compilation program
Whitham et al. Predictable out-of-order execution using virtual traces