JP2002304302A - Optimizing device and optimizing method for microprocessor object code, and recording medium recorded with optimizing program - Google Patents

Optimizing device and optimizing method for microprocessor object code, and recording medium recorded with optimizing program

Info

Publication number
JP2002304302A
JP2002304302A JP2001104924A JP2001104924A JP2002304302A JP 2002304302 A JP2002304302 A JP 2002304302A JP 2001104924 A JP2001104924 A JP 2001104924A JP 2001104924 A JP2001104924 A JP 2001104924A JP 2002304302 A JP2002304302 A JP 2002304302A
Authority
JP
Japan
Prior art keywords
code
data
instruction
access
address
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.)
Granted
Application number
JP2001104924A
Other languages
Japanese (ja)
Other versions
JP3758984B2 (en
Inventor
Manabu Ezaki
学 江崎
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.)
Renesas Micro Systems Co Ltd
Original Assignee
Renesas Micro Systems Co 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 Renesas Micro Systems Co Ltd filed Critical Renesas Micro Systems Co Ltd
Priority to JP2001104924A priority Critical patent/JP3758984B2/en
Publication of JP2002304302A publication Critical patent/JP2002304302A/en
Application granted granted Critical
Publication of JP3758984B2 publication Critical patent/JP3758984B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To relocate data codes in object codes to improve an execution speed of a program even if the data codes are outside a displacement range. SOLUTION: In this optimizing device, a simulator 1 analyzes a data access command in the primary object codes F1. The simulator 1 has a data access information generation part 14 outputting a data address and a size to data access information F3; a data relocation part 15 referring to the data access information F3, sorting the data codes in descending order of an access frequency of each address, selecting the data code of a maximum size in the same address as a selection data code, relocating the selection data codes in the descending order of the access frequency in a cache area and correcting command code; and a secondary object code generation part 16 generating the relocated data and the corrected command code as secondary object codes F4.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明はマイクロプロセッサ
用目的コードの最適化装置、最適化方法及び最適化プロ
グラムを記録した記録媒体に関し、特にマイクロプロセ
ッサ用目的コードの最適化処理を行うコンパイラが生成
した一次目的コードの命令コードを解析して1命令でア
クセス可能な命令コードを生成するための二次目的コー
ドを生成するマイクロプロセッサ用目的コードの最適化
装置、最適化方法及び最適化プログラムを記録した記録
媒体に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a device for optimizing an object code for a microprocessor, an optimizing method, and a recording medium on which an optimizing program is recorded, and more particularly to a device for optimizing an object code for a microprocessor. An apparatus, an optimization method, and an optimization program for a microprocessor purpose code for generating a secondary purpose code for analyzing an instruction code of a primary purpose code to generate an instruction code accessible by one instruction are recorded. It relates to a recording medium.

【0002】[0002]

【従来の技術】従来、この種のマイクロプロセッサ用目
的コードの最適化処理は、データ処理装置によるコンパ
イル用プログラム又はコンパイラの読み取り実行により
実現され、ソースプログラムのコード(コンパイラが生
成した一次目的コード)を入力し、マイクロプロセッサ
に対応してプログラムの実行速度を高める目的コード
(二次目的コード)を出力するために用いられている。
2. Description of the Related Art Conventionally, this kind of optimization processing of an object code for a microprocessor is realized by reading and executing a compiling program or a compiler by a data processing device, and a source program code (primary object code generated by the compiler). Is used to output a target code (secondary target code) for increasing the execution speed of the program corresponding to the microprocessor.

【0003】ここで、コンパイラが生成した一次目的コ
ードとは、C言語、FORTRAN,COBOLなどの
高級プログラミング言語を、目的とするCPU上の機械
語命令コード及びデータコードに翻訳したものを意味す
る。
Here, the primary purpose code generated by the compiler means a high-level programming language such as C language, FORTRAN, COBOL translated into a machine language instruction code and data code on a target CPU.

【0004】例えば、パイプライン方式のマイクロプロ
セッサにおいて、命令間のコンフリクトを回避させつつ
プログラムの実行速度を高めるために、互いに依存関係
のない複数の命令に関しては、コンパイラによって、他
の命令の結果を待っている遅延時間が短い命令を自動的
に前に配置するようにした命令コードのスケジューリン
グ方式が提案されている。
For example, in a pipelined microprocessor, in order to avoid a conflict between instructions and to increase the execution speed of a program, a plurality of instructions that do not depend on each other are interpreted by a compiler using the results of other instructions. There has been proposed an instruction code scheduling method in which an instruction having a short waiting time is automatically arranged before the instruction.

【0005】また、現在、マイクロプロセッサは、CP
Uと主メモリとの間に高速、小容量のキャッシュメモリ
を配置し、主メモリに置かれたデータコードへのアクセ
スの高速化を図っているものが一般的となっている。し
かし、必要なデータコードがキャッシュ上に存在しない
キャッシュミスに起因する実行速度低下が依然として残
っており、この実行速度低下を低減するために、コンパ
イラにより、命令実行時のキャッシュミス・ペナルティ
を小さくするための命令スケジューリングを行う方式が
考案されている。
At present, the microprocessor is a CP.
It is common to arrange a high-speed, small-capacity cache memory between the U and the main memory to speed up access to data codes stored in the main memory. However, there still remains a reduction in execution speed due to a cache miss in which the required data code does not exist in the cache. To reduce this reduction in execution speed, the compiler reduces the cache miss penalty during instruction execution. A method of performing instruction scheduling has been devised.

【0006】特開平10−333916号公報記載の従
来のマイクロプロセッサ用目的コードの最適化装置であ
るコンパイル装置をブロックで示す図13(A)を参照
すると、この従来のマイクロプロセッサ用目的コードの
最適化装置は、記録媒体に記録されたコンパイル用プロ
グラムである入力コードF5をプロファイルデータF2
を用いてコンパイルして目的コードF100を生成する
コンパイル部2と、目的コードF100をシミュレーシ
ョンしプロファイルデータF2を生成するマシン又はシ
ミュレータであるシミュレータ100とを備える。
FIG. 13A is a block diagram showing a compiling apparatus which is a conventional apparatus for optimizing an object code for a microprocessor described in Japanese Patent Application Laid-Open No. 10-333916. The conversion device converts the input code F5, which is a compile program recorded on a recording medium, into profile data F2.
And a simulator 100 that compiles the target code F100 to generate the target code F100, and simulates the target code F100 to generate the profile data F2.

【0007】入力コードF5は、例えば、C言語、JA
VA(登録商標)言語、FORTRAN言語などの高級
言語で記述したものである。
The input code F5 is, for example, C language, JA
It is described in a high-level language such as VA (registered trademark) language or FORTRAN language.

【0008】コンパイル部2は、入力コードF5の実行
を行うソフトウェア機能手段として、入力コードF5の
供給を受けこの入力コードF5の字句解析及び構文解析
を行うフロントエンド21と、後述するバックエンド2
2とを備える。
[0008] The compiling unit 2 includes a front end 21 which receives the input code F5 and performs lexical analysis and syntax analysis of the input code F5, and a back end 2 which will be described later as software function means for executing the input code F5.
2 is provided.

【0009】バックエンド22は、目的コードF100
のシミュレーション結果であるプロファイルデータF2
を基にキャッシュミスペナルティをできるだけ小さくす
るために命令コードのスケジューリングを行うコードス
ケジューリング部221と、コードスケジューリング部
221のコードスケジューリング結果に基づきシミュレ
ータ100上で実行可能な目的コードF100を生成す
る目的コード生成部222とを備える。
The back end 22 has a purpose code F100
Profile data F2 which is the simulation result of
A code scheduling unit 221 that schedules instruction codes to minimize the cache miss penalty based on the above, and an object code generation unit that generates an object code F100 executable on the simulator 100 based on the code scheduling result of the code scheduling unit 221. A part 222.

【0010】シミュレータ100の構成例をブロックで
示す図13(B)を参照すると、このシミュレータ10
0は、コンパイル部2が生成した目的コードである一次
目的コードF100の命令コードの解析を行う命令コー
ド解析部11と、解析した命令コードの実行を行う命令
シミュレーション部12と、プロファイルデータの生成
を行いプロファイルデータF2に格納するプロファイル
データ生成部13とを備える。
Referring to FIG. 13B, which shows a configuration example of a simulator 100 by blocks,
0 designates an instruction code analyzing unit 11 for analyzing an instruction code of a primary object code F100 which is an object code generated by the compiling unit 2, an instruction simulation unit 12 for executing the analyzed instruction code, and generating profile data. And a profile data generating unit 13 for storing the profile data in the profile data F2.

【0011】次に、図13(A),(B)を参照して、
従来のマイクロプロセッサ用目的コードの最適化装置の
動作について説明すると、まず、コンパイル部2のフロ
ントエンド21は、入力コードF5の供給を受けこの入
力コードF5の字句解析及び構文解析を行い、解析結果
をバックエンド22に供給する。
Next, referring to FIGS. 13A and 13B,
First, the front end 21 of the compiling unit 2 receives the input code F5, performs lexical analysis and syntax analysis of the input code F5, and describes the analysis result. Is supplied to the back end 22.

【0012】次に、バックエンド22のコードスケジュ
ーリング部221は、有効設定された場合に、プロファ
イルデータF2を基にキャッシュミスペナルティをでき
るだけ小さくするために命令コードのスケジューリング
を行う。無効設定された場合は不動作となり、何も実行
しない。
Next, when the code scheduling section 221 of the back end 22 is set to be valid, the instruction scheduling is performed to minimize the cache miss penalty based on the profile data F2. If it is invalidated, it will not operate and will not execute anything.

【0013】有効設定の場合、まず、コードスケジュー
リング部221は、目的コードF100をシミュレータ
100で実行して得たCPU動作の記録であるプロファ
イルデータF2を解析しキャッシュミスペナルティ発生
部分を検出するとともにコードスケジューリング実行部
224で利用するためのキャッシュ動作情報を生成す
る。次に、このキャッシュ動作情報に基づき検出したキ
ャッシュミスペナルティを軽減するための命令コードの
再スケジューリングを行う。
In the case of the valid setting, first, the code scheduling unit 221 analyzes the profile data F2 which is a record of the CPU operation obtained by executing the target code F100 by the simulator 100, detects the cache miss penalty occurrence part, The cache operation information to be used by the scheduling execution unit 224 is generated. Next, instruction code rescheduling for reducing cache miss penalty detected based on the cache operation information is performed.

【0014】ここで、キャッシュ動作情報とは、キャッ
シュミスしたデータを主記憶からキャッシュに読み込む
動作が各動作クロックで行われている否かを表わす情報
である。
Here, the cache operation information is information indicating whether or not the operation of reading the cache-missed data from the main memory into the cache is performed at each operation clock.

【0015】目的コード生成部222は、コードスケジ
ューリング部221の命令コードの再スケジューリング
結果を受け、シミュレータ100上で実行可能な目的コ
ードを生成し、目的コードF100に出力する。
The target code generator 222 receives the result of rescheduling the instruction code by the code scheduler 221, generates a target code executable on the simulator 100, and outputs the target code to the target code F 100.

【0016】シミュレータ100は、まず、命令コード
解析部11において、コンパイル部2が生成した一次目
的コードである目的コードF100の命令コード(以下
一次命令コード)の解析を行う。次に、命令シミュレー
ション部12において、解析した一次命令コードの実行
を行う。最後に、プロファイルデータ生成部13におい
て、プロファイルデータの生成を行い、プロファイルデ
ータF2へ出力する。
In the simulator 100, first, the instruction code analyzing section 11 analyzes an instruction code (hereinafter, a primary instruction code) of a target code F100 which is a primary target code generated by the compiling section 2. Next, the instruction simulation unit 12 executes the analyzed primary instruction code. Finally, the profile data generation unit 13 generates profile data and outputs the profile data to the profile data F2.

【0017】このように従来技術では、シミュレータ1
00上で実行して得られるプロファイルデータF2を基
に、実行速度を低下させるキャッシュミスペナルティを
解析し、キャッシュミスペナルティをできるだけ小さく
するために目的コードF100を再スケジューリングす
るコードスケジューリング処理を行い、目的コード生成
部222により、最終的な目的コードF100を生成
し、その実行速度を向上させていた。
As described above, in the prior art, the simulator 1
Based on the profile data F2 obtained by executing the above process, a cache miss penalty that reduces the execution speed is analyzed, and a code scheduling process for rescheduling the target code F100 is performed to minimize the cache miss penalty. The code generator 222 generates the final target code F100, and improves the execution speed.

【0018】マイクロプロセッサは、一般的に、機械語
命令のデータコードアクセス命令において、アクセスで
きるデータコードのディスプレースメント(オフセッ
ト)に制限があり、例えば、ディスプレースメントとし
て16ビットの値までしかとることができない。このた
め、従来のマイクロプロセッサ用目的コードの最適化装
置においては、データコード領域の任意の位置にポイン
タを設定し、そのポインタをポインタ専用のレジスタに
格納することにより、そのレジスタからのオフセット
(ディスプレースメント)を用いてデータコード領域を
アクセスする。そのポインタの近辺にサイズの小さいデ
ータコードをできるだけ多く配置することにより、でき
るだけ多くのデータコードを1命令のデータコードアク
セス命令でアクセスし、実行速度を向上させるという技
術がある。
In general, a microprocessor is limited in the displacement (offset) of a data code that can be accessed in a data code access instruction of a machine language instruction. For example, the microprocessor can take only a 16-bit value as a displacement. Can not. For this reason, in the conventional microprocessor object code optimization apparatus, a pointer is set at an arbitrary position in the data code area, and the pointer is stored in a pointer-dedicated register. ) To access the data code area. There is a technique of arranging as many small-sized data codes as possible near the pointer, thereby accessing as many data codes as possible with a single data code access instruction to improve the execution speed.

【0019】しかし、依然として、アクセスできるデー
タコードのディスプレースメントの範囲外にあるデータ
コード(以下、ディスプレースメント範囲外データコー
ド)においては、1命令でアクセスすることができず、
複数命令でアクセスしなければならないため、ディスプ
レースメント範囲外データコードへのアクセス頻度が高
いプログラムにおいては、実行速度が低下するという問
題がある。
However, data codes outside the range of accessible data code displacements (hereinafter, data codes outside the displacement range) cannot be accessed by one instruction.
Since a program needs to be accessed by a plurality of instructions, there is a problem that the execution speed is reduced in a program that frequently accesses the data code outside the displacement range.

【0020】次に、データコードアクセス命令がディス
プレースメントとして16ビットの値までしかとること
ができない(以下、16ビットディスプレースメント)
マイクロプロセッサに対するデータコード領域を説明図
で示す図14(A)及び命令コードの例を示す図14
(B),(C)を参照して、上記問題が生じる理由につ
いて説明する。
Next, a data code access instruction can take only a 16-bit value as a displacement (hereinafter, 16-bit displacement).
FIG. 14A showing the data code area for the microprocessor in an explanatory diagram and FIG. 14 showing an example of an instruction code
The reason why the above problem occurs will be described with reference to FIGS.

【0021】図14(A)を参照すると、この図に示す
ポインタP1は、データコード領域を高速にアクセスす
るためのデータコード領域の任意の位置を示すポインタ
を示し、このポインタP1から16ビットディスプレー
スメントでアクセスできるデータコード領域901に
「Sdata」が配置されている。このため、「Sda
ta」は、図14(B)に示すように、データコードア
クセス命令ld.wにより1命令でアクセスすることが
でき、このデータコードアクセス命令ld.wは、図1
4(A)のポインタを示す[gp]からのディスプレー
スメント$Sdataに格納されているSdataの値
を取り出し、汎用レジスタr20へ格納している。
Referring to FIG. 14A, a pointer P1 shown in FIG. 14A indicates a pointer indicating an arbitrary position in the data code area for accessing the data code area at high speed, and a 16-bit display is provided from the pointer P1. “Sdata” is arranged in the data code area 901 accessible by the statement. For this reason, "Sda
ta ”, as shown in FIG. 14B, the data code access instruction ld. w, the data code access instruction ld. w
4 (A), the value of Sdata stored in the displacement $ Sdata from [gp] indicating the pointer is extracted and stored in the general-purpose register r20.

【0022】しかし、図14(A)中の「Data」,
「Data1」は、ポインタP1から16ビットディス
プレースメントでアクセスできないデータコード領域9
00,901にそれぞれ配置されており、図14(C)
に示すように、データコードアクセス命令の16ビット
ディスプレースメント指定では表現できないため、2命
令を必要とする。まず、命令movhiにより、Dat
aの上位16ビットを取り出し、汎用レジスタr1に格
納し、次に、データコードアクセス命令ld.wによ
り、前記のDataの下位16ビットと前記の汎用レジ
スタr1で32ビットのディスプレースメントを表現
し、Dataの値を取り出して汎用レジスタr20に格
納している。このため、16ビットディスプレースメン
トでアクセスできないデータコード領域900,901
に配置されているデータコードへのアクセス頻度が高い
プログラムにおいては、実行速度が低下する。
However, “Data” in FIG.
“Data1” is a data code area 9 that cannot be accessed by a 16-bit displacement from the pointer P1.
00 and 901 respectively, as shown in FIG.
As shown in (1), two instructions are required because they cannot be expressed by the 16-bit displacement specification of the data code access instruction. First, by the instruction movhi, Dat
a, the upper 16 bits of the data code access instruction ld. By using w, the lower 16 bits of the data and the general-purpose register r1 represent a 32-bit displacement, and the value of Data is extracted and stored in the general-purpose register r20. Therefore, the data code areas 900 and 901 that cannot be accessed by the 16-bit displacement
The execution speed of a program that frequently accesses the data code arranged in the program is reduced.

【0023】また、従来技術において、データコード領
域のどこにどのデータコードを配置するかを指定するこ
とが可能な技術が存在するが、データコードのアクセス
頻度を知る手段がないため、効率的にアクセス頻度の高
いデータコードを16ビットディスプレースメントでア
クセス可能なデータコード領域に配置することが困難で
あった。
Further, in the prior art, there is a technique capable of designating where in the data code area which data code is to be arranged. However, since there is no means for knowing the access frequency of the data code, efficient access is required. It has been difficult to arrange frequently used data codes in a data code area accessible by 16-bit displacement.

【0024】[0024]

【発明が解決しようとする課題】上述した従来のマイク
ロプロセッサ用目的コードの最適化装置、最適化方法及
び最適化プログラムを記録した記録媒体は、コンパイル
部が生成した一次目的コードの命令コード(以下一次命
令コード)の解析を行い、次に、解析した一次命令コー
ドの実行を行い、最後に、プロファイルデータの生成を
行っており、シミュレータ上で実行して得られるプロフ
ァイルデータを基に、実行速度を低下させるキャッシュ
ミスペナルティを解析し、キャッシュミスペナルティを
できるだけ小さくするために目的コードを再スケジュー
リングするコードスケジューリング処理を行い、目的コ
ード生成部により、最終的な目的コードを生成し、その
実行速度を向上させていたが、アクセスできるデータコ
ードのディスプレースメントの範囲外にあるデータコー
ド(以下、ディスプレースメント範囲外データコード)
においては、1命令でアクセスすることができず、複数
命令でアクセスしなければならないため、ディスプレー
スメント範囲外データコードへのアクセス頻度が高いプ
ログラムにおいては、実行速度が低下するという欠点が
あった。
The above-described conventional object code optimizing apparatus for a microprocessor, an optimizing method, and a recording medium on which an optimizing program are recorded include an instruction code (hereinafter, referred to as a primary object code) generated by a compiling unit. (Primary instruction code) is analyzed, and then the analyzed primary instruction code is executed. Finally, profile data is generated. Based on the profile data obtained by executing on the simulator, the execution speed is calculated. Analyze the cache miss penalty that reduces the cache miss penalty, perform code scheduling processing to reschedule the target code in order to minimize the cache miss penalty, generate the final target code by the target code generator, and reduce the execution speed. Improved display of accessible data codes Assessments range data code at the (hereinafter, displacement range data code)
In this case, the program cannot be accessed by one instruction but must be accessed by a plurality of instructions. Therefore, in a program in which the frequency of accessing the data code outside the displacement range is high, there is a disadvantage that the execution speed is reduced.

【0025】本発明の目的は、ディスプレースメント範
囲外データコードであっても、目的コード中のデータコ
ードを再配置し、プログラムの実行速度を向上させるマ
イクロプロセッサ用目的コードの最適化装置、最適化方
法及び最適化プログラムを記録した記録媒体を提供する
ことにある。
An object of the present invention is to provide an object code optimizing apparatus for a microprocessor which rearranges data codes in an object code even if the data code is out of a displacement range, thereby improving a program execution speed. An object of the present invention is to provide a recording medium recording a method and an optimization program.

【0026】[0026]

【課題を解決するための手段】請求項1記載の発明のマ
イクロプロセッサ用目的コードの最適化装置は、記録媒
体に記録されたコンパイル用プログラムである入力コー
ドをプロファイルデータを用いてコンパイルして一次目
的コードを生成するコンパイル部と、前記一次目的コー
ドをシミュレーションし前記プロファイルデータを生成
するシミュレータとを備えるマイクロプロセッサ用目的
コードの最適化装置において、前記シミュレータが、前
記コンパイル部が生成した前記一次目的コードの命令コ
ードを解析してこの命令コード対応処理の実行である命
令コード実行を行い、前記命令コード実行によるデータ
コードのアクセス回数をアドレス及びアクセス対象のデ
ータコードのサイズ毎に記録したデータアクセス情報に
基づきアクセス頻度の高いデータコードを検出し、1命
令でアクセス可能なデータコード領域であるキャッシュ
領域に再配置して二次目的コードを生成し、前記二次目
的コードの命令コードを解析して前記命令コード実行を
行うことにより、高速のシミュレーション実行を可能と
することを特徴とするものである。
According to a first aspect of the present invention, there is provided an apparatus for optimizing an object code for a microprocessor, comprising compiling an input code, which is a compile program recorded on a recording medium, using profile data to obtain a primary code. An object code optimization device for a microprocessor, comprising: a compiling unit that generates an object code; and a simulator that simulates the primary object code and generates the profile data, wherein the simulator generates the primary object generated by the compiling unit. Data access information in which the instruction code of the code is analyzed to execute the instruction code corresponding processing, and the number of accesses of the data code by the execution of the instruction code is recorded for each address and the size of the data code to be accessed. Access frequently based on , A secondary purpose code is generated by relocating to the cache area which is a data code area accessible by one instruction, and the instruction code of the secondary purpose code is analyzed to execute the instruction code. Is performed to enable high-speed simulation execution.

【0027】また、請求項2記載の発明は、請求項1記
載のマイクロプロセッサ用目的コードの最適化装置にお
いて、前記シミュレータが、前記コンパイル部で生成し
た目的コードである一次目的コード又は前記シミュレー
タが生成した目的コードである二次目的コードのいずれ
か一方(以下目的コード)の命令コードの解析を行う命
令コード解析部と、解析した前記命令コードの実行を行
う命令シミュレーション部と、前記命令コードの実行の
結果に基づき前記プロファイルデータを生成するプロフ
ァイルデータ生成部と、前記一次目的コード中のデータ
アクセス命令の解析を行い、このデータアクセスアドレ
ス(以下アドレス)とデータアクセスサイズ(以下サイ
ズ)をデータアクセス情報に出力するデータアクセス情
報生成部と、前記データアクセス情報を参照してアドレ
ス毎のアクセス頻度の降順にデータコードをソートし、
同一アドレスでの最大サイズの前記データコードを選択
データコードとして選択し、前記キャッシュ領域に前記
アクセス頻度の降順に前記選択データコードを再配置し
命令コードを補正するデータ再配置部と、前記データ再
配置部が再配置したデータ及び補正した命令コードを前
記二次目的コードとして生成する二次目的コード生成部
とを備えて構成されている。
According to a second aspect of the present invention, in the apparatus for optimizing an object code for a microprocessor according to the first aspect, the simulator comprises a primary object code or an object code generated by the compiling unit. An instruction code analyzing unit that analyzes an instruction code of one of the secondary objective codes (hereinafter, an objective code) that is the generated objective code; an instruction simulation unit that executes the analyzed instruction code; A profile data generating unit for generating the profile data based on a result of the execution, analyzing a data access instruction in the primary object code, and determining a data access address (hereinafter an address) and a data access size (hereinafter a size) by data access; A data access information generating unit for outputting information, Referring to over data access information to sort the data code in descending order of access frequency of each address,
A data rearrangement unit that selects the maximum size data code at the same address as a selected data code, rearranges the selected data code in the cache area in descending order of the access frequency, and corrects an instruction code; A secondary purpose code generation unit configured to generate the rearranged data and the corrected instruction code as the secondary purpose code by the arranging unit.

【0028】また、請求項3記載の発明は、請求項2記
載のマイクロプロセッサ用目的コードの最適化装置にお
いて、前記データアクセス情報生成部が、前記一次目的
コード中の前記データアクセス命令の解析を行い、前記
データアクセスアドレスとサイズを検出するデータアク
セス命令解析部と、前記データアクセス命令解析部で検
出した前記データアドレスと前記データアクセスサイズ
とを前記データアクセス情報に出力するデータアクセス
情報出力部とを備えて構成されている。
According to a third aspect of the present invention, in the apparatus for optimizing an object code for a microprocessor according to the second aspect, the data access information generating section analyzes the data access instruction in the primary object code. A data access instruction analysis unit for detecting the data access address and size, and a data access information output unit for outputting the data address and the data access size detected by the data access instruction analysis unit to the data access information. It is provided with.

【0029】また、請求項4記載の発明は、請求項2記
載のマイクロプロセッサ用目的コードの最適化装置にお
いて、前記データ再配置部が、前記データアクセス情報
を参照しアドレス毎にアクセス頻度の降順にデータコー
ドをソートして最大サイズのデータコードを選択し、前
記キャッシュ領域にアクセス頻度の降順に再配置し、再
配置後のアドレスを前記データアクセス情報にそれぞれ
付加し再配置情報として出力するデータ再配置実行部
と、読み出した前記目的コードがデータコードアクセス
命令でありかつそのアクセスアドレスが前記再配置情報
の再配置前のアクセスアドレスと一致する場合に前記目
的コードのアクセスアドレスを配置後のアクセスアドレ
スに置き換え命令コードを補正する命令コード補正部と
を備えて構成されている。
According to a fourth aspect of the present invention, in the apparatus for optimizing an object code for a microprocessor according to the second aspect, the data rearrangement unit refers to the data access information in descending order of access frequency for each address. The data to be sorted, the data code having the largest size is selected, the data is rearranged in the cache area in descending order of access frequency, the addresses after the rearrangement are added to the data access information, and the data is output as the rearrangement information. A relocation execution unit that, when the read target code is a data code access instruction and the access address matches the access address before the relocation of the relocation information, sets the access address of the target code after the relocation; And an instruction code correction unit for correcting the instruction code replaced with the address. That.

【0030】請求項5記載の発明のマイクロプロセッサ
用目的コードの最適化方法は、記録媒体に記録されたコ
ンパイル用プログラムである入力コードをプロファイル
データを用いてコンパイルして一次目的コードを生成
し、前記一次目的コードをシミュレーションし前記プロ
ファイルデータを生成するマイクロプロセッサ用目的コ
ードの最適化方法において、前記シミュレーションが、
前記コンパイルにより生成した前記一次目的コードの命
令コードを解析してこの命令コード対応処理の実行であ
る命令コード実行を行い、前記命令コード実行によるデ
ータコードのアクセス回数をアドレス及びアクセス対象
のデータコードのサイズ毎に記録したデータアクセス情
報に基づきアクセス頻度の高いデータコードを検出し、
1命令でアクセス可能なデータコード領域であるキャッ
シュ領域に再配置して二次目的コードを生成し、前記二
次目的コードの命令コードを解析して前記命令コード実
行を行うことにより、高速のシミュレーション実行を可
能とすることを特徴とするものである。
According to a fifth aspect of the present invention, there is provided a method for optimizing an object code for a microprocessor, comprising: compiling an input code, which is a compile program recorded on a recording medium, by using profile data to generate a primary object code; In a method for optimizing a target code for a microprocessor that simulates the primary target code and generates the profile data, the simulation includes:
The instruction code of the primary purpose code generated by the compilation is analyzed to execute the instruction code corresponding to the execution of the instruction code corresponding process, and the number of times the data code is accessed by executing the instruction code is determined by the address and the access target data code. Detects frequently accessed data codes based on data access information recorded for each size,
A high-speed simulation is performed by rearranging in the cache area which is a data code area accessible by one instruction, generating a secondary purpose code, analyzing the instruction code of the secondary purpose code, and executing the instruction code. It is characterized in that it can be executed.

【0031】請求項6記載の発明のマイクロプロセッサ
用目的コードの最適化方法は、記録媒体に記録されたコ
ンパイル用プログラムである入力コードをプロファイル
データを用いてコンパイルして一次目的コードを生成
し、前記一次目的コードをシミュレーションし前記プロ
ファイルデータを生成するマイクロプロセッサ用目的コ
ードの最適化方法において、前記一次目的コードの命令
コードの解析を行う命令コード解析ステップと、解析し
た前記一次命令コードの実行を行う命令シミュレーショ
ンステップと、前記一次命令コードの実行の結果に基づ
き前記プロファイルデータの生成を行うプロファイルデ
ータ生成ステップと、前記命令コード中のデータアクセ
ス命令の解析を行い、データのアクセスアドレスとアク
セスサイズを検出し、検出したデータの前記アクセスア
ドレスと前記アクセスサイズをデータアクセス情報に格
納するデータアクセス情報生成ステップと、前記データ
アクセス情報生成ステップで生成した前記データコード
のアクセス回数を前記アクセスアドレス及び前記アクセ
スサイズ毎に記録した前記データアクセス情報に基づき
アクセス頻度の降順に前記データコードを検出して1命
令でアクセス可能なデータコード領域であるキャッシュ
領域に前記アクセス頻度の降順に再配置し命令コードを
補正するデータ再配置ステップと、前記データ再配置ス
テップで補正した前記目的コードを二次目的コードとし
て生成する二次目的コード生成ステップとを有すること
を特徴とするものである。
According to a sixth aspect of the present invention, there is provided a method for optimizing an object code for a microprocessor, comprising: compiling an input code which is a compile program recorded on a recording medium by using profile data to generate a primary object code; In the method for optimizing a target code for a microprocessor that simulates the primary target code and generates the profile data, an instruction code analyzing step of analyzing an instruction code of the primary target code; and executing the analyzed primary instruction code. An instruction simulation step to perform, a profile data generation step to generate the profile data based on a result of the execution of the primary instruction code, and an analysis of a data access instruction in the instruction code to determine an access address and an access size of data. Detect A data access information generating step of storing the access address and the access size of the detected data in data access information, and the number of accesses of the data code generated in the data access information generating step for each of the access address and the access size. Based on the recorded data access information, the data code is detected in the descending order of the access frequency, and is relocated to the cache area, which is a data code area accessible by one instruction, in the descending order of the access frequency to correct the instruction code. And a secondary object code generating step of generating the object code corrected in the data rearrangement step as a secondary object code.

【0032】また、請求項7記載の発明は、請求項5記
載のマイクロプロセッサ用目的コードの最適化方法にお
いて、前記命令コード解析ステップが、前記シミュレー
ションの入力となる前記目的コードが、前記コンパイル
により生成された前記一次目的コードであるか、前記シ
ミュレーションにより生成された前記二次目的コードで
あるかの判定を行う一次/二次目的コード判定ステップ
と、前記一次/二次目的コード判定ステップで前記一次
目的コードであれば、この一次目的コードの命令コード
の解析を行う一次目的コード解析ステップと、前記一次
/二次目的コード判定ステップで前記二次目的コードで
あれば、この二次目的コードの命令コードの解析を行う
二次目的コード解析ステップとを有することを特徴とす
るものである。
According to a seventh aspect of the present invention, in the method for optimizing an object code for a microprocessor according to the fifth aspect, the instruction code analyzing step includes the step of compiling the object code as an input of the simulation by the compiling. A primary / secondary objective code determining step of determining whether the primary objective code is the generated primary objective code or the secondary objective code generated by the simulation; and If it is a primary purpose code, a primary purpose code analysis step for analyzing the instruction code of the primary purpose code, and if the primary purpose code is the secondary purpose code in the primary / secondary purpose code determination step, the primary purpose code is analyzed. And a secondary purpose code analyzing step of analyzing the instruction code.

【0033】また、請求項8記載の発明は、請求項6記
載のマイクロプロセッサ用目的コードの最適化方法にお
いて、前記データアクセス情報生成ステップが、前記命
令コード中の前記データアクセス命令の解析を行い、こ
のデータアクセス命令の前記データアクセスアドレスと
前記アクセスサイズを検出するデータアクセス命令解析
ステップと、検出した前記データアクセスアドレスと前
記アクセスサイズを前記データアクセス情報に出力し、
前記データアクセス情報内のアクセス回数をインクリメ
ントするデータアクセス情報出力ステップとを有するこ
とを特徴とするものである。
According to an eighth aspect of the present invention, in the method of optimizing an object code for a microprocessor according to the sixth aspect, the data access information generating step analyzes the data access instruction in the instruction code. A data access instruction analyzing step of detecting the data access address and the access size of the data access instruction, and outputting the detected data access address and the access size to the data access information;
Outputting a data access information for incrementing the number of accesses in the data access information.

【0034】また、請求項9記載の発明は、請求項6記
載のマイクロプロセッサ用目的コードの最適化方法にお
いて、前記データ再配置ステップが、前記データアクセ
ス情報を参照して、アドレス毎にアクセス頻度の降順に
データコードをソートして最大アクセスサイズのデータ
コードを選択データコードとして選択し、この選択デー
タコードを前記キャッシュ領域にアクセス頻度の降順に
再配置し、再配置後のアドレスを前記データアクセス情
報にそれぞれ付加し再配置情報として出力するデータ再
配置実行ステップと、前記目的コードを1命令コードず
つ読み出し、前記目的コードがデータコードアクセス命
令でありかつそのアクセスアドレスが前記再配置情報の
再配置前のアクセスアドレスと一致する場合、一致した
データコードアクセス命令のアクセスアドレスを配置後
のアクセスアドレスに置き換えて命令コードを補正する
命令コード補正ステップとを有することを特徴とするも
のである。
According to a ninth aspect of the present invention, in the method of optimizing an object code for a microprocessor according to the sixth aspect, the data relocation step refers to the data access information to determine an access frequency for each address. The data code having the maximum access size is selected as the selected data code by sorting the data codes in descending order of the data size, the selected data code is rearranged in the cache area in the descending order of the access frequency, and the address after the rearrangement is set to the data access A data relocation execution step of adding the information to each piece of information and outputting as relocation information; reading the object code one instruction code at a time; If the previous access address matches, the matched data code access It is characterized in that it has an instruction code correction step of correcting the instruction code by replacing the access address of the scan instruction access address after placement.

【0035】また、請求項10記載の発明は、請求項8
記載のマイクロプロセッサ用目的コードの最適化方法に
おいて、前記データアクセス命令解析ステップが、前記
命令コード中の前記データアクセス命令がデータアクセ
ス命令であるか否かの判定を行い前記データアクセス命
令でなければ命令コード終了判定ステップに進むデータ
アクセス命令判定ステップと、前記データアクセス命令
判定ステップで前記データアクセス命令であれば前記デ
ータアクセス命令中のデータアクセスアドレスと前記ア
クセスサイズの取り出しを行うアドレスサイズ取り出し
ステップと、前記アドレスサイズ取り出しステップで取
り出した前記データアクセスアドレスと前記アクセスサ
イズに該当する前記データアクセス情報中のエントリを
検索する該当エントリ検索ステップと、前記データアク
セス情報に該当エントリがある場合、該当エントリアク
セス回数インクリメントステップに進む該当エントリ有
り判定ステップと、前記該当エントリのアクセス回数を
インクリメントする該当エントリアクセス回数インクリ
メントステップと、前記該当エントリ有り判定ステップ
で前記データアクセス情報に前記該当エントリがない場
合新規に、前記アドレスサイズ取り出しステップで取り
出した前記データアクセスアドレスと前記アクセスサイ
ズのエントリを前記データアクセス情報へ追加する新規
エントリ追加ステップと、命令コードの終了であるか否
かの判定を行い、終了でなければ命令コード解析ステッ
プへと戻り、終了であればデータ再配置ステップへ進む
前記命令コード終了判定ステップとを有することを特徴
とするものである。
The invention according to claim 10 is the same as that in claim 8
In the method for optimizing an object code for a microprocessor according to the above, the data access instruction analyzing step determines whether the data access instruction in the instruction code is a data access instruction, and determines whether the data access instruction is a data access instruction. A data access instruction determining step for proceeding to an instruction code end determining step; and an address size extracting step for extracting the data access address and the access size in the data access instruction if the data access instruction determining step is the data access instruction. An entry search step for searching for an entry in the data access information corresponding to the data access address and the access size extracted in the address size extraction step; and an entry corresponding to the data access information. If there is a corresponding entry, the corresponding entry presence count determining step proceeds to the corresponding entry access count increment step, the corresponding entry access count increment step increments the access count of the corresponding entry, and If there is no corresponding entry, a new entry adding step of adding the data access address and the access size entry extracted in the address size extracting step to the data access information, and determining whether the end of the instruction code is reached. A determination is made, and if not completed, the process returns to the instruction code analysis step, and if completed, the process proceeds to a data rearrangement step.

【0036】また、請求項11記載の発明は、請求項9
記載のマイクロプロセッサ用目的コードの最適化方法に
おいて、前記データ再配置実行ステップが、前記データ
アクセス情報に基づきアドレス毎のアクセス頻度の降順
に前記データコードをソートしソートデータを生成する
データソートステップと、前記ソートデータからアクセ
ス頻度の降順にデータコードを取り出すデータ取り出し
ステップと、取り出したアクセスアドレスと同一アドレ
スの前記データコードの中で最大アクセスサイズのデー
タコードを検索し選択データコードとして選択する最大
サイズエントリ検索ステップと、前記選択データコード
を前記キャッシュ領域に移動するキャッシュ領域移動ス
テップと、前記データアクセス情報に配置後アドレスを
付加し、再配置情報として出力する再配置情報出力ステ
ップと、前記キャッシュ領域の空領域が無いかの判定を
行い前記キャッシュ領域の空領域がまだ残っている場合
後述のデータ終了判定ステップへ進み、前記キャッシュ
領域の空領域がなくなった場合、後述の非キャッシュ領
域移動ステップへ進む空きキャッシュ領域無し判定ステ
ップと、前記ソートデータの全アドレスの終了であれ
ば、前記命令コード補正ステップへ進み、全アドレス終
了でなければ、前記データ取り出しステップへ戻り、以
上の処理を繰り返す前記データ終了判定ステップと、前
記ソートデータの残りのアクセスアドレスのデータコー
ドを低速でのアクセス可能なデータコード領域である非
キャッシュ領域へ移動し、前記再配置情報へ前記再配置
情報を出力し、前記命令コード補正ステップに進む前記
非キャッシュ領域移動ステップとを有することを特徴と
するものである。
The invention according to claim 11 is the invention according to claim 9
In the method for optimizing an object code for a microprocessor according to the above, the data relocation execution step includes a step of sorting the data codes in descending order of access frequency for each address based on the data access information to generate sort data. A data fetching step of fetching data codes in descending access frequency order from the sorted data, and a maximum size for searching for a data code having a maximum access size among the data codes having the same address as the fetched access address and selecting the data code as a selected data code An entry search step, a cache area moving step of moving the selected data code to the cache area, a rearrangement information output step of adding a post-placement address to the data access information and outputting it as relocation information, It is determined whether or not there is an empty area in the cache area. If the empty area in the cache area still remains, the process proceeds to a data end determination step described later. Proceeding to a step, there is no free cache area determination step, and if all the addresses of the sort data are completed, proceed to the instruction code correction step; if not, return to the data fetching step and repeat the above processing. The data end determination step, and move the data code of the remaining access address of the sorted data to a non-cache area that is a low-speed accessible data code area, and output the relocation information to the relocation information; Moving the non-cache area to the instruction code correcting step. And it is characterized in Rukoto.

【0037】また、請求項12記載の発明は、請求項9
記載のマイクロプロセッサ用目的コードの最適化方法に
おいて、前記命令コード補正ステップが、前記一次目的
コードから1命令コードを取り出す1命令コード取り出
しステップと、前記命令コードを最後まで読み出したか
の判定を行い、最後まで読み出したならば、終了し、ま
だ読み込むべき命令コードが残っていれば、後述のアク
セス命令判定ステップへ進む命令コード終了判定ステッ
プと、前記1命令コード取り出しステップで読み出した
前記命令コードが前記データコードアクセス命令でなけ
れば、前記1命令コード取り出しステップへ戻り、前記
命令コードが前記データコードアクセス命令であれば、
次の一致検索ステップへ進む前記アクセス命令判定ステ
ップと、前記再配置情報内を検索し、前記データコード
アクセス命令のアクセスアドレスと前記再配置情報内の
配置前アドレスとが一致するエントリである一致エント
リを探す前記一致検索ステップと、前記一致検索ステッ
プで前記一致エントリが見つかった場合、次の置換ステ
ップへ進み、前記1命令コード取り出しステップへ戻
り、以上の処理を反復し、前記一致検索ステップで前記
一致エントリが見つからなかった場合、前記1命令コー
ド取り出しステップへ戻り、以上の処理を反復する一致
判定ステップと、データコードアクセス命令のアドレス
を前記一致エントリの配置後アドレスに置き換える前記
置換ステップとを有することを特徴とするものである。
The invention according to claim 12 is the invention according to claim 9
In the method for optimizing an object code for a microprocessor according to the above, the instruction code correcting step includes: an instruction code extracting step of extracting one instruction code from the primary object code; and determining whether the instruction code has been read to the end. When the instruction code to be read is read, the operation is terminated. If there is still an instruction code to be read, an instruction code end determination step proceeds to an access instruction determination step described later. If it is not a code access instruction, the process returns to the one instruction code fetching step, and if the instruction code is the data code access instruction,
An access instruction determining step for proceeding to a next match search step; and a matching entry for searching the relocation information, wherein an access address of the data code access instruction matches an address before arrangement in the relocation information. If the match entry is found in the match search step and the match search step, the process proceeds to the next replacement step, returns to the one instruction code extraction step, and repeats the above processing. When a matching entry is not found, the method returns to the one instruction code fetching step, and includes a matching determining step of repeating the above processing, and a replacing step of replacing an address of a data code access instruction with a post-arrangement address of the matching entry. It is characterized by the following.

【0038】また、請求項13記載の発明は、請求項9
記載のマイクロプロセッサ用目的コードの最適化方法に
おいて、前記データ再配置実行ステップが、前記データ
アクセス情報に基づきアドレス毎のアクセス頻度の降順
に前記データコードをソートしソートデータを生成する
データソートステップと、前記ソートデータからアクセ
ス頻度の降順にデータコードを取り出すデータ取り出し
ステップと、取り出したアクセスアドレスと同一アドレ
スの前記データコードの中で最大アクセスサイズのデー
タコードを検索し選択データコードとして選択する最大
サイズエントリ検索ステップと、前記キャッシュ領域の
空領域が無いかの判定を行い前記キャッシュ領域の空領
域がまだ残っている場合後述のキャッシュ領域移動ステ
ップへ進み、前記キャッシュ領域の空領域がなくなった
場合、後述の非キャッシュ領域移動ステップへ進む空き
キャッシュ領域無し判定ステップと、前記選択データコ
ードを前記キャッシュ領域に移動するキャッシュ領域移
動ステップと、前記ソートデータの残りのアクセスアド
レスのデータコードを低速でのアクセス可能なデータコ
ード領域である非キャッシュ領域へ移動する前記非キャ
ッシュ領域移動ステップと、前記データアクセス情報に
配置後アドレスを付加し、再配置情報として出力する再
配置情報出力ステップと、前記ソートデータの全アドレ
スの終了であれば、前記命令コード補正ステップへ進
み、全アドレス終了でなければ、前記データ取り出しス
テップへ戻り、以上の処理を繰り返す前記データ終了判
定ステップとを有することを特徴とするものである。
The thirteenth aspect of the present invention provides the ninth aspect.
In the method for optimizing an object code for a microprocessor according to the above, the data relocation execution step includes a step of sorting the data codes in descending order of access frequency for each address based on the data access information to generate sort data. A data fetching step of fetching a data code in descending access frequency order from the sorted data; and a maximum size for searching for a data code having a maximum access size among the data codes having the same address as the fetched access address and selecting the data code as a selected data code. An entry search step and a determination as to whether there is no empty area in the cache area, and if an empty area in the cache area still remains, proceed to a cache area moving step described below, and if there is no empty area in the cache area, Non-keys described later Determining that there is no free cache area, proceeding to a cache area moving step, moving the selected data code to the cache area, and moving the data code of the remaining access address of the sorted data at a low speed. A non-cache area moving step of moving to a non-cache area which is a code area; a rearrangement information output step of adding a post-placement address to the data access information and outputting it as relocation information; If it is completed, the process proceeds to the instruction code correction step, and if not all the addresses are completed, the process returns to the data fetching step, and the data end determining step of repeating the above processing is provided.

【0039】また、請求項14記載の発明は、請求項9
記載のマイクロプロセッサ用目的コードの最適化方法に
おいて、前記命令コード補正ステップが、前記再配置情
報から1エントリを取り出す再配置情報取り出しステッ
プと、前記再配置情報の終わりまで検索したか否かの判
定を行い、前記再配置情報の終わりであれば終了し、前
記再配置情報の終わりでなければ次の第1の1命令コー
ド取り出しステップへ進む再配置情報終了判定ステップ
と、前記一次目的コードから1命令コードを取り出す前
記第1の1命令コード取り出しステップと、前記1命令
コード取り出しステップで読み出した前記命令コードが
前記データコードアクセス命令でなければ、前記1命令
コード取り出しステップへ戻り、前記命令コードが前記
データコードアクセス命令であれば、次の配置後アドレ
ス置換ステップへ進むアクセス命令判定ステップと、前
記再配置情報内を検索し、前記データコードアクセス命
令のアクセスアドレスと前記再配置情報内の配置前アド
レスとが一致する一致エントリを探し、前記一致エント
リの配置後アドレスへの置換処理を行う前記配置後アド
レス置換ステップと、前記一次目的コードから1命令コ
ードを取り出す第2の1命令コード取り出しステップ
と、前記命令の終了か否かの判定を行い、終了でなけれ
ば前記アクセス命令判定ステップへ戻り、以下の処理を
反復し、終了であれば前記再配置情報取り出しステップ
へ戻り以下の処理を反復する命令コード終了判定ステッ
プとを有することを特徴とするものである。
The invention according to claim 14 is the invention according to claim 9
In the method for optimizing an object code for a microprocessor according to the above, the instruction code correcting step is a step of retrieving one entry from the relocation information, and determining whether or not the search is performed up to the end of the relocation information. If it is the end of the relocation information, the process is terminated. If the end of the relocation information is not the end, the process proceeds to the next first instruction code fetching step. The first one instruction code fetching step of fetching an instruction code; and if the instruction code read in the one instruction code fetching step is not the data code access instruction, the process returns to the one instruction code fetching step, and the instruction code is If it is the data code access instruction, go to the next post-placement address replacement step. An access instruction determining step; searching the relocation information for a matching entry in which the access address of the data code access instruction matches the pre-placement address in the relocation information; The post-placement address replacement step of performing a replacement process to a second instruction code extracting step of extracting one instruction code from the primary target code, and determining whether or not the instruction is completed. The method further comprises an instruction code end determining step of returning to the access instruction determining step, repeating the following processing, and returning to the relocation information extracting step if it is completed, and repeating the following processing.

【0040】請求項15記載の発明のマイクロプロセッ
サ用目的コードの最適化プログラムを記録した記録媒体
は、コンパイル用プログラムである入力コードをプロフ
ァイルデータを用いてコンパイルして一次目的コードを
生成し、前記一次目的コードをシミュレーションし前記
プロファイルデータを生成するマイクロプロセッサ用目
的コードの最適化プログラムを記録した記録媒体におい
て、前記シミュレーションが、前記コンパイルにより生
成した前記一次目的コードの命令コードを解析してこの
命令コード対応処理の実行である命令コード実行を行
い、前記命令コード実行によるデータコードのアクセス
回数をアドレス及びアクセス対象のデータコードのサイ
ズ毎に記録したデータアクセス情報に基づきアクセス頻
度の高いデータコードを検出し、1命令でアクセス可能
なデータコード領域であるキャッシュ領域に再配置して
二次目的コードを生成し、前記二次目的コードの命令コ
ードを解析して前記命令コード実行を行うことにより、
高速のシミュレーション実行を可能とすることを特徴と
するものである。
According to a fifteenth aspect of the present invention, there is provided a recording medium on which a program for optimizing an object code for a microprocessor is compiled, wherein an input code which is a compile program is compiled using profile data to generate a primary object code. In a recording medium storing a microprocessor object code optimization program that simulates a primary object code and generates the profile data, the simulation analyzes an instruction code of the primary object code generated by the compilation, and executes the instruction code. An instruction code is executed, which is the execution of the code-corresponding process, and the number of accesses to the data code by the execution of the instruction code is determined based on data access information recorded for each address and the size of the data code to be accessed. By relocating to the cache area, which is a data code area accessible by one instruction, to generate a secondary purpose code, analyze the instruction code of the secondary purpose code, and execute the instruction code. ,
It is characterized in that a high-speed simulation can be executed.

【0041】請求項16記載の発明のマイクロプロセッ
サ用目的コードの最適化プログラムを記録した記録媒体
は、コンパイル用プログラムである入力コードをプロフ
ァイルデータを用いてコンパイルして一次目的コードを
生成し、前記一次目的コードをシミュレーションし前記
プロファイルデータを生成するマイクロプロセッサ用目
的コードの最適化プログラムを記録した記録媒体におい
て、前記一次目的コードの命令コードの解析を行う命令
コード解析ステップと、解析した前記一次命令コードの
実行を行う命令シミュレーションステップと、前記一次
命令コードの実行の結果に基づき前記プロファイルデー
タの生成を行うプロファイルデータ生成ステップと、前
記命令コード中のデータアクセス命令の解析を行い、デ
ータのアクセスアドレスとアクセスサイズを検出し、検
出したデータの前記アクセスアドレスと前記アクセスサ
イズをデータアクセス情報に格納するデータアクセス情
報生成ステップと、前記データアクセス情報生成ステッ
プで生成した前記データコードのアクセス回数を前記ア
クセスアドレス及び前記アクセスサイズ毎に記録した前
記データアクセス情報に基づきアクセス頻度の降順に前
記データコードを検出して1命令でアクセス可能なデー
タコード領域であるキャッシュ領域に前記アクセス頻度
の降順に再配置し命令コードを補正するデータ再配置ス
テップと、前記データ再配置ステップで補正した前記目
的コードを二次目的コードとして生成する二次目的コー
ド生成ステップとを有することを特徴とするものであ
る。
According to a sixteenth aspect of the present invention, there is provided a recording medium on which a program for optimizing an object code for a microprocessor according to the present invention is recorded. An instruction code analyzing step of analyzing an instruction code of the primary object code on a recording medium storing an optimization program of an object code for a microprocessor that simulates a primary object code and generates the profile data; and the analyzed primary instruction. An instruction simulation step for executing the code, a profile data generation step for generating the profile data based on a result of the execution of the primary instruction code, and a data access instruction in the instruction code is analyzed to access the data. Address and the access size of the detected data, and storing the access address and the access size of the detected data in data access information, and the number of accesses of the data code generated in the data access information generating step is The data code is detected in descending order of access frequency based on the access address and the data access information recorded for each access size, and is rearranged in a cache area which is a data code area accessible by one instruction in descending order of access frequency. A data rearrangement step of correcting an instruction code; and a secondary object code generation step of generating the object code corrected in the data rearrangement step as a secondary object code.

【0042】[0042]

【発明の実施の形態】次に、本発明の実施の形態につい
て図面を参照して詳細に説明する。
Next, embodiments of the present invention will be described in detail with reference to the drawings.

【0043】本実施の形態のマイクロプロセッサ用目的
コードの最適化装置及び最適化方法は、記録媒体に記録
されたコンパイル用プログラムである入力コードをプロ
ファイルデータを用いてコンパイルして一次目的コード
を生成するコンパイル部と、上記一次目的コードをシミ
ュレーションし上記プロファイルデータを生成するシミ
ュレータとを備えるマイクロプロセッサ用目的コードの
最適化装置において、上記シミュレータが、上記コンパ
イル部が生成した上記一次目的コードの命令コードを解
析してこの命令コード対応処理の実行である命令コード
実行を行い、上記命令コード実行によるデータコードの
アクセス回数をアドレス及びアクセス対象のデータコー
ドのサイズ毎に記録したデータアクセス情報に基づきア
クセス頻度の高いデータコードを検出し、1命令でアク
セス可能なデータコード領域であるキャッシュ領域に再
配置して二次目的コードを生成し、この二次目的コード
の命令コードを解析して上記命令コード実行を行うこと
により、高速のシミュレーション実行を可能とすること
を特徴とするものである。
The apparatus and method for optimizing the object code for a microprocessor according to the present embodiment compiles an input code, which is a compile program recorded on a recording medium, using profile data to generate a primary object code. And a simulator that simulates the primary object code and generates the profile data, wherein the simulator has an instruction code of the primary object code generated by the compiling unit. And executes the instruction code corresponding to the execution of the instruction code corresponding processing. The access frequency based on the data access information recorded for each address and the size of the data code to be accessed by the execution of the instruction code. High Data code is detected and rearranged in a cache area, which is a data code area accessible by one instruction, to generate a secondary purpose code, analyze the instruction code of the secondary purpose code, and execute the above instruction code. Thus, a high-speed simulation can be performed.

【0044】ここで、コンパイラが生成した一次目的コ
ードとは、C言語、FORTRAN,COBOLなどの
高級プログラミング言語を、目的とするCPU上の機械
語命令コード及びデータコードに翻訳したものを意味す
る。
Here, the primary purpose code generated by the compiler means a high-level programming language such as C language, FORTRAN, COBOL translated into a machine language instruction code and data code on a target CPU.

【0045】また、1命令でアクセス可能なデータコー
ド領域、すなわち、キャッシュ領域とは、一般的なキャ
ッシュメモリ(以下キャッシュ)だけではなく、例え
ば、従来技術の図4で説明したポインタP1の16ビッ
トディスプレースメント範囲の領域901のようなデー
タコード記憶領域を意味する。
A data code area that can be accessed by one instruction, that is, a cache area is not only a general cache memory (hereinafter, cache), but also a 16-bit pointer P1 described in FIG. It means a data code storage area such as a displacement range area 901.

【0046】次に、本発明の実施の形態を図13と共通
の構成要素には共通の参照文字/数字を付して同様にブ
ロックで示す図2(A)を参照すると、この図に示す本
実施の形態のマイクロプロセッサ用目的コードの最適化
装置は、記録媒体に記録されたコンパイル用プログラム
である入力コードF5をプロファイルデータF2を用い
てコンパイルして一次目的コードF1を生成するコンパ
イル部2と、一次目的コードF1をシミュレーションし
プロファイルデータF2を生成するとともに二次目的コ
ードF4を生成するマシン又はシミュレータであるシミ
ュレータ1とを備える。
Next, referring to FIG. 2 (A), which shows the embodiment of the present invention in the same manner as FIG. The object code optimizing device for a microprocessor according to the present embodiment compiles an input code F5, which is a compile program recorded on a recording medium, using profile data F2 to generate a primary object code F1. And a simulator 1 that is a machine or a simulator that simulates the primary purpose code F1 to generate profile data F2 and generates the secondary purpose code F4.

【0047】シミュレータ1は、一次目的コードF1か
ら読み出した一次命令コードを解析してこの一次命令コ
ードの命令コード実行をシミュレーションしてプロファ
イルデータF1を生成し、命令コード実行に伴うデータ
コードのアクセス回数をアドレス及びアクセスサイズ毎
に記録したデータアクセス情報F3を生成し、このデー
タアクセス情報F3に基づきアクセス頻度の高いデータ
コードを検出し、1命令でアクセス可能なデータコード
領域に再配置し、二次目的コードF4を生成する。
The simulator 1 analyzes the primary instruction code read from the primary purpose code F1, simulates the execution of the instruction code of the primary instruction code, generates profile data F1, and accesses the data code with the execution of the instruction code. Is generated for each address and access size, a data code having a high access frequency is detected based on the data access information F3, and is rearranged in a data code area accessible by one instruction. A purpose code F4 is generated.

【0048】入力コードF5は、例えば、C言語、JA
VA言語、FORTRAN言語などの高級言語で記述し
たものである。
The input code F5 is, for example, C language, JA
It is described in a high-level language such as a VA language or a FORTRAN language.

【0049】コンパイル部2は、入力コードF5の実行
を行うソフトウェア機能手段として、入力コードF5の
供給を受けこの入力コードF5の字句解析及び構文解析
を行うフロントエンド21と、後述するバックエンド2
2とを備える。
The compiling unit 2 includes a front end 21 which receives the input code F5 and performs lexical analysis and syntax analysis of the input code F5, and a back end 2 which will be described later, as software function means for executing the input code F5.
2 is provided.

【0050】バックエンド22は、一次目的コードF1
/二次目的コードF4のシミュレーション結果であるプ
ロファイルデータF2を基にキャッシュミスペナルティ
をできるだけ小さくするために命令コードのスケジュー
リングを行うコードスケジューリング部221と、コー
ドスケジューリング部221のコードスケジューリング
結果に基づきシミュレータ1上で実行可能な一次目的コ
ードF1を生成する目的コード生成部222とを備え
る。
The back end 22 has a primary purpose code F1
/ A code scheduling unit 221 for scheduling instruction codes to minimize cache miss penalty based on profile data F2, which is a simulation result of the secondary purpose code F4, and a simulator 1 based on the code scheduling result of the code scheduling unit 221. And a target code generation unit 222 that generates a primary target code F1 that can be executed above.

【0051】コードスケジューリング部221の構成例
をブロックで示す図2(B)を参照すると、このコード
スケジューリング部221は、一次目的コードF1のシ
ミュレーション結果であるプロファイルデータF2を解
析しキャッシュミスペナルティ発生部分を検出するとと
もにコードスケジューリング実行部224で利用するた
めのキャッシュ動作情報を出力するプロファイルデータ
解析部223と、上記キャッシュ動作情報に基づき検出
したキャッシュミスペナルティ軽減のための命令コード
の再スケジューリングを行うコードスケジューリング実
行部224とを備える。
Referring to FIG. 2B, which shows a block diagram of an example of the configuration of the code scheduling section 221, the code scheduling section 221 analyzes profile data F2, which is a simulation result of the primary target code F1, and generates a cache miss penalty generating portion. And a code for rescheduling an instruction code for reducing cache miss penalty detected based on the cache operation information, and a profile data analysis unit 223 for outputting cache operation information for use by the code scheduling execution unit 224. A scheduling execution unit 224.

【0052】ここで、このキャッシュ動作情報とは、キ
ャッシュミスしたデータを主記憶からキャッシュに読み
込む動作が各動作クロックで行われている否かを表わす
情報である。
Here, the cache operation information is information indicating whether or not the operation of reading the cache-missed data from the main memory into the cache is performed at each operation clock.

【0053】本実施の形態を特徴付けるシミュレータ1
の構成を図13(B)と共通の構成要素には共通の参照
文字/数字を付して同様にブロックで示す図1(A)を
参照すると、従来と共通のコンパイル部2で生成した目
的コードである一次目的コードF1又はシミュレータ1
が生成した二次目的コードF4(以下、一次又は二次目
的コードの両方を指す場合を目的コードFXと呼ぶ)の
命令コードの解析を行う命令コード解析部11と、解析
した命令コードの実行を行う命令シミュレーション部1
2と、プロファイルデータの生成を行いプロファイルデ
ータファイルF2(以下特記ない限りファイルを省略
し、例えばプロファイルデータF2等と呼ぶ)に格納す
るプロファイルデータ生成部13とに加えて、コンパイ
ル部2で生成した一次目的コードF1中のデータアクセ
ス命令の解析を行い、このデータアクセスアドレス(以
下アドレス)とデータアクセスサイズ(以下サイズ:デ
ータアクセスアドレスとデータアクセスサイズをデータ
アドレスとサイズと省略)をデータアクセス情報F3に
出力するデータアクセス情報生成部14と、データアク
セス情報F3を参照してアドレス毎のアクセス頻度の高
い順(降順)にデータコードをソートし、同一アドレス
での最大サイズのデータコードを選択データコードとし
て選択し、1命令でアクセス可能なデータコード領域
(以下キャッシュ領域)にアクセス頻度の降順に選択デ
ータコードを再配置し命令コードを補正するデータ再配
置部15と、データ再配置部15が再配置したデータ及
び補正した命令コードを二次目的コードF4として生成
する二次目的コード生成部16とを備える。
Simulator 1 characterizing the present embodiment
FIG. 1A, in which the same components as those in FIG. 13B are denoted by the same reference characters / numbers as in FIG. Primary purpose code F1 which is a code or simulator 1
The instruction code analyzing unit 11 analyzes the instruction code of the secondary object code F4 generated by the program (hereinafter, the case where both the primary and secondary object codes are referred to as the object code FX), and executes the analyzed instruction code. Instruction simulation unit 1
2 and a profile data generating unit 13 that generates profile data and stores the profile data in a profile data file F2 (hereinafter, the file is omitted unless otherwise specified, and is referred to as, for example, profile data F2). The data access instruction in the primary purpose code F1 is analyzed, and the data access address (hereinafter, the address) and the data access size (hereinafter, the size: the data access address and the data access size are abbreviated as the data address and the size) are described in data access information F3 The data codes are sorted in the order of decreasing access frequency (descending order) for each address with reference to the data access information generating unit 14 and the data access information F3, and the data code of the maximum size at the same address is selected. As a single instruction A data rearrangement unit 15 for rearranging selected data codes in an accessible data code area (hereinafter referred to as a cache area) in descending order of access frequency and correcting an instruction code; data rearranged by the data rearrangement unit 15 and corrected instructions A secondary purpose code generation unit 16 that generates a code as a secondary purpose code F4.

【0054】データアクセス情報生成部14の構成をブ
ロックで示す図1(B)を参照すると、このデータアク
セス情報生成部14は、コンパイル部2で生成した一次
目的コード中のデータアクセス命令の解析を行い、アド
レス及びサイズを検出するデータアクセス命令解析部1
41と、データアクセス命令解析部で検出したデータア
ドレスとサイズをデータアクセス情報F3に出力するデ
ータアクセス情報出力部142とを備える。
Referring to FIG. 1B, which shows the configuration of the data access information generation unit 14 by blocks, the data access information generation unit 14 analyzes the data access instruction in the primary purpose code generated by the compilation unit 2. Data access instruction analysis unit 1 for detecting addresses and sizes
41, and a data access information output unit 142 that outputs the data address and size detected by the data access instruction analysis unit to the data access information F3.

【0055】データ再配置部15の構成をブロックで示
す図1(C)を参照すると、このデータ再配置部15
は、データアクセス情報F3を参照しアドレス毎にアク
セス頻度の降順にデータコードをソートして最大サイズ
のデータコードを選択し、キャッシュ領域にアクセス頻
度順に再配置し、再配置後のアドレスをデータアクセス
情報F3にそれぞれ付加し再配置情報として出力するデ
ータ再配置実行部151と、読み出した目的コードFX
がデータコードアクセス命令でありかつその(目的コー
ドFXの)アドレスが再配置情報の再配置前のアドレス
と一致する場合に目的コードのアクセスを配置後のアド
レスに置き換え命令コードを補正する命令コード補正部
152とを備える。
Referring to FIG. 1C, which shows the configuration of the data rearrangement section 15 by blocks,
Refers to the data access information F3, sorts the data codes in descending order of access frequency for each address, selects the data code of the maximum size, rearranges them in the cache area in order of access frequency, and performs data access for the relocated addresses. A data relocation execution unit 151 that adds the information to the information F3 and outputs it as relocation information;
Is a data code access instruction, and when the address (of the target code FX) matches the address before the relocation of the relocation information, the access of the target code is replaced with the address after the relocation, and the instruction code correction for correcting the instruction code And a unit 152.

【0056】次に、図1、図2、及び本実施の形態のシ
ミュレータ1の処理をフローチャートで示す図3を参照
して本実施の形態の動作について説明すると、まず、コ
ンパイル部2のフロントエンド21は、入力コードF5
の供給を受けこの入力コードF5の字句解析及び構文解
析を行い、解析結果をバックエンド22に供給する。
Next, the operation of the present embodiment will be described with reference to FIG. 1 and FIG. 2 and FIG. 3 which is a flowchart showing the processing of the simulator 1 of the present embodiment. 21 is an input code F5
And analyzes the lexical and syntax of the input code F5, and supplies the analysis result to the back end 22.

【0057】次に、バックエンド22のコードスケジュ
ーリング部221は、有効設定された場合に、プロファ
イルデータF2を基にキャッシュミスペナルティをでき
るだけ小さくするために命令コードのスケジューリング
を行う。無効設定された場合は不動作となり、何も実行
しない。
Next, the code scheduling section 221 of the back end 22, when enabled, performs instruction code scheduling based on the profile data F2 to minimize cache miss penalty. If it is invalidated, it will not operate and will not execute anything.

【0058】有効設定の場合、まず、コードスケジュー
リング部221のプロファイルデータ解析部223は、
目的コードFXをシミュレータ1で実行して得たCPU
動作の記録であるプロファイルデータF2を解析しキャ
ッシュミスペナルティ発生部分を検出するとともにコー
ドスケジューリング実行部224で利用するためのキャ
ッシュ動作情報を出力し、コードスケジューリング実行
部224に供給する。次に、コードスケジューリング実
行部224は、供給を受けたキャッシュ動作情報に基づ
きプロファイルデータ解析部223で検出したキャッシ
ュミスペナルティを軽減するための命令コードの再スケ
ジューリングを行う。
In the case of the valid setting, first, the profile data analysis unit 223 of the code scheduling unit 221
CPU obtained by executing target code FX on simulator 1
The profile data F2, which is a record of the operation, is analyzed to detect a cache miss penalty occurrence portion, and at the same time, outputs cache operation information to be used by the code scheduling execution unit 224 and supplies it to the code scheduling execution unit 224. Next, the code scheduling execution unit 224 reschedules the instruction code for reducing the cache miss penalty detected by the profile data analysis unit 223 based on the supplied cache operation information.

【0059】目的コード生成部222は、コードスケジ
ューリング実行部224の命令コードの再スケジューリ
ング結果を受け、シミュレータ1上で実行可能な目的コ
ードを生成し、一次目的コードF1に出力する。
The target code generator 222 receives the result of the instruction code rescheduling by the code scheduling executor 224, generates a target code executable on the simulator 1, and outputs the target code to the primary target code F1.

【0060】シミュレータ1では、まず、命令コード解
析部11が、コンパイル部2が生成した一次目的コード
F1の命令コード(以下一次命令コード)の解析を行う
(命令コード解析ステップS1)。次に、命令シミュレ
ーション部12が、解析した一次命令コードの実行を行
う(命令シミュレーションステップS2)。次に、プロ
ファイルデータ生成部13が、一次命令コードの実行結
果に基づきプロファイルデータの生成を行い、プロファ
イルデータF2へ出力する(プロファイルデータ生成ス
テップS3)。ここまでは、従来と同様の処理である。
In the simulator 1, first, the instruction code analyzing unit 11 analyzes the instruction code of the primary purpose code F1 generated by the compiling unit 2 (hereinafter, the primary instruction code) (instruction code analyzing step S1). Next, the instruction simulation unit 12 executes the analyzed primary instruction code (instruction simulation step S2). Next, the profile data generation unit 13 generates profile data based on the execution result of the primary instruction code, and outputs the profile data to the profile data F2 (profile data generation step S3). The processing so far is the same as the conventional processing.

【0061】次に、データアクセス情報生成部14は、
命令コード中のデータアクセス命令の解析を行い、デー
タのアドレスとサイズを検出し、検出したデータのアド
レスとサイズをデータアクセス情報F3に格納する(デ
ータアクセス情報生成ステップS4)。
Next, the data access information generation unit 14
The data access instruction in the instruction code is analyzed, the address and size of the data are detected, and the address and size of the detected data are stored in the data access information F3 (data access information generation step S4).

【0062】まず、データアクセス命令解析部141
は、有効設定された場合、命令コード中のデータアクセ
ス命令の解析を行い、このデータアクセス命令のデータ
アドレスとサイズを検出する(データアクセス命令解析
ステップS41)。次に、データアクセス情報出力部1
42は、有効設定された場合、データアクセス命令解析
部141で検出したデータアドレスとサイズをデータア
クセス情報F3に出力し、データアクセス情報F3内の
アクセス回数をインクリメントする(データアクセス情
報出力ステップS42)。
First, the data access instruction analyzer 141
Analyzes the data access instruction in the instruction code, and detects the data address and size of the data access instruction (data access instruction analysis step S41). Next, the data access information output unit 1
42 outputs the data address and size detected by the data access instruction analysis unit 141 to the data access information F3 when the valid setting is made, and increments the number of accesses in the data access information F3 (data access information output step S42). .

【0063】データアクセス情報生成部14で生成され
るデータアクセス情報F3の内容例を説明図で示す図7
(A)を参照すると、このデータアクセス情報は、「ア
ドレス」、「アクセスサイズ」、「アクセス回数」とか
ら構成されている。ここで、「アドレス」は、アクセス
時のデータコードの格納アドレスを示し、「アクセスサ
イズ」は、アクセス時のデータコードのサイズを示し、
「アクセス回数」は、データコードのアクセス回数を示
す。
FIG. 7 is an explanatory diagram showing an example of the contents of data access information F3 generated by data access information generating section 14.
Referring to (A), this data access information is composed of “address”, “access size”, and “access count”. Here, “address” indicates the storage address of the data code at the time of access, “access size” indicates the size of the data code at the time of access,
The “access count” indicates the access count of the data code.

【0064】データ再配置部15は、有効設定された場
合、データアクセス情報生成部14が生成したデータコ
ードのアクセス回数をアドレス及びアクセスサイズ毎に
記録したデータアクセス情報F3に基づき、アクセス頻
度の高い順、すなわち降順にデータコードを検出して1
命令でアクセス可能なデータコード領域、すなわち、キ
ャッシュ領域にアクセス頻度の降順に再配置し命令コー
ドを補正する(データ再配置ステップS5)。
When the data relocation unit 15 is set to be valid, the access frequency of the data code generated by the data access information generation unit 14 is determined based on the data access information F3 recorded for each address and access size. Data code is detected in descending order,
The instruction code is rearranged in the data code area accessible by the instruction, that is, the cache area in descending order of access frequency to correct the instruction code (data rearrangement step S5).

【0065】このデータ再配置ステップS5は、まず、
データ再配置実行部151で、データアクセス情報F3
を参照して、アドレス毎にアクセス頻度の降順にデータ
コードをソートして最大アクセスサイズのデータコード
を選択データコードとして選択し、この選択データコー
ドをキャッシュ領域にアクセス頻度の降順に再配置し、
再配置後のアドレスをデータアクセス情報F3にそれぞ
れ付加し再配置情報として出力する(データ再配置実行
ステップS51)。図7(B)は再配置情報の記述例を
示す。
In the data relocation step S5, first,
In the data relocation execution unit 151, the data access information F3
, Sort the data codes in descending order of access frequency for each address, select the data code of the maximum access size as the selected data code, and rearrange the selected data code in the cache area in descending order of access frequency,
The addresses after the rearrangement are added to the data access information F3 and output as the rearrangement information (data rearrangement execution step S51). FIG. 7B shows a description example of the relocation information.

【0066】次に、命令コード補正部152で、目的コ
ードFXを1命令コードずつ読み出し、この目的コード
FXがデータコードアクセス命令でありかつそのアドレ
スが再配置情報の再配置前のアドレスと一致する場合、
一致したデータコードアクセス命令のアドレスを配置後
のアドレスに置き換えて命令コードを補正する(命令コ
ード補正ステップS52)。
Next, the instruction code correction unit 152 reads the target code FX one instruction code at a time, and the target code FX is a data code access instruction, and its address matches the address of the relocation information before relocation. If
The instruction code is corrected by replacing the address of the matched data code access instruction with the address after arrangement (instruction code correction step S52).

【0067】二次目的コード生成部16は、命令コード
補正部15により補正された目的コードを二次目的コー
ドF4として生成する(二次目的コード生成ステップS
6)。
The secondary purpose code generator 16 generates the target code corrected by the instruction code corrector 15 as a secondary target code F4 (secondary target code generation step S4).
6).

【0068】データアクセス命令解析部141のデータ
アクセス命令解析ステップS41とデータアクセス情報
出力部142のデータアクセス情報出力ステップS42
の各々の処理をそれぞれフローチャートで示す図4を併
せて参照してデータアクセス情報生成ステップS4の詳
細処理について説明すると、データアクセス命令解析ス
テップS41は、まず、データアクセス命令判定ステッ
プS411で、命令シミュレーション部12が実行した
命令コードがデータアクセス命令であるか否かの判定を
行う。データアクセス命令であれば次のアドレスサイズ
取り出しステップS412へと進む。データアクセス命
令でなければ命令コード終了判定ステップS425へと
進む。
The data access command analysis step S41 of the data access command analysis section 141 and the data access information output step S42 of the data access information output section 142
The detailed process of the data access information generation step S4 will be described with reference to FIG. 4 which shows each process in a flowchart. The data access command analysis step S41 first includes a data access command determination step S411 and an instruction simulation It is determined whether the instruction code executed by the unit 12 is a data access instruction. If it is a data access instruction, the process proceeds to the next address size fetching step S412. If it is not a data access instruction, the process proceeds to an instruction code end determination step S425.

【0069】次に、アドレスサイズ取り出しステップS
412において、データアクセス命令中のデータアドレ
スとサイズの取り出しを行う。
Next, address size extracting step S
At 412, the data address and the size in the data access instruction are extracted.

【0070】次に、該当エントリ検索ステップS421
において、アドレスサイズ取り出しステップS412に
おいて取り出したデータアドレスとサイズに該当する装
置内部の直接アクセス記憶データであるデータアクセス
情報F3中のエントリを検索する。
Next, the corresponding entry search step S421
In step S412, an entry in the data access information F3, which is the direct access storage data inside the device, corresponding to the data address and size extracted in the address size extraction step S412 is searched.

【0071】次に、該当エントリ有り判定ステップS4
22で直接アクセス記憶データであるデータアクセス情
報F3に該当エントリがある場合、該当エントリアクセ
ス回数インクリメントステップS423へと進む。該当
エントリアクセス回数インクリメントステップS423
で、該当エントリのアクセス回数をインクリメントす
る。該当エントリ有り判定ステップS422でデータア
クセス情報に該当エントリがない場合新規エントリ追加
ステップS424へと進み、新規に、アドレスサイズ取
り出しステップS412で取り出したデータアドレスと
サイズのエントリをデータアクセス情報F3へ追加す
る。
Next, the corresponding entry existence determination step S4
If there is a corresponding entry in the data access information F3 which is the direct access storage data at 22, the process proceeds to the corresponding entry access count increment step S423. Corresponding entry access count increment step S423
Then, the access count of the corresponding entry is incremented. If there is no corresponding entry in the data access information in the corresponding entry existence determination step S422, the process proceeds to a new entry adding step S424, and a new entry of the data address and size extracted in the address size extracting step S412 is added to the data access information F3. .

【0072】最後に、命令コード終了判定ステップS4
25で、命令コードの終了であるか否かの判定を行い、
終了でなければ命令コード解析ステップS1へと戻る。
終了であればデータ再配置ステップS5へと進む。
Finally, instruction code end determination step S4
At 25, it is determined whether or not the end of the instruction code is reached,
If not, the process returns to the instruction code analysis step S1.
If completed, the process proceeds to the data relocation step S5.

【0073】次に、データ再配置実行部151のデータ
再配置実行ステップS51と命令コード補正部152の
命令コード補正ステップS52の各々の処理をそれぞれ
フローチャートで示す図5,図6を併せて参照してデー
タ再配置ステップS5の詳細処理について説明すると、
まず、データ再配置実行ステップS51は、データソー
トステップS511で、データアクセス情報F3を基
に、アドレス毎のアクセス頻度の高い順(降順)にデー
タコードをソートし、ソートデータF6に出力する。
Next, the respective processes of the data relocation execution step S51 of the data relocation execution section 151 and the instruction code correction step S52 of the instruction code correction section 152 will be described with reference to FIGS. The detailed processing of the data relocation step S5 will be described below.
First, in a data rearrangement execution step S51, in a data sort step S511, based on the data access information F3, the data codes are sorted in the order of decreasing access frequency for each address (descending order) and output to the sort data F6.

【0074】次に、データ取り出しステップS512
で、ソートデータF6からアクセス頻度の降順にデータ
コードを取り出し、最大サイズエントリ検索ステップS
513で、取り出したアドレスと同一アドレスのデータ
コードの中で最大アクセスサイズのデータコードを検索
選択し、このデータコードをキャッシュ領域移動ステッ
プS514で1命令でアクセス可能なデータ領域である
キャッシュ領域に移動し、再配置情報出力ステップS5
15でデータアクセス情報に配置後アドレスを付加し、
再配置情報F7として出力する。図7(B)は、この再
配置情報F7の例を示す説明図である。
Next, a data fetching step S512
Then, the data codes are extracted from the sort data F6 in descending order of the access frequency, and the maximum size entry search step S
In step 513, the data code having the maximum access size is searched and selected from among the data codes of the same address as the extracted address, and this data code is moved to the cache area which is a data area accessible by one instruction in the cache area moving step S514. And relocation information output step S5
At 15, an address is added to the data access information after the arrangement,
Output as relocation information F7. FIG. 7B is an explanatory diagram showing an example of the relocation information F7.

【0075】次に、空きキャッシュ領域無し判定ステッ
プS516で、キャッシュ領域の空領域がまだ残ってい
る場合、データ終了判定ステップS518へ進み、ソー
トデータの全アドレスの終了であれば、命令コード補正
ステップS52へ進み、全アドレス終了でなければ、デ
ータ取り出しステップS512へ戻り、以上の処理を繰
り返す。
Next, in the step S516 of determining that there is no free cache area, if there is still an empty area in the cache area, the process proceeds to a data end determination step S518. Proceeding to S52, if all addresses are not completed, the process returns to the data fetching step S512, and the above processing is repeated.

【0076】また、空きキャッシュ領域無し判定ステッ
プS516で、キャッシュ領域の空領域がなくなった場
合、残りデータ移動ステップS517へ進み、ソートデ
ータの残りのアドレスのデータコードを低速にしかアク
セスできないデータコード領域である非キャッシュ領域
へ移動し、再配置情報F7へ再配置情報を出力し、命令
コード補正ステップS52に進む。
If there is no free space in the cache area in step S516 of determining that there is no free cache area, the flow advances to step S517 to move the remaining data to the data code area where the data code of the remaining address of the sort data can be accessed only at low speed. , And outputs the relocation information to the relocation information F7, and proceeds to the instruction code correction step S52.

【0077】命令コード補正ステップS52では、ま
ず、1命令コード取り出しステップS521で、一次目
的コードF1から1命令コードを取り出す。
In the instruction code correction step S52, first, in one instruction code extraction step S521, one instruction code is extracted from the primary purpose code F1.

【0078】次に、命令コード終了判定ステップS52
2において、命令コードを最後まで読み出したかの判定
を行い、最後まで読み出したならば、この命令コード補
正ステップS52を終了し、二次目的コード生成ステッ
プS6へ進む。
Next, an instruction code end determination step S52
In step 2, it is determined whether the instruction code has been read to the end. If the instruction code has been read to the end, the instruction code correction step S52 ends, and the process proceeds to the secondary purpose code generation step S6.

【0079】命令コード終了判定ステップS522で、
まだ読み込むべき命令コードが残っていれば、アクセス
命令判定ステップS523へ進む。アクセス命令判定ス
テップS523において、1命令コード取り出しステッ
プS521で読み出した命令コードがデータコードアク
セス命令でなければ、1命令コード取り出しステップS
521へ戻り、次の命令コードを読み出す。命令コード
がデータコードアクセス命令であれば、一致検索ステッ
プS524へと進み、再配置情報F7内を検索し、デー
タコードアクセス命令のアドレスと再配置情報F7内の
配置前アドレスとが一致するエントリを探す。
In the instruction code end determination step S522,
If there is still an instruction code to be read, the process proceeds to an access instruction determination step S523. In the access instruction determination step S523, if the instruction code read in the one instruction code fetch step S521 is not a data code access instruction, the one instruction code fetch step S521
Returning to 521, the next instruction code is read. If the instruction code is a data code access instruction, the process proceeds to a match search step S524 to search the relocation information F7 and find an entry in which the address of the data code access instruction matches the pre-arrangement address in the relocation information F7. look for.

【0080】最後に、一致判定ステップS525にて、
一致検索ステップS524で一致するエントリである一
致エントリが見つかった場合、置換ステップS526へ
進み、データコードアクセス命令のアドレスを上記一致
エントリの配置後アドレスに置き換え、1命令コード取
り出しステップS521へ戻り、以上の処理を反復す
る。また、一致検索ステップS524で一致エントリが
見つからなかった場合、1命令コード取り出しステップ
S521へ戻り、以上の処理を反復する。
Finally, in the match determination step S525,
If a matching entry that is a matching entry is found in the matching search step S524, the process proceeds to the replacing step S526, where the address of the data code access instruction is replaced with the address after the arrangement of the matching entry, and the process returns to the one instruction code extracting step S521. Is repeated. If no matching entry is found in the matching search step S524, the process returns to the one instruction code extracting step S521, and the above processing is repeated.

【0081】例えば、本実施形態のマイクロプロセッサ
用目的コードの最適化装置において、図12(A)に示
すようなC言語における共用体のコード例のように、ア
クセスサイズが異なるが同一データ領域をアクセスする
入力コードをコンパイルする場合、データアクセス情報
F3は、図12(B)に示すようになり、同一アドレス
のデータコードにおいて、小さいサイズのデータコード
のアクセス回数が、大きいサイズのデータコードのアク
セス回数より多い場合がある。
For example, in the apparatus for optimizing the object code for a microprocessor according to the present embodiment, like the code example of the union in the C language as shown in FIG. When compiling the input code to be accessed, the data access information F3 is as shown in FIG. 12B. In the data code of the same address, the number of accesses of the small-size data code is changed to the access number of the large-size data code. May be more than the number of times.

【0082】この場合、データ再配置ステップS5にお
いて、アクセス頻度の高いデータコードを優先して再配
置を行うため、番号2の2バイトのデータコードが再配
置の対象となるが、この番号2のデータコード領域は番
号1の4バイトのデータコードでもアクセスされている
ため、4バイトのデータコードが分断されないように、
最大のアクセスサイズである番号1の4バイトのデータ
コードを再配置の対象として選択する。つまり、同一デ
ータ領域をアクセスしているがアクセスサイズが異なる
場合、より大きなアクセスサイズでアクセスされている
データコードを1つの単位としてデータコード領域の再
配置を行う。
In this case, in the data rearrangement step S5, the data code having a high access frequency is prioritized for rearrangement. Therefore, the 2-byte data code of number 2 is to be rearranged. Since the data code area is accessed even with the 4-byte data code of number 1, the 4-byte data code is not divided so that
The 4-byte data code of number 1, which is the maximum access size, is selected as a relocation target. That is, when the same data area is accessed but the access size is different, the data code area is rearranged using the data code accessed with the larger access size as one unit.

【0083】以上説明したように、本実施の形態を特徴
付けるシミュレータ1は、データアクセス情報生成部1
4がデータアクセス情報F3を生成し、データ再配置部
15が、高アクセス頻度のデータをキャッシュ領域に再
配置処理するため、二次目的コード生成部6が生成した
目的コードを再度シミュレータ1上で実行する場合、高
アクセス頻度のデータコード領域へのアクセスが高速化
し、プログラムの実行速度が向上する。
As described above, the simulator 1 characterizing the present embodiment comprises the data access information generator 1
4 generates the data access information F3, and the data rearrangement unit 15 rearranges the frequently accessed data in the cache area. Therefore, the object code generated by the secondary object code generation unit 6 is regenerated on the simulator 1 again. In the case of execution, access to a data code area having a high access frequency is accelerated, and the execution speed of a program is improved.

【0084】特に、データコード領域内のデータコード
に対してループ処理を行う場合、著しい効果がある。例
えば、あるデータコード領域内の値を0に初期化するた
め100回のループを必要とするプログラム例におい
て、データコード領域が2命令でなく1命令でアクセス
可能な目的コードの場合、100命令分の実行時間だ
け、プログラムの実行速度が向上する。
Particularly, when the loop processing is performed on the data code in the data code area, there is a remarkable effect. For example, in an example of a program that requires 100 loops to initialize a value in a certain data code area to 0, if the data code area is a target code that can be accessed by one instruction instead of two instructions, The execution time of the program is improved by the execution time.

【0085】次に、本発明の第2の実施の形態を特徴付
けるデータアクセス情報生成ステップS4Aの処理を図
4と共通の構成要素には共通の参照文字/数字を付して
同様にフローチャートで示す図8を参照すると、この図
に示す本実施の形態のデータアクセス情報生成ステップ
S4Aの前述の第1の実施の形態のデータアクセス情報
生成ステップS4との相違点は、内部の直接アクセス記
憶データであるデータアクセス情報F3の代わりに外部
記憶装置である外部データアクセス情報F3Aを有し、
該当エントリ検索ステップS421の代わりに外部デー
タアクセス情報F3Aを検索する該当エントリ検索ステ
ップS421Aを有することである。
Next, the processing of the data access information generating step S4A characterizing the second embodiment of the present invention is similarly shown by a flowchart with common reference characters / numerals added to components common to FIG. Referring to FIG. 8, the difference between the data access information generation step S4A of the present embodiment shown in FIG. 8 and the data access information generation step S4 of the first embodiment described above is the internal direct access storage data. Has external data access information F3A which is an external storage device instead of the data access information F3,
It has a corresponding entry search step S421A for searching the external data access information F3A instead of the corresponding entry search step S421.

【0086】図8を参照して本実施の形態のデータアク
セス情報生成ステップS4Aの処理について第1の実施
の形態との相違点を重点的に説明すると、データアクセ
ス命令解析ステップS411及びアドレスサイズ取り出
しステップS412は第1の実施の形態と同一の処理を
行う。すなわち、ステップS411でデータアクセス命
令であるか否かの判定を行い、ステップS412でデー
タアクセス命令中のアドレスとサイズの取り出しを行
う。
The processing of the data access information generation step S4A of the present embodiment will be described with reference to FIG. 8 focusing on the differences from the first embodiment. The data access instruction analysis step S411 and the address size extraction Step S412 performs the same process as in the first embodiment. That is, it is determined in step S411 whether the instruction is a data access instruction, and in step S412, the address and size in the data access instruction are extracted.

【0087】次に、該当エントリ検索ステップS421
Aで、取り出したデータアドレスとサイズに該当する外
部記憶データである外部データアクセス情報F3A中の
エントリを検索する。
Next, the corresponding entry search step S421
In A, an entry in the external data access information F3A, which is external storage data corresponding to the extracted data address and size, is searched.

【0088】以下、該当エントリ有り判定ステップS4
22、該当エントリアクセス回数インクリメントステッ
プS423、新規エントリ追加ステップS424及び命
令コード終了判定ステップS425は第1の実施の形態
と同一の処理を行う。
Hereinafter, the corresponding entry existence determination step S4
22, the corresponding entry access count increment step S423, the new entry addition step S424, and the instruction code end determination step S425 perform the same processing as in the first embodiment.

【0089】次に、本発明の第3の実施の形態を特徴付
けるデータ再配置実行ステップS51Aの処理を図5と
共通の構成要素には共通の参照文字/数字を付して同様
にフローチャートで示す図9を参照すると、この図に示
す本実施の形態のデータ再配置実行ステップS51Aの
前述の第1の実施の形態のデータ再配置実行ステップS
51との相違点は、最大サイズエントリ検索ステップS
513の次に、空きキャッシュ領域無し判定ステップS
516と、空きキャッシュ領域無し判定ステップS51
6で空きキャッシュ領域がある場合はキャッシュ領域に
データを移動するキャッシュ領域移動ステップS514
と、空きキャッシュ領域がない場合キャッシュ領域以外
の領域である非キャッシュ領域にデータを移動する非キ
ャッシュ領域移動ステップS517とを行い、ャッシュ
領域移動ステップS514と非キャッシュ領域移動ステ
ップS517の処理後再配置情報出力ステップS515
と、データ終了判定ステップS517を行うことであ
る。
Next, the process of the data rearrangement execution step S51A characterizing the third embodiment of the present invention is similarly shown by a flowchart with the same reference characters / numerals as those of FIG. Referring to FIG. 9, the data relocation execution step S51 according to the first embodiment of the data relocation execution step S51A according to the embodiment shown in FIG.
The difference from the first embodiment is that the maximum size entry search step S
After 513, there is no free cache area determination step S
516 and free cache area absence determination step S51
If there is a free cache area in step 6, the cache area is moved to the cache area.
And a non-cache area move step S517 for moving data to a non-cache area which is an area other than the cache area when there is no free cache area, and relocation after the cache area move step S514 and the non-cache area move step S517 Information output step S515
And performing the data end determination step S517.

【0090】図9を参照して本実施の形態のデータ再配
置実行ステップS51Aの処理について第1の実施の形
態との相違点を重点的に説明すると、まず、データソー
トステップS511で、データアクセス情報F3に基づ
きアドレス毎のアクセス頻度の降順にデータコードをソ
ートし、ソートデータF6に出力する。次に、データ取
り出しステップS512で、ソートデータF6からアク
セス頻度の降順にデータコードを取り出し、最大サイズ
エントリ検索ステップS513で、取り出したアドレス
と同一アドレスのデータコード中で最大アクセスサイズ
のデータコードを検索選択する。
With reference to FIG. 9, the processing of the data relocation execution step S51A of this embodiment will be described focusing on the differences from the first embodiment. First, in the data sorting step S511, the data access is executed. The data codes are sorted in descending order of the access frequency for each address based on the information F3, and output to the sorted data F6. Next, in a data fetching step S512, data codes are fetched from the sort data F6 in descending order of access frequency, and in a maximum size entry search step S513, a data code having a maximum access size is searched in a data code having the same address as the fetched address. select.

【0091】次に、空きキャッシュ領域無し判定ステッ
プS516で、空きキャッシュ領域がまだ残っている場
合、キャッシュ領域移動ステップS514へと進み、こ
のキャッシュ領域移動ステップS514で、最大サイズ
エントリ検索ステップS513で選択したデータコード
をキャッシュ領域へ移動する。空きキャッシュ領域が無
い場合、非キャッシュ領域移動ステップS517へと進
み、非キャッシュ領域移動ステップS517において選
択したデータコードを非キャッシュ領域に移動する。
Next, in the step S516 of determining that there is no free cache area, if a free cache area still remains, the process proceeds to the cache area moving step S514, in which the maximum size entry search step S513 is selected. The data code is moved to the cache area. If there is no free cache area, the process proceeds to the non-cache area moving step S517, and the data code selected in the non-cache area moving step S517 is moved to the non-cache area.

【0092】以下第1の実施の形態と同様に、再配置情
報出力ステップS515で、データアクセス情報に配置
後アドレスを付加し、再配置情報として出力し、データ
終了判定ステップS518で終了判定を行う。
In the same manner as in the first embodiment, in the relocation information output step S515, the post-placement address is added to the data access information, and the data is output as relocation information, and the end determination is made in the data end determination step S518. .

【0093】次に、本発明の第4の実施の形態を特徴付
ける命令コード補正ステップS52Aの処理を図6と共
通の構成要素には共通の参照文字/数字を付して同様に
フローチャートで示す図10を参照して第1の実施の形
態との相違点を重点的に説明すると、この図に示す本実
施の形態の命令コード補正ステップS52Aは、まず、
再配置情報取り出しステップS527で再配置情報F7
から1エントリを取り出す。
Next, the process of the instruction code correcting step S52A characterizing the fourth embodiment of the present invention is shown in the same flowchart as FIG. 6 with common components being denoted by common reference characters / numerals. 10, the difference from the first embodiment will be mainly described. The instruction code correction step S52A of the present embodiment shown in FIG.
In the relocation information extracting step S527, the relocation information F7
Fetch one entry from

【0094】次に、再配置情報終了判定ステップS52
8で、再配置情報F7の終わりまで検索したか否かの判
定を行い、再配置情報F7の終わりであれば終了し、二
次目的コード生成ステップS6へ進む。再配置情報F7
の終わりでなければ1命令コード取り出しステップS5
21へ進む。
Next, relocation information end determination step S52
At 8, it is determined whether or not the search has been performed up to the end of the relocation information F7. If the search has been completed, the process ends, and the process proceeds to the secondary purpose code generation step S6. Relocation information F7
If it is not the end, one instruction code fetching step S5
Proceed to 21.

【0095】次に、1命令コード取り出しステップS5
21において、一次目的コードF1の先頭から1命令コ
ードを取り出す。
Next, one instruction code extracting step S5
At 21, one instruction code is extracted from the head of the primary purpose code F1.

【0096】次に、アクセス命令判定ステップS523
で、1命令コード取り出しステップS521で読み出し
た命令コードがデータコードアクセス命令でなければ、
1命令コード取り出しステップS521へと戻り、次の
命令コードを読み出す。命令コードがデータコードアク
セス命令であれば、配置後アドレス置換ステップS53
0へと進み、再配置情報内を検索し、データコードアク
セス命令のアクセスアドレスと再配置情報内の配置前ア
ドレスとが一致する一致エントリを探し、この一致エン
トリの配置後アドレスへの置換処理を行う。
Next, an access instruction determination step S523
If the instruction code read in one instruction code fetching step S521 is not a data code access instruction,
Returning to one instruction code fetching step S521, the next instruction code is read. If the instruction code is a data code access instruction, the post-placement address replacement step S53
0, searching the relocation information for a matching entry in which the access address of the data code access instruction matches the pre-placement address in the relocation information, and replaces the matching entry with the post-placement address. Do.

【0097】次に、1命令コード取り出しステップS5
31において、一次目的コードから次の1命令を取り出
す。
Next, one instruction code extracting step S5
At 31, the next instruction is fetched from the primary purpose code.

【0098】最後に、命令コード終了判定ステップS5
22において、命令の終了か否かの判定を行い、終了で
なければ、アクセス命令判定ステップS523へ戻り、
以下の処理を繰り返す。命令の終了であれば、再配置情
報取り出しステップS527へ戻り以下の処理を繰り返
す。
Finally, instruction code end determination step S5
At 22, it is determined whether or not the instruction is completed. If not, the process returns to the access instruction determination step S523,
The following processing is repeated. If the instruction has ended, the process returns to the relocation information extracting step S527 and the following processing is repeated.

【0099】次に、本発明の第5の実施の形態を特徴付
ける命令コード解析ステップS1の処理をフローチャー
トで示す図11を参照すると、この命令コード解析ステ
ップS1は、シミュレータ1の入力(シミュレーション
の入力)となる目的コードが、コンパイル部2によるコ
ンパイルの結果から生成された一次目的コードF1であ
るか、シミュレータ1により生成された二次目的コード
F4であるかの判定を行う(一次/二次目的コード判定
ステップS11)。
Next, referring to FIG. 11 which is a flowchart showing the processing of an instruction code analyzing step S1 characterizing the fifth embodiment of the present invention, the instruction code analyzing step S1 is executed by the input of the simulator 1 (input of the simulation). ) Is determined as the primary target code F1 generated from the result of compilation by the compiling unit 2 or the secondary target code F4 generated by the simulator 1 (primary / secondary target). Code determination step S11).

【0100】次に、コンパイル部2から生成された一次
目的コードF1であれば、一次目的コード解析ステップ
S12へ進み、この一次目的コードF1の命令コードの
解析を行う。
Next, if it is the primary purpose code F1 generated by the compiling unit 2, the process proceeds to the primary purpose code analysis step S12, where the instruction code of the primary purpose code F1 is analyzed.

【0101】また、シミュレータ1から生成された二次
目的コードF4であれば、一次目的コード解析ステップ
S13へ進み、この二次目的コードF4の命令コードの
解析を行う。
If it is the secondary purpose code F4 generated from the simulator 1, the process goes to the primary purpose code analyzing step S13 to analyze the instruction code of the secondary purpose code F4.

【0102】[0102]

【発明の効果】以上説明したように、本発明のマイクロ
プロセッサ用目的コードの最適化装置、最適化方法及び
最適化プログラムを記録した記録媒体は、本発明を特徴
付けるシミュレータが、コンパイル部が生成した一次目
的コードの命令コードを解析してこの命令コード対応処
理の実行である命令コード実行を行い、この命令コード
実行によるデータコードのアクセス回数をアドレス及び
アクセス対象のデータコードのサイズ毎に記録したデー
タアクセス情報に基づきアクセス頻度の高いデータコー
ドを検出し、1命令でアクセス可能なデータコード領域
であるキャッシュ領域に再配置して二次目的コードを生
成し、この二次目的コードの命令コードを解析して上記
命令コード実行を行うことにより、高アクセス頻度のデ
ータコード領域へのアクセスを高速化でき、プログラム
の実行速度が向上するという効果がある。
As described above, the optimizing apparatus, the optimizing method, and the recording medium storing the optimizing program for the object code for the microprocessor of the present invention are provided by the simulator characterizing the present invention, which is generated by the compiling section. Analyzes the instruction code of the primary purpose code, executes the instruction code corresponding to the execution of the instruction code corresponding processing, and records the number of accesses of the data code by the execution of the instruction code for each address and the size of the data code to be accessed. A data code having a high access frequency is detected based on the access information, rearranged in a cache area which is a data code area accessible by one instruction, a secondary purpose code is generated, and an instruction code of the secondary purpose code is analyzed. And execute the above instruction code to access the data code area with high access frequency. Access can speed up, there is an effect that the execution speed of the program is improved.

【0103】特に、データコード領域内のデータコード
に対してループ処理を行う場合、著しい効果がある。例
えば、あるデータコード領域内の値を0に初期化するた
め100回のループを必要とするプログラム例におい
て、データコード領域が2命令でなく1命令でアクセス
可能な目的コードの場合、100命令分の実行時間だ
け、プログラムの実行速度が向上する。
Particularly, when the loop processing is performed on the data code in the data code area, there is a remarkable effect. For example, in an example of a program that requires 100 loops to initialize a value in a certain data code area to 0, if the data code area is a target code that can be accessed by one instruction instead of two instructions, The execution time of the program is improved by the execution time.

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

【図1】本発明の第1の実施の形態のマイクロプロセッ
サ用目的コードの最適化装置を特徴付けるシミュレーシ
ョン装置を示すブロック図である。
FIG. 1 is a block diagram showing a simulation device that characterizes a device for optimizing an object code for a microprocessor according to a first embodiment of the present invention.

【図2】本実施の形態のマイクロプロセッサ用目的コー
ドの最適化装置を示すブロック図である。
FIG. 2 is a block diagram illustrating an apparatus for optimizing an object code for a microprocessor according to an embodiment;

【図3】本実施の形態のシミュレーション装置の処理動
作であるシミュレーション方法の一例を示すフローチャ
ートである。
FIG. 3 is a flowchart illustrating an example of a simulation method that is a processing operation of the simulation apparatus according to the present embodiment.

【図4】図3のデータアクセス命令解析処理の詳細処理
を示すフローチャートである。
FIG. 4 is a flowchart showing a detailed process of a data access instruction analysis process of FIG. 3;

【図5】図3のデータ再配置部15によるデータ再配置
処理の詳細処理を示すフローチャートである。
FIG. 5 is a flowchart showing a detailed process of a data relocation process by the data relocation unit 15 of FIG. 3;

【図6】データ再配置部によるデータ再配置処理の詳細
処理を示すフローチャートである。
FIG. 6 is a flowchart showing a detailed process of a data relocation process by a data relocation unit.

【図7】再配置情報の一例を示す説明図である。FIG. 7 is an explanatory diagram illustrating an example of relocation information.

【図8】本発明の第2の実施の形態を特徴付けるデータ
アクセス情報生成部の詳細処理を示すフローチャートで
ある。
FIG. 8 is a flowchart illustrating a detailed process of a data access information generation unit characterizing the second embodiment of the present invention.

【図9】本発明の第3の実施の形態を特徴付けるデータ
アクセス情報解析部の詳細処理を示すフローチャートで
ある。
FIG. 9 is a flowchart showing a detailed process of a data access information analysis unit characterizing the third embodiment of the present invention.

【図10】本発明の第4の実施の形態を特徴付けるコー
ド補正処理部の詳細処理を示すフローチャートである。
FIG. 10 is a flowchart illustrating a detailed process of a code correction processing unit characterizing a fourth embodiment of the present invention.

【図11】本発明の第5の実施の形態を特徴付ける命令
コード解析部の詳細処理を示すフローチャートである。
FIG. 11 is a flowchart illustrating a detailed process of an instruction code analyzing unit characterizing a fifth embodiment of the present invention.

【図12】C言語における共用体のコードのデータアク
セス情報の一例を示す説明図である。
FIG. 12 is an explanatory diagram showing an example of data access information of a union code in C language.

【図13】従来のマイクロプロセッサ用目的コードの最
適化装置の一例を示すブロック図である。
FIG. 13 is a block diagram showing an example of a conventional object code optimization device for a microprocessor.

【図14】データコードアクセス命令のディスプレース
メントとして16ビットの値までしかとることができな
いマイクロプロセッサに対するデータコード領域,命令
コードの例を示す説明図である。
FIG. 14 is an explanatory diagram showing an example of a data code area and an instruction code for a microprocessor which can take only a 16-bit value as a displacement of a data code access instruction.

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

1,100 シミュレータ 2 コンパイル部 11 命令コード解析部 12 命令シミュレーション部 13 プロファイルデータ生成部 14 データアクセス情報生成部 15 データ再配置部 16 二次目的コード生成部 21 フロントエンド 22 バックエンド 141 データアクセス命令解析部 142 データアクセス情報出力部 151 データ再配置実行部 152 命令コード補正部 221 コードスケジューリング部 222 目的コード生成部 223 プロファイルデータ解析部 224 コードスケジューリング実行部 F1 一次目的コード F2 プロファイルデータ F3,F3A データアクセス情報 F4 二次目的コード F5 入力コード F6 ソートデータ F7 配置情報 F100 目的コード 1,100 Simulator 2 Compiling unit 11 Instruction code analysis unit 12 Instruction simulation unit 13 Profile data generation unit 14 Data access information generation unit 15 Data relocation unit 16 Secondary purpose code generation unit 21 Front end 22 Back end 141 Data access instruction analysis Unit 142 Data access information output unit 151 Data relocation execution unit 152 Instruction code correction unit 221 Code scheduling unit 222 Object code generation unit 223 Profile data analysis unit 224 Code scheduling execution unit F1 Primary object code F2 Profile data F3, F3A Data access information F4 Secondary purpose code F5 Input code F6 Sort data F7 Positioning information F100 Purpose code

Claims (16)

【特許請求の範囲】[Claims] 【請求項1】 記録媒体に記録されたコンパイル用プロ
グラムである入力コードをプロファイルデータを用いて
コンパイルして一次目的コードを生成するコンパイル部
と、前記一次目的コードをシミュレーションし前記プロ
ファイルデータを生成するシミュレータとを備えるマイ
クロプロセッサ用目的コードの最適化装置において、 前記シミュレータが、前記コンパイル部が生成した前記
一次目的コードの命令コードを解析してこの命令コード
対応処理の実行である命令コード実行を行い、前記命令
コード実行によるデータコードのアクセス回数をアドレ
ス及びアクセス対象のデータコードのサイズ毎に記録し
たデータアクセス情報に基づきアクセス頻度の高いデー
タコードを検出し、1命令でアクセス可能なデータコー
ド領域であるキャッシュ領域に再配置して二次目的コー
ドを生成し、前記二次目的コードの命令コードを解析し
て前記命令コード実行を行うことにより、高速のシミュ
レーション実行を可能とすることを特徴とするマイクロ
プロセッサ用目的コードの最適化装置。
1. A compiling section for compiling an input code, which is a compiling program recorded on a recording medium, using profile data to generate a primary purpose code, and simulating the primary purpose code to generate the profile data. A microprocessor object code optimization device comprising a simulator, wherein the simulator analyzes an instruction code of the primary object code generated by the compiling unit and executes an instruction code corresponding to execution of the instruction code corresponding process. The number of accesses of the data code by the execution of the instruction code is detected based on the data access information recorded for each address and the size of the data code to be accessed. A certain cap A second object code generated by rearranging the second object code, analyzing the instruction code of the second object code, and executing the instruction code, thereby enabling high-speed simulation execution. Object code optimization device for processors.
【請求項2】 前記シミュレータが、前記コンパイル部
で生成した目的コードである一次目的コード又は前記シ
ミュレータが生成した目的コードである二次目的コード
のいずれか一方(以下目的コード)の命令コードの解析
を行う命令コード解析部と、 解析した前記命令コードの実行を行う命令シミュレーシ
ョン部と、 前記命令コードの実行の結果に基づき前記プロファイル
データを生成するプロファイルデータ生成部と、 前記一次目的コード中のデータアクセス命令の解析を行
い、このデータアクセスアドレス(以下アドレス)とデ
ータアクセスサイズ(以下サイズ)をデータアクセス情
報に出力するデータアクセス情報生成部と、 前記データアクセス情報を参照してアドレス毎のアクセ
ス頻度の降順にデータコードをソートし、同一アドレス
での最大サイズの前記データコードを選択データコード
として選択し、前記キャッシュ領域に前記アクセス頻度
の降順に前記選択データコードを再配置し命令コードを
補正するデータ再配置部と、 前記データ再配置部が再配置したデータ及び補正した命
令コードを前記二次目的コードとして生成する二次目的
コード生成部とを備えることを特徴とする請求項1記載
のマイクロプロセッサ用目的コードの最適化装置。
2. The method according to claim 1, wherein the simulator analyzes an instruction code of one of a primary target code as a target code generated by the compiling unit and a secondary target code as a target code generated by the simulator. An instruction code analysis unit that executes the analyzed instruction code; a profile data generation unit that generates the profile data based on a result of the execution of the instruction code; and data in the primary object code. A data access information generating unit that analyzes an access instruction and outputs the data access address (hereinafter referred to as an address) and a data access size (hereinafter referred to as a size) to data access information; and an access frequency for each address with reference to the data access information. Data codes in descending order of A data rearrangement unit that selects the data code having the maximum size as a selected data code as a selected data code, rearranges the selected data code in the cache area in descending order of the access frequency, and corrects an instruction code; and 2. The apparatus according to claim 1, further comprising a secondary purpose code generation unit configured to generate the data rearranged by the unit and the corrected instruction code as the secondary purpose code.
【請求項3】 前記データアクセス情報生成部が、前記
一次目的コード中の前記データアクセス命令の解析を行
い、前記データアクセスアドレスとサイズを検出するデ
ータアクセス命令解析部と、 前記データアクセス命令解析部で検出した前記データア
ドレスと前記データアクセスサイズとを前記データアク
セス情報に出力するデータアクセス情報出力部とを備え
ることを特徴とする請求項2記載のマイクロプロセッサ
用目的コードの最適化装置。
3. The data access information analysis section, wherein the data access information generation section analyzes the data access instruction in the primary object code, and detects the data access address and the size, and the data access instruction analysis section. 3. The apparatus according to claim 2, further comprising a data access information output unit that outputs the data address and the data access size detected in the step (c) to the data access information.
【請求項4】 前記データ再配置部が、前記データアク
セス情報を参照しアドレス毎にアクセス頻度の降順にデ
ータコードをソートして最大サイズのデータコードを選
択し、前記キャッシュ領域にアクセス頻度の降順に再配
置し、再配置後のアドレスを前記データアクセス情報に
それぞれ付加し再配置情報として出力するデータ再配置
実行部と、 読み出した前記目的コードがデータコードアクセス命令
でありかつそのアクセスアドレスが前記再配置情報の再
配置前のアクセスアドレスと一致する場合に前記目的コ
ードのアクセスアドレスを配置後のアクセスアドレスに
置き換え命令コードを補正する命令コード補正部とを備
えることを特徴とする請求項2記載のマイクロプロセッ
サ用目的コードの最適化装置。
4. The data rearrangement section references the data access information, sorts data codes in descending order of access frequency for each address, selects a data code having a maximum size, and places the data code in the cache area in descending order of access frequency. A data relocation execution unit that adds the relocated address to the data access information and outputs the data as relocation information, wherein the read target code is a data code access instruction and the access address is 3. An instruction code correcting unit for correcting an instruction code by replacing an access address of the object code with an access address after the arrangement when the access address before the relocation of the relocation information matches the access address. Object code optimization device for microprocessors.
【請求項5】 記録媒体に記録されたコンパイル用プロ
グラムである入力コードをプロファイルデータを用いて
コンパイルして一次目的コードを生成し、前記一次目的
コードをシミュレーションし前記プロファイルデータを
生成するマイクロプロセッサ用目的コードの最適化方法
において、 前記シミュレーションが、前記コンパイルにより生成し
た前記一次目的コードの命令コードを解析してこの命令
コード対応処理の実行である命令コード実行を行い、前
記命令コード実行によるデータコードのアクセス回数を
アドレス及びアクセス対象のデータコードのサイズ毎に
記録したデータアクセス情報に基づきアクセス頻度の高
いデータコードを検出し、1命令でアクセス可能なデー
タコード領域であるキャッシュ領域に再配置して二次目
的コードを生成し、前記二次目的コードの命令コードを
解析して前記命令コード実行を行うことにより、高速の
シミュレーション実行を可能とすることを特徴とするマ
イクロプロセッサ用目的コードの最適化方法。
5. A microprocessor for compiling an input code as a compiling program recorded on a recording medium using profile data to generate a primary purpose code, simulating the primary purpose code, and generating the profile data. In the method of optimizing an object code, the simulation analyzes an instruction code of the primary object code generated by the compilation, executes an instruction code corresponding to execution of the instruction code corresponding process, and executes a data code by executing the instruction code. The number of times of access is detected based on data access information recorded for each address and the size of the data code to be accessed, and a frequently accessed data code is detected and relocated to a cache area which is a data code area accessible by one instruction. Secondary purpose It generates said by performing the instruction code executed by analyzing the instruction code of the secondary object code, a method of optimizing object code for a microprocessor, characterized in that to enable high-speed simulation runs.
【請求項6】 記録媒体に記録されたコンパイル用プロ
グラムである入力コードをプロファイルデータを用いて
コンパイルして一次目的コードを生成し、前記一次目的
コードをシミュレーションし前記プロファイルデータを
生成するマイクロプロセッサ用目的コードの最適化方法
において、 前記一次目的コードの命令コードの解析を行う命令コー
ド解析ステップと、 解析した前記一次命令コードの実行を行う命令シミュレ
ーションステップと、 前記一次命令コードの実行の結果に基づき前記プロファ
イルデータの生成を行うプロファイルデータ生成ステッ
プと、 前記命令コード中のデータアクセス命令の解析を行い、
データのアクセスアドレスとアクセスサイズを検出し、
検出したデータの前記アクセスアドレスと前記アクセス
サイズをデータアクセス情報に格納するデータアクセス
情報生成ステップと、 前記データアクセス情報生成ステップで生成した前記デ
ータコードのアクセス回数を前記アクセスアドレス及び
前記アクセスサイズ毎に記録した前記データアクセス情
報に基づきアクセス頻度の降順に前記データコードを検
出して1命令でアクセス可能なデータコード領域である
キャッシュ領域に前記アクセス頻度の降順に再配置し命
令コードを補正するデータ再配置ステップと、 前記データ再配置ステップで補正した前記目的コードを
二次目的コードとして生成する二次目的コード生成ステ
ップとを有することを特徴とするマイクロプロセッサ用
目的コードの最適化方法。
6. A microprocessor for compiling an input code, which is a compilation program recorded on a recording medium, using profile data to generate a primary purpose code, simulating the primary purpose code, and generating the profile data. In the method for optimizing an object code, an instruction code analyzing step for analyzing an instruction code of the primary object code; an instruction simulation step for executing the analyzed primary instruction code; and, based on a result of the execution of the primary instruction code. A profile data generating step of generating the profile data, and analyzing a data access instruction in the instruction code,
Detects data access address and access size,
A data access information generating step of storing the access address and the access size of the detected data in data access information; and an access count of the data code generated in the data access information generating step for each of the access address and the access size. Based on the recorded data access information, the data code is detected in the descending order of the access frequency, and is relocated to the cache area, which is a data code area accessible by one instruction, in the descending order of the access frequency to correct the instruction code. A method of optimizing an object code for a microprocessor, comprising: an arranging step; and a secondary object code generating step of generating, as a secondary object code, the object code corrected in the data rearranging step.
【請求項7】 前記命令コード解析ステップが、前記シ
ミュレーションの入力となる前記目的コードが、前記コ
ンパイルにより生成された前記一次目的コードである
か、前記シミュレーションにより生成された前記二次目
的コードであるかの判定を行う一次/二次目的コード判
定ステップと、 前記一次/二次目的コード判定ステップで前記一次目的
コードであれば、この一次目的コードの命令コードの解
析を行う一次目的コード解析ステップと、 前記一次/二次目的コード判定ステップで前記二次目的
コードであれば、この二次目的コードの命令コードの解
析を行う二次目的コード解析ステップとを有することを
特徴とする請求項6記載のマイクロプロセッサ用目的コ
ードの最適化方法。
7. The instruction code analyzing step, wherein the object code serving as an input of the simulation is the primary object code generated by the compilation or the secondary object code generated by the simulation. A primary / secondary target code determining step of determining whether the primary / secondary target code is the primary target code in the primary / secondary target code determining step; and a primary target code analyzing step of analyzing an instruction code of the primary target code. 7. The method according to claim 6, further comprising a secondary object code analyzing step of analyzing an instruction code of the secondary object code if the primary / secondary object code determining step is the secondary object code. To optimize object code for microprocessors.
【請求項8】 前記データアクセス情報生成ステップ
が、前記命令コード中の前記データアクセス命令の解析
を行い、このデータアクセス命令の前記データアクセス
アドレスと前記アクセスサイズを検出するデータアクセ
ス命令解析ステップと、 検出した前記データアクセスアドレスと前記アクセスサ
イズを前記データアクセス情報に出力し、前記データア
クセス情報内のアクセス回数をインクリメントするデー
タアクセス情報出力ステップとを有することを特徴とす
る請求項6記載のマイクロプロセッサ用目的コードの最
適化方法。
8. The data access information generating step analyzes the data access instruction in the instruction code, and detects the data access address and the access size of the data access instruction. 7. The microprocessor according to claim 6, further comprising: outputting the detected data access address and the access size to the data access information, and incrementing a number of accesses in the data access information. How to optimize purpose code.
【請求項9】 前記データ再配置ステップが、前記デー
タアクセス情報を参照して、アドレス毎にアクセス頻度
の降順にデータコードをソートして最大アクセスサイズ
のデータコードを選択データコードとして選択し、この
選択データコードを前記キャッシュ領域にアクセス頻度
の降順に再配置し、再配置後のアドレスを前記データア
クセス情報にそれぞれ付加し再配置情報として出力する
データ再配置実行ステップと、 前記目的コードを1命令コードずつ読み出し、前記目的
コードがデータコードアクセス命令でありかつそのアク
セスアドレスが前記再配置情報の再配置前のアクセスア
ドレスと一致する場合、一致したデータコードアクセス
命令のアクセスアドレスを配置後のアクセスアドレスに
置き換えて命令コードを補正する命令コード補正ステッ
プとを有することを特徴とする請求項6記載のマイクロ
プロセッサ用目的コードの最適化方法。
9. The data rearrangement step refers to the data access information, sorts data codes in descending order of access frequency for each address, and selects a data code having a maximum access size as a selected data code. A data rearrangement execution step of rearranging the selected data code in the cache area in descending order of access frequency, adding the rearranged address to the data access information and outputting the data access information as relocation information; When the target code is a data code access instruction and the access address matches the access address before the relocation of the relocation information, the access address of the matched data code access instruction is replaced with the access address after the read. To correct the instruction code Method of optimizing object code for the microprocessor according to claim 6, characterized in that it comprises a correction step.
【請求項10】 前記データアクセス命令解析ステップ
が、前記命令コード中の前記データアクセス命令がデー
タアクセス命令であるか否かの判定を行い前記データア
クセス命令でなければ命令コード終了判定ステップに進
むデータアクセス命令判定ステップと、 前記データアクセス命令判定ステップで前記データアク
セス命令であれば前記データアクセス命令中のデータア
クセスアドレスと前記アクセスサイズの取り出しを行う
アドレスサイズ取り出しステップと、 前記アドレスサイズ取り出しステップで取り出した前記
データアクセスアドレスと前記アクセスサイズに該当す
る前記データアクセス情報中のエントリを検索する該当
エントリ検索ステップと、 前記データアクセス情報に該当エントリがある場合、該
当エントリアクセス回数インクリメントステップに進む
該当エントリ有り判定ステップと、 前記該当エントリのアクセス回数をインクリメントする
該当エントリアクセス回数インクリメントステップと、 前記該当エントリ有り判定ステップで前記データアクセ
ス情報に前記該当エントリがない場合新規に、前記アド
レスサイズ取り出しステップで取り出した前記データア
クセスアドレスと前記アクセスサイズのエントリを前記
データアクセス情報へ追加する新規エントリ追加ステッ
プと、 命令コードの終了であるか否かの判定を行い、終了でな
ければ命令コード解析ステップへと戻り、終了であれば
データ再配置ステップへ進む前記命令コード終了判定ス
テップとを有することを特徴とする請求項8記載のマイ
クロプロセッサ用目的コードの最適化方法。
10. The data access instruction analyzing step determines whether or not the data access instruction in the instruction code is a data access instruction. If the data access instruction is not the data access instruction, the data proceeds to an instruction code end determination step. An access instruction determination step; an address size extraction step for extracting the data access address and the access size in the data access instruction if the data access instruction is the data access instruction in the data access instruction determination step; A corresponding entry search step of searching for an entry in the data access information corresponding to the data access address and the access size, and, if the data access information has a corresponding entry, a corresponding entry access count A corresponding entry presence determination step for proceeding to an increment step; a corresponding entry access count increment step for incrementing the access count of the corresponding entry; and a new entry if the data access information does not have the corresponding entry in the corresponding entry presence determination step. A new entry adding step of adding the data access address and the access size entry fetched in the address size fetching step to the data access information; and determining whether or not the end of the instruction code has been reached. 9. The method for optimizing an object code for a microprocessor according to claim 8, further comprising: an instruction code end determination step of returning to a code analysis step and proceeding to a data rearrangement step when the instruction code end is completed.
【請求項11】 前記データ再配置実行ステップが、前
記データアクセス情報に基づきアドレス毎のアクセス頻
度の降順に前記データコードをソートしソートデータを
生成するデータソートステップと、 前記ソートデータからアクセス頻度の降順にデータコー
ドを取り出すデータ取り出しステップと、 取り出したアクセスアドレスと同一アドレスの前記デー
タコードの中で最大アクセスサイズのデータコードを検
索し選択データコードとして選択する最大サイズエント
リ検索ステップと、 前記選択データコードを前記キャッシュ領域に移動する
キャッシュ領域移動ステップと、 前記データアクセス情報に配置後アドレスを付加し、再
配置情報として出力する再配置情報出力ステップと、 前記キャッシュ領域の空領域が無いかの判定を行い前記
キャッシュ領域の空領域がまだ残っている場合後述のデ
ータ終了判定ステップへ進み、前記キャッシュ領域の空
領域がなくなった場合、後述の非キャッシュ領域移動ス
テップへ進む空きキャッシュ領域無し判定ステップと、 前記ソートデータの全アドレスの終了であれば、前記命
令コード補正ステップへ進み、全アドレス終了でなけれ
ば、前記データ取り出しステップへ戻り、以上の処理を
繰り返す前記データ終了判定ステップと、 前記ソートデータの残りのアクセスアドレスのデータコ
ードを低速でのアクセス可能なデータコード領域である
非キャッシュ領域へ移動し、前記再配置情報へ前記再配
置情報を出力し、前記命令コード補正ステップに進む前
記非キャッシュ領域移動ステップとを有することを特徴
とする請求項9記載のマイクロプロセッサ用目的コード
の最適化方法。
11. The data rearrangement execution step includes the steps of: sorting the data codes in descending order of access frequency for each address based on the data access information to generate sort data; A data fetching step of fetching data codes in descending order; a maximum size entry search step of searching for a data code having a maximum access size among the data codes having the same address as the fetched access address and selecting the selected data code as a selected data code; A cache area moving step of moving a code to the cache area; a relocation information output step of adding a post-placement address to the data access information and outputting it as relocation information; and determining whether there is an empty area in the cache area. Before doing When the empty area of the cache area still remains, the process proceeds to a data end determination step described later. When the empty area of the cache area is exhausted, the empty cache area absence determination step proceeds to a non-cache area moving step described below. If all the addresses of the data are completed, the process proceeds to the instruction code correction step. If not all the addresses are completed, the process returns to the data fetching step, and the above process is repeated. Moving the data code of the access address to a non-cache area which is a data code area accessible at a low speed, outputting the relocation information to the relocation information, and proceeding to the instruction code correction step; 10. The microphone according to claim 9, comprising: Optimization method for object code for low-speed processors.
【請求項12】 前記命令コード補正ステップが、前記
一次目的コードから1命令コードを取り出す1命令コー
ド取り出しステップと、 前記命令コードを最後まで読み出したかの判定を行い、
最後まで読み出したならば、終了し、まだ読み込むべき
命令コードが残っていれば、後述のアクセス命令判定ス
テップへ進む命令コード終了判定ステップと、 前記1命令コード取り出しステップで読み出した前記命
令コードが前記データコードアクセス命令でなければ、
前記1命令コード取り出しステップへ戻り、前記命令コ
ードが前記データコードアクセス命令であれば、次の一
致検索ステップへ進む前記アクセス命令判定ステップ
と、 前記再配置情報内を検索し、前記データコードアクセス
命令のアクセスアドレスと前記再配置情報内の配置前ア
ドレスとが一致するエントリである一致エントリを探す
前記一致検索ステップと、 前記一致検索ステップで前記一致エントリが見つかった
場合、次の置換ステップへ進み、前記1命令コード取り
出しステップへ戻り、以上の処理を反復し、前記一致検
索ステップで前記一致エントリが見つからなかった場
合、前記1命令コード取り出しステップへ戻り、以上の
処理を反復する一致判定ステップと、 データコードアクセス命令のアドレスを前記一致エント
リの配置後アドレスに置き換える前記置換ステップとを
有することを特徴とする請求項9記載のマイクロプロセ
ッサ用目的コードの最適化方法。
12. The instruction code correction step includes: extracting one instruction code from the primary object code; and determining whether the instruction code has been read to the end.
If the instruction code has been read to the end, the operation is terminated, and if there is still an instruction code to be read, an instruction code end determination step that proceeds to an access instruction determination step described below; If it is not a data code access instruction,
Returning to the one instruction code fetching step, if the instruction code is the data code access instruction, the access instruction determining step to proceed to the next matching search step; and searching the relocation information for the data code access instruction. The match search step for finding a match entry that is an entry where the access address of the relocation information matches the pre-placement address in the relocation information.If the match entry is found in the match search step, proceed to the next replacement step. Returning to the one instruction code fetching step and repeating the above processing; if the matching entry is not found in the matching search step, returning to the one instruction code fetching step and repeating the above processing; The address of the data code access instruction is assigned to the matching entry. Method of optimizing object code for the microprocessor of claim 9, characterized in that it comprises a said replacement step of replacing the rear address.
【請求項13】 前記データ再配置実行ステップが、前
記データアクセス情報に基づきアドレス毎のアクセス頻
度の降順に前記データコードをソートしソートデータを
生成するデータソートステップと、 前記ソートデータからアクセス頻度の降順にデータコー
ドを取り出すデータ取り出しステップと、 取り出したアクセスアドレスと同一アドレスの前記デー
タコードの中で最大アクセスサイズのデータコードを検
索し選択データコードとして選択する最大サイズエント
リ検索ステップと、 前記キャッシュ領域の空領域が無いかの判定を行い前記
キャッシュ領域の空領域がまだ残っている場合後述のキ
ャッシュ領域移動ステップへ進み、前記キャッシュ領域
の空領域がなくなった場合、後述の非キャッシュ領域移
動ステップへ進む空きキャッシュ領域無し判定ステップ
と、 前記選択データコードを前記キャッシュ領域に移動する
キャッシュ領域移動ステップと、 前記ソートデータの残りのアクセスアドレスのデータコ
ードを低速でのアクセス可能なデータコード領域である
非キャッシュ領域へ移動する前記非キャッシュ領域移動
ステップと、 前記データアクセス情報に配置後アドレスを付加し、再
配置情報として出力する再配置情報出力ステップと、 前記ソートデータの全アドレスの終了であれば、前記命
令コード補正ステップへ進み、全アドレス終了でなけれ
ば、前記データ取り出しステップへ戻り、以上の処理を
繰り返す前記データ終了判定ステップとを有することを
特徴とする請求項9記載のマイクロプロセッサ用目的コ
ードの最適化方法。
13. The data rearrangement execution step includes the steps of: sorting the data codes in descending order of access frequency for each address based on the data access information to generate sort data; A data retrieval step of retrieving data codes in descending order; a maximum size entry retrieval step of retrieving a data code having a maximum access size from the data codes at the same address as the retrieved access address and selecting the selected data code as a selected data code; It is determined whether or not there is an empty area. If the empty area of the cache area still remains, the process proceeds to a cache area moving step described below. If the empty area of the cache area is exhausted, the process proceeds to a non-cache area moving step to be described later. Advancing free cash Determining a non-cache area, a cache area moving step of moving the selected data code to the cache area, and a non-cache area which is a data code area that can access the data code of the remaining access address of the sort data at a low speed. Moving the non-cache area to the data access information; adding a post-placement address to the data access information; and outputting the rearrangement information as relocation information. 10. The microprocessor according to claim 9, further comprising: a code correction step; if not all addresses are completed, returning to the data fetching step and repeating the above processing. Method.
【請求項14】 前記命令コード補正ステップが、前記
再配置情報から1エントリを取り出す再配置情報取り出
しステップと、 前記再配置情報の終わりまで検索したか否かの判定を行
い、前記再配置情報の終わりであれば終了し、前記再配
置情報の終わりでなければ次の第1の1命令コード取り
出しステップへ進む再配置情報終了判定ステップと、 前記一次目的コードから1命令コードを取り出す前記第
1の1命令コード取り出しステップと、 前記1命令コード取り出しステップで読み出した前記命
令コードが前記データコードアクセス命令でなければ、
前記1命令コード取り出しステップへ戻り、前記命令コ
ードが前記データコードアクセス命令であれば、次の配
置後アドレス置換ステップへ進むアクセス命令判定ステ
ップと、 前記再配置情報内を検索し、前記データコードアクセス
命令のアクセスアドレスと前記再配置情報内の配置前ア
ドレスとが一致する一致エントリを探し、前記一致エン
トリの配置後アドレスへの置換処理を行う前記配置後ア
ドレス置換ステップと、 前記一次目的コードから1命令コードを取り出す第2の
1命令コード取り出しステップと、 前記命令の終了か否かの判定を行い、終了でなければ前
記アクセス命令判定ステップへ戻り、以下の処理を反復
し、終了であれば前記再配置情報取り出しステップへ戻
り以下の処理を反復する命令コード終了判定ステップと
を有することを特徴とする請求項9記載のマイクロプロ
セッサ用目的コードの最適化方法。
14. The instruction code correcting step includes: a relocation information extracting step of extracting one entry from the relocation information; and determining whether or not the search has been performed until the end of the relocation information. If it is the end, the process ends. If it is not the end of the relocation information, the process proceeds to the next first instruction code fetching step. One instruction code fetching step; and if the instruction code read in the one instruction code fetching step is not the data code access instruction,
Returning to the one instruction code fetching step, if the instruction code is the data code access instruction, an access instruction determining step to proceed to the next post-placement address replacement step; A post-placement address replacement step of searching for a matching entry in which the access address of the instruction matches the pre-placement address in the relocation information, and replacing the matched entry with a post-placement address; A second one-instruction-code fetching step for fetching an instruction code; and determining whether or not the instruction is completed. If not, return to the access-instruction determination step. Repeat the following processing. Return to the relocation information extracting step and repeat the following processing. 9. method of optimizing object code for a microprocessor as claimed, characterized in that the.
【請求項15】 コンパイル用プログラムである入力コ
ードをプロファイルデータを用いてコンパイルして一次
目的コードを生成し、前記一次目的コードをシミュレー
ションし前記プロファイルデータを生成するマイクロプ
ロセッサ用目的コードの最適化プログラムを記録した記
録媒体において、 前記シミュレーションが、前記コンパイルにより生成し
た前記一次目的コードの命令コードを解析してこの命令
コード対応処理の実行である命令コード実行を行い、前
記命令コード実行によるデータコードのアクセス回数を
アドレス及びアクセス対象のデータコードのサイズ毎に
記録したデータアクセス情報に基づきアクセス頻度の高
いデータコードを検出し、1命令でアクセス可能なデー
タコード領域であるキャッシュ領域に再配置して二次目
的コードを生成し、前記二次目的コードの命令コードを
解析して前記命令コード実行を行うことにより、高速の
シミュレーション実行を可能とすることを特徴とするマ
イクロプロセッサ用目的コードの最適化プログラムを記
録した記録媒体。
15. A program for optimizing a target code for a microprocessor which compiles an input code which is a compile program using profile data to generate a primary target code, simulates the primary target code, and generates the profile data. In the recording medium, the simulation analyzes the instruction code of the primary target code generated by the compilation, executes the instruction code corresponding to the execution of the instruction code corresponding process, and executes the instruction code execution. A data code having a high access frequency is detected based on the data access information recorded for each address and the size of the data code to be accessed, and relocated to a cache area which is a data code area accessible by one instruction. Next Generating a code, analyzing the instruction code of the secondary object code, and executing the instruction code, thereby enabling a high-speed simulation execution; and recording a program for optimizing an object code for a microprocessor. Recording medium.
【請求項16】 コンパイル用プログラムである入力コ
ードをプロファイルデータを用いてコンパイルして一次
目的コードを生成し、前記一次目的コードをシミュレー
ションし前記プロファイルデータを生成するマイクロプ
ロセッサ用目的コードの最適化プログラムを記録した記
録媒体において、 前記一次目的コードの命令コードの解析を行う命令コー
ド解析ステップと、 解析した前記一次命令コードの実行を行う命令シミュレ
ーションステップと、 前記一次命令コードの実行の結果に基づき前記プロファ
イルデータの生成を行うプロファイルデータ生成ステッ
プと、 前記命令コード中のデータアクセス命令の解析を行い、
データのアクセスアドレスとアクセスサイズを検出し、
検出したデータの前記アクセスアドレスと前記アクセス
サイズをデータアクセス情報に格納するデータアクセス
情報生成ステップと、 前記データアクセス情報生成ステップで生成した前記デ
ータコードのアクセス回数を前記アクセスアドレス及び
前記アクセスサイズ毎に記録した前記データアクセス情
報に基づきアクセス頻度の降順に前記データコードを検
出して1命令でアクセス可能なデータコード領域である
キャッシュ領域に前記アクセス頻度の降順に再配置し命
令コードを補正するデータ再配置ステップと、 前記データ再配置ステップで補正した前記目的コードを
二次目的コードとして生成する二次目的コード生成ステ
ップとを有することを特徴とするマイクロプロセッサ用
目的コードの最適化プログラムを記録した記録媒体。
16. A program for optimizing a target code for a microprocessor which compiles an input code which is a compile program using profile data to generate a primary target code, simulates the primary target code, and generates the profile data. An instruction code analyzing step of analyzing the instruction code of the primary object code, an instruction simulation step of executing the analyzed primary instruction code, and a step of executing the primary instruction code based on a result of the execution of the primary instruction code. Profile data generating step of generating profile data, and analyzing a data access instruction in the instruction code,
Detects data access address and access size,
A data access information generating step of storing the access address and the access size of the detected data in data access information; and an access count of the data code generated in the data access information generating step for each of the access address and the access size. Based on the recorded data access information, the data code is detected in the descending order of the access frequency, and is relocated to the cache area, which is a data code area accessible by one instruction, in the descending order of the access frequency to correct the instruction code. Recording a program for optimizing an object code for a microprocessor, comprising: an arrangement step; and a secondary object code generation step of generating the object code corrected in the data rearrangement step as a secondary object code. Medium.
JP2001104924A 2001-04-03 2001-04-03 Microprocessor target code optimizing device, optimizing method, and recording medium recording optimizing program Expired - Fee Related JP3758984B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001104924A JP3758984B2 (en) 2001-04-03 2001-04-03 Microprocessor target code optimizing device, optimizing method, and recording medium recording optimizing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001104924A JP3758984B2 (en) 2001-04-03 2001-04-03 Microprocessor target code optimizing device, optimizing method, and recording medium recording optimizing program

Publications (2)

Publication Number Publication Date
JP2002304302A true JP2002304302A (en) 2002-10-18
JP3758984B2 JP3758984B2 (en) 2006-03-22

Family

ID=18957710

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001104924A Expired - Fee Related JP3758984B2 (en) 2001-04-03 2001-04-03 Microprocessor target code optimizing device, optimizing method, and recording medium recording optimizing program

Country Status (1)

Country Link
JP (1) JP3758984B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7428625B2 (en) 2004-02-13 2008-09-23 Samsung Electronics Co., Ltd. Method of adaptively controlling data access by data storage system and disk drive using the method
US9250939B2 (en) 2011-11-11 2016-02-02 International Business Machines Corporation Information processing device, profile target determining program, and method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7428625B2 (en) 2004-02-13 2008-09-23 Samsung Electronics Co., Ltd. Method of adaptively controlling data access by data storage system and disk drive using the method
US9250939B2 (en) 2011-11-11 2016-02-02 International Business Machines Corporation Information processing device, profile target determining program, and method

Also Published As

Publication number Publication date
JP3758984B2 (en) 2006-03-22

Similar Documents

Publication Publication Date Title
US7571432B2 (en) Compiler apparatus for optimizing high-level language programs using directives
JP3499252B2 (en) Compiling device and data processing device
US6988183B1 (en) Methods for increasing instruction-level parallelism in microprocessors and digital system
US7849453B2 (en) Method and apparatus for software scouting regions of a program
EP1280056B1 (en) Generation of debugging information
US7921418B2 (en) Compile time evaluation of library functions
EP1039382B1 (en) Memory access optimizing method
US20040093591A1 (en) Method and apparatus prefetching indexed array references
US20070011664A1 (en) Device and method for generating an instruction set simulator
US8352686B2 (en) Method and system for data prefetching for loops based on linear induction expressions
US7243195B2 (en) Software managed cache optimization system and method for multi-processing systems
US20090049431A1 (en) Method and compiler of compiling a program
CN111159062A (en) Cache data scheduling method and device, CPU chip and server
US20030088863A1 (en) Method and apparatus for selecting references for prefetching in an optimizing compiler
US20030088864A1 (en) Method and apparatus for inserting prefetch instructions in an optimizing compiler
US7228528B2 (en) Building inter-block streams from a dynamic execution trace for a program
US7689976B2 (en) Compiler apparatus and linker apparatus
US7313787B2 (en) Compiler and method for optimizing object codes for hierarchical memories
JP2002304302A (en) Optimizing device and optimizing method for microprocessor object code, and recording medium recorded with optimizing program
TWI743698B (en) Method and device for interpreting execution byte code instruction stream
KR20080045545A (en) Method of pre-processing conditional region
JP2004038279A (en) Compiler, arithmetic operation system and arithmetic operation method
JP2011081836A (en) Compiler device
JP2001195263A (en) Compile device and compile method and recording medium with program for compile recorded thereon
US20040268100A1 (en) Apparatus to implement mesocode

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050801

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050809

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051007

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20051206

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20051227

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees