[go: up one dir, main page]

JPH04252336A - Program optimization processing device - Google Patents

Program optimization processing device

Info

Publication number
JPH04252336A
JPH04252336A JP883591A JP883591A JPH04252336A JP H04252336 A JPH04252336 A JP H04252336A JP 883591 A JP883591 A JP 883591A JP 883591 A JP883591 A JP 883591A JP H04252336 A JPH04252336 A JP H04252336A
Authority
JP
Japan
Prior art keywords
instruction
instructions
parent
weight
program
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.)
Withdrawn
Application number
JP883591A
Other languages
Japanese (ja)
Inventor
Toshihiro Ozawa
年弘 小沢
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 JP883591A priority Critical patent/JPH04252336A/en
Publication of JPH04252336A publication Critical patent/JPH04252336A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To obtain a program optimization processor which changes the executing order of instruction trains so as to attain the optimization of a program to the execution of a processor which performs the pipeline processing in regard of the program optimization processing of a computer. CONSTITUTION:An inter-instruction weight data base 2 holds the information which shows the estimated pipeline break length as the prescribed weight value when two instructions are continuously carried out for each arrangement of two necessary instructions of different types. A reliance analyzing part 3 shows the master-slave relation with the instruction right before the output of each input defined as a master instruction for each input of the corresponding instruction in regard of each instruction of an instruction train 1. Then the part 3 generates the information that set the weight decided by the base 2 as the master-slave relation information 5 for each master-slave relation. An instruction order setting part 4 repeats the prescribed instruction order setting processing until. the corresponding candidate assembly 6, becomes empty after the instruction lacking a master instruction is transferred to the candidate assembly from the relation 5 from the assembly 6. Thus a new instruction train is obtained.

Description

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

【0001】0001

【産業上の利用分野】本発明は計算機における、プログ
ラムの命令実行順序の最適化、特にパイプラインによる
並列処理機能を持つ計算機による実行において、パイプ
ライン・ブレークを減少するように最適化するためのプ
ログラム最適化処理装置に関する。
[Industrial Application Field] The present invention is an optimization method for optimizing the instruction execution order of a program in a computer, and in particular, for optimizing to reduce pipeline breaks when executed by a computer having a parallel processing function using a pipeline. The present invention relates to a program optimization processing device.

【0002】0002

【従来の技術】計算機における、プログラムの命令列を
効率良く実行できるように修正する処理は最適化処理と
して知られており、コンパイラ等の最適化ルーチンでは
、プログラムのループ中の不変式をループ該へ移動して
、繰り返し部分のステップ数を減少したり、共通式を削
除する等の最適化がよく行われている。
[Background Art] The process of modifying a program's instruction sequence so that it can be executed efficiently in a computer is known as optimization process.In an optimization routine such as a compiler, an invariant expression in a program loop is Optimizations such as reducing the number of steps in the repetitive part and deleting common expressions are often performed.

【0003】0003

【発明が解決しようとする課題】前記のような従来の最
適化によって、ステップ数を減少する最適化はできるが
、パイプライン処理を行うプロセッサでプログラムを実
行する場合には、同じ意味 (処理結果) の命令列を
実行しても、命令の実行順序によってパイプラインの流
れ方が異なって、性能に大きな差を生じる。
[Problem to be Solved by the Invention] Although it is possible to reduce the number of steps using the conventional optimization described above, when a program is executed on a processor that performs pipeline processing, the same meaning (processing result) can be achieved. ), the pipeline flow differs depending on the instruction execution order, resulting in a large difference in performance.

【0004】即ち、例えば先行命令の出力を入力として
使用する後続命令を近接してパイプラインに流すような
場合には、先行命令の完了をパイプラインの途中で後続
命令が待ち合わせるための制御により、いわゆるパイプ
ライン・ブレークが生じ、パイプラインの何サイクルか
の時間は後続命令列の進行が抑えられる。
That is, when, for example, subsequent instructions that use the output of a preceding instruction as input are passed into a pipeline in close proximity to each other, control allows the subsequent instruction to wait for the completion of the preceding instruction in the middle of the pipeline. A so-called pipeline break occurs, and the progress of subsequent instructions is suppressed for several cycles of the pipeline.

【0005】従って、このような場合に、前記先行命令
の実行に関係の無い適当な命令があれば、前記先行命令
と後続命令との間にその命令を挿入するように実行順序
を変更することにより、パイプラインの流れに停滞がな
くなって実行時間を短縮することが可能である。しかし
、従来このようなパイプラインの特性を考慮した最適化
は行われていない。
Therefore, in such a case, if there is an appropriate instruction unrelated to the execution of the preceding instruction, the execution order may be changed so that the instruction is inserted between the preceding instruction and the subsequent instruction. This eliminates stagnation in the pipeline flow and reduces execution time. However, optimization that takes such pipeline characteristics into consideration has not been performed in the past.

【0006】本発明は、パイプライン処理を行うプロセ
ッサによる実行に最適化するように命令列の実行順序を
変更するプログラム最適化処理装置を目的とする。
The object of the present invention is to provide a program optimization processing device that changes the execution order of instruction sequences so as to optimize execution by a processor that performs pipeline processing.

【0007】[0007]

【課題を解決するための手段】図1は、本発明の構成を
示すブロック図である。図はプログラム最適化処理装置
の構成であって、プログラムを構成する命令列1の命令
順序を最適化する処理において、命令間重みデータベー
ス2と、依存関係解析部3と、命令順序付け部4とを設
ける。
Means for Solving the Problems FIG. 1 is a block diagram showing the configuration of the present invention. The figure shows the configuration of a program optimization processing device, which includes an inter-instruction weight database 2, a dependency relationship analysis section 3, and an instruction ordering section 4 in the process of optimizing the instruction order of an instruction sequence 1 constituting a program. establish.

【0008】命令間重みデータベース2は、所要の各種
2命令の並びごとについて、該2命令を続けて実行する
場合に予定されるパイプライン・ブレークの長さを所定
の重み値として表す情報を保持する。
[0008] The inter-instruction weight database 2 holds information representing, as a predetermined weight value, the length of a pipeline break that is expected when the two instructions are successively executed, for each sequence of various required two instructions. do.

【0009】依存関係解析部3は、命令列1の各命令に
ついて、当該命令の各入力ごとに、各該入力を出力する
直前の命令を親命令として親子関係を示し、該親子関係
ごとについて、命令間重みデータベース2から定まる重
みを設定した情報を、親子関係情報5として生成する。
The dependency analysis unit 3 indicates the parent-child relationship for each instruction in the instruction sequence 1 for each input of the instruction, with the instruction immediately before outputting each input as the parent instruction, and for each parent-child relationship, Information in which weights determined from the inter-instruction weight database 2 are set is generated as parent-child relationship information 5.

【0010】命令順序付け部4は、該親命令の無い命令
を親子関係情報5から候補集合6に移した後、命令順序
付け処理を候補集合6が空になるまで反復して、新命令
列7を生成する。
After moving the instruction without a parent instruction from the parent-child relationship information 5 to the candidate set 6, the instruction ordering unit 4 repeats the instruction ordering process until the candidate set 6 is empty, and creates a new instruction sequence 7. generate.

【0011】第1の発明において、該命令順序付け処理
は、候補集合6について、該重みが最小の該命令の1つ
を該候補集合から除いて新命令列7に出力し、候補集合
6に残る各命令について該重みが0でなければ1だけ減
じた後、該親子関係情報上で該親命令が無くなった命令
を、該親子関係情報から該候補集合に移す処理とし、該
出力順に該命令を配列した該新命令列を最適化結果のプ
ログラムとする。
In the first invention, the instruction ordering process removes one of the instructions with the smallest weight from the candidate set 6 and outputs it to a new instruction sequence 7, which remains in the candidate set 6. If the weight of each instruction is not 0, it is decreased by 1, and then the instructions whose parent instruction no longer exists on the parent-child relationship information are moved from the parent-child relationship information to the candidate set, and the instructions are transferred in the output order. The new sequence of instructions thus arranged is used as an optimization result program.

【0012】又第2の発明においては、所要の命令種類
について、それぞれ+属性及び−属性を設け、前記第1
の発明命令順序付け処理に、前記候補集合から前記新命
令列に出力する該命令の選択の場合に、該+属性の該命
令の順位を最も優先し、該−属性の該命令の順位を最も
後位にして、該順位に従って優先される該命令のうち前
記重みが最小の該命令の1つを選択する処理を追加する
[0012] In the second invention, a + attribute and a - attribute are provided for each required instruction type, and the above-mentioned first
In the invention instruction ordering process, when selecting the instruction to be output to the new instruction sequence from the candidate set, the order of the instruction with the + attribute is given the highest priority, and the order of the instruction with the - attribute is given the lowest priority. A process of selecting one of the instructions having the minimum weight among the instructions prioritized according to the order is added.

【0013】更に又第3の発明においては、所要の命令
種類の命令と、前記プログラムの命令配列上該命令の次
に位置する命令との間に次命令関係を設け、前記第1又
は第2の発明の命令順序付け処理に、前記候補集合から
前記新命令列に出力する該命令の選択の場合に、該命令
種類の命令を出力した後には、次に続けて当該命令と該
次命令関係を有する命令を選択する処理を追加する。
Furthermore, in the third invention, a next instruction relationship is provided between an instruction of a required instruction type and an instruction located next to the instruction in the instruction array of the program, and the first or second In the instruction ordering process of the invention, in the case of selecting the instruction to be output from the candidate set to the new instruction sequence, after outputting the instruction of the instruction type, the relationship between the instruction and the next instruction is successively determined. Add processing to select instructions that have

【0014】[0014]

【作用】必要な命令種類の組み合わせについて、プロセ
ッサで実行される機械語の命令は、一般に幾つかのレジ
スタ又は記憶領域として指定される引数を持ち、各引数
は入力又は出力の何れかである。ここで引数とは、機械
語命令に陽に指定されるものの他、暗に定まるもの、例
えばいわゆる「条件コード」等も含む。
For the required combination of instruction types, machine language instructions executed by a processor generally have arguments designated as several registers or storage areas, each argument being either an input or an output. Here, the term "argument" includes not only those explicitly specified in a machine language instruction but also those implicitly determined, such as a so-called "condition code."

【0015】ここで入力とは、他の命令の実行によって
値が決定されていて、当命令の実行に際して参照しなけ
ればならない引数をいい、出力とは、当命令の処理結果
として値が決定される引数をいっている。
[0015] Here, input refers to an argument whose value has been determined by the execution of another instruction and must be referenced when executing this instruction, and output refers to an argument whose value has been determined as a result of the processing of this instruction. It says the argument.

【0016】そこで、プログラムの命令列においては、
各命令の入出力関係によって命令間に依存関係があり、
ある命令の入力となる引数を出力として持つ他の命令は
必ず先に実行されなければならず、逆にこの依存関係を
保持する限り、命令の実行順序を変えても命令列の意味
(処理結果)は一般に変わらない。
Therefore, in the instruction sequence of the program,
There are dependencies between instructions depending on the input/output relationship of each instruction,
Any other instruction that has an input argument as its output must always be executed first, and as long as this dependency is maintained, the meaning of the instruction sequence (processing result) will not change even if the execution order of the instructions is changed. ) generally remains unchanged.

【0017】そこで、本発明のプログラム最適化処理装
置により、所与のプログラムについて、前記の命令間の
依存関係を示すようにした親子関係情報を作成し、その
親子関係を保持しながら、実行順序を変更して、パイプ
ライン処理の場合にパイプライン・ブレークができるだ
け少なくなるように最適化する。
Therefore, the program optimization processing device of the present invention creates parent-child relationship information indicating the dependence relationship between instructions for a given program, and adjusts the execution order while maintaining the parent-child relationship. Optimize pipeline breaks to minimize pipeline breaks by changing .

【0018】そのために、パイプライン処理により第1
の種類の命令に続けて第2の種類の命令を実行した場合
に、第2の種類の命令で生じるパイプライン・ブレーク
の長さを重みとして示す命令間重みデータベースを設け
、それを参照して前記の親子関係の各々について重みを
付けておく。
For this purpose, the first
An inter-instruction weight database is provided that indicates, as a weight, the length of a pipeline break caused by the second type of instruction when the second type of instruction is executed following the second type of instruction. A weight is assigned to each of the above-mentioned parent-child relationships.

【0019】最適化の順序付け処理では、命令間に他の
親子関係の無い命令を挟めば重みを減少できることを考
慮して、前記処理により重みの総和が最小になるように
命令を並べ変えることにより、パイプライン処理の実行
時間に関して最適化する。
In the optimization ordering process, taking into consideration that the weight can be reduced by inserting other instructions with no parent-child relationship between the instructions, the instructions are rearranged so that the sum of the weights is minimized. , optimize the execution time of pipeline processing.

【0020】[0020]

【実施例】例えばread命令を、「read r1,
data1 」という命令で、アドレスdata1 の
記憶領域を入力として、出力のレジスタr1にデータを
読み込む命令として、その命令の後に続けてwrite
 命令を実行する場合を考える。
[Example] For example, the read command is changed to “read r1,
``data1'' is an instruction to input the storage area at address data1 and read data into the output register r1.
Consider the case of executing an instruction.

【0021】そのwrite 命令を、「write 
r1,data2」のように、入力のレジスタr1のデ
ータを、出力の記憶領域data2 に書き出す命令で
あるとした場合に、入力レジスタr1にread命令で
データが出力されるのを待つ時間によって、パイプライ
ン・ブレークが例えば1サイクル時間生じるとすると、
read命令からwrite命令への組合せにおけるw
rite 命令の重みを例えば「1」とする。
[0021] The write command is
r1, data2'', the data in the input register r1 is written to the output storage area data2. If the line break occurs for example one cycle time, then
w in combination from read instruction to write instruction
For example, assume that the weight of the rite command is "1".

【0022】図1の命令間重みデータベース2には、必
要な命令種類の組合せ、例えばread、write 
、moveというような命令があるとした場合に、 read→write の場合の重み1read→mo
ve  の場合の重み0write→read の場合
の重み1、等のように必要な2種類の命令の並びすべて
について後続命令の重みを表した情報を準備しておく。 従って、プロセッサのパイプラインの構成や制御方式等
が異なれば、一般にそれらの重み値は異なってくる。
The inter-instruction weight database 2 in FIG. 1 contains necessary combinations of instruction types, such as read and write.
, if there is an instruction such as move, the weight in the case of read→write is 1read→mo
Information representing the weight of subsequent instructions is prepared for all necessary sequences of two types of instructions, such as weight 0 in the case of ve, weight 1 in the case of write→read, and so on. Therefore, if the pipeline configuration, control method, etc. of the processor differ, the weight values will generally differ.

【0023】図1の依存関係解析部3は、命令列1の各
命令について、当該命令の各入力ごとに、各該入力を出
力する直前の命令を親命令として親子関係を示し、この
親子関係ごとについて、命令間重みデータベース2から
定まる重みを設定した情報を、親子関係情報5として生
成する。
The dependency analysis unit 3 in FIG. 1 shows the parent-child relationship for each input of the instruction in the instruction sequence 1 by setting the instruction immediately before outputting the input as the parent instruction, and calculates this parent-child relationship. For each command, information in which a weight determined from the inter-instruction weight database 2 is set is generated as parent-child relationship information 5.

【0024】図2は依存関係解析部3の処理の流れの一
例を示し、処理ステップ10で識別して、命令列1の全
命令について先頭から順次処理するものとし、処理ステ
ップ11で1命令を取り出す。
FIG. 2 shows an example of the processing flow of the dependency relationship analysis unit 3, in which it is assumed that all instructions in the instruction sequence 1 are identified in processing step 10 and sequentially processed from the beginning, and one instruction is processed in processing step 11. Take it out.

【0025】処理ステップ12で識別して、その命令種
類により定まる引数の全入力について順次処理するもの
とし、処理ステップ13で1入力を取り上げる。処理ス
テップ14で識別して、その命令より前の命令に順次遡
りながら、取り上げている入力と同じものを出力の引数
に持つ最近の命令を探す。即ち、処理ステップ15で前
の1命令を取り出し、処理ステップ16で現処理対象の
入力と同じものを出力に指定されているか識別し、一致
する出力が無ければ処理ステップ14に戻って、もう一
つ前の命令について以上の処理をする。
In processing step 12, all inputs of arguments determined by the instruction type are sequentially processed, and in processing step 13, one input is picked up. Identification is made in processing step 14, and a recent instruction whose output argument is the same as the input being taken is searched for while sequentially going back to the instructions preceding the instruction. That is, in processing step 15, the previous instruction is extracted, and in processing step 16, it is determined whether the same input as the current processing target is specified as the output, and if there is no matching output, the process returns to processing step 14 and another instruction is executed. Perform the above processing for the previous instruction.

【0026】入力と一致する出力を持つ命令があれば、
処理ステップ17に進み、その出力を持つ命令を親とし
現処理対象の命令を子とするアークを設定し、処理ステ
ップ18で親命令の命令種類と、子命令の命令種類をキ
ーにして命令間重みデータベース2を検索することによ
り、そのアークに重みを設定し、親子関係情報5を生成
した後、処理ステップ12に戻る。
If there is an instruction whose output matches the input,
Proceeding to processing step 17, an arc is set with the instruction that has the output as the parent and the instruction currently being processed as the child, and in processing step 18, the instruction type of the parent instruction and the instruction type of the child instruction are used as keys to create an arc between instructions. After setting a weight to the arc by searching the weight database 2 and generating the parent-child relationship information 5, the process returns to step 12.

【0027】又第2及び第3の発明の場合、依存関係解
析部3は特定の命令種類についての次命令関係の属性、
+属性、−属性の情報を保持し、処理した命令の命令種
類が特定命令種類の1つに該当する場合には、処理ステ
ップ18で親子関係情報5の該当する命令にそれらの属
性を設定する。
In the case of the second and third inventions, the dependency relationship analysis unit 3 determines the attributes of the next instruction relationship for a specific instruction type;
+ attribute and - attribute information are held, and if the instruction type of the processed instruction corresponds to one of the specific instruction types, those attributes are set to the corresponding instruction in the parent-child relationship information 5 in processing step 18. .

【0028】ここで、次命令関係とは、特定種類の命令
がある場合に、命令列1でその命令の次にある命令は、
必ず最適化後も次に実行されるように順序付けなければ
成らないことを示す属性であって、次命令関係が指定さ
れている命令種類の命令を処理した場合には、命令列1
上でその次にある命令へのアークを設け、そのアークが
次命令関係のものであることを示す所定の表示をする。
Here, the next instruction relationship means that when there is a specific type of instruction, the instruction following that instruction in instruction sequence 1 is
This is an attribute that indicates that the instruction must be ordered so that it will be executed next even after optimization, and when an instruction of an instruction type for which the next instruction relationship is specified is processed, the instruction sequence 1
An arc to the next instruction is provided above, and a predetermined display is provided to indicate that the arc is related to the next instruction.

【0029】次命令関係の対象となる特定種類としては
、例えばskip命令 (条件判定により、次の命令か
、又は次の次の命令を実行する命令) や、delay
ed branch命令 (通常の分岐機能の命令であ
るが、分岐する場合にも次の命令は実行するもの)等が
ある。
Specific types of next-instruction relationships include, for example, a skip instruction (an instruction that executes the next instruction or the next instruction based on conditional judgment), and a delay instruction.
There is an ed branch instruction (an instruction with a normal branch function, but the next instruction is executed even when branching).

【0030】又、+属性、−属性を指定されている種類
の命令を処理した場合には、親子関係情報5のその命令
に、それぞれの属性を示す所定の表示をする。+属性は
、できるだけ早期に実行した方が効率の良い種類の命令
で、排他制御のためのロックを解くてめのアンロック命
令とか、プロセッサのバッファ中の不要のデータを無効
化するキャッシュ無効化命令 (マルチプロセッサシス
テムにおけるキャッシュ制御の効率化のために設けられ
ることがある) 等があり、−属性は、+属性とは逆に
できるだけ後で実行した方が効率の良い種類の命令で、
排他制御のためのロックを実行するロック命令等がある
Furthermore, when a type of command for which +attribute or -attribute is specified is processed, a predetermined display indicating each attribute is displayed for the command in the parent-child relationship information 5. The + attribute is a type of instruction that is more efficient if executed as early as possible, such as an unlock instruction to release a lock for exclusive control, or a cache invalidation instruction to invalidate unnecessary data in the processor's buffer. instructions (sometimes provided to improve the efficiency of cache control in multiprocessor systems), etc. The - attribute, contrary to the + attribute, is a type of instruction that is more efficient if executed as late as possible.
There are lock instructions and the like that execute locks for exclusive control.

【0031】以上により生成する親子関係情報5は、例
えば命令列1の各命令ごとに割り当てた記憶領域を有し
、各領域に当該命令の内容と、+属性又は−属性の表示
領域とを設け、その命令を親とするアークを表す子命令
の記憶領域を指示するポインタと、子命令の場合の重み
値と、次命令関係の表示とを、アークの個数だけ設け、
その他必要な制御情報を持つ構成とする。
The parent-child relationship information 5 generated as described above has a storage area allocated to each instruction in the instruction sequence 1, for example, and each area is provided with a display area for the content of the instruction and a + attribute or - attribute. , a pointer indicating a storage area of a child instruction representing an arc whose parent is the instruction, a weight value in the case of a child instruction, and a display of the next instruction relationship are provided for the number of arcs,
The configuration should include other necessary control information.

【0032】命令順序付け部4は、以上により生成され
た親子関係情報5を入力として処理し、先ず親子関係情
報5で親命令の無い命令を候補集合6に移した後、命令
順序付け処理を候補集合6が空になるまで反復して、新
命令列7を生成する。
The instruction ordering unit 4 processes the parent-child relationship information 5 generated as described above as input, first moves instructions without a parent instruction in the parent-child relationship information 5 to the candidate set 6, and then performs instruction ordering processing on the candidate set. A new instruction sequence 7 is generated by repeating this process until 6 becomes empty.

【0033】図3は命令順序付け部4の処理の流れの一
例を示す図であり、処理ステップ20で親子関係情報5
を走査して、親の無い命令をすべて取り出し、候補集合
6とする。
FIG. 3 is a diagram showing an example of the processing flow of the instruction ordering unit 4. In processing step 20, parent-child relationship information 5 is
is scanned and all instructions without parents are extracted and set as candidate set 6.

【0034】処理ステップ21で識別して、候補集合6
が空になるまで以下の処理を繰り返すものとし、候補集
合6に命令があれば処理ステップ22で次命令関係のア
ークを持つ命令があるか識別し、あれば処理ステップ2
3でその命令を新命令列7に出力し、処理ステップ24
でその命令と次命令関係で順次つながる命令を親子関係
情報5から取り出して出力する。
Candidate set 6 is identified in processing step 21.
The following process is repeated until the candidate set 6 is empty, and if there is an instruction in candidate set 6, it is determined in processing step 22 whether there is an instruction with an arc related to the next instruction, and if there is, processing step 2 is performed.
3, the instruction is output to the new instruction string 7, and processing step 24
Then, the instructions sequentially connected to that instruction in the next instruction relationship are extracted from the parent-child relationship information 5 and output.

【0035】又、次命令関係のアークを持つ命令が無け
れば、処理ステップ25で+属性の命令を選択し、+属
性の命令があれば処理ステップ27でその中で重みが最
小の1命令を選び、その命令を処理ステップ28で新命
令列7へ出力する。
If there is no instruction with an arc related to the next instruction, an instruction with + attribute is selected in processing step 25, and if there is an instruction with + attribute, one instruction with the minimum weight among them is selected in processing step 27. The selected instruction is output to the new instruction string 7 in processing step 28.

【0036】+属性の命令がなければ、処理ステップ2
6で−属性でない命令を選択し、従って+属性でも、−
属性でもない命令があれば処理ステップ27、28で前
記のように1命令を選択して出力する。又、−属性のみ
であればそれらの命令について処理ステップ27、28
で前記のように1命令を選択して出力する。
[0036] If there is no +attribute command, processing step 2
6 selects an instruction that is not a - attribute, so even if it is a + attribute, -
If there is an instruction that is not an attribute, one instruction is selected and outputted in processing steps 27 and 28 as described above. Also, if only attributes are present, process steps 27 and 28 for those instructions.
select one instruction and output it as described above.

【0037】以上で命令を新命令列7に出力する処理で
は、出力した命令を親命令としている直下の子命令 (
一般に複数ある)をアークによって識別し、それらの子
命令について、制御情報中の親命令の個数を1個減じる
処理を同時に行う。
In the above process of outputting an instruction to the new instruction string 7, the immediate child instruction (
(generally there are a plurality of instructions) are identified by arcs, and the number of parent instructions in the control information is simultaneously reduced by one for those child instructions.

【0038】以上の後、処理ステップ29で候補集合6
に残っている各命令の重みで、0になっていないものを
すべて−1した後、処理ステップ30で親子関係情報5
を走査し、命令が残っていれば、新たに親が無くなった
命令をすべて候補集合6へ移して、処理ステップ21へ
戻る。
After the above, in processing step 29, candidate set 6 is
After subtracting by 1 all the weights of the remaining instructions that are not 0, the parent-child relationship information 5 is calculated in processing step 30.
is scanned, and if any instructions remain, all instructions that have newly lost their parents are moved to candidate set 6, and the process returns to step 21.

【0039】以上の処理を処理ステップ21で候補集合
6に命令が無くなるまで繰り返すことにより、出力順に
並んだ命令からなる新命令列7が、最適化プログラムと
して得られる。
By repeating the above processing until there are no more instructions in the candidate set 6 in processing step 21, a new instruction sequence 7 consisting of instructions arranged in output order is obtained as an optimized program.

【0040】[0040]

【発明の効果】以上の説明から明らかなように本発明に
よれば、計算機におけるプログラムの最適化処理におい
て、パイプライン処理を行うプロセッサによる実行を、
命令列の実行順序を変更してパイプライン・ブレークを
最小にするように最適化することができるという著しい
工業的効果がある。
As is clear from the above description, according to the present invention, in program optimization processing in a computer, execution by a processor that performs pipeline processing is
There is a significant industrial effect in that the execution order of a sequence of instructions can be changed and optimized to minimize pipeline breaks.

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

【図1】  本発明の構成を示すブロック図[Figure 1] Block diagram showing the configuration of the present invention

【図2】 
 依存関係解析部の処理の流れ図
[Figure 2]
Processing flowchart of dependency analysis section

【図3】  命令順序
付け部の処理の流れ図
[Figure 3] Flowchart of processing of instruction ordering unit

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

1  命令列 2  命令間重みデータベース 3  依存関係解析部 4  命令順序付け部 5  親子関係情報 6  候補集合 7  新命令列 1 Instruction sequence 2 Inter-instruction weight database 3 Dependency analysis section 4 Instruction ordering section 5 Parent-child relationship information 6 Candidate set 7 New instruction sequence

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】  プログラムを構成する命令列(1) 
の命令順序を最適化する処理において、命令間重みデー
タベース(2)と、依存関係解析部(3)と、命令順序
付け部(4) とを設け、該命令間重みデータベース(
2)は、所要の各種2命令の並びごとについて、該2命
令を続けて実行する場合に予定されるパイプライン・ブ
レークの長さを所定の重み値として表す情報を保持し、
該依存関係解析部(3)は、該命令列(1)の各命令に
ついて、当該命令の各入力ごとに、各該入力を出力する
直前の命令を親命令として親子関係を示し、該親子関係
ごとについて、該命令間重みデータベース(2) から
定まる重みを設定した情報を、親子関係情報(5)とし
て生成し、該命令順序付け部(4)は、該親命令の無い
命令を該親子関係情報(5)から候補集合(6) に移
した後、命令順序付け処理を該候補集合が空になるまで
反復して、新命令列(7)を生成し、該命令順序付け処
理は、該候補集合(6) について、該重みが最小の該
命令の1つを該候補集合から除いて該新命令列(7) 
に出力し、該候補集合に残る各命令について該重みが0
でなければ1だけ減じた後、該親子関係情報上で該親命
令が無くなった命令を、該親子関係情報から該候補集合
に移す処理とし、該出力順に該命令を配列した該新命令
列を最適化結果のプログラムとするように構成されてい
ることを特徴とするプログラム最適化処理装置。
[Claim 1] Instruction sequence (1) constituting the program
In the process of optimizing the order of instructions, an inter-instruction weight database (2), a dependency analysis section (3), and an instruction ordering section (4) are provided, and the inter-instruction weight database (
2) holds information representing, as a predetermined weight value, the length of a pipeline break that is expected when the two instructions are successively executed for each sequence of various two instructions;
The dependency analysis unit (3) indicates the parent-child relationship for each instruction in the instruction sequence (1) by setting the instruction immediately before outputting each input as a parent instruction for each input of the instruction, and calculates the parent-child relationship. For each command, information in which a weight determined from the inter-instruction weight database (2) is set is generated as parent-child relationship information (5), and the instruction ordering unit (4) assigns instructions without the parent instruction to the parent-child relationship information. After moving from (5) to candidate set (6), the instruction ordering process is repeated until the candidate set becomes empty to generate a new instruction sequence (7). 6), remove one of the instructions with the minimum weight from the candidate set and create the new instruction sequence (7).
and the weight is 0 for each instruction remaining in the candidate set.
If not, after decrementing by 1, the instructions whose parent instruction no longer exists on the parent-child relationship information are moved from the parent-child relationship information to the candidate set, and the new instruction sequence in which the instructions are arranged in the output order is created. A program optimization processing device, characterized in that it is configured to produce an optimization result as a program.
【請求項2】  所要の命令種類について、それぞれ+
属性及び−属性を設け、前記命令順序付け処理(4)は
、前記候補集合(6)から前記新命令列に出力する該命
令の選択の場合に、該+属性の該命令の順位を最も優先
し、該−属性の該命令の順位を最も後位にして、該順位
に従って優先される該命令のうち前記重みが最小の該命
令の1つを選択する、請求項1記載のプログラム最適化
処理装置。
[Claim 2] For each required instruction type, +
attributes and - attributes are provided, and the instruction ordering process (4) gives the highest priority to the order of the instructions with the + attributes when selecting the instructions to be output to the new instruction sequence from the candidate set (6). , the program optimization processing device according to claim 1, wherein the order of the instruction in the - attribute is set to the lowest position, and one of the instructions having the minimum weight is selected from among the instructions prioritized according to the order. .
【請求項3】  所要の命令種類の命令と、前記プログ
ラムの命令配列上該命令の次に位置する命令との間に次
命令関係を設け、前記命令順序付け処理(4) は、前
記候補集合(6) から前記新命令列に出力する該命令
の選択の場合に、該命令種類の命令を出力した後には、
次に続けて当該命令と該次命令関係を有する命令を選択
する、請求項1又は請求項2記載のプログラム最適化処
理装置。
3. A next-instruction relationship is established between an instruction of a desired instruction type and an instruction located next to the instruction in the instruction array of the program, and the instruction ordering process (4) is performed in accordance with the candidate set ( 6) In the case of selecting the instruction to be output to the new instruction sequence, after outputting the instruction of the instruction type,
3. The program optimization processing device according to claim 1, further comprising selecting an instruction having a relationship between the instruction and the next instruction.
JP883591A 1991-01-29 1991-01-29 Program optimization processing device Withdrawn JPH04252336A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP883591A JPH04252336A (en) 1991-01-29 1991-01-29 Program optimization processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP883591A JPH04252336A (en) 1991-01-29 1991-01-29 Program optimization processing device

Publications (1)

Publication Number Publication Date
JPH04252336A true JPH04252336A (en) 1992-09-08

Family

ID=11703842

Family Applications (1)

Application Number Title Priority Date Filing Date
JP883591A Withdrawn JPH04252336A (en) 1991-01-29 1991-01-29 Program optimization processing device

Country Status (1)

Country Link
JP (1) JPH04252336A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06208462A (en) * 1991-02-27 1994-07-26 Sun Microsyst Inc Method and apparatus for scheduling instruction heuristically on the basis of cost for pipeline processor
US8677367B2 (en) 2009-03-31 2014-03-18 Mitsubishi Electric Corporation Execution order decision device
US10013270B2 (en) 2015-12-03 2018-07-03 International Business Machines Corporation Application-level initiation of processor parameter adjustment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06208462A (en) * 1991-02-27 1994-07-26 Sun Microsyst Inc Method and apparatus for scheduling instruction heuristically on the basis of cost for pipeline processor
US8677367B2 (en) 2009-03-31 2014-03-18 Mitsubishi Electric Corporation Execution order decision device
US10013270B2 (en) 2015-12-03 2018-07-03 International Business Machines Corporation Application-level initiation of processor parameter adjustment

Similar Documents

Publication Publication Date Title
JP4042604B2 (en) Program parallelization apparatus, program parallelization method, and program parallelization program
US5710902A (en) Instruction dependency chain indentifier
JP4339907B2 (en) Optimal code generation method and compiling device for multiprocessor
US6487715B1 (en) Dynamic code motion optimization and path tracing
JP2980178B2 (en) Method for synchronizing parallel instruction streams processed by parallel processors
JP2947356B2 (en) Parallel processing system and parallel processor synchronization method
US4821181A (en) Method for converting a source program of high level language statement into an object program for a vector processor
US5339420A (en) Partitioning case statements for optimal execution performance
JPH02217926A (en) Compiler
JP2003099248A (en) Processor, compiling device and compiling method
JPH11232147A (en) Method and device for power estimation, and machine-redable recording medium having recorded power estmation program
EP0523337A2 (en) Self-scheduling parallel computer system and method
JPH05143332A (en) Computer system having instruction scheduler and method for rescheduling input instruction sequence
US6564372B1 (en) Critical path optimization-unzipping
RU2206119C2 (en) Method for producing object code
JPH04252336A (en) Program optimization processing device
WO2000022523A1 (en) Apparatus and method for program optimizing
JPH0850554A (en) Method and device for automatically generating operation model of processor and test instruction sequence for logic verification
Fukuhara et al. Automated kernel fusion for GPU based on code motion
JP3175768B2 (en) Composite instruction scheduling processor
JPH04293150A (en) Compiling method
Prabhu et al. Global mobility based scheduling
JPH1196018A (en) COMPILING DEVICE AND METHOD, AND COMPUTER-READABLE RECORDING MEDIUM RECORDING COMPILING EXECUTION PROGRAM
JP2002318689A (en) VLIW processor for executing instruction with delay specification of resource use cycle and method of generating instruction with delay specification
JP3394353B2 (en) Machine instruction scheduling device

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19980514