JP2010122820A - Compile device and compile method - Google Patents

Compile device and compile method Download PDF

Info

Publication number
JP2010122820A
JP2010122820A JP2008294733A JP2008294733A JP2010122820A JP 2010122820 A JP2010122820 A JP 2010122820A JP 2008294733 A JP2008294733 A JP 2008294733A JP 2008294733 A JP2008294733 A JP 2008294733A JP 2010122820 A JP2010122820 A JP 2010122820A
Authority
JP
Japan
Prior art keywords
register
code
recovery
save
exit
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
JP2008294733A
Other languages
Japanese (ja)
Inventor
Hiroyuki Hashimoto
博幸 橋本
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 JP2008294733A priority Critical patent/JP2010122820A/en
Publication of JP2010122820A publication Critical patent/JP2010122820A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To reduce unnecessary recovery codes while using a pop instruction with a recovery code of a callee-save register. <P>SOLUTION: A compile device has capabilities of: detecting a recovery unnecessary register at an exit of a function; determining a saving order and a recovery order of the callee-save register taking the recovery unnecessary register into consideration; reflecting a total size of the registers which have become unnecessary of recovery in update size of a stack register without generating the recovery code of recovery unnecessary register. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、計算機の利用技術において、オブジェクトプログラムのコードサイズと実行時間を削減するコンパイル装置、コンパイル方法及びコンパイラに関する。特に、push/pop命令等のスタック操作命令を利用したcallee−saveレジスタの回復コード削減方法に関し、命令数を増加させることなく関数出口において必要なcallee−saveレジスタのみを回復するコード列を生成することで、callee−saveレジスタの回復コードを削減し、コードサイズが小さく、かつ、実行性能の良いオブジェクトプログラムを生成するcallee−saveレジスタの回復コード削減するコンパイル装置、コンパイル方法及びコンパイラに関する。   The present invention relates to a compiling device, a compiling method, and a compiler that reduce the code size and execution time of an object program in a computer utilization technique. In particular, with respect to a recovery code reduction method for a call-save register using a stack operation instruction such as a push / pop instruction, a code string for recovering only a call-save register necessary at a function exit is generated without increasing the number of instructions. The present invention relates to a compiling device, a compiling method, and a compiler that reduce a recovery code of a callee-save register, reduce a recovery code of a callee-save register that generates an object program having a small code size and good execution performance.

ソースコードを実行コードに変換するコンパイラでは、関数呼び出しを行う場合、関数の呼び出し先でレジスタの退避と回復が必要になる。このように関数の呼び出し先で退避と回復する必要のあるレジスタを一般にcallee−saveレジスタと呼んでいる。このcallee−saveレジスタの退避、回復場所は通常、予めメモリ上に設定されたスタック上に確保される。また、関数呼び出し直後にスタックの先頭位置を指し示す値(スタックポインタ)を格納するレジスタも用意されており、このレジスタのことを本明細書ではスタックレジスタ(以下、SPと記載する)と呼ぶことにする。   In a compiler that converts source code into executable code, register saving and recovery are required at the function call destination when a function call is made. A register that needs to be saved and restored at a function call destination is generally called a “calle-save register”. The save / restore location of the callee-save register is usually secured on a stack set in advance in the memory. Also, a register for storing a value (stack pointer) indicating the top position of the stack immediately after the function call is prepared, and this register is referred to as a stack register (hereinafter referred to as SP) in this specification. To do.

一般に行われているデータの退避と回復処理の一例を示すと、関数入口のコードは、図12(a)に示すとおり、callee−saveレジスタの退避を、SPのレジスタサイズ分のアドレスを減算した後、減算後のSPが指すスタック上にcallee−saveレジスタのデータをストアする命令(push命令)で実行した後、関数内で利用するワーク領域(図示の−αに相当)を確保するために、スタックレジスタの更新命令をadd命令で実行する。   An example of data saving and recovery processing that is generally performed is as follows. As shown in FIG. 12A, the function entry code saves the callee-save register and subtracts the address corresponding to the SP register size. In order to secure a work area (corresponding to -α in the figure) used in the function after executing with an instruction (push instruction) for storing the data in the callee-save register on the stack pointed to by the SP after subtraction The stack register update instruction is executed by the add instruction.

一方関数出口のコードは、図12(b)に示すとおり、スタックレジスタSPの更新命令をadd命令で実行した後、callee−saveレジスタの回復を、SPが指すスタック上からcallee−saveレジスタにデータをロードした後、SPにレジスタサイズ分のアドレスを加算する命令(pop命令)で実行する。   On the other hand, as shown in FIG. 12B, the function exit code executes the update instruction of the stack register SP with the add instruction, and then restores the callee-save register from the stack pointed to by the SP to the callee-save register. Is loaded with an instruction (pop instruction) for adding an address corresponding to the register size to SP.

上記のようなcallee−saveレジスタの退避と回復については、特許文献1に開示される技術が知られている。
特開2008−71065号
A technique disclosed in Patent Document 1 is known for saving and restoring a callee-save register as described above.
JP 2008-71065 A

ここで、関数出口が複数存在し、関数入口からある関数出口に至るパス上で、退避したcallee−saveレジスタの一部しか定義していない場合の回復コード(pop命令)について考える。この場合、関数出口においては、定義されているcallee−saveレジスタのみを回復すれば良いため、必要なレジスタのみの回復コードをpop命令で生成したとする。しかし、pop命令は、スタックからレジスタへ値を回復する機構の他に、スタックアドレスを更新する機構を含む命令である。そのため、単純に回復コードを削減しただけでは、回復するレジスタにおいて、退避時と異なるスタックアドレスから値を回復することになり、不正なコード実行することになる。   Here, a recovery code (pop instruction) in the case where there are a plurality of function exits and only a part of the saved call-save register is defined on a path from the function entry to a function exit will be considered. In this case, since only the defined call-save register needs to be recovered at the function exit, it is assumed that the recovery code of only the necessary register is generated by the pop instruction. However, the pop instruction is an instruction including a mechanism for updating the stack address in addition to a mechanism for recovering a value from the stack to the register. Therefore, if the recovery code is simply reduced, the value of the register to be recovered is recovered from a stack address different from that at the time of saving, and illegal code is executed.

そこで、本発明の目的は、callee−saveレジスタの回復コードでpop命令を利用しながら、不要な回復コードを削減できる手段を提供することにある。   Therefore, an object of the present invention is to provide means for reducing unnecessary recovery codes while using a pop instruction in the recovery code of a callee-save register.

本発明は、演算処理を行う第1のプロセッサと、前記プロセッサが利用する情報を格納する記憶部と、を備えて、関数を含むソースプログラムを読み込んでスタック操作命令を含むオブジェクトプログラムを生成するコンパイル装置において、前記ソースプログラムを読み込んで中間コードを生成する構文解析部と、前記中間コードを読み込んで、前記オブジェクトプログラムを実行する計算機を構成する第2のプロセッサのレジスタを前記中間コードに割り付けるレジスタ割り付け部と、前記レジスタに割り付けた中間コードからオブジェクトコードを生成し、オブジェクトプログラムを出力するコード生成部、とを備え、前記記憶部は、前記第2のプロセッサのレジスタの情報を格納したターゲット情報と、前記関数に割り付けられた前記レジスタの情報を格納する第1のレジスタ情報と、前記レジスタの退避順序と回復順序を格納する第2のレジスタ情報と、を有し、前記コード生成部は、前記関数の入口及び出口に割り付けられた前記レジスタの情報を収集して前記第1のレジスタ情報に格納する定義レジスタ情報収集部と、前記第1のレジスタ情報を読み込んで、前記関数の入口及び出口に割り付けられた前記レジスタの退避順序と回復順序を決定する退避・回復順序決定部と、前記退避・回復順序決定部が決定した退避順序と回復順序に従って前記レジスタの退避コードと回復コードを生成する退避・回復コード生成部と、を有し、退避・回復コード生成部は、前記レジスタの退避順序に従ってレジスタの退避コードを前記関数の入口に生成し、前記第1のレジスタ情報と前記退避順序及び回復順序から前記関数の入口から出口に至るパス上で割り付けられているレジスタに対して、前記関数の出口毎にそれぞれ回復コードを生成し、前記パス上で定義されてないレジスタのサイズの和を求め、前記関数の出口でスタックアドレスを前記レジスタのサイズの和だけ補正するスタックアドレスの更新命令を生成する。   The present invention includes a first processor that performs arithmetic processing, and a storage unit that stores information used by the processor, and that compiles a source program including a function and generates an object program including a stack operation instruction In the apparatus, a syntax analysis unit that reads the source program and generates an intermediate code, and a register allocation that allocates a register of a second processor that constitutes a computer that reads the intermediate code and executes the object program to the intermediate code And a code generation unit that generates an object code from the intermediate code allocated to the register and outputs an object program, and the storage unit includes target information storing information on the register of the second processor; Before being assigned to the function First register information for storing register information, and second register information for storing the save order and recovery order of the registers, and the code generation unit is assigned to the entry and exit of the function A definition register information collection unit that collects information on the registers and stores the information in the first register information; and a saving order of the registers assigned to the function entry and exit by reading the first register information A save / recovery order determination unit that determines a recovery order, and a save / recovery code generation unit that generates a save code and a recovery code of the register according to the save order and the recovery order determined by the save / recovery order determination unit. And a save / recovery code generation unit generates a save code for the register at the entry of the function according to the save order of the registers, and stores the first register information. And a register that is generated on the path from the entry to the exit of the function from the save order and the recovery order and generates a recovery code for each exit of the function, and is not defined on the path The stack address update instruction for correcting the stack address by the sum of the register sizes is generated at the exit of the function.

したがって、本発明によれば、複数の出口を有する関数のオブジェクトコードを生成する場合には、callee−saveレジスタの不要な回復コードが削減可能になるため、オブジェクトプログラムのコードサイズを増加させることなく、実行性能の良いオブジェクトプログラム(実行コード)を生成することが可能になる。   Therefore, according to the present invention, when generating an object code of a function having a plurality of exits, unnecessary recovery code of the callee-save register can be reduced, so that the code size of the object program is not increased. It is possible to generate an object program (execution code) with good execution performance.

以下、本発明の一実施形態を添付図面に基づいて説明する。   Hereinafter, an embodiment of the present invention will be described with reference to the accompanying drawings.

<第1実施形態>
図1は、本発明によるコンパイラが稼動する計算機システム(コンパイル装置)の構成図である。この計算機システム200は、演算処理を行うCPU(またはプロセッサ)201と、情報の表示を行うディスプレイ装置202と、情報の入力を行うキーボード203と、CPU201が利用する情報を格納する主記憶装置204、および情報を格納する外部記憶装置205より構成されている。キーボード203により、ユーザからのコンパイラ起動命令を受け付ける。コンパイラ終了メッセージやエラーメッセージは、ディスプレイ装置202に表示される。外部記憶装置205はHDDや不揮発性メモリで構成され、ソースプログラム206とオブジェクトプログラム207が格納される。主記憶装置204には、ソースプログラム206を読み込んでオブジェクトプログラム207を生成するコンパイラ208と、コンパイル過程で必要となる中間コード209と定義レジスタ情報テーブル210とレジスタ情報テーブル211及びターゲット情報テーブル212が格納される。コンパイル処理はCPU201がコンパイラ(プログラム)208を実行することにより行われる。
<First Embodiment>
FIG. 1 is a configuration diagram of a computer system (compiler) in which a compiler according to the present invention operates. The computer system 200 includes a CPU (or processor) 201 that performs arithmetic processing, a display device 202 that displays information, a keyboard 203 that inputs information, a main storage device 204 that stores information used by the CPU 201, And an external storage device 205 for storing information. The keyboard 203 accepts a compiler activation command from the user. The compiler end message and error message are displayed on the display device 202. The external storage device 205 is configured by an HDD or a nonvolatile memory, and stores a source program 206 and an object program 207. The main memory 204 stores a compiler 208 that reads the source program 206 and generates an object program 207, an intermediate code 209, a definition register information table 210, a register information table 211, and a target information table 212 that are necessary in the compilation process. Is done. Compile processing is performed by the CPU 201 executing a compiler (program) 208.

ターゲット情報テーブル212は、オブジェクトプログラム207を実行する計算機システム(ターゲットシステム)250(図2参照)の構成に関する情報を予め格納したものである。ターゲット情報テーブル212は、例えば、ターゲットシステム250のCPUの種類や利用可能なレジスタの種類、数及びターゲットシステムで稼働するOSの種類などが予め格納されている。コンパイラ208は、ターゲット情報テーブル212からターゲットシステムの構成を読み込んでオブジェクトプログラム207を生成するコンパイル処理を実行する。   The target information table 212 stores in advance information related to the configuration of a computer system (target system) 250 (see FIG. 2) that executes the object program 207. In the target information table 212, for example, the CPU type of the target system 250, the types and numbers of available registers, the type of OS running on the target system, and the like are stored in advance. The compiler 208 executes a compile process for reading the configuration of the target system from the target information table 212 and generating the object program 207.

コンパイラ208は、コンパイル処理を行う過程で、ターゲットシステム250のレジスタの割り付け(定義)状態を保持する定義レジスタ情報テーブル210を後述するように作成し、また、定義レジスタ情報テーブル210に格納されたターゲットシステムのレジスタの重要度を設定するレジスタ情報テーブル211を後述のように生成する。   The compiler 208 creates a definition register information table 210 that holds the allocation (definition) state of the registers of the target system 250 as will be described later in the course of performing the compilation process, and the target stored in the definition register information table 210. A register information table 211 that sets the importance of the registers of the system is generated as described later.

なお、外部記憶装置205は、コンパイラ208を格納する記憶媒体として機能する。CPU201は、キーボード203からコンパイラ起動命令を受け付けると、外部記憶装置205からコンパイラ208を主記憶装置204に読み込み、ソースプログラム206を読み込んで、コンパイル処理を実行する。このとき、ターゲット情報テーブル212は予め主記憶装置204に読み込んでおくものとする。   The external storage device 205 functions as a storage medium that stores the compiler 208. When the CPU 201 receives a compiler activation command from the keyboard 203, the CPU 201 reads the compiler 208 from the external storage device 205 into the main storage device 204, reads the source program 206, and executes compilation processing. At this time, it is assumed that the target information table 212 is read into the main storage device 204 in advance.

なお、図1の主記憶装置204には図示しないOSが読み込まれ、CPU201によってOSが実行され、このOS上でコンパイラ208を実行しても良い。   Note that an OS (not shown) may be read into the main storage device 204 of FIG. 1 and executed by the CPU 201, and the compiler 208 may be executed on the OS.

図2は、本発明のコンパイラ208が生成したオブジェクトプログラム207を実行する計算機システム(以下、ターゲットシステムとする)250の構成図である。このターゲットシステム250は、演算処理を行うCPU(またはプロセッサ)251と、情報の表示を行うディスプレイ装置252と、情報の入力を行うキーボード253と、CPU251が利用する情報を格納する主記憶装置254、および情報を格納する外部記憶装置255より構成されている。キーボード253により、ユーザからオブジェクトプログラム207の起動命令を受け付ける。オブジェクトプログラム207の実行結果や終了メッセージまたはエラーメッセージは、ディスプレイ装置252に表示される。外部記憶装置255はHDDや不揮発性メモリで構成され、コンパイル装置200で生成されたオブジェクトプログラム207が格納される。主記憶装置254には、OS270とオブジェクトプログラム207が格納される。OS270は主記憶装置254上にスタック領域260を確保する。   FIG. 2 is a configuration diagram of a computer system (hereinafter referred to as a target system) 250 that executes the object program 207 generated by the compiler 208 of the present invention. The target system 250 includes a CPU (or processor) 251 that performs arithmetic processing, a display device 252 that displays information, a keyboard 253 that inputs information, and a main storage device 254 that stores information used by the CPU 251. And an external storage device 255 for storing information. The keyboard 253 accepts an activation command for the object program 207 from the user. An execution result, an end message, or an error message of the object program 207 is displayed on the display device 252. The external storage device 255 is composed of an HDD or a non-volatile memory, and stores the object program 207 generated by the compiling device 200. The main storage device 254 stores an OS 270 and an object program 207. The OS 270 secures a stack area 260 on the main storage device 254.

この例では、CPU251のレジスタとしてR1、R2、R3、…、Rn、SP(スタックレジスタ)が存在し、SPに格納されたスタックポインタがスタック領域260のアドレスを指し示す。なお、R1〜R3、…、Rnは、例えば、汎用レジスタを示す。   In this example, R1, R2, R3,..., Rn, SP (stack registers) exist as registers of the CPU 251, and the stack pointer stored in the SP indicates the address of the stack area 260. Note that R1 to R3,..., Rn indicate general-purpose registers, for example.

CPU251は、キーボード253からオブジェクトプログラム207の起動命令を受け付けると、外部記憶装置255からオブジェクトプログラム207を主記憶装置254に読み込んで実行する。なお、オブジェクトプログラム207は、図示しないネットワークなどにより、コンパイル装置200からターゲットシステム250に転送されるものとする。   When the CPU 251 receives an activation command for the object program 207 from the keyboard 253, the CPU 251 reads the object program 207 from the external storage device 255 into the main storage device 254 and executes it. Note that the object program 207 is transferred from the compiling device 200 to the target system 250 via a network (not shown).

図3は、図1の計算機システム200で稼動するコンパイラ208の処理手順を示す。   FIG. 3 shows a processing procedure of the compiler 208 operating in the computer system 200 of FIG.

コンパイラ208の処理は、ソースプログラム206の構文解析301と、コード最適化302と、レジスタ割り付け303と、オブジェクトコードをオブジェクトプログラム207として生成するコード生成304の順で行う。   The processing of the compiler 208 is performed in the order of syntax analysis 301 of the source program 206, code optimization 302, register allocation 303, and code generation 304 that generates object code as the object program 207.

構文解析301では、コンパイラ208がソースプログラム206を入力として構文解析を行い、中間コード209を出力する。コード最適化302では、コンパイラ208が中間コード209を入力し、ループ構造変換や部分冗長性削除などの最適化を適用し、その結果を変換後の中間コード209として出力する。   In the syntax analysis 301, the compiler 208 performs a syntax analysis with the source program 206 as an input, and outputs an intermediate code 209. In the code optimization 302, the compiler 208 inputs the intermediate code 209, applies optimization such as loop structure conversion and partial redundancy deletion, and outputs the result as the converted intermediate code 209.

レジスタ割り付け303では、コンパイラ208が中間コード209の各ノード(各処理要素)に対しターゲットシステム250のプロセッサ251のレジスタR1〜R3、…、Rnを割り付ける。コード生成304では、コンパイラ208が中間コード209をオブジェクトプログラム207に変換してオブジェクトプログラム207として出力する。上記構文解析301、コード最適化302及びレジスタ割り付け303は、公知または周知の技術を適用すれば良い。   In the register allocation 303, the compiler 208 allocates the registers R1 to R3,..., Rn of the processor 251 of the target system 250 to each node (each processing element) of the intermediate code 209. In the code generation 304, the compiler 208 converts the intermediate code 209 into the object program 207 and outputs it as the object program 207. For the parsing 301, code optimization 302, and register allocation 303, a known or well-known technique may be applied.

callee−saveレジスタ(以下、calleeレジスタと略す)退避コード及び回復コード削減処理305は、ソースプログラム206で記述される関数の入口または出口において必要とされる退避コード(Push命令)または回復コード(Pop命令)だけを生成し、出力されるオブジェクトプログラム207のコードサイズを削減する処理であり、コード生成304内で実施される。   A save-save register (hereinafter referred to as “calle register”) save code and recovery code reduction process 305 is a save code (Push instruction) or recovery code (Pop) required at the entry or exit of a function described in the source program 206. This is a process for reducing the code size of the object program 207 to be generated and generated in the code generation 304.

なお、退避コードは、ターゲットシステム250のスタック領域260に、ターゲットシステム250のcalleeレジスタ(例えばR1〜R3)の内容を退避させ、スタックポインタを更新する命令コードである。特に、push命令は、退避するレジスタのサイズ分だけスタックアドレスを減算した後、減算後のスタックアドレスの指す領域に該レジスタのデータをストアする命令である。   The save code is an instruction code that saves the contents of the callee registers (for example, R1 to R3) of the target system 250 in the stack area 260 of the target system 250 and updates the stack pointer. In particular, the push instruction is an instruction for subtracting the stack address by the size of the register to be saved and then storing the data of the register in the area indicated by the stack address after the subtraction.

また、回復コードは、ターゲットシステム250のスタック領域260から、ターゲットシステム250のcalleeレジスタ(例えばR1〜R3)の内容を復帰させ、スタックポインタを更新する命令コードである。特に、pop命令は、スタックアドレスの指す領域から該レジスタにデータをロードした後、当該レジスタのサイズ分だけスタックアドレスを加算する命令である。   The recovery code is an instruction code for restoring the contents of the call register (for example, R1 to R3) of the target system 250 from the stack area 260 of the target system 250 and updating the stack pointer. In particular, the pop instruction is an instruction for adding the stack address by the size of the register after loading data from the area indicated by the stack address to the register.

図4に、定義レジスタ情報テーブル210の一例を示す。コンパイラ208により主記憶装置204上に生成される。定義レジスタ情報テーブルは、出口ブロック801、定義レジスタ集合802、重み803、処理済フラグ804などの欄からなる。   FIG. 4 shows an example of the definition register information table 210. It is generated on the main memory 204 by the compiler 208. The definition register information table includes columns such as an exit block 801, a definition register set 802, a weight 803, a processed flag 804, and the like.

出口ブロック801は、ソースプログラム206で記述される関数内に存在する出口ブロック情報を登録する。出口ブロックとは、呼び出された関数で最後に実行される基本ブロックを指すものとする。これに対し、入口ブロックとは、呼び出された関数で最初に実行される基本ブロックを指すものとする。図11に示すソースプログラム206において、入口ブロックは、関数の実際の処理が行われる第3行目の処理を示し、出口ブロックは、呼び出し元に戻る第5行目または第11行目の処理を示し、図11の例では、条件分岐命令の「if」によって関数の出口ブロックが2つ存在する例を示す。   The exit block 801 registers exit block information that exists in a function described by the source program 206. The exit block refers to the basic block that is executed last in the called function. On the other hand, the entry block indicates a basic block that is executed first in the called function. In the source program 206 shown in FIG. 11, the entry block indicates the process on the third line where the actual processing of the function is performed, and the exit block performs the process on the fifth line or the eleventh line that returns to the caller. The example of FIG. 11 shows an example in which there are two function exit blocks depending on the conditional branch instruction “if”.

定義レジスタ集合802は、関数の入口ブロックから、出口ブロックに至るパス(処理過程)上で中間コード209に定義されているcalleeレジスタの集合を登録する。ここで、calleeレジスタの集合とは、コンパイラ208が上記図3のレジスタ割り付け303の処理で、ある関数についてブロック毎にターゲットシステムのCPU251のレジスタを割り付け(定義)られるので、関数の出口ブロックごとに、入口ブロックから当該出口ブロックまでのパス上で定義(割り付け)されたレジスタの番号(名称)または識別子を列記したものである。   The definition register set 802 registers a set of callee registers defined in the intermediate code 209 on the path (processing process) from the function entry block to the exit block. Here, the set of callee registers means that the compiler 208 allocates (defines) the registers of the CPU 251 of the target system for each block for a certain function in the process of register allocation 303 in FIG. The register numbers (names) or identifiers defined (allocated) on the path from the entry block to the exit block are listed.

また、重み803は、各出口ブロックの重要度を登録する。ここで、重要度とは、各出口ブロックがどの程度実行されるかを示した指標であり、重要度が高いほど、その出口ブロックの実行頻度が高いことを示す。この重要度を求める手法としては、コンパイラ208がコンパイル時に求める方法(これを静的手法と呼ぶ)や、コンパイラ208が生成したオブジェクトプログラム207を実行することで求める方法(これを動的手法と呼ぶ)などが考えられる。処理済フラグ804は、コンパイラ208内の各種処理で対応する出口ブロックの処理が終了しているか否かを判定する際に用いるフラグである。   The weight 803 registers the importance of each exit block. Here, the importance is an index showing how much each exit block is executed, and the higher the importance, the higher the execution frequency of the exit block. As a technique for obtaining this importance, a method that the compiler 208 obtains at the time of compilation (referred to as a static technique) or a method that obtains by executing the object program 207 generated by the compiler 208 (this is referred to as a dynamic technique). ) Etc. are considered. The processed flag 804 is a flag used when determining whether or not the processing of the corresponding exit block has been completed in various processes in the compiler 208.

図5(a)に、レジスタ情報テーブル211の一例を示す。レジスタ情報テーブル211は、コンパイラ208により主記憶装置204上に生成される。レジスタ情報テーブル211は、レジスタ番号901、重み902、処理済フラグ903などの欄からなる。   FIG. 5A shows an example of the register information table 211. The register information table 211 is generated on the main storage device 204 by the compiler 208. The register information table 211 includes columns such as a register number 901, a weight 902, a processed flag 903, and the like.

レジスタ番号901は、ターゲットシステム250のCPU251のレジスタ番号(または識別子)のうち中間コード209で定義されているcalleeレジスタ番号(または識別子)を登録する。重み902は、各レジスタの重要度を登録する。重要度とは、そのレジスタの回復コードがどの程度実行されるかを示した指標であり、重要度が高いほど、そのレジスタの回復コードの実行頻度が高いことを示す。この重要度は、定義レジスタ情報テーブル210の、定義レジスタ集合802と、重み803から計算することができる。詳細は、図8で説明する。処理済フラグ903は、各種処理で対応するレジスタの処理が終了しているか否かを判定する際に用いるフラグである。なお、図5(a)は、レジスタ情報テーブル211のソート前の状態を示し、図5(b)は、calleeレジスタ退避コード及び回復コード削減処理305でソートを行った後の状態を示す。   The register number 901 registers a callee register number (or identifier) defined by the intermediate code 209 among the register numbers (or identifiers) of the CPU 251 of the target system 250. The weight 902 registers the importance of each register. The importance is an index indicating how much the recovery code of the register is executed. The higher the importance, the higher the execution frequency of the recovery code of the register. This importance can be calculated from the definition register set 802 and the weight 803 in the definition register information table 210. Details will be described with reference to FIG. The processed flag 903 is a flag used when determining whether or not the processing of the corresponding register is completed in various processes. 5A shows a state before sorting of the register information table 211, and FIG. 5B shows a state after sorting by the callee register save code and recovery code reduction process 305. FIG.

図6に、図3に示したcalleeレジスタ退避コード及び回復コード削減処理305の処理手順を示す。ステップ101で、コンパイラ208は、ソースプログラム206の入口ブロックから、出口ブロックに至るパス上で定義されているレジスタ情報を収集する。なお、ステップ101の処理は、関数毎やサブルーチン毎に行うことができる。   FIG. 6 shows a processing procedure of the callee register save code and recovery code reduction process 305 shown in FIG. In step 101, the compiler 208 collects register information defined on the path from the entry block of the source program 206 to the exit block. Note that the processing of step 101 can be performed for each function or for each subroutine.

ステップ102は、コンパイラ208がcalleeレジスタの退避順序または回復順序を決定する。ステップ103では、コンパイラ208が関数の入口ブロックにcalleeレジスタの退避コード(例えば、Push命令)を生成する。ステップ104は、コンパイラ208が関数の出口ブロックに、ステップ102で求めた回復順序を考慮したcalleeレジスタの回復コード(例えば、Pop命令)を生成する。この回復順序を考慮することで、不要な回復コードをオブジェクトプログラム207から削減することができる。図6のフローチャートに示したそれぞれの処理の詳細は、図7、図8、図9、図10で説明する。   In step 102, the compiler 208 determines the save order or the recovery order of the callee register. In step 103, the compiler 208 generates a save register save code (for example, a Push instruction) in the entry block of the function. In step 104, the recovery code (for example, Pop instruction) of the callee register in consideration of the recovery order obtained in step 102 is generated in the function exit block by the compiler 208. By considering this recovery order, unnecessary recovery codes can be reduced from the object program 207. Details of the processes shown in the flowchart of FIG. 6 will be described with reference to FIGS. 7, 8, 9, and 10.

図7に、図6で示した定義レジスタ情報収集101の処理手順を示す。ステップ401では、コンパイラ208が中間コード209を読み込んで、関数内にあるすべての出口ブロックを出口ブロック集合に登録する。なお、出口ブロック集合は変数としてコンパイラ208が主記憶装置204上に所定の領域を確保する。以下に説明する基本ブロック集合、処理済基本ブロック集合等も同様に変数としてコンパイラ208が主記憶装置204上に所定の領域を確保する。   FIG. 7 shows a processing procedure of the definition register information collection 101 shown in FIG. In step 401, the compiler 208 reads the intermediate code 209 and registers all exit blocks in the function in the exit block set. Note that the compiler 208 secures a predetermined area on the main storage device 204 as a variable for the exit block set. Similarly, a basic block set, a processed basic block set, and the like described below are also used as variables by the compiler 208 to secure a predetermined area on the main storage device 204.

ステップ402では、コンパイラ208が出口ブロック集合が空であるか否かを判定する。空でなければ、処理の終了していない出口ブロックが存在しているということなので、ステップ403に進む。ステップ403では、処理の終了していない出口ブロックに対応する定義レジスタ集合802を初期化のため空にする。ステップ404では、処理済基本ブロック集合を初期化のため空にする。これは、同じ基本ブロックを何度も処理しないために設けている。なお、基本ブロックは、ひとつの関数(またはサブルーチン)のうち、一連の演算処理を示し、例えば、図11のソースプログラム206に記述された1行を基本ブロックとして扱う。   In step 402, the compiler 208 determines whether the exit block set is empty. If it is not empty, it means that there is an exit block for which processing has not been completed, and the process proceeds to step 403. In step 403, the definition register set 802 corresponding to the exit block that has not been processed is emptied for initialization. In step 404, the processed basic block set is emptied for initialization. This is provided so that the same basic block is not processed many times. The basic block indicates a series of arithmetic processing among one function (or subroutine). For example, one line described in the source program 206 in FIG. 11 is handled as a basic block.

ステップ405では、基本ブロック集合に出口ブロック集合を登録する。ステップ406では、基本ブロック集合が空か否かを判定する。基本ブロック集合が空の場合は、ステップ411に進む。基本ブロック集合が空でない場合は、ステップ407に進む。ステップ407では、基本ブロック集合から先頭要素を取り出す。取り出した先頭要素は基本ブロック集合から削除する。   In step 405, the exit block set is registered in the basic block set. In step 406, it is determined whether the basic block set is empty. If the basic block set is empty, the process proceeds to step 411. If the basic block set is not empty, the process proceeds to step 407. In step 407, the head element is extracted from the basic block set. The extracted top element is deleted from the basic block set.

ステップ408では、コンパイラ208がステップ407で取り出した基本ブロックに対し、基本ブロック内の全命令を辿り、それぞれの命令で定義されているレジスタを定義レジスタ情報テーブル210の定義レジスタ集合802に登録していく。ステップ409では、処理の終了した基本ブロックを、処理済基本ブロック集合に登録する。ステップ410では、ステップ407で取り出した基本ブロックの直前に実行される基本ブロックを辿り、直前に実行される基本ブロックが処理済基本ブロック集合に登録されていなければ、当該基本ブロックを基本ブロック集合に登録し、ステップ406に戻る。   In step 408, the compiler 208 traces all instructions in the basic block with respect to the basic block extracted in step 407, and registers the registers defined by the respective instructions in the definition register set 802 of the definition register information table 210. Go. In step 409, the processed basic block is registered in the processed basic block set. In step 410, the basic block executed immediately before the basic block extracted in step 407 is traced. If the basic block executed immediately before is not registered in the processed basic block set, the basic block is set as the basic block set. Register and return to step 406.

上記ステップ406〜ステップ410の処理を繰り返すことで、入口ブロックからある出口ブロックに至るパス上で定義されている定義レジスタ集合を求めることができる。   By repeating the processing of step 406 to step 410, a definition register set defined on the path from the entry block to a certain exit block can be obtained.

定義レジスタ集合を求めた後は、基本ブロック集合が空になっているはずなので、ステップ406の判定により、ステップ411に進む。ステップ411では、出口ブロックと定義レジスタ集合の組を定義レジスタ情報テーブル210へ登録する。   Since the basic block set should be empty after the definition register set is obtained, the process proceeds to step 411 based on the determination in step 406. In step 411, a set of an exit block and a definition register set is registered in the definition register information table 210.

コンパイラ208が定義レジスタ情報テーブル210へ定義レジスタ情報802を登録することにより、入口ブロックから出口ブロックに至るパス上で定義されているレジスタ情報が図4で示すように明確になる。定義レジスタ情報テーブル210に定義されているレジスタは、出口ブロックにおいて回復の必要なレジスタとなる。よって、入口ブロックで退避されたレジスタであっても、この定義レジスタ集合に登録されてないレジスタは、回復不要なレジスタとみなすことができる。この回復不要なレジスタを抽出することで、オブジェクトプログラム207に挿入する回復コードが削減可能となるのである。つまり、ソースプログラム206で記述された処理の手順でコンパイル処理を行った場合、オブジェクトプログラム207に生成される回復コードのうち、実際には機能しない回復コードを抽出して、当該回復コードをオブジェクトプログラム207に加えるのを阻止することができる。   When the compiler 208 registers the definition register information 802 in the definition register information table 210, the register information defined on the path from the entry block to the exit block becomes clear as shown in FIG. The registers defined in the definition register information table 210 are registers that need to be recovered in the exit block. Therefore, even if a register is saved in the entry block, a register that is not registered in the definition register set can be regarded as a recovery unnecessary register. By extracting the registers that do not need to be recovered, the recovery code inserted into the object program 207 can be reduced. That is, when compiling is performed according to the processing procedure described in the source program 206, a recovery code that does not actually function is extracted from the recovery codes generated in the object program 207, and the recovery code is extracted from the object program. 207 can be blocked.

ステップ412では、処理の終了した出口ブロックを、出口ブロック集合から削除し、ステップ402に戻る。ステップ402では、出口ブロック集合が空の場合、つまり、すべての出口ブロックの処理が終了した場合は、ステップ413に進む。ステップ413では、定義レジスタ情報テーブルに登録されている出口ブロックに対し、そのブロックの重要度を表現する重みという値を設定する。この重みが重い(大きい)ほど、その出口ブロックの定義レジスタ集合に登録されているレジスタの重要度が高くなる。   In step 412, the exit block that has been processed is deleted from the exit block set, and the process returns to step 402. In step 402, if the exit block set is empty, that is, if all exit blocks have been processed, the process proceeds to step 413. In step 413, a value called a weight expressing the importance of the block is set for the exit block registered in the definition register information table. The heavier (larger) the weight, the higher the importance of the register registered in the definition register set of the exit block.

この重みを設定する手法として、上述したような静的に設定する手法と、動的に設定する手法などが存在する。静的に設定する手法は、コンパイラ208自身が各出口ブロックの重みを決定するものである。動的に設定する手法は、予め関数出口の実行回数をカウントするコードを埋め込んだオブジェクトプログラムを実行させ、関数出口の実行回数情報を取得した後、取得した実行回数情報をコンパイラ208が読み込み、実行回数からコンパイラ208が重みを計算して設定する。この動的な関数出口の重み付けの場合では、関数出口の実行回数情報を、ターゲット情報テーブル212で関数毎に設定しておけばよい。静的に設定する手法は、一度のコンパイルで重みを決定するため、オブジェクトプログラム207を実行しなくて良いという利点があるが、コンパイラ208の決めた重みと実際のプログラム(オブジェクトプログラム207)の動作が大きく異なる可能性があるという欠点がある。   As a method for setting the weight, there are a static setting method as described above, a dynamic setting method, and the like. In the static setting method, the compiler 208 itself determines the weight of each exit block. The method of dynamically setting is to execute an object program in which a code for counting the number of executions of a function exit is embedded in advance, acquire the execution count information of the function exit, and then read and execute the acquired execution count information. The compiler 208 calculates and sets the weight from the number of times. In the case of this dynamic function exit weighting, the function exit execution frequency information may be set for each function in the target information table 212. The method of setting statically has an advantage that the object program 207 need not be executed because the weight is determined by one compilation, but the weight determined by the compiler 208 and the operation of the actual program (object program 207) are advantageous. Have the disadvantage that they can be very different.

一方、動的に重みを設定する手法では、オブジェクトプログラム207をターゲットシステム250で一度実行させる手間がかかるという欠点があるが、得られた情報が実際のプログラム動作と一致しているという利点がある。   On the other hand, the method of dynamically setting the weight has the disadvantage that it takes time to execute the object program 207 once by the target system 250, but has the advantage that the obtained information is consistent with the actual program operation. .

図8に、calleeレジスタの退避順序及び回復順序の決定102の処理手順を示す。ステップ501では、コンパイラ208がレジスタ情報テーブル211の重みをクリアして初期化する。ステップ502では、コンパイラ208が定義レジスタ情報テーブル210の処理済フラグをクリアして初期化する。   FIG. 8 shows a processing procedure for determining the save order and recovery order 102 of the callee register. In step 501, the compiler 208 clears and initializes the weight of the register information table 211. In step 502, the compiler 208 clears and initializes the processed flag in the definition register information table 210.

ステップ503では、コンパイラ208が定義レジスタ情報テーブル210の処理済フラグ804を読み込んで、すべての出口ブロックが処理済か否かを判定する。出口ブロックが処理済か否かは、定義レジスタ情報テーブル210に登録されている出口ブロックに対する処理済フラグ804がすべて設定されているか否かで判定する。すべての出口ブロックが処理済の場合は、ステップ509に進む。一方、すべての出口ブロックが処理済でない場合は、ステップ504に進む。   In step 503, the compiler 208 reads the processed flag 804 of the definition register information table 210, and determines whether all the exit blocks have been processed. Whether or not the exit block has been processed is determined by whether or not all the processed flags 804 for the exit blocks registered in the definition register information table 210 are set. If all exit blocks have been processed, go to step 509. On the other hand, if all the exit blocks have not been processed, the process proceeds to step 504.

ステップ504では、コンパイラ208が処理対象とした出口ブロックに対応する定義レジスタ情報テーブル210の処理済みフラグをセットする。ステップ505では、コンパイラ208がまだ処理されてない出口ブロックに対応する定義レジスタ集合を定義レジスタ情報テーブル210から取り出し、ステップ506に進む。   In step 504, the processed flag of the definition register information table 210 corresponding to the exit block to be processed by the compiler 208 is set. In step 505, the definition register set corresponding to the exit block not yet processed by the compiler 208 is extracted from the definition register information table 210, and the process proceeds to step 506.

ステップ506では、前記取り出した定義レジスタ集合をすべて処理したか否かを判定する。取り出した定義レジスタ集合がすべて処理済の場合は、ステップ503に戻り、次の出口ブロックの処理を行う。一方、取り出した定義レジスタ集合が、まだ処理されてない場合は、ステップ507に進む。ステップ507では、定義レジスタ集合から1つレジスタを取り出し、このレジスタの重みをステップ508で設定する。   In step 506, it is determined whether all the extracted definition register sets have been processed. If all the extracted definition register sets have been processed, the process returns to step 503 to process the next exit block. On the other hand, if the extracted definition register set has not yet been processed, the process proceeds to step 507. In step 507, one register is extracted from the definition register set, and the weight of this register is set in step 508.

ステップ508では、出口ブロック情報から定義レジスタ情報テーブル210に登録されている重み803を取り出す。さらに、処理対象のレジスタのレジスタ情報テーブル211に、ステップ508で取り出した重みを加算する。   In step 508, the weight 803 registered in the definition register information table 210 is extracted from the exit block information. Further, the weight extracted in step 508 is added to the register information table 211 of the register to be processed.

上記ステップ503〜ステップ508までを繰り返すことで、定義レジスタ情報テーブル210の定義レジスタ集合に対してコンパイラ208が設定した重み803が、各レジスタに対する重みとしてレジスタ情報テーブル211に加算される。すべてのレジスタの重みが設定された後は、ステップ509に進み、重みが降順になるようにレジスタ情報テーブル211をソートする。ソート後は、図5(b)のように、レジスタ情報テーブル211の先頭(図中最上方のエントリ)から、重要と判定したレジスタが配置される。   By repeating steps 503 to 508, the weight 803 set by the compiler 208 for the definition register set in the definition register information table 210 is added to the register information table 211 as a weight for each register. After the weights of all the registers are set, the process proceeds to step 509 and the register information table 211 is sorted so that the weights are in descending order. After sorting, as shown in FIG. 5B, the registers determined to be important are arranged from the top of the register information table 211 (the uppermost entry in the figure).

図9に、calleeレジスタの退避コード生成103の処理手順を示す。ステップ601では、コンパイラ208が中間コード209を読み込んで、入口ブロック集合に入口ブロックを登録する。なお、入口ブロック集合は変数としてコンパイラ208が主記憶装置204上に所定の領域を確保する。また、入口ブロックは、図11で示したように、ひとつの関数(またはサブルーチン)のうち最初の演算処理を行う基本ブロックであり、図11のソースプログラム206において、関数の最初の演算処理を行う行を指す。   FIG. 9 shows a processing procedure of the save code generation code 103 of the callee register. In step 601, the compiler 208 reads the intermediate code 209 and registers the entry block in the entry block set. Note that the compiler 208 secures a predetermined area on the main memory 204 as a variable for the entry block set. In addition, as shown in FIG. 11, the entry block is a basic block that performs the first calculation process of one function (or subroutine), and performs the first calculation process of the function in the source program 206 of FIG. Point to a line.

ステップ602では、入口ブロック集合が空か否かを判定する。空の場合は、処理を終了する。入口ブロック集合が空でない場合は、ステップ603に進む。ステップ603では、入口ブロック集合から先頭要素を取り出す。そして、取り出した先頭要素は基本ブロック集合から削除する。   In step 602, it is determined whether the entry block set is empty. If it is empty, the process is terminated. If the entrance block set is not empty, the process proceeds to step 603. In step 603, the head element is extracted from the entry block set. Then, the extracted top element is deleted from the basic block set.

ステップ604では、処理対象としている入口ブロックで、退避コードを挿入するための基準点となる命令を登録する。本実施形態では、ターゲットシステム250のスタックアドレス(スタックポインタ)を保持するスタックレジスタSPの更新を行う命令(例えば、add命令)を基準点として登録する。   In step 604, an instruction serving as a reference point for inserting a save code is registered in the entry block to be processed. In this embodiment, an instruction (for example, an add instruction) for updating the stack register SP that holds the stack address (stack pointer) of the target system 250 is registered as a reference point.

ステップ605では、コンパイラ208がレジスタ情報テーブル211の処理済フラグ903をすべてクリアして初期化する。ステップ606では、すべてのレジスタの退避コードが生成されているか否かを判定する。この判定は、レジスタ情報テーブル211の処理済フラグ903がすべてセットされているか否かで行う。処理済フラグ903がすべてセットされている場合は、ステップ602に戻る。処理済フラグ903がすべてセットされてない場合は、ステップ607に進む。   In step 605, the compiler 208 clears and initializes all processed flags 903 in the register information table 211. In step 606, it is determined whether save codes for all registers have been generated. This determination is made based on whether all the processed flags 903 in the register information table 211 are set. If all the processed flags 903 are set, the process returns to step 602. If all the processed flags 903 are not set, the process proceeds to step 607.

ステップ607では、コンパイラ208がレジスタ情報テーブル211の先頭(図中最上方のエントリ)から後方(図中最下方のエントリ)へテーブルを辿りながら、処理済フラグ903がセットされてないレジスタの退避コードを生成する。退避コードは、例えば、push命令を用いる。ステップ607で生成された退避コードは、ステップ604で設定した、挿入基準命令の直前に挿入する。   In step 607, the compiler 208 traces the table from the beginning (the uppermost entry in the figure) to the rear (the lowermost entry in the figure) of the register information table 211, and saves the register for which the processed flag 903 is not set. Is generated. As the save code, for example, a push instruction is used. The save code generated in step 607 is inserted immediately before the insertion reference instruction set in step 604.

ステップ608では、コンパイラ208が退避コードの生成を終えたレジスタに対応する、レジスタ情報テーブル211の処理済フラグ903をセットする。   In step 608, the processed flag 903 of the register information table 211 corresponding to the register for which the compiler 208 has finished generating the save code is set.

上記ステップ606〜ステップ608までの処理を繰り返すことで、ソースプログラム206で記述された基本ブロックの入口ブロックにおいて必要なcalleeレジスタの退避コードを生成することができる。   By repeating the processing from step 606 to step 608, the save code of the callee register necessary for the entry block of the basic block described by the source program 206 can be generated.

図10に、calleeレジスタの回復コード生成104の処理手順を示す。ステップ701では、コンパイラ208が定義レジスタ情報テーブル210の処理済フラグ804をすべてクリアして初期化する。ステップ702では、全ての出口ブロックが処理済か否かを判定する。この判定は、定義レジスタ情報テーブル210の処理済フラグ804がすべてセットされているか否かで行う。処理済フラグ804がすべてセットされている場合は、処理を終了する。   FIG. 10 shows a processing procedure of the recovery code generation 104 of the callee register. In step 701, the compiler 208 clears and initializes all processed flags 804 in the definition register information table 210. In step 702, it is determined whether all exit blocks have been processed. This determination is made based on whether all the processed flags 804 of the definition register information table 210 are set. If all the processed flags 804 are set, the process ends.

一方、処理済フラグ804がすべてセットされてない場合は、ステップ703に進む。ステップ703では、処理対象とした出口ブロックに対応する定義レジスタ情報テーブル210の処理済みフラグ804をセットする。ステップ704では、処理対象としている出口ブロックで、回復コードを挿入するための基準点となる命令を登録する。基準点となる命令は、上述の入口ブロックの基準点と同様に、スタックレジスタSPの更新を行う命令(例えば、Pop命令)とする。   On the other hand, if all the processed flags 804 are not set, the process proceeds to step 703. In step 703, the processed flag 804 of the definition register information table 210 corresponding to the exit block to be processed is set. In step 704, an instruction serving as a reference point for inserting a recovery code is registered in the exit block to be processed. The instruction serving as the reference point is an instruction (for example, a Pop instruction) for updating the stack register SP, similarly to the reference point of the entry block described above.

ステップ705では、コンパイラ208が回復コード削減サイズの初期化を行う。この回復コード削減サイズが、0であるか否かを判定することで、ある出口ブロックにおいて回復コードを削減したか否かが判定可能となる。なお、回復コード削減サイズは、コンパイラ208が変数として主記憶装置204上に確保する。   In step 705, the compiler 208 initializes the recovery code reduction size. By determining whether or not the recovery code reduction size is 0, it is possible to determine whether or not the recovery code has been reduced in a certain exit block. The recovery code reduction size is secured on the main memory 204 by the compiler 208 as a variable.

ステップ706では、コンパイラ208がレジスタ情報テーブル211の処理済フラグ903をすべてクリアする。ステップ707では、すべてのレジスタが処理済か否かを判定する。この判定は、レジスタ情報テーブル211の処理済フラグ903がすべてセットされているか否かで行う。処理済フラグ903がすべてセットされている場合は、ステップ712に進む。処理済フラグ903がすべてセットされてない場合は、ステップ708に進む。   In step 706, the compiler 208 clears all processed flags 903 in the register information table 211. In step 707, it is determined whether all the registers have been processed. This determination is made based on whether all the processed flags 903 in the register information table 211 are set. If all the processed flags 903 are set, the process proceeds to step 712. If all the processed flags 903 are not set, the process proceeds to step 708.

ステップ708では、レジスタ情報テーブル211の先頭から後方へテーブルを辿りながら、最初に見つけた処理済フラグ903の設定されてないレジスタ番号に対し、当該出口ブロックで回復コードが必要か否かを判定する。この判定は、当該出口ブロックに対応する定義レジスタ情報テーブル210の定義レジスタ集合802に、当該レジスタが登録されているか否かで行う。当該出口ブロックに対応する定義レジスタ情報テーブル210の定義レジスタ集合802に、当該レジスタが登録されてない場合は、入口ブロックから当該出口ブロックに至るパス上で、このレジスタの定義が行われてないと判定されるので、回復コードを生成する必要はなく、ステップ710に進む。   In step 708, while tracing the table from the beginning of the register information table 211 to the back, it is determined whether or not a recovery code is required in the exit block for the register number for which the first processed flag 903 is not set. . This determination is made based on whether or not the register is registered in the definition register set 802 of the definition register information table 210 corresponding to the exit block. If the register is not registered in the definition register set 802 of the definition register information table 210 corresponding to the exit block, this register is not defined on the path from the entry block to the exit block. Since it is determined, it is not necessary to generate a recovery code, and the process proceeds to step 710.

ステップ710では、削減したレジスタのサイズを記憶しておくために、コンパイラ208が上記ステップ708で回復コードの必用がないと判定したレジスタのサイズを回復コード削減サイズに加算する。   In step 710, in order to store the reduced register size, the size of the register determined by the compiler 208 that the recovery code is not necessary in step 708 is added to the recovery code reduction size.

一方、定義レジスタ情報テーブル210の定義レジスタ集合802に当該レジスタが登録されている場合は、回復コードが必要になるため、ステップ709で回復コードを生成し、ステップ704で設定した挿入基準点の直後に挿入する。回復コードは、例えば、pop命令を用いる。   On the other hand, if the register is registered in the definition register set 802 of the definition register information table 210, a recovery code is required. Therefore, a recovery code is generated in step 709 and immediately after the insertion reference point set in step 704. Insert into. As the recovery code, for example, a pop instruction is used.

ステップ711では、コンパイラ208が上記回復コードの処理を終えたレジスタに対応するレジスタ情報テーブル211の処理済フラグ903をセットし、ステップ707に戻る。ステップ712では、当該出口ブロックでの回復コード削減サイズが0であるか否かを判定する。回復コード削減サイズが0の場合は、回復コードの削減が行われてないと判定して、ステップ702に戻る。回復コード削減サイズが0以外の場合は、回復コードの削減が行われていると判定して、ステップ713に進む。   In step 711, the processed flag 903 of the register information table 211 corresponding to the register for which the compiler 208 has finished processing the recovery code is set, and the process returns to step 707. In step 712, it is determined whether or not the recovery code reduction size at the exit block is zero. If the recovery code reduction size is 0, it is determined that the recovery code has not been reduced, and the process returns to step 702. If the recovery code reduction size is other than 0, it is determined that the recovery code has been reduced, and the process proceeds to step 713.

ステップ713では、コンパイラ208が回復コードの削減が行われた出口ブロックに対し、出口ブロックのスタックレジスタSPの更新命令に削減サイズを反映させる。この反映処理により、push/pop命令利用時に回復コードを削減しても正しいコードを生成することができる。   In step 713, the compiler 208 reflects the reduced size in the update instruction of the stack register SP of the exit block for the exit block in which the recovery code has been reduced. With this reflection processing, a correct code can be generated even if the recovery code is reduced when the push / pop instruction is used.

以上の処理により、関数の出口毎に回復コードが挿入されるが、関数の出口が複数存在する場合は、各関数出口で関数の入口で挿入した退避コードに対応するすべてのレジスタについて回復する必用はなく、関数入口から当該関数出口までのパス上で割り付けられたレジスタのみについて回復コードを生成することになる。この結果、前記従来例では、関数入口で退避したレジスタについて、関数出口ですべてのレジスタに対して回復コードを生成したのに対し、本発明では、関数入口から関数出口のパス上で定義されていないレジスタについては退避コードの生成を行わず、オブジェクトプログラム207のサイズを削減できる。そして、回復コードを削減したレジスタについては、レジスタのサイズに相当するスタックアドレスを補正することで、回復コードの生成を省略しながら正常なオブジェクトプログラム207を生成することができる。   With the above processing, a recovery code is inserted for each function exit. However, if there are multiple function exits, it is necessary to recover all registers corresponding to the save code inserted at the function entry at each function exit. Rather, the recovery code is generated only for the registers allocated on the path from the function entry to the function exit. As a result, in the conventional example, for the registers saved at the function entry, recovery codes are generated for all the registers at the function exit, whereas in the present invention, they are defined on the path from the function entry to the function exit. For the registers that do not exist, the size of the object program 207 can be reduced without generating save code. For a register with a reduced recovery code, it is possible to generate a normal object program 207 while omitting the generation of the recovery code by correcting the stack address corresponding to the register size.

図11のプログラム(ソースプログラム206)例を参照して本実施形態における回復コード削減処理手順を示す。   A recovery code reduction processing procedure in the present embodiment will be described with reference to the example of the program (source program 206) in FIG.

図11のプログラム例はC言語で記述してある。このソースプログラム206、引数で渡された配列とその要素数から、配列要素の合計を求めるものである。また、4行目で配列が存在しない場合は5行目で配列要素の合計として0を返却し、配列が存在する場合は、8行目から10行目の繰り返し文により、配列要素の合計を計算し、11行目で合計を返却する。そのため、このソースプログラム206では、関数出口が5行目と11行目の2箇所存在する。この2箇所の関数出口が上述した出口ブロックとしてコンパイラ208で処理され、また、関数の入口となる3行目が入口ブロックとしてコンパイラ208で処理される。なお、1行目などは、コンパイラ208に対する定義分であるため、コード生成304では基本ブロックとして扱わないものとする。   The program example of FIG. 11 is described in C language. The source program 206 calculates the total of array elements from the array passed as an argument and the number of elements. If the array does not exist in the 4th row, 0 is returned as the sum of the array elements in the 5th row. If the array exists, the array elements are summed up by the repeated statements in the 8th to 10th rows. Calculate and return the total in line 11. Therefore, in the source program 206, there are two function exits on the fifth and eleventh lines. The two function exits are processed by the compiler 208 as the above-described exit blocks, and the third line serving as the entry of the function is processed by the compiler 208 as an entry block. Note that the first line and the like are definitions for the compiler 208 and are not handled as basic blocks in the code generation 304.

本ソースプログラム206に対し、コンパイラ208がレジスタ割り付けを行った結果、入口から11行目の出口1に至るパス上で定義されたレジスタが図1で示したターゲットシステム250のCPU251のレジスタR1、R2、R3であり、入口から5行目の出口2に至るパス上で定義されたレジスタがR3であったとし、それぞれの出口ブロックの重みが出口1で0.8、出口2で0.2であったとする。この状態でステップ101の定義レジスタ情報収集処理を適用すると、図4の定義レジスタ情報テーブル210が求められる。   As a result of the register assignment by the compiler 208 for the source program 206, the registers defined on the path from the entry to the exit 1 of the 11th line are the registers R1, R2 of the CPU 251 of the target system 250 shown in FIG. , R3, and the register defined on the path from the entrance to the exit 2 of the fifth row is R3, and the weight of each exit block is 0.8 at exit 1 and 0.2 at exit 2 Suppose there was. When the definition register information collection process of step 101 is applied in this state, the definition register information table 210 of FIG. 4 is obtained.

次に、図4の定義レジスタ情報テーブルに対し、コンパイラ208はステップ102のcalleeレジスタの退避・回復順序を決定する処理を適用した結果を図5(a)に示す。   Next, FIG. 5A shows the result of applying the processing for determining the save / restore order of the callee register in step 102 to the definition register information table of FIG.

図4の定義レジスタ情報テーブル210において、まず、出口1では、定義レジスタ集合802にレジスタR1、R2、R3が定義されており、出口ブロックの重みが0.8と登録されているため、図5(a)のレジスタ情報テーブル211のR1、R2、R3の重みに0.8がそれぞれ設定される。図4の定義レジスタ情報テーブル210の出口2では、定義レジスタ集合802にレジスタR3だけが定義されており、出口ブロックの重みが0.2と登録されているため、レジスタ情報テーブル211のレジスタR3だけに重み0.2を加算する。その結果図5(a)で示す状態のレジスタ情報テーブル211が得られる。図5(a)のレジスタ情報テーブル211に対し、重み902に従って降順にソートした結果が図5(b)のレジスタ情報テーブル211である。   In the definition register information table 210 of FIG. 4, first, in the exit 1, registers R1, R2, and R3 are defined in the definition register set 802, and the weight of the exit block is registered as 0.8. 0.8 is set to the weights of R1, R2, and R3 in the register information table 211 in (a). In the exit 2 of the definition register information table 210 of FIG. 4, only the register R3 is defined in the definition register set 802 and the weight of the exit block is registered as 0.2, so only the register R3 of the register information table 211 is registered. Add a weight of 0.2. As a result, the register information table 211 in the state shown in FIG. The result of sorting the register information table 211 in FIG. 5A in descending order according to the weight 902 is the register information table 211 in FIG.

図5(b)において、レジスタR3は、出口1から出る場合でも出口2から出る場合でもレジスタの回復コードが必要になるため、レジスタR1やレジスタR2よりも重要であると判定されている。つまり、出口1では、入口で退避したすべてのレジスタR1〜R3の回復が必用になるのに対し、出口2では、入口から出口2までのパス上でレジスタR3のみが定義されるだけである。このため、コンパイラ208は、出口2ではレジスタR3のみの退避コードを生成し、レジスタR1、R2の退避コードを省略することができる。   In FIG. 5B, the register R3 is determined to be more important than the register R1 and the register R2 because the register recovery code is required both when exiting from the exit 1 and exiting from the exit 2. That is, at the exit 1, all the registers R1 to R3 saved at the entrance need to be restored, whereas at the exit 2, only the register R3 is defined on the path from the entrance to the exit 2. Therefore, the compiler 208 can generate a save code for only the register R3 at the exit 2 and omit the save codes for the registers R1 and R2.

従来技術において図11のソースプログラム206の退避コードと、回復コードを生成した例を図12に示す。図12(a)の退避コードでは、レジスタR1、R2、R3が順番にスタック上にpush命令で退避され、その後でワーク領域を確保するためにスタックアドレス更新命令(add SP、−α)が実行されている。また、従来技術による図12(b)の回復コードでは、まずワーク領域を解放するためにスタックアドレス更新命令(add SP、α)が実行された後、レジスタR3、R2、R1の順番でスタック上からpop命令で回復されている。   FIG. 12 shows an example in which the save code and the recovery code of the source program 206 in FIG. 11 are generated in the prior art. In the save code in FIG. 12A, the registers R1, R2, and R3 are sequentially saved on the stack by a push instruction, and then a stack address update instruction (add SP, -α) is executed to secure a work area. Has been. In the recovery code of FIG. 12B according to the prior art, first, a stack address update instruction (add SP, α) is executed to release the work area, and then the registers R3, R2, R1 are placed on the stack in the order. Has been recovered with the pop instruction.

次に、図4の定義レジスタ情報テーブルと、図5(a)、図5(b)のレジスタ情報テーブルから生成される本実施形態による退避コード及び回復コードの例を図13、図14に示す。   Next, examples of the save code and the recovery code according to the present embodiment generated from the definition register information table of FIG. 4 and the register information tables of FIGS. 5A and 5B are shown in FIGS. .

図13(a)、図13(b)は、本発明により回復レジスタの削減がない出口1で退避コードと回復コードを生成した例を示している。   FIGS. 13A and 13B show an example in which the save code and the recovery code are generated at the exit 1 without the reduction of the recovery register according to the present invention.

図13(a)の退避コードでは、重み付けに応じた順序でレジスタR3、R1、R2がスタック領域上にpush命令で退避され、その後でワーク領域を確保するためにスタックアドレス更新命令(add SP、−α)が実行されている。また、図13(b)の回復コードでは、まずワーク領域を解放するためにスタックアドレス更新命令(add SP、α)が実行された後、重み付けに応じた順序でレジスタR2、R1、R3がスタック上からpop命令で回復されている。前記従来例の図12(b)の回復コードは、退避したレジスタの逆順でレジスタの回復が行われる。この従来例に対して、本発明では図13(b)で示すように、POP命令を実行するレジスタの順序が重みに応じてR2、R1、R3の順でレジスタの回復を実行する。なお、関数入口のレジスタの退避コードの順位は、関数出口の重みの順位を援用する。   In the save code of FIG. 13A, the registers R3, R1, and R2 are saved on the stack area by a push instruction in the order according to the weighting, and then a stack address update instruction (add SP, -Α) is being executed. In the recovery code of FIG. 13B, first, a stack address update instruction (add SP, α) is executed to release the work area, and then the registers R2, R1, and R3 are stacked in the order according to the weighting. It has been recovered from above with the pop instruction. In the recovery code shown in FIG. 12B of the conventional example, the registers are recovered in the reverse order of the saved registers. In contrast to this conventional example, in the present invention, as shown in FIG. 13B, the order of the registers that execute the POP instruction is restored in the order of R2, R1, and R3 according to the weight. Note that the rank of the function exit register uses the rank of the function exit weight.

図14(b)は、回復レジスタの削減がある出口2での回復コードを示している。レジスタの重要度を考慮してレジスタの退避順序と回復順序を決定することにより、図14(b)の回復コードでレジスタR1とレジスタR2の回復コードを削減した場合でも、回復コードであるpop命令でのスタックアドレス更新サイズ(=削減レジスタサイズ)を、スタックレジスタ更新命令の更新サイズα+8に反映させることにより、上記従来例のように余計な命令を挿入することなく、回復コードの削減を行うことができる。   FIG. 14B shows the recovery code at exit 2 with recovery register reduction. Even when the recovery codes of the registers R1 and R2 are reduced by the recovery code of FIG. 14B by determining the saving order and the recovery order of the registers in consideration of the importance of the register, the pop instruction which is the recovery code By reflecting the stack address update size (= reduced register size) at the update size α + 8 of the stack register update instruction, the recovery code can be reduced without inserting extra instructions as in the conventional example. Can do.

すなわち、図14(a)の退避コードでは、上記出口1と同様に、重み付けに応じた順でレジスタR3、R1、R2がスタック領域上にpush命令で退避され、その後でワーク領域を確保するためにスタックアドレス更新命令(add SP、−α)が実行される。   That is, in the save code shown in FIG. 14A, as in the case of the exit 1, the registers R3, R1, and R2 are saved in the stack area in the order corresponding to the weight by the push instruction, and then the work area is secured. The stack address update instruction (add SP, -α) is executed.

そして、図14(b)の回復コードでは、まずワーク領域を解放するためにスタックアドレス更新命令が実行されるが、このとき、回復コードを削除するレジスタの数に応じてスタックアドレスが補正される。この例では、レジスタR1、R2の回復コードを削除するので、各レジスタR1〜R3のサイズを4バイトとすると、2つのレジスタ分の8バイトが削除レジスタサイズとなる。このため、スタックアドレス更新命令は、(add SP、α+8)となって、2つ分のレジスタに相当するスタックアドレスがシフトする。   In the recovery code of FIG. 14B, a stack address update instruction is first executed to release the work area. At this time, the stack address is corrected according to the number of registers from which the recovery code is deleted. . In this example, since the recovery codes of the registers R1 and R2 are deleted, if the size of each of the registers R1 to R3 is 4 bytes, 8 bytes for two registers become the deletion register size. Therefore, the stack address update instruction is (add SP, α + 8), and the stack addresses corresponding to two registers are shifted.

スタックアドレス更新命令が実行された後、重み付けに応じて選択されたレジスタR3のみがスタック領域からpop命令で回復されている。   After the stack address update instruction is executed, only the register R3 selected according to the weight is restored from the stack area with the pop instruction.

このように関数出口2では、連続したレジスタR1とR2の回復が不要とコンパイラ208は判定し、レジスタR3のみを回復すればよい。このため、コンパイラ208は、2つのpop命令の代わりに1つのスタックアドレス更新命令(add SP+8)を実行して、削除するレジスタの数に応じてスタックアドレスを補正してからレジスタR3のPOP命令を生成する。この結果、ターゲットシステム250でオブジェクトプログラム207を実行すると、図14(a)の退避コードでレジスタR3,R1、R2の順でスタック領域260に各レジスタの内容を退避させてからαバイトのワーク領域を確保する。   As described above, at the function exit 2, the compiler 208 determines that it is not necessary to recover the continuous registers R1 and R2, and only the register R3 needs to be recovered. Therefore, the compiler 208 executes one stack address update instruction (add SP + 8) instead of two pop instructions, corrects the stack address according to the number of registers to be deleted, and then issues the POP instruction in the register R3. Generate. As a result, when the object program 207 is executed by the target system 250, the contents of each register are saved in the stack area 260 in the order of the registers R3, R1, and R2 using the save code shown in FIG. Secure.

関数出口2では、αバイトのワーク領域を解放し、かつ、スタックアドレスに回復コードを削除した2つのレジスタR1、R2のサイズに相当する8バイトを加算してからレジスタR3をPOP命令で回復する。これにより、2つの回復コードを削減しながらスタックレジスタSPのスタックアドレスを各レジスタR1〜R3の退避以前の状態に復帰させて、オブジェクトプログラム207を正常に実行させることができる。   Function exit 2 releases the α-byte work area and adds 8 bytes corresponding to the sizes of the two registers R1 and R2 from which the recovery code is deleted to the stack address, and then restores register R3 with the POP instruction. . Thus, the object program 207 can be executed normally by reducing the stack address of the stack register SP to the state before the saving of the registers R1 to R3 while reducing two recovery codes.

このように、本第1の実施形態によれば、複数の関数出口が存在する関数のオブジェクトコードを生成する場合には、callee−saveレジスタの不要な回復コードが削減可能となって、オブジェクトプログラム207のコードサイズを削減し、実行性能の良いオブジェクトプログラム(実行コード)を生成することが可能になる。   As described above, according to the first embodiment, when generating an object code of a function having a plurality of function exits, unnecessary recovery code in the callee-save register can be reduced, and the object program can be reduced. It is possible to reduce the code size of 207 and generate an object program (execution code) with good execution performance.

また、不要な回復コードの生成を削除した分、スタックアドレスを補正するが、このとき作成しなかった回復コードのそれぞれについてスタックレジスタの更新命令を生成すると、オブジェクトコードの削減ができないが、本発明のように、関数出口のレジスタに重みを設定して、重みの降順にソートしてから複数のレジスタ更新命令を一つにまとめるようにしたので、コンパイラ208が生成するオブジェクトコードのサイズを低減することが可能となる。   Further, although the stack address is corrected by deleting unnecessary recovery code generation, if the stack register update instruction is generated for each recovery code not created at this time, the object code cannot be reduced. As described above, since the weights are set in the function exit registers and sorted in descending order of the weights, a plurality of register update instructions are combined into one, so that the size of the object code generated by the compiler 208 is reduced. It becomes possible.

<第2実施形態>
図15、図16に、calleeレジスタ退避・回復コード削減処理の第2の実施形態を示す。
<Second Embodiment>
15 and 16 show a second embodiment of callee register save / restore code reduction processing.

図15は、前記第1の実施形態の図3に示したcalleeレジスタ退避コード及び回復コード削減処理305の第2の処理手順を示すフローチャートである。   FIG. 15 is a flowchart showing a second processing procedure of the callee register saving code and recovery code reduction processing 305 shown in FIG. 3 of the first embodiment.

ステップ101では、コンパイラ208が前記第1の実施形態と同様に中間コード209を読み込んで、入口ブロックから、出口ブロックに至るパス上で定義されているレジスタ情報を収集する。ステップ103では、コンパイラ208が関数入口ブロックにcalleeレジスタの退避コードを生成する。ステップ1504は、コンパイラ208がcalleeレジスタの回復コードを生成する。   In step 101, the compiler 208 reads the intermediate code 209 as in the first embodiment and collects register information defined on the path from the entry block to the exit block. In step 103, the compiler 208 generates a save code for the callee register in the function entry block. In step 1504, the compiler 208 generates a recovery code for the callee register.

図16に、図15で示したcalleeレジスタの回復コード生成1504の処理手順を示す。この回復コード生成処理1504では、回復が不要と判定したレジスタに対し、pop命令の代わりに、スタックアドレスを更新する命令を挿入する。スタックアドレス更新命令とは、スタックアドレスを保持するスタックレジスタ(SP)に、レジスタサイズ分の定数を加算するものである。そして、スタックアドレスを更新する命令が連続して挿入された場合、当該連続する命令を1つの命令にまとめることで、回復コードの削減を行うものである。例えば、連続する2命令を1命令にまとめた場合、スタックアドレス更新命令の定数部分は、レジスタサイズ×2となる。以下、回復コード生成処理1504の処理手順を説明する。   FIG. 16 shows a processing procedure of the recovery code generation 1504 of the callee register shown in FIG. In this recovery code generation processing 1504, an instruction for updating the stack address is inserted in place of the pop instruction for the register determined to be unnecessary for recovery. The stack address update instruction is to add a constant for the register size to the stack register (SP) holding the stack address. When instructions for updating the stack address are continuously inserted, the recovery instructions are reduced by combining the continuous instructions into one instruction. For example, when two consecutive instructions are combined into one instruction, the constant part of the stack address update instruction is register size × 2. Hereinafter, the processing procedure of the recovery code generation processing 1504 will be described.

ステップ1601では、コンパイラ208が定義レジスタ情報テーブル210の処理済フラグ804をすべてクリアして初期化する。ステップ1602では、全ての出口ブロックが処理済か否かを判定する。この判定は、定義レジスタ情報テーブル210の処理済フラグ804がすべてセットされているか否かで行う。処理済フラグ804がすべてセットされている場合は、処理を終了する。一方、処理済フラグ804がすべてセットされてない場合は、ステップ1603に進む。ステップ1603では、処理対象とした出口ブロックに対応する定義レジスタ情報テーブル210の処理済みフラグ804をセットする。ステップ1604では、処理対象としている出口ブロックで、回復コードを挿入するための基準点となる命令を登録する。基準点となる命令は、前記第1の実施形態で述べたように入口ブロックの基準点と同様に、スタックレジスタの更新を行う命令とする。   In step 1601, the compiler 208 clears and initializes all processed flags 804 in the definition register information table 210. In step 1602, it is determined whether all exit blocks have been processed. This determination is made based on whether all the processed flags 804 of the definition register information table 210 are set. If all the processed flags 804 are set, the process ends. On the other hand, if all the processed flags 804 are not set, the process proceeds to step 1603. In step 1603, the processed flag 804 of the definition register information table 210 corresponding to the exit block to be processed is set. In step 1604, an instruction serving as a reference point for inserting a recovery code is registered in the exit block to be processed. As described in the first embodiment, the instruction serving as the reference point is an instruction for updating the stack register, like the reference point of the entry block.

ステップ1605では、コンパイラ208が連続するスタックアドレス更新命令を1つにまとめる際に利用する領域を初期化し、スタックアドレス更新命令を未登録の状態にする。ステップ1606では、レジスタ情報テーブル211の処理済フラグ903をすべてクリアして初期化する。ステップ1607では、すべてのレジスタが処理済か否かを判定する。この判定は、レジスタ情報テーブル211の処理済フラグ903がすべてセットされているか否かで行う。処理済フラグ903がすべてセットされている場合は、ステップ1602に戻る。一方、処理済フラグ903がすべてセットされてない場合は、ステップ1608に進む。ステップ1608では、レジスタ情報テーブル211の先頭から後方へテーブルを辿りながら、最初に見つけた処理済フラグ903がセットされてないレジスタ番号に対し、当該出口ブロックで回復コードが必要か否かを判定する。この判定は、当該出口ブロックに対応する定義レジスタ情報テーブル210の定義レジスタ集合802に、当該レジスタが登録されているか否かで行う。定義レジスタ集合802に当該レジスタが登録されている場合は、回復コードが必要になるため、ステップ1609で回復コードを生成し、ステップ1604で設定した挿入基準点の直後に挿入する。回復コードは、例えば、pop命令を用いる。   In step 1605, an area used when the compiler 208 combines consecutive stack address update instructions into one is initialized, and the stack address update instruction is set to an unregistered state. In step 1606, all the processed flags 903 in the register information table 211 are cleared and initialized. In step 1607, it is determined whether all the registers have been processed. This determination is made based on whether all the processed flags 903 in the register information table 211 are set. If all the processed flags 903 are set, the process returns to step 1602. On the other hand, if all the processed flags 903 are not set, the process proceeds to step 1608. In step 1608, while tracing the table from the beginning of the register information table 211 to the back, it is determined whether or not a recovery code is necessary in the exit block for the register number for which the first processed flag 903 is not set. . This determination is made based on whether or not the register is registered in the definition register set 802 of the definition register information table 210 corresponding to the exit block. If the register is registered in the definition register set 802, a recovery code is required. Therefore, a recovery code is generated in step 1609 and inserted immediately after the insertion reference point set in step 1604. As the recovery code, for example, a pop instruction is used.

ステップ1610では、スタックアドレス更新命令の登録状態(変数)を初期化し、スタックアドレス更新命令を未登録の状態にする。スタックアドレス更新命令は、連続したスタックアドレス命令を1つにまとめるためのものなので、回復コードでpop命令が生成された場合は、登録状態を初期化する必要がある。ステップ1608で、コンパイラ208は、定義レジスタ集合802に当該レジスタが登録されてない場合は、入口ブロックから当該出口ブロックに至るパス上で、このレジスタの定義が行われてないと判定されるので、回復コードを生成する必要はなく、ステップ1611に進む。   In step 1610, the registration state (variable) of the stack address update instruction is initialized, and the stack address update instruction is set to an unregistered state. Since the stack address update instruction is used to combine consecutive stack address instructions into one, when a pop instruction is generated with a recovery code, it is necessary to initialize the registration state. In step 1608, if the register is not registered in the definition register set 802, the compiler 208 determines that this register is not defined on the path from the entry block to the exit block. There is no need to generate a recovery code, and the process proceeds to step 1611.

ステップ1611では、スタックアドレス更新命令が登録済か否かを判定する。この判定は、スタックアドレス更新命令の登録状態(変数)を参照して既登録であるか否かを判定すればよい。スタックアドレス更新命令が登録されている場合は、コンパイラ208が回復コードで連続してスタックアドレス更新命令が生成されたと判定するので、命令の削減処理を行う。命令の削減は、当該レジスタに対するアドレス更新命令を生成せず、当該レジスタのサイズ分を、スタックアドレス更新命令として登録されている命令の定数加算部分に反映させることで行える。   In step 1611, it is determined whether or not the stack address update instruction has been registered. This determination may be made by referring to the registration state (variable) of the stack address update instruction to determine whether or not it is already registered. If the stack address update instruction has been registered, the compiler 208 determines that the stack address update instruction has been continuously generated with the recovery code, and therefore performs instruction reduction processing. The number of instructions can be reduced by not generating an address update instruction for the register and reflecting the size of the register in the constant addition portion of the instruction registered as the stack address update instruction.

この定数加算値を修正する処理をステップ1612で行う。ステップ1611で、スタックアドレス更新命令の登録状態に登録されてない場合は、ステップ1613に進む。ステップ1613では、回復コードが不要と判定されたものについて、スタックアドレス更新命令を作成し、ステップ1604で設定した挿入基準点の直後に挿入する。そして、ステップ1614で、スタックアドレス更新命令を登録する。これらの処理が終了した後は、ステップ1615でレジスタ情報テーブル211の処理済フラグ903を設定し、ステップ1607に戻る。   In step 1612, the process of correcting the constant addition value is performed. If it is not registered in the registration state of the stack address update instruction in step 1611, the process proceeds to step 1613. In step 1613, a stack address update instruction is created for those for which it is determined that the recovery code is unnecessary, and is inserted immediately after the insertion reference point set in step 1604. In step 1614, a stack address update instruction is registered. After these processes are completed, the processed flag 903 of the register information table 211 is set in step 1615, and the process returns to step 1607.

上記処理によって、連続するレジスタの回復コードが不要と判定された場合、pop命令を利用せず、1つのスタックアドレス更新命令でスタックアドレスを操作することにより、回復コードサイズを削減することができる。   If it is determined by the above processing that recovery codes of consecutive registers are unnecessary, the recovery code size can be reduced by manipulating the stack address with one stack address update instruction without using the pop instruction.

次に、図4の定義レジスタ情報テーブルと、図5(a)、図5(b)のレジスタ情報テーブルから生成される本第2実施形態による回復コードの例を図17(b)に示す。前記従来例の図12(b)では、回復レジスタの削減がない出口1での回復コードを示している。本第2の実施形態の図17(b)は、回復レジスタの削減がある出口2での回復コードを示している。図17(b)に示す出口2では、連続したレジスタR1とR2の回復が不要と判定されているため、2つのpop命令の変わりに1つのアドレス更新命令(add SP,8)が生成されるため、回復コードサイズを削減することができる。この例ではひとつのレジスタサイズを4バイトとしているため、スタックアドレス更新命令の定数部分は8(=4×2)となる。   Next, FIG. 17B shows an example of the recovery code according to the second embodiment generated from the definition register information table of FIG. 4 and the register information tables of FIGS. 5A and 5B. FIG. 12B of the conventional example shows a recovery code at the exit 1 where there is no reduction in the recovery register. FIG. 17B of the second embodiment shows a recovery code at the exit 2 where there is a reduction in the recovery register. In the exit 2 shown in FIG. 17B, it is determined that recovery of the continuous registers R1 and R2 is unnecessary, so that one address update instruction (add SP, 8) is generated instead of two pop instructions. Therefore, the recovery code size can be reduced. In this example, since one register size is 4 bytes, the constant part of the stack address update instruction is 8 (= 4 × 2).

以上のように、第2の実施形態においても、callee−saveレジスタの不要な回復コードが削減可能となって、オブジェクトプログラムのコードサイズを削減し、実行性能の良いオブジェクトプログラム(実行コード)を生成することが可能になる。   As described above, even in the second embodiment, unnecessary recovery code in the callee-save register can be reduced, the object program code size can be reduced, and an object program (execution code) with good execution performance can be generated. It becomes possible to do.

なお、上記各実施形態においては、ソースプログラム206からオブジェクトプログラム207を生成する計算機と、オブジェクトプログラム207を実行する計算機(ターゲットシステム250)が異なる例を示したが、ひとつの計算機で、コンパイル処理とオブジェクトプログラム207の実行を行っても良い。この場合、ターゲット情報テーブル212は、計算機200のリソースについて記載しておけばよい。   In each of the above embodiments, an example is shown in which the computer that generates the object program 207 from the source program 206 and the computer that executes the object program 207 (target system 250) are different. The object program 207 may be executed. In this case, the target information table 212 may describe the resources of the computer 200.

以上のように、本発明では、ソースプログラムをオブジェクトプログラムに変換する処理でスタック操作命令(push/pop命令)を利用してcallee−saveレジスタ退避コードおよび回復コードを生成するコンパイル装置、コンパイラに適用できる。   As described above, the present invention is applied to a compiling device and a compiler that generate a callee-save register save code and a recovery code using a stack operation instruction (push / pop instruction) in a process of converting a source program into an object program. it can.

本発明に係るコンパイラが稼動する計算機システムのブロック図である。1 is a block diagram of a computer system in which a compiler according to the present invention operates. 図1のコンパイラで生成したオブジェクトプログラムを実行するターゲットシステムのブロック図である。FIG. 2 is a block diagram of a target system that executes an object program generated by the compiler of FIG. 1. 第1の実施形態を示し、コンパイラの処理手順を示すフローチャート。The flowchart which shows 1st Embodiment and shows the processing procedure of a compiler. 第1の実施形態を示し、定義レジスタ情報テーブルの一例を示す説明図。Explanatory drawing which shows 1st Embodiment and shows an example of a definition register information table. 第1の実施形態を示し、レジスタ情報テーブルの一例を示す説明図で、(a)はソート前の状態を示し、(b)はソート後の状態を示す。FIG. 2 is an explanatory diagram illustrating the first embodiment and an example of a register information table, where (a) illustrates a state before sorting and (b) illustrates a state after sorting. 図3に示したcalleeレジスタ退避コード及び回復コード生成の処理手順を示すフローチャート。FIG. 4 is a flowchart showing a processing procedure for generating a callee register save code and a recovery code shown in FIG. 3. 第1の実施形態を示し、図6で示した定義レジスタ情報収集101の処理手順を示すフローチャート。The flowchart which shows 1st Embodiment and shows the process sequence of the definition register information collection 101 shown in FIG. 第1の実施形態を示し、図6で示したcalleeレジスタの退避順序及び回復順序の決定の処理手順を示すフローチャート。7 is a flowchart illustrating a processing procedure for determining a save order and a recovery order of the callee register illustrated in FIG. 6 according to the first embodiment. 第1の実施形態を示し、図6で示したcalleeレジスタの退避コード生成の処理手順を示すフローチャート。The flowchart which shows 1st Embodiment and shows the process sequence of the save code generation of the callee register shown in FIG. 第1の実施形態を示し、図6で示したcalleeレジスタの回復コード生成の処理手順を示すフローチャート。The flowchart which shows 1st Embodiment and shows the process sequence of the recovery code production | generation of the callee register shown in FIG. 第1の実施形態を示し、ソースプログラムの一例を示す説明図。Explanatory drawing which shows 1st Embodiment and shows an example of a source program. 従来技術による退避コードと回復コードの生成例を示し、(a)は退避コードを示し、(b)は退避コードに対応する回復コードを示す。An example of generation of a save code and a recovery code according to the prior art is shown, (a) shows a save code, and (b) shows a recovery code corresponding to the save code. 第1の実施形態を示し、回復コードを削減しない場合の退避コードと回復コードの生成例を示しており、(a)は退避コードを示し、(b)は退避コードに対応する回復コードを示す。The first embodiment shows an example of generation of a save code and a recovery code when the recovery code is not reduced, (a) shows the save code, and (b) shows the recovery code corresponding to the save code. . 第1の実施形態を示し、回復コードを削減する場合の退避コードと回復コードの生成例を示しており、(a)は退避コードを示し、(b)は退避コードに対応する回復コードを示す。The 1st embodiment is shown and the example of the production | generation of the save code and recovery code in the case of reducing a recovery code is shown, (a) shows a save code, (b) shows the recovery code corresponding to a save code . 第2の実施形態を示し、calleeレジスタ退避コード及び回復コード生成の処理手順を示すフローチャートThe flowchart which shows 2nd Embodiment and shows the processing procedure of calle register saving code and recovery code generation 第2の実施形態を示し、図15で示したcalleeレジスタの回復コード生成1504の処理手順を示すフローチャート。The flowchart which shows 2nd Embodiment and shows the process sequence of the recovery code production | generation 1504 of the callee register shown in FIG. 第2の実施形態を示し、回復コードを削減する場合の退避コードと回復コードの生成例を示しており、(a)は退避コードを示し、(b)は退避コードに対応する回復コードを示す。The second embodiment shows an example of generating a save code and a recovery code when reducing the recovery code, (a) showing the save code, and (b) showing the recovery code corresponding to the save code. .

符号の説明Explanation of symbols

101 定義レジスタ情報収集処理
102 退避・回復順序の決定処理
103 退避コード生成処理
104 回復コード生成処理
200 計算機システム(コンパイル装置)
206 ソースプログラム
207 オブジェクトプログラム
208 コンパイラ
210 定義レジスタ情報テーブル
211 レジスタ情報テーブル
212 ターゲット情報テーブル
250 計算機システム(ターゲットシステム)
101 definition register information collection process 102 save / recovery order determination process 103 save code generation process 104 recovery code generation process 200 computer system (compile device)
206 Source Program 207 Object Program 208 Compiler 210 Definition Register Information Table 211 Register Information Table 212 Target Information Table 250 Computer System (Target System)

Claims (7)

演算処理を行う第1のプロセッサと、前記プロセッサが利用する情報を格納する記憶部と、を備えて、関数を含むソースプログラムを読み込んでスタック操作命令を含むオブジェクトプログラムを生成するコンパイル装置において、
前記ソースプログラムを読み込んで中間コードを生成する構文解析部と、
前記中間コードを読み込んで、前記オブジェクトプログラムを実行する計算機を構成する第2のプロセッサのレジスタを前記中間コードに割り付けるレジスタ割り付け部と、
前記レジスタに割り付けた中間コードからオブジェクトコードを生成し、オブジェクトプログラムを出力するコード生成部、とを備え、
前記記憶部は、
前記第2のプロセッサのレジスタの情報を格納したターゲット情報と、
前記関数に割り付けられた前記レジスタの情報を格納する第1のレジスタ情報と、
前記レジスタの退避順序と回復順序を格納する第2のレジスタ情報と、
を有し、
前記コード生成部は、
前記関数の入口及び出口に割り付けられた前記レジスタの情報を収集して前記第1のレジスタ情報に格納する定義レジスタ情報収集部と、
前記第1のレジスタ情報を読み込んで、前記関数の入口及び出口に割り付けられた前記レジスタの退避順序と回復順序を決定する退避・回復順序決定部と、
前記退避・回復順序決定部が決定した退避順序と回復順序に従って前記レジスタの退避コードと回復コードを生成する退避・回復コード生成部と、を有し、
退避・回復コード生成部は、
前記レジスタの退避順序に従ってレジスタの退避コードを前記関数の入口に生成し、前記第1のレジスタ情報と前記退避順序及び回復順序から前記関数の入口から出口に至るパス上で割り付けられているレジスタに対して、前記関数の出口毎にそれぞれ回復コードを生成し、前記パス上で定義されてないレジスタのサイズの和を求め、前記関数の出口でスタックアドレスを前記レジスタのサイズの和だけ補正するスタックアドレスの更新命令を生成することを特徴とするコンパイル装置。
In a compiling apparatus that includes a first processor that performs arithmetic processing and a storage unit that stores information used by the processor, and that reads a source program including a function and generates an object program including a stack operation instruction.
A parsing unit that reads the source program and generates intermediate code;
A register allocating unit that reads the intermediate code and allocates a register of a second processor constituting a computer that executes the object program to the intermediate code;
A code generation unit that generates an object code from the intermediate code assigned to the register and outputs an object program;
The storage unit
Target information storing register information of the second processor;
First register information for storing information of the register allocated to the function;
Second register information for storing the save order and recovery order of the registers;
Have
The code generator is
A definition register information collection unit that collects information of the registers allocated to the entry and exit of the function and stores the information in the first register information;
A save / restore order determining unit that reads the first register information and determines a save order and a restore order of the registers assigned to the entry and exit of the function;
A save / recovery code generation unit that generates a save code and a recovery code of the register according to the save order and the recovery order determined by the save / recovery order determination unit;
The evacuation / recovery code generator
A register save code is generated at the entry of the function according to the save order of the registers, and the first register information and the registers allocated on the path from the save order to the exit from the save order and the recovery order On the other hand, a stack that generates a recovery code for each exit of the function, calculates a sum of register sizes that are not defined on the path, and corrects a stack address at the exit of the function by the sum of the register sizes. A compiling device for generating an address update instruction.
請求項1に記載のコンパイル装置であって、
前記退避・回復順序決定部は、
前記関数の出口に割り付けられたレジスタについて重み付けを行い、前記重みの順位に基づいて回復コードを生成するレジスタの順位を決定することを特徴とするコンパイル装置。
The compiling device according to claim 1,
The evacuation / recovery order determination unit
A compiling apparatus that weights a register assigned to an exit of the function and determines a rank of a register that generates a recovery code based on the rank of the weight.
請求項2に記載のコンパイル装置であって、
前記ターゲット情報は、前記第2のプロセッサで前記オブジェクトプログラムを実行したときの関数出口の実行回数を予め格納し、
前記退避・回復順序決定部は、
前記ターゲット情報から関数出口の実行回数を読み込んで、前記実行回数の大きさから前記重みを求めることを特徴とするコンパイル装置。
The compiling device according to claim 2,
The target information stores in advance the number of executions of the function exit when the object program is executed by the second processor,
The evacuation / recovery order determination unit
A compiling device, wherein the number of executions of a function exit is read from the target information, and the weight is obtained from the size of the execution times.
請求項1に記載のコンパイル装置であって、
前記退避コードは、前記レジスタのサイズに相当するバイト数でスタックアドレスを減算した後、減算後のスタックアドレスが指す領域に前記レジスタのデータをストアし、
前記回復コードは、前記スタックアドレスの指す領域から前記レジスタにデータをロードした後、当該レジスタのサイズに相当するバイト数を前記スタックアドレスに加算することを特徴とするコンパイル装置。
The compiling device according to claim 1,
The save code, after subtracting the stack address by the number of bytes corresponding to the size of the register, stores the data of the register in the area pointed to by the stack address after the subtraction,
The compile apparatus, wherein after the data is loaded from the area indicated by the stack address to the register, the recovery code adds the number of bytes corresponding to the size of the register to the stack address.
演算処理を行う第1のプロセッサと、前記プロセッサが利用する情報を格納する記憶部と、を備えて、関数を含むソースプログラムを読み込んでスタック操作命令を含むオブジェクトプログラムを生成するコンパイル装置において、
前記ソースプログラムを読み込んで中間コードを生成する構文解析部と、
前記中間コードを読み込んで、前記オブジェクトプログラムを実行する計算機を構成する第2のプロセッサのレジスタを前記中間コードに割り付けるレジスタ割り付け部と、
前記レジスタに割り付けた中間コードからオブジェクトコードを生成し、オブジェクトプログラムを出力するコード生成部、とを備え、
前記記憶部は、
前記第2のプロセッサのレジスタの情報を格納したターゲット情報と、
前記関数に割り付けられた前記レジスタの情報を格納する第1のレジスタ情報と、
を有し、
前記コード生成部は、
前記関数の入口及び出口に割り付けられた前記レジスタの情報を収集して前記第1のレジスタ情報に格納する定義レジスタ情報収集部と、
前記定義レジスタ情報収集部が割り付けた前記レジスタの退避コードと回復コードを生成する退避・回復コード生成部と、を有し、
退避・回復コード生成部は、
前記第1のレジスタ情報を読み込んで、前記関数の入口に割り付けられたレジスタの退避コードを生成し、前記関数の入口から出口に至るパス上で割り付けられているレジスタに対して前記関数の出口毎にそれぞれ回復コードを生成し、前記パス上で定義されてないレジスタについて当該レジスタのサイズに応じてスタックアドレスを補正するスタックアドレスの更新命令を生成することを特徴とするコンパイル装置。
In a compiling apparatus that includes a first processor that performs arithmetic processing and a storage unit that stores information used by the processor, and that reads a source program including a function and generates an object program including a stack operation instruction.
A parsing unit that reads the source program and generates intermediate code;
A register allocating unit that reads the intermediate code and allocates a register of a second processor constituting a computer that executes the object program to the intermediate code;
A code generation unit that generates an object code from the intermediate code assigned to the register and outputs an object program;
The storage unit
Target information storing register information of the second processor;
First register information for storing information of the register allocated to the function;
Have
The code generator is
A definition register information collection unit that collects information of the registers allocated to the entry and exit of the function and stores the information in the first register information;
A save / recovery code generation unit that generates a save code and a recovery code of the register allocated by the definition register information collection unit;
The evacuation / recovery code generator
Reading the first register information, generating a save code for the register allocated to the function entry, and for each register exit assigned to the register allocated on the path from the function entry to the exit A compiling device that generates a recovery code and corrects a stack address according to the size of the register for a register that is not defined on the path.
請求項5に記載のコンパイル装置であって、
前記スタックアドレスの更新命令が連続して生成されることを検出する検出部と、
前記検出結果に従ってスタックアドレスの更新命令の値を修正する更新値修正部と、を有し、
前記更新値修正部は、
前記検出部がスタックアドレスの更新命令を連続して生成する際には、連続する2つめ以降のスタックアドレス更新命令を生成せず、最初に生成したスタックアドレス更新命令の値を、複数のスタックアドレスの補正値に修正することを特徴とするコンパイル装置。
The compiling device according to claim 5,
A detection unit for detecting that the update instruction of the stack address is continuously generated;
An update value correction unit that corrects the value of the update instruction of the stack address according to the detection result,
The update value correction unit
When the detection unit continuously generates stack address update instructions, it does not generate the second and subsequent stack address update instructions, and the value of the stack address update instruction generated first is set to a plurality of stack addresses. A compiling device for correcting to a correction value.
演算処理を行う第1のプロセッサと、前記プロセッサが利用する情報を格納する記憶部と、を備えた第1の計算機で、関数を含むソースプログラムを読み込んでスタック操作命令を含むオブジェクトプログラムを生成するコンパイル方法において、
前記第1のプロセッサが、前記ソースプログラムを読み込んで中間コードを生成するステップと、
前記第1のプロセッサが、前記中間コードを読み込んで、前記オブジェクトプログラムを実行する第2の計算機を構成する第2のプロセッサのレジスタを前記中間コードに割り付けるステップと、
前記第1のプロセッサが、前記レジスタに割り付けた中間コードからオブジェクトコードを生成し、オブジェクトプログラムとして出力するステップ、とを含み、
前記レジスタに割り付けた中間コードからオブジェクトコードを生成し、オブジェクトプログラムとして出力するステップは、
前記関数の入口及び出口に割り付けられた前記レジスタの情報を収集して前記記憶部に設定した第1のレジスタ情報に格納するステップと、
前記第1のレジスタ情報を読み込んで、前記関数の入口及び出口に割り付けられた前記レジスタの退避順序と回復順序を決定するステップと、
前記決定した退避順序と回復順序に従って前記レジスタの退避コードと回復コードを生成するステップと、を有し、
前記決定した退避順序と回復順序に従って前記レジスタの退避コードと回復コードを生成するステップは、
前記レジスタの退避順序に従ってレジスタの退避コードを前記関数の入口に生成し、前記第1のレジスタ情報と前記退避順序及び回復順序から前記関数の入口から出口に至るパス上で割り付けられているレジスタに対して、前記関数の出口毎にそれぞれ回復コードを生成し、前記パス上で定義されてないレジスタのサイズの和を求め、前記関数の出口でスタックアドレスを前記レジスタのサイズの和だけ補正するスタックアドレスの更新命令を生成することを特徴とするコンパイル方法。
A first computer including a first processor that performs arithmetic processing and a storage unit that stores information used by the processor reads a source program including a function and generates an object program including a stack operation instruction. In the compilation method,
The first processor reads the source program and generates intermediate code;
The first processor reads the intermediate code and allocates a register of a second processor constituting a second computer that executes the object program to the intermediate code;
The first processor generates an object code from the intermediate code allocated to the register and outputs the object code as an object program;
The step of generating an object code from the intermediate code assigned to the register and outputting it as an object program,
Collecting information on the registers allocated to the entry and exit of the function and storing them in the first register information set in the storage unit;
Reading the first register information and determining a save order and a recovery order of the registers assigned to the entry and exit of the function;
Generating a save code and a recovery code of the register according to the determined save order and recovery order, and
The step of generating the save code and the recovery code of the register according to the determined save order and the recovery order,
A register save code is generated at the entry of the function according to the save order of the registers, and the first register information and the registers allocated on the path from the save order to the exit from the save order and the recovery order On the other hand, a stack that generates a recovery code for each exit of the function, calculates a sum of register sizes that are not defined on the path, and corrects a stack address at the exit of the function by the sum of the register sizes. A compiling method characterized by generating an address update instruction.
JP2008294733A 2008-11-18 2008-11-18 Compile device and compile method Pending JP2010122820A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008294733A JP2010122820A (en) 2008-11-18 2008-11-18 Compile device and compile method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008294733A JP2010122820A (en) 2008-11-18 2008-11-18 Compile device and compile method

Publications (1)

Publication Number Publication Date
JP2010122820A true JP2010122820A (en) 2010-06-03

Family

ID=42324119

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008294733A Pending JP2010122820A (en) 2008-11-18 2008-11-18 Compile device and compile method

Country Status (1)

Country Link
JP (1) JP2010122820A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019007474A (en) * 2017-06-22 2019-01-17 株式会社デンソー High-pressure fuel pump and fuel supply system
CN112445484A (en) * 2019-08-27 2021-03-05 龙芯中科技术股份有限公司 Register processing method and device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019007474A (en) * 2017-06-22 2019-01-17 株式会社デンソー High-pressure fuel pump and fuel supply system
JP7035542B2 (en) 2017-06-22 2022-03-15 株式会社デンソー High pressure fuel pump and fuel supply system
CN112445484A (en) * 2019-08-27 2021-03-05 龙芯中科技术股份有限公司 Register processing method and device, electronic equipment and storage medium
CN112445484B (en) * 2019-08-27 2023-11-24 龙芯中科技术股份有限公司 Register processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US10175983B2 (en) Branch trace compression
US9582321B2 (en) System and method of data processing
US20160321048A1 (en) Information processing apparatus and compiling method
US20150058825A1 (en) Stack trace compression
US8250557B2 (en) Configuring a dependency graph for dynamic by-pass instruction scheduling
US8549502B2 (en) Compiler with user-defined type inference rules
JPH07234792A (en) Compile processor
JPH1097430A (en) Method and system for inserting assembly code routine into source code routine for optimization
US9104402B2 (en) Branch trace compression
JP2008009957A (en) Compiling device
US20100250564A1 (en) Translating a comprehension into code for execution on a single instruction, multiple data (simd) execution
US8423980B1 (en) Methods for handling inlined functions using sample profiles
US7987457B2 (en) Targeted patching for native generation images
JP5048949B2 (en) Software tools including asynchronous program flow modeling
EP2009547A2 (en) Method and apparatus for parallel XSL transformation with low contention and load balancing
JP2007532990A (en) Method and structure for explicit software control of thread execution including helper subthreads
JP2010122820A (en) Compile device and compile method
JP2011141676A (en) Apparatus and method for processing language, and computer program product
US10310871B2 (en) Non-transitory computer-readable recording medium storing control program, control device and control method
US10108405B2 (en) Compiling apparatus and compiling method
KR101670916B1 (en) Method for storing function and system device using the same
US20210303283A1 (en) Generating compilable machine code programs from dynamic language code
JP2008250838A (en) Software generation device, method and program
JP2021184246A (en) Instruction conversion support program, instruction conversion support method and information processing device
CN115004150A (en) Method and apparatus for predicting and scheduling duplicate instructions in software pipelining loops