JP2011028523A - Program conversion device and program conversion system - Google Patents
Program conversion device and program conversion system Download PDFInfo
- Publication number
- JP2011028523A JP2011028523A JP2009173735A JP2009173735A JP2011028523A JP 2011028523 A JP2011028523 A JP 2011028523A JP 2009173735 A JP2009173735 A JP 2009173735A JP 2009173735 A JP2009173735 A JP 2009173735A JP 2011028523 A JP2011028523 A JP 2011028523A
- Authority
- JP
- Japan
- Prior art keywords
- intermediate code
- unit
- optimality
- program
- optimization
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
本発明は、ソースプログラムを、ターゲットプロセッサ向けのコードに変換するプログラム変換装置およびプログラム変換システムに関する。 The present invention relates to a program conversion apparatus and a program conversion system for converting a source program into a code for a target processor.
近年、メディア処理における高性能化が求められている。メディア処理は、例えば、画像および音声の符号化処理、画像および音声の復号処理である。これまで、単一での変換処理のみ行っていれば商品要求を満たしていたが、商品の高性能化により、符号化処理、復号処理の輻輳処理が求められてきた事により、より高性能なメディア処理が求められている。そのために、コンパイラでの最適化処理が実装され、かつ、これまで最適化処理の改善も行われてきた。 In recent years, high performance in media processing has been demanded. The media processing is, for example, image and audio encoding processing and image and audio decoding processing. Until now, if only a single conversion process was performed, the product requirement was satisfied, but due to the high performance of the product, the congestion processing of the encoding process and the decoding process has been required, so the higher performance Media processing is required. For this reason, optimization processing by a compiler has been implemented, and the optimization processing has been improved so far.
しかし、メディア処理の性能向上の要求が高まるにつれ、コンパイラでの最適化処理の効率が向上するようなコードの記述が必要となってきた。プログラム開発者(以下、プログラマという)は、コンパイラに対して#pragma指令による最適化のアシスト情報の記述や、プログラムのチューニングを施すことでコンパイラの最適化処理の活用を行ってきた。 However, as the demand for improving the performance of media processing increases, it has become necessary to write code that improves the efficiency of optimization processing in the compiler. A program developer (hereinafter referred to as a programmer) has used optimization processing of the compiler by describing optimization assistance information by the #pragma instruction to the compiler and tuning the program.
しかし、プログラマは、ソースプログラムのどの箇所にどの様なチューニングを施せばどれだけの性能向上が図れるか分からないため、ソースプログラムの修正に対してどれだけ性能が向上したかを確認するチューニングを繰り返し行い、多大な工数を費やす必要がある。 However, the programmer does not know how much performance improvement can be achieved by applying what kind of tuning to which part of the source program. Therefore, the tuning is repeated to confirm how much the performance has improved by correcting the source program. It is necessary to carry out and spend a great deal of man-hours.
特許文献1には、上記問題を解決するために、プログラマにチューニングを施す箇所を知らせる技術(以下、従来技術Aという)が開示されている。具体的には、特許文献1には、ソースプログラムに対して最適化を施した内容をコンパイルリストファイルとして出力する最適化コンパイラが開示されている。
また、非特許文献1には、入力プログラムをより最適化させるための補助情報の入力を促す対話型の最適化コンパイラが開示されている。
Non-Patent
従来技術Aでは、ソースプログラムに対し行った最適化処理の内容を出力する。プログラムは、この最適化処理の内容に基づいて、ソースプログラムのチューニングを繰り返す。 In the prior art A, the contents of the optimization process performed on the source program are output. The program repeats tuning of the source program based on the contents of the optimization process.
しかし、プログラマは、既に最良となっているかもしれないソースプログラムに対しても、チューニング効果が収束するまで、チューニングを繰り返し実施することで、ソースプログラムの最適性を確認しなければならない。つまり、プログラマは、チューニングに対し多大な工数を費やす必要があり、ソースプログラムのチューニングの効率が悪い。 However, the programmer must confirm the optimality of the source program by repeatedly performing tuning on the source program that may already be the best until the tuning effect converges. That is, the programmer needs to spend a great amount of man-hours for tuning, and the efficiency of tuning the source program is poor.
本発明は、上述の問題点を解決するためになされたものであって、その目的は、ソースプログラムの効率的なチューニングを支援することである。 The present invention has been made to solve the above-described problems, and an object thereof is to support efficient tuning of a source program.
上述の課題を解決するために、この発明のある局面に従うプログラム変換装置は、高級言語で記述されたソースプログラムを、ターゲットプロセッサ向けのコードに変換する。プログラム変換装置は、ソースプログラムから第1の中間コードを生成する中間コード生成部と、第1の中間コードに対しターゲットプロセッサに応じた最適化処理を行うことにより、第2の中間コードを生成する最適化部と、第2の中間コードの性能の分析を行い、性能分析の結果を示す最適性到達度情報を出力する解析部とを備える。 In order to solve the above-described problem, a program conversion device according to an aspect of the present invention converts a source program described in a high-level language into a code for a target processor. The program conversion device generates a second intermediate code by performing an intermediate code generation unit that generates a first intermediate code from a source program and an optimization process corresponding to the target processor for the first intermediate code. An optimization unit, and an analysis unit that analyzes the performance of the second intermediate code and outputs optimality achievement information indicating the result of the performance analysis.
すなわち、中間コード生成部は、ソースプログラムから第1の中間コードを生成する。最適化部は、第1の中間コードに対しターゲットプロセッサに応じた最適化処理を行うことにより、第2の中間コードを生成する。解析部は、第2の中間コードの性能の分析を行い、性能分析の結果を示す最適性到達度情報を出力する。 That is, the intermediate code generation unit generates the first intermediate code from the source program. The optimization unit generates a second intermediate code by performing an optimization process corresponding to the target processor on the first intermediate code. The analysis unit analyzes the performance of the second intermediate code and outputs optimality achievement information indicating the result of the performance analysis.
したがって、プログラマは、最適性到達度情報を参照することにより、ソースプログラムに対応する第2の中間コードの性能分析の結果を把握することができる。その結果、プログラマは、第2の中間コードに対応するソースプログラムに対するチューニングの効果を把握することができる。つまり、最適性到達度情報を出力することにより、プログラマに対し、ソースプログラムの効率的なチューニングを支援することができる。 Therefore, the programmer can grasp the result of the performance analysis of the second intermediate code corresponding to the source program by referring to the optimality achievement degree information. As a result, the programmer can grasp the effect of tuning on the source program corresponding to the second intermediate code. That is, by outputting the optimality reachability information, it is possible to assist the programmer in efficiently tuning the source program.
また、プログラム変換装置は、さらに、第1の中間コードに対し、特定の条件を.緩和させた最適化処理である特定条件緩和最適化処理を行うことにより、第3の中間コードを生成する特定条件緩和最適化部を備え、解析部は、さらに、第3の中間コードの性能を分析し、第2の中間コードおよび第3の中間コードの性能の分析結果を示す最適性到達度情報を出力することが好ましい。 Further, the program conversion apparatus further performs a specific condition relaxation optimization process, which is an optimization process in which a specific condition is relaxed, for the first intermediate code, thereby generating a third intermediate code. A condition relaxation optimization unit is provided, and the analysis unit further analyzes the performance of the third intermediate code and outputs optimality reachability information indicating the analysis results of the performance of the second intermediate code and the third intermediate code. It is preferable to do.
これにより、第2および第3の中間コードの性能の分析結果を把握することができる。
また、特定条件緩和最適化部は、さらに、特定の条件を緩和させた条件の情報を出力することが好ましい。
Thereby, the analysis result of the performance of the second and third intermediate codes can be grasped.
Further, it is preferable that the specific condition relaxation optimizing unit further outputs information on a condition in which the specific condition is relaxed.
また、プログラム変換装置は、さらに、指示を受付ける受付部を備え、特定条件緩和最適化部は、受付部が受付けた指示が示す条件に基づいた特定条件緩和最適化処理を行うことが好ましい。 Moreover, it is preferable that the program conversion apparatus further includes a reception unit that receives an instruction, and the specific condition relaxation optimization unit performs a specific condition relaxation optimization process based on a condition indicated by the instruction received by the reception unit.
また、受付部が受付けた指示は、コマンドラインによる指示であることが好ましい。
また、受付部が受付けた指示は、ソースプログラムに含まれる指示であることが好ましい。
Moreover, it is preferable that the instruction received by the reception unit is an instruction by a command line.
Moreover, it is preferable that the instruction received by the receiving unit is an instruction included in the source program.
また、プログラム変換装置は、さらに、第1の中間コードに対し、論理の正当性を保証しない最適化処理である論理未保証最適化処理を行うことにより、第4の中間コードを生成する論理未保証最適化部を備え、解析部は、さらに、第4の中間コードの性能を分析し、第2の中間コードおよび第4の中間コードの性能の分析結果を示す最適性到達度情報を出力することが好ましい。 In addition, the program conversion apparatus further performs a logic unguaranteed optimization process, which is an optimization process that does not guarantee the validity of the logic, on the first intermediate code, thereby generating a fourth logic code that does not generate a fourth intermediate code. A guarantee optimization unit is provided, and the analysis unit further analyzes the performance of the fourth intermediate code, and outputs optimum reachability information indicating the analysis results of the performance of the second intermediate code and the fourth intermediate code. It is preferable.
これにより、第2および第4の中間コードの性能の分析結果を把握することができる。
また、論理未保証最適化部は、さらに、論理の正当性を保証していない条件の情報を出力することが好ましい。
Thereby, the analysis result of the performance of the second and fourth intermediate codes can be grasped.
Further, it is preferable that the logic non-guaranteed optimization unit further outputs information on conditions for which the logical validity is not guaranteed.
また、プログラム変換装置は、さらに、指示を受付ける受付部を備え、論理未保証最適化部は、受付部が受付けた指示が示す、論理の保証が不要な条件に基づいた論理未保証最適化処理を行うことが好ましい。 The program conversion apparatus further includes a receiving unit that receives an instruction, and the logical unguaranteed optimization unit performs a logical unguaranteed optimization process based on a condition that does not require a logical guarantee indicated by the instruction received by the receiving unit. It is preferable to carry out.
また、受付部が受付けた指示は、コマンドラインによる指示であることが好ましい。
また、受付部が受付けた指示は、ソースプログラムに含まれる指示であることが好ましい。
Moreover, it is preferable that the instruction received by the reception unit is an instruction by a command line.
Moreover, it is preferable that the instruction received by the receiving unit is an instruction included in the source program.
また、最適性到達度情報は、ターゲットプロセッサに対する第2の中間コードの最適度合いを少なくとも示すことが好ましい。 Further, it is preferable that the optimality reachability information indicates at least the optimal degree of the second intermediate code for the target processor.
この発明の他の局面に従うプログラム変換システムは、高級言語で記述されたソースプログラムを、ターゲットプロセッサ向けの機械語コードに変換するシステムである。プログラム変換システムは、プログラムから第1の中間コードを生成する中間コード生成部と、第1の中間コードに対しターゲットプロセッサに応じた最適化処理を行うことにより、第2の中間コードを生成する最適化部と、第2の中間コードの性能の分析を行うことにより、性能分析の結果を示す最適性到達度情報を出力する解析部と、第2の中間コードに基づくファイルを使用してターゲットプロセッサで動作する機械語コードを生成する機械語コード生成部とを備える。 A program conversion system according to another aspect of the present invention is a system for converting a source program described in a high-level language into a machine language code for a target processor. The program conversion system includes an intermediate code generation unit that generates a first intermediate code from a program and an optimization process that generates a second intermediate code by performing an optimization process on the first intermediate code according to a target processor. An analysis unit that outputs performance reachability information indicating the result of the performance analysis by analyzing the performance of the second intermediate code, and a target processor using a file based on the second intermediate code A machine language code generation unit that generates machine language code that operates on the machine.
なお、本発明は、このような特徴的な手段を備えるプログラム変換装置として実現するだけでなく、プログラム変換装置に含まれる特徴的な処理を行う各部をステップとするプログラム変換方法として実現したり、プログラム変換装置に含まれる特徴的な手段としてコンピュータを機能させるためのプログラムとして実現したりすることもできる。そして、そのようなプログラムは、CD−ROM(Compact Disc-Read Only Memory)等の記録媒体やインターネット等の通信ネットワークを介して流通させることができるのは言うまでもない。 Note that the present invention is not only realized as a program conversion apparatus including such characteristic means, but also realized as a program conversion method in which each unit performing characteristic processing included in the program conversion apparatus is a step, It can also be realized as a program for causing a computer to function as characteristic means included in the program conversion apparatus. Needless to say, such a program can be distributed via a recording medium such as a CD-ROM (Compact Disc-Read Only Memory) or a communication network such as the Internet.
本発明により、ソースプログラムの効率的なチューニングを支援することができる。 According to the present invention, efficient tuning of a source program can be supported.
以下、図面を参照しつつ、本発明の実施の形態について説明する。以下の説明では、同一の部品には同一の符号を付してある。それらの名称および機能も同じである。したがって、それらについての詳細な説明は繰り返さない。 Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following description, the same parts are denoted by the same reference numerals. Their names and functions are also the same. Therefore, detailed description thereof will not be repeated.
<第1の実施の形態>
以下、第1の実施の形態におけるコンパイラシステムについて説明する。
<First Embodiment>
Hereinafter, the compiler system in the first embodiment will be described.
第1の実施の形態におけるコンパイラシステムは、図1に示されるコンピュータ500において、プログラムが実行されることにより実現される。
The compiler system in the first embodiment is realized by executing a program in the
次に、コンピュータ500について詳細に説明する。
図2は、コンピュータ500内のハードウエア構成を示したブロック図である。なお、図2には、説明のために、記録媒体50も示している。記録媒体50には、後述するプログラム51が記録されている。すなわち、プログラム51は、媒体等に記録されてプログラム製品として流通される。また、記録媒体50もプログラム製品として流通される。
Next, the
FIG. 2 is a block diagram showing a hardware configuration in the
図2に示されるように、コンピュータ500は、制御部510と、RAM(Random Access Memory)520と、記憶部522と、記憶媒体アクセス部530と、表示部540と、キーボード551と、マウス552と、通信部560とを備える。
As shown in FIG. 2, the
制御部510、RAM520、記憶部522、記憶媒体アクセス部530、表示部540、キーボード551、マウス552および通信部560は、データバス502に接続されている。
制御部510は、CPU(Central Processing Unit)である。なお、制御部510は、CPUに限定されることなく、演算機能を有するその他の回路であってもよい。
RAM520は、揮発性のメモリである。RAM520は、制御部510によってデータアクセスされる。RAM520は、一時的にデータを記憶するワークメモリとしての機能を有する。
The
記憶部522は、不揮発性のメモリである。記憶部522は、たとえば、ハードディスクドライブである。なお、記憶部522は、ハードディスクドライブに限定されることなく、不揮発的のメモリであれば、その他のメモリ(たとえば、フラッシュメモリ)であってもよい。記憶部522は、制御部510によって、データアクセスされる。記憶部522には、プログラム51、その他の各種データ等が記憶されている。
The
制御部510は、記憶部522に記憶されているプログラム51を実行し、プログラム51に基づいて、コンピュータ500内の各部に対する各種処理や、演算処理等を行なう。
記憶媒体アクセス部530は、制御部510からの指示により、プログラム51が記憶された記録媒体50から、プログラム51を読み出す機能を有する。記録媒体50に記憶されているプログラム51は、制御部510が行なうインストール処理により、記憶媒体アクセス部530により読み出され、記憶部522に記憶される。このインストール処理用プログラムは、予め、記憶部522に格納されている。インストール処理は、制御部510が、インストール処理用プログラムに基づいて行なう。
The storage
記録媒体50は、CD−ROM(Compact Disc-Read Only Memory)である。なお、記録媒体50は、CD−ROMに限定されることなく、データを不揮発的に記録可能なその他の媒体(例えば、SD(Secure Digital)メモリーカード)であってもよい。
The
表示部540は、文字や画像等を表示する機能を有する。表示部540には、文字や画像等を表示する表示面が設けられる。表示部540は、LCDパネル(Liquid Crystal Display Panel)を使用した装置である。なお、表示部540は、上記以外の表示方式のパネルを使用した装置であってもよい。
The
ユーザは、キーボード551またはマウス552を操作することにより、コンピュータ500に指示を与える。キーボード551またはマウス552からの入力指示は、制御部510へ送信される。制御部510は、キーボード551またはマウス552からの入力指示に基づいて所定の処理を行なう。すなわち、キーボード551およびマウス552は、ユーザがコンピュータ500を操作するためのインターフェースである。
The user gives an instruction to the
通信部560は、有線技術または無線技術を利用して、ネットワークに接続される装置とデータ通信を行なう機能を有する。有線技術は、たとえば、イーサネット(登録商標)に基づく技術である。なお、有線技術は、イーサネット(登録商標)に基づく技術に限定されることなく、その他の有線技術であってもよい。
The
(システム構成(基本))
図3は、第1の実施の形態におけるコンパイラシステム148の構成を示す図である。コンパイラシステム148は、プログラム51が制御部510により実行されることにより実現される。すなわち、プログラム51は、コンパイラシステム148を含む。
(System configuration (basic))
FIG. 3 is a diagram illustrating a configuration of the
コンパイラシステム148は、C言語等の高級言語で記述されたソースプログラム141を、機械語コードで記述される実行プログラム145に変換するソフトウエアシステムである。具体的には、コンパイラシステム148は、ソースプログラム141を、ターゲットプロセッサが実行可能な実行プログラム145に変換するソフトウエアシステムである。ここで、ターゲットプロセッサとは、実行プログラム145を実行させる対象となるCPUである。当該CPUは、コンピュータで使用されるCPUである。
The
ターゲットプロセッサは、複数種類のハードウエア資源を有する。複数種類のハードウエア資源は、例えば、実行ユニット、キャッシュメモリ、命令デコードユニット等である。実行ユニットには、演算器(ALU)、レジスタ等が含まれる。 The target processor has multiple types of hardware resources. The plural types of hardware resources are, for example, an execution unit, a cache memory, an instruction decode unit, and the like. The execution unit includes an arithmetic unit (ALU), a register, and the like.
コンパイラシステム148は、コンパイラ149と、アセンブラ150と、リンカ151とを含む。
The
コンパイラ149は、ソースプログラム141を、ターゲットプロセッサ向けのアセンブラファイル143に変換するプログラムである。アセンブラファイル143は、アセンブラ言語で記述されたファイルである。
The
コンパイラ149は、ソースプログラム141をアセンブラファイル143に変換する際に、最適化処理を行い、アセンブラファイル143および最適性到達度情報142を出力する。最適性到達度情報142は、ソースプログラム141に対する最適性を解析した結果を示す情報である。
The
アセンブラ150は、アセンブラ言語で記述されたアセンブラファイル143を機械語コードで記述されたオブジェクトファイル144に変換するプログラムである。
The
リンカ151は、複数のオブジェクトファイル144を結合し、実行プログラム145を生成するプログラムである。実行プログラム145は、ターゲットプロセッサで動作するプログラムである。つまり、アセンブラ150およびリンカ151は、アセンブラファイル143を使用して、機械語コードで記述された実行プログラム145を生成する機械語コード生成部を構成する。
The
(コンパイラの構成(基本))
図4は、第1の実施の形態におけるコンパイラ149の構成を示す図である。
(Compiler configuration (basic))
FIG. 4 is a diagram illustrating a configuration of the
コンパイラ149は、構文解析部182と、論理保証最適化部184と、最適性到達度解析部186と、コード出力部188とを含む。コンパイラ149内の各部は、プログラムモジュールとして実現される。
The
構文解析部182は、ソースプログラム141に対し構文解析処理を行うことにより、中間コード(以下、第1の中間コードという)を生成し、第1の中間コードを出力する。すなわち、構文解析部182は、ソースプログラム141から第1の中間コードを生成する中間コード生成部である。
The
ここで、以下に記載する最適化処理は、一般的な最適化コンパイラが行う最適化処理であるとする。当該最適化処理は、例えば、ループ回数を少なくするための処理、命令の実行回数を減らすための処理、コードサイズを小さくするための処理、分岐の数を少なくするための処理等を含む。当該最適化処理は、一般的なコンパイラで行われる処理と同様なので詳細な説明は繰り返さない。 Here, it is assumed that the optimization process described below is an optimization process performed by a general optimization compiler. The optimization process includes, for example, a process for reducing the number of loops, a process for reducing the number of instruction executions, a process for reducing the code size, and a process for reducing the number of branches. Since the optimization process is the same as the process performed by a general compiler, detailed description will not be repeated.
論理保証最適化部184は、第1の中間コードに対して、論理の正当性を保証した最適化処理を行う。論理の正当性を保証した最適化処理とは、例えば、当該最適化処理が行われることにより得られる中間コードの論理(アルゴリズム)に矛盾がない処理である。すなわち、論理保証最適化部184は、第1の中間コードに対して、論理の正当性を保証可能な範囲内で最適化処理を行う。
The logic
以下においては、論理保証最適化部184が行う最適化処理を、論理保証最適化処理という。
Hereinafter, the optimization process performed by the logic
具体的には、論理保証最適化部184は、第1の中間コードに対して、ターゲットプロセッサの仕様に応じた最適化処理(論理保証最適化処理)を行うことにより、最適化処理が施された中間コード(以下、第2の中間コードという)を出力する。第2の中間コードは、第1の中間コードに対して最適化処理が行われることにより得られる中間コードである。すなわち、論理保証最適化部184は、第1の中間コードに対してターゲットプロセッサに応じた最適化処理を行うことにより、第2の中間コードを生成する。
Specifically, the logic
この場合、第2の中間コードは、論理(アルゴリズム)に矛盾がないコードである。
プログラマが一般的に行うチューニング手法の一つに、一般的な、C99言語にて定義されているrestrict修飾子を用いた、見かけのメモリ依存の緩和手法がある。C99言語とは「ISO/IEC 9899:1999-Programming Language C」の規格に基づくC言語である。restrict修飾子および見かけのメモリ依存は、一般的で周知なものであるため、その詳細な説明はここでは行わない。
In this case, the second intermediate code is a code having no contradiction in logic (algorithm).
One of the tuning methods generally performed by programmers is a general memory dependence mitigation method using a restrict modifier defined in the C99 language. The C99 language is a C language based on the standard of “ISO / IEC 9899: 1999-Programming Language C”. Since the restrict qualifier and apparent memory dependence are common and well known, a detailed description thereof will not be given here.
本実施の形態では、例えば、見かけのメモリ依存に着目し、論理保証最適化部184は、第1の中間コードに対して、見かけのメモリ依存を考慮した論理保証最適化処理を行うことにより、第2の中間コードを得る。
In the present embodiment, for example, paying attention to the apparent memory dependence, the logic
最適性到達度解析部186は、論理保証最適化部184から出力された第2の中間コードに基づいて、第2の中間コードの最適性の到達度としての最適度情報を算出する。当該最適度情報は、第2の中間コードが、ターゲットプロセッサのハードウエア資源をどれだけ効率的に使用できているかの割合である。最適度情報は、例えば、レジスタ資源使用率、演算器資源使用率、パイプライン占有率、バス幅占有率、IPC(Instruction par Cycle)、ストール率等である。
Based on the second intermediate code output from the logic
最適性到達度解析部186は、例えば、第2の中間コードと、ターゲットプロセッサのアーキテクチャ仕様とを照らし合わせて、算出した最適度情報を示す最適性到達度情報142を出力する。
The optimality achievement
すなわち、最適性到達度解析部186は、第2の中間コードの最適性の到達度(最適度合い)を解析(分析)し、解析(分析)の結果(最適度合い)を示す最適性到達度情報142を出力する。つまり、最適性到達度解析部186は、第2の中間コードの性能の分析を行い、性能分析の結果を示す最適性到達度情報142を出力する。この場合、最適性到達度情報142は、第2の中間コードの最適度合いを示す。
That is, the optimality
コード出力部188は、論理保証最適化部184にて、論理を保証して最適化された第2の中間コードをアセンブラ言語に変換して、アセンブラファイル143を出力する。すなわち、アセンブラファイル143は、第2の中間コードに基づくファイルである。
The
(コンパイラ処理の流れ(基本))
次に、コンパイラ149が実行する処理の流れについて説明する。
(Flow of compiler processing (basic))
Next, the flow of processing executed by the
図5は、コンパイラ149が実行する処理のフローチャートである。
構文解析部182は、ソースプログラム141の構文解析を行い、第1の中間コードを生成する(S1)。論理保証最適化部184は、第1の中間コードに対し前述した論理保証最適化処理を行うことにより、第2の中間コードを生成する(S2)。
FIG. 5 is a flowchart of processing executed by the
The
最適性到達度解析部186は、第2の中間コードの最適性の到達度を解析(分析)し、解析(分析)の結果を示す最適性到達度情報142を出力する(S3)。
The optimality
コード出力部188は、第2の中間コードをアセンブラ言語に変換し、アセンブラファイル143として出力する(S4)。
The
(最適性到達度解析処理の詳細な流れ(基本))
次に、図5のステップS3の最適性到達度解析処理について詳細に説明する。
(Detailed flow of optimality achievement analysis processing (basic))
Next, the optimality achievement analysis process in step S3 of FIG. 5 will be described in detail.
図6は、最適性到達度解析処理のフローチャートである。
最適性到達度解析部186は、第2の中間コードを、関数(手続き)毎に分割して第2の中間コードを解析する(S31)。
FIG. 6 is a flowchart of optimality reachability analysis processing.
The optimality
次に、最適性到達度解析部186は、ステップS31にて関数毎に分割された第2の中間コードを、基本ブロック毎に分割して、分割された各第2の中間コードを解析する(S32)。ここで、基本ブロックとは、分岐命令のないブロックである。
Next, the optimality achievement
次に、最適性到達度解析部186は、ステップS32にて基本ブロック毎に分割された各第2の中間コードに対応するDAG(Directed acyclic graph)情報を生成する(S33)。DAG情報とは、閉路を持たない有効グラフを示す情報である。
Next, the optimality achievement
次に、最適性到達度解析部186は、生成されたDAG情報と、ターゲットプロセッサのアーキテクチャ仕様と比較した結果を、性能解析情報データベース201Dに登録する。具体的には、最適性到達度解析部186は、関数シンボル名を主キーとして、基本ブロックを特定する番号と比較結果とを対応づけて性能解析情報データベース201Dに登録する(S34)。
Next, the optimality achievement
例えば、ターゲットプロセッサのアーキテクチャ仕様が、3命令同時発行可能であることを示しているとする。この場合、DAG情報から、分割された第2の中間コードのIPC(Instruction par Cycle)が、2.5であることが解析されたとする。IPCとは、1サイクルにおいて、ターゲットプロセッサが実行可能な命令の数である。 For example, assume that the architecture specification of the target processor indicates that three instructions can be issued simultaneously. In this case, it is assumed that the IPC (Instruction Par Cycle) of the divided second intermediate code is analyzed from the DAG information as 2.5. The IPC is the number of instructions that can be executed by the target processor in one cycle.
この場合、最適性到達度は、2.5/3=83%となる。すなわち、ステップS34の処理により、最適性到達度83%が、性能解析情報データベース201Dに登録される。
In this case, the optimality achievement is 2.5 / 3 = 83%. That is, the optimality achievement level of 83% is registered in the performance
次に、ステップS35にて、最適性到達度解析部186は、性能解析情報データベース201Dから、主キーの関数名毎に基本ブロック番号と比較結果を整形し、整形された後の情報を示す最適性到達度情報142を出力する。この場合、制御部510は、最適性到達度情報142を、例えば、表示部540に表示させるための処理を行う。そして、この最適性到達度解析処理は終了する。
Next, in step S35, the optimality achievement
ここで、ソースプログラム141が、一例として、図7に示されるプログラムであるとする。この場合、図5の処理および図6の最適性到達度解析処理が行われることにより出力される最適性到達度情報142は、一例として、図8に示される情報である。
Here, it is assumed that the
図8は、第1の実施の形態における一例としての最適性到達度情報142を示す図である。
FIG. 8 is a diagram showing the optimality
図8において、「BasicBlockNum」とは、基本ブロック番号である。「IPC(解析結果)」とは、最適性到達度解析処理により得られた、基本ブロック番号に対応する、分割された第2の中間コードのIPCを示す。「IPC(仕様)」とは、ターゲットプロセッサのアーキテクチャ仕様として示されるIPCである。 In FIG. 8, “BasicBlockNum” is a basic block number. “IPC (analysis result)” indicates the IPC of the divided second intermediate code corresponding to the basic block number, obtained by the optimality reachability analysis process. “IPC (specification)” is an IPC indicated as an architecture specification of the target processor.
図8の「最適性到達度」は、(IPC(解析結果)/IPC(仕様))の式により算出される値である。「最適性到達度」は、ステップS34の処理において、最適性到達度解析部186が算出する。この場合、「最適性到達度」は、ステップS34の処理における比較結果である。
The “optimum achievement level” in FIG. 8 is a value calculated by the equation (IPC (analysis result) / IPC (specification)). The “optimum achievement level” is calculated by the optimality
基本ブロックに対応する最適性到達度が100(%)に近い値であるほど、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードが、ターゲットプロセッサのハードウエア資源を、より効率的に使用できていることになる。すなわち、最適性到達度は、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードのアルゴリズムの最適度を示す。
The closer the optimality achievement level corresponding to the basic block is to a value close to 100 (%), the more the source code of the part corresponding to the basic block described in the
基本ブロックに対応する最適性到達度が100(%)である場合、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードは、ターゲットプロセッサのハードウエア資源を最も効率的に使用できていることになる。
When the optimality achievement degree corresponding to the basic block is 100 (%), the source code of the part corresponding to the basic block described in the
例えば、図8では、基本ブロック番号“2”に対応する、分割された第2の中間コードの最適性到達度が最も大きいことになる。すなわち、ソースプログラム141に記述されている、基本ブロック番号“2”に対応する部分のソースコードのアルゴリズムの最適度が最もよいことになる。
For example, in FIG. 8, the optimal reachability of the divided second intermediate code corresponding to the basic block number “2” is the highest. That is, the optimality of the algorithm of the source code of the part corresponding to the basic block number “2” described in the
図8に示される情報(最適性到達度情報142)が、表示部540に表示されることにより、プログラマは、作成しているソースプログラム141に記述されているソースコードのアルゴリズムの最適度を把握することができる。
The information (optimum reachability information 142) shown in FIG. 8 is displayed on the
以上説明したように、本実施の形態では、ソースプログラム141のコンパイル時に、ソースプログラム141のアルゴリズムの最適度としての最適性到達度が、表示部540に表示される。
As described above, in this embodiment, when the
したがって、プログラマは、作成しているソースプログラム141に記述されているソースコードのアルゴリズムの最適度を把握することができる。その結果、プログラマは、開発の工程数を無駄にすることなく、ソースプログラム141のチューニングを実施することができる。
Therefore, the programmer can grasp the optimum degree of the algorithm of the source code described in the
つまり、本実施の形態によれば、ソースプログラム141において、改善効果が見込める部分を容易に特定可能となる。そのため、プログラマは、いくら修正しても性能が上がらないようなプログラムのチューニングに無駄な時間を費やすことなく、効率的にプログラムのチューニングを進めることができる。
In other words, according to the present embodiment, it is possible to easily specify a portion in the
すなわち、図8に示される情報(最適性到達度情報142)が、表示部540に表示(出力)されることにより、プログラマに対し、ソースプログラムの効率的なチューニングを支援することができる。
That is, the information (optimum reachability information 142) shown in FIG. 8 is displayed (output) on the
<第2の実施の形態>
以下、第2の実施の形態におけるコンパイラシステムについて説明する。
<Second Embodiment>
Hereinafter, a compiler system according to the second embodiment will be described.
第2の実施の形態におけるコンパイラシステムは、図1に示されるコンピュータ500において、プログラムが実行されることにより実現される。
The compiler system in the second embodiment is realized by executing a program in the
(システム構成(特定条件緩和))
図9は、第2の実施の形態におけるコンパイラシステム148Aの構成を示す図である。コンパイラシステム148Aは、プログラム51が制御部510により実行されることにより実現される。すなわち、プログラム51は、コンパイラシステム148Aを含む。
(System configuration (relaxation of specific conditions))
FIG. 9 is a diagram illustrating a configuration of a
図9を参照して、コンパイラシステム148Aは、図3のコンパイラシステム148と比較して、コンパイラ149の代わりにコンパイラ149Aを含む点が異なる。それ以外の構成は、コンパイラシステム148と同様なので詳細な説明は繰り返さない。
9,
(コンパイラの構成(特定条件緩和))
図10は、第2の実施の形態におけるコンパイラ149Aの構成を示す図である。
(Compiler configuration (relaxation of specific conditions))
FIG. 10 is a diagram illustrating a configuration of the
図10を参照して、コンパイラ149Aは、図4のコンパイラ149と比較して、特定条件緩和最適化部183をさらに含む点と、最適性到達度解析部186の代わりに最適性到達度解析部186Aを含む点とが異なる。それ以外の構成は、コンパイラ149と同様なので詳細な説明は繰り返さない。コンパイラ149A内の各部は、プログラムモジュールとして実現される。
Referring to FIG. 10,
構文解析部182は、前述した第1の中間コードを、論理保証最適化部184および特定条件緩和最適化部183へ送信する。
The
特定条件緩和最適化部183は、構文解析部182から受信する第1の中間コードに対して、特定の条件を緩和させた最適化処理(以下、特定条件緩和最適化処理という)を行う。すなわち、特定条件緩和最適化処理は、特定条件を緩和させた条件(以下、緩和特定条件という)に基づいた最適化処理である。特定条件とは、一般的なコンパイラに実装される複数種類の最適化の条件のうちの1つの最適化の条件である。
The specific condition
特定条件には、例えば、前述のメモリアクセスにおける見かけの依存(見かけのメモリ依存)やポインタレジスタのアラインメント等の制約や、命令数(コードサイズ)、使用演算器資源等の指標がある。以下においては、見かけのメモリ依存を、単に、見かけの依存という。 Specific conditions include, for example, the above-described restrictions on apparent memory access (apparent memory dependence), alignment of pointer registers, and the like, the number of instructions (code size), and operational unit resources used. In the following, apparent memory dependence is simply referred to as apparent dependence.
特定条件は、例えば、見かけの依存に関する制約では、複数のポインタ変数による互いのメモリアクセスは、見かけの依存が発生していると仮定しなければならないという条件である。この場合、緩和特定条件は、例えば、仮引数のポインタ変数に関しては見かけの依存が発生しないものして仮定するという条件である。この場合、特定条件を緩和させた最適化処理(特定条件緩和最適化処理)は、最適化処理の対象となるコードの見かけの依存を、例えば、仮引数のポインタ変数に関して発生しないとする処理を含む。 The specific condition is a condition that, for example, in the constraint on the apparent dependency, it is assumed that the mutual memory access by the plurality of pointer variables has an apparent dependency. In this case, the relaxation specifying condition is, for example, a condition that it is assumed that no apparent dependence occurs with respect to the pointer variable of the dummy argument. In this case, the optimization process (specific condition relaxation optimization process) in which the specific condition is relaxed is a process in which the apparent dependency of the code targeted for the optimization process does not occur with respect to the pointer variable of the dummy argument, for example. Including.
また、特定条件は、例えば、アラインメントに関する制約では、ポインタ変数によるメモリアクセスは、アラインメントに応じたメモリアクセス命令を生成しなければならないという条件である。この場合、緩和特定条件は、例えば、仮引数のポインタ変数に関してはアラインメントが8バイトアラインメントであるという条件である。この場合、特定条件を緩和させた最適化処理(特定条件緩和最適化処理)は、最適化処理の対象となるコードに含まれるメモリアクセスのアラインメントを、例えば、仮引数のポインタ変数に関して8バイトアラインメントとする処理を含む。 The specific condition is, for example, a condition that a memory access instruction corresponding to the alignment must be generated for a memory access using a pointer variable in a constraint related to alignment. In this case, the relaxation specifying condition is, for example, a condition that the alignment is 8-byte alignment with respect to the pointer variable of the dummy argument. In this case, the optimization process (specific condition relaxation optimization process) in which the specific condition is relaxed performs the alignment of the memory access included in the code to be optimized, for example, 8-byte alignment with respect to the pointer variable of the dummy argument. Including processing.
また、特定条件は、例えば、最適化処理の対象となるコードにおける命令の数を、50%以下にするという条件である。この場合、緩和特定条件は、例えば、最適化処理の対象となるコードにおける命令の数を、例えば、60%以下にするという条件である。この場合、特定条件を緩和させた最適化処理(特定条件緩和最適化処理)は、最適化処理の対象となるコードにおける命令の数を、例えば、60%以下にする処理を含む。 The specific condition is, for example, a condition that the number of instructions in the code to be optimized is 50% or less. In this case, the relaxation specifying condition is, for example, a condition that the number of instructions in the code to be optimized is, for example, 60% or less. In this case, the optimization process in which the specific condition is relaxed (specific condition relaxation optimization process) includes a process in which the number of instructions in the code to be optimized is, for example, 60% or less.
また、特定条件は、例えば、最適化処理の対象となるコードにおける命令の使用演算器資源数を、50%以下にするという条件である。この場合、緩和特定条件は、例えば、最適化処理の対象となるコードにおける命令の使用演算器資源数を、例えば、60%以下にするという条件である。この場合、特定条件を緩和させた最適化処理(特定条件緩和最適化処理)は、最適化処理の対象となるコードにおける命令の使用演算器資源数を、例えば、60%以下にする処理を含む。 The specific condition is, for example, a condition that the number of used computing unit resources of instructions in the code to be optimized is 50% or less. In this case, the relaxation specifying condition is, for example, a condition that the number of used arithmetic unit resources of instructions in the code to be optimized is, for example, 60% or less. In this case, the optimization process in which the specific condition is relaxed (specific condition relaxation optimization process) includes a process in which, for example, the number of used arithmetic unit resources in the code targeted for the optimization process is reduced to 60% or less. .
緩和特定条件は、コンパイラに実装される様々な最適化の条件に適用できる。
特定条件緩和最適化部183は、第1の中間コードに対して特定条件緩和最適化処理を行うことにより、特定条件緩和最適化処理が施された中間コード(以下、第3の中間コードという)を出力する。すなわち、特定条件緩和最適化部183は、第1の中間コードに対して特定条件緩和最適化処理を行うことにより、第3の中間コードを生成する。
The relaxation specific condition can be applied to various optimization conditions implemented in the compiler.
The specific condition
特定条件緩和最適化部183は、第3の中間コードを、最適性到達度解析部186Aへ送信する。
The specific condition
論理保証最適化部184は、第1の実施の形態で説明した処理に加え、第2の中間コードを、最適性到達度解析部186Aへ送信する。
In addition to the processing described in the first embodiment, the logic
最適性到達度解析部186Aは、第2の中間コードおよび第3の中間コードを受信する。最適性到達度解析部186Aは、第2の中間コードと、第3の中間コードとの性能の比較が可能なように、第2の中間コードおよび第3の中間コードの性能の分析(解析)を行い、第2の中間コードおよび第3の中間コードの性能の分析結果を示す最適性到達度情報142を出力する。
Optimality
この場合、最適性到達度情報142は、第2の中間コードの性能と、第3の中間コードの性能とが比較可能なように分析結果を示す。
In this case, the optimality
(コンパイラ処理の流れ(特定条件緩和))
次に、コンパイラ149Aが実行する処理の流れについて説明する。
(Flow of compiler processing (relaxation of specific conditions))
Next, the flow of processing executed by the
図11は、コンパイラ149Aが実行する処理のフローチャートである。図11において、図5のステップ番号と同じステップ番号の処理は、第1の実施の形態で説明した処理と同様な処理が行なわれるので詳細な説明は繰り返さない。
FIG. 11 is a flowchart of processing executed by the
構文解析部182は、ソースプログラム141の構文解析を行い、第1の中間コードを生成する(S1)。構文解析部182は、第1の中間コードを、論理保証最適化部184および特定条件緩和最適化部183へ送信する。
The
論理保証最適化部184は、第1の実施の形態と同様に、第1の中間コードに対し前述した論理保証最適化処理を行うことにより、第2の中間コードを生成する。そして、論理保証最適化部184は、第2の中間コードを最適性到達度解析部186Aおよびコード出力部188へ送信する(S2A)。
Similarly to the first embodiment, the logic
特定条件緩和最適化部183は、第1の中間コードに対し前述した特定条件緩和最適化処理を行うことにより、第3の中間コードを生成し、第3の中間コードを、最適性到達度解析部186Aへ送信する(S6)。
The specific condition
最適性到達度解析部186Aは、第2の中間コードおよび第3の中間コードの最適性の到達度を解析(分析)し、解析(分析)の結果を示す最適性到達度情報142を出力する(S3Aの最適性到達度解析処理A)。すなわち、最適性到達度解析部186Aは、第2の中間コードおよび第3の中間コードの性能の分析結果を示す最適性到達度情報142を出力する。
Optimality
(最適性到達度解析処理Aの詳細な流れ(特定条件緩和))
次に、図11のステップS3Aの最適性到達度解析処理Aについて詳細に説明する。
(Detailed flow of optimality achievement analysis process A (relaxation of specific conditions))
Next, the optimality achievement analysis process A in step S3A of FIG. 11 will be described in detail.
図12は、最適性到達度解析処理Aのフローチャートである。図12において、図6のステップ番号と同じステップ番号の処理は、第1の実施の形態で説明した処理と同様な処理が行なわれるので詳細な説明は繰り返さない。 FIG. 12 is a flowchart of the optimality achievement level analysis process A. In FIG. 12, the process with the same step number as the step number of FIG. 6 is performed in the same way as the process described in the first embodiment, and therefore detailed description will not be repeated.
最適性到達度解析部186Aは、第2の中間コードを、関数(手続き)毎に分割して第2の中間コードを解析する(S31)。
The optimality
次に、最適性到達度解析部186Aは、ステップS31にて関数毎に分割された第2の中間コードを、基本ブロック毎に分割して、分割された各第2の中間コードを解析する(S32)。
Next, the optimality achievement
次に、最適性到達度解析部186Aは、基本ブロック毎に分割された各第2の中間コードに対応するDAG情報を生成する(S33)。
Next, the optimality achievement
次に、最適性到達度解析部186Aは、生成されたDAG情報が示すDAGの高さを解析することにより、サイクル情報としてのサイクル数(以下、論理保証サイクル数という)を求める(S36)。当該論理保証サイクル数は、処理対象のDAG情報に対応する第2の中間コードを、ターゲットプロセッサが実行するために必要なサイクル数である。
Next, the optimality achievement
また、最適性到達度解析部186Aは、関数シンボル名を主キーとして、基本ブロックを特定する番号と、サイクル情報としての論理保証サイクル数とを対応づけて性能解析情報データベース211Dに登録する(S36)。
Further, the optimality achievement
図12のステップS31〜S36と同様に、最適性到達度解析部186Aは、以下の処理を行う。
Similar to steps S31 to S36 in FIG. 12, the optimality achievement
まず、最適性到達度解析部186Aは、第3の中間コードを、関数(手続き)毎に分割して第3の中間コードを解析する(S61)。
First, the optimality achievement
次に、最適性到達度解析部186Aは、ステップS61にて関数毎に分割された第2の中間コードを、基本ブロック毎に分割して、分割された各第3の中間コードを解析する(S62)。
Next, the optimality achievement
次に、最適性到達度解析部186Aは、基本ブロック毎に分割された各第3の中間コードに対応するDAG情報を生成する(S63)。
Next, the optimality achievement
次に、最適性到達度解析部186Aは、生成されたDAG情報が示すDAGの高さを解析することにより、サイクル情報としてのサイクル数(以下、条件緩和サイクル数という)を求める(S64)。
Next, the optimality achievement
また、最適性到達度解析部186Aは、関数シンボル名を主キーとして、基本ブロックを特定する番号と、サイクル情報としての条件緩和サイクル数とを対応づけて性能解析情報データベース212Dに登録する(S64)。
Further, the optimality achievement
次に、ステップS35Aにて、最適性到達度解析部186Aは、性能解析情報データベース211Dおよび性能解析情報データベース212Dの各々から、主キーの関数名毎に基本ブロック番号およびサイクル情報を整形し、整形された後の情報を示す最適性到達度情報142を出力する。この場合、制御部510は、最適性到達度情報142を、例えば、表示部540に表示させるための処理を行う。そして、この最適性到達度解析処理Aは終了する。
Next, in step S35A, the optimality achievement
ここで、ソースプログラム141が、一例として、図7に示されるプログラムであるとする。この場合、図11の処理および図12の最適性到達度解析処理Aが行われることにより出力される最適性到達度情報142は、一例として、図13に示される情報である。
Here, it is assumed that the
図13は、第2の実施の形態における一例としての最適性到達度情報142を示す図である。
FIG. 13 is a diagram illustrating optimality
図13において、「BasicBlockNum」とは、基本ブロック番号である。「論理保証サイクル数」とは、最適性到達度解析処理Aにより得られた、分割された第2の中間コードに対応する、サイクル情報としての論理保証サイクル数である。「条件緩和サイクル数」とは、最適性到達度解析処理Aにより得られた、分割された第3の中間コードに対応する、サイクル情報としての条件緩和サイクル数である。 In FIG. 13, “BasicBlockNum” is a basic block number. The “number of logic guarantee cycles” is the number of logic guarantee cycles as cycle information corresponding to the divided second intermediate code obtained by the optimality reachability analysis process A. “The number of condition relaxation cycles” is the number of condition relaxation cycles as cycle information corresponding to the divided third intermediate code obtained by the optimum reachability analysis process A.
図13の「最適性到達度」は、(条件緩和サイクル数/論理保証サイクル数)の式により算出される値である。「最適性到達度」は、ステップS35Aの処理において、最適性到達度解析部186Aが算出する。なお、最適性到達度解析部186Aは、条件緩和サイクル数が論理保証サイクル数より大きい場合、最適性到達度を100とする。
The “optimum achievement degree” in FIG. 13 is a value calculated by the equation (number of condition relaxation cycles / number of logic guarantee cycles). The “optimum achievement level” is calculated by the optimality
図13の「最適性到達度」は、図8で説明した「最適性到達度」と同様なので詳細な説明は繰り返さない。つまり、基本ブロックに対応する最適性到達度が100(%)に近い値であるほど、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードが、ターゲットプロセッサのハードウエア資源を、より効率的に使用できていることになる。すなわち、最適性到達度は、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードのアルゴリズムの最適度を示す。
The “optimum achievement degree” in FIG. 13 is the same as the “optimum achievement degree” described in FIG. 8, and therefore, detailed description thereof will not be repeated. That is, the closer the optimality achievement level corresponding to the basic block is to 100 (%), the more the source code of the part corresponding to the basic block described in the
例えば、図13では、基本ブロック番号“1”に対応する、分割された第2の中間コードの最適性到達度が最も大きいことになる。すなわち、ソースプログラム141に記述されている、基本ブロック番号“1”に対応する部分のソースコードのアルゴリズムの最適度が最もよいことになる。
For example, in FIG. 13, the optimal reachability of the divided second intermediate code corresponding to the basic block number “1” is the highest. That is, the optimality of the algorithm of the source code corresponding to the basic block number “1” described in the
図13に示される情報(最適性到達度情報142)が、表示部540に表示されることにより、プログラマは、作成しているソースプログラム141に記述されているソースコードのアルゴリズムの最適度を把握することができる。
The information shown in FIG. 13 (optimum achievement level information 142) is displayed on the
以上説明したように、本実施の形態においても、第1の実施の形態と同様な効果を得ることができる。すなわち、プログラマは、作成しているソースプログラム141に記述されているソースコードのアルゴリズムの最適度を把握することができる。その結果、プログラマは、開発の工程数を無駄にすることなく、ソースプログラム141のチューニングを実施することができる。
As described above, also in this embodiment, the same effect as that of the first embodiment can be obtained. That is, the programmer can grasp the optimum degree of the algorithm of the source code described in the
すなわち、図13に示される情報(最適性到達度情報142)が、表示部540に表示(出力)されることにより、プログラマに対し、ソースプログラムの効率的なチューニングを支援することができる。
That is, the information (optimum reachability information 142) shown in FIG. 13 is displayed (output) on the
<第2の実施の形態の変形例1>
次に、特定条件を緩和した条件(以下、緩和特定条件という)の情報を出力する構成について説明する。
<
Next, a configuration for outputting information on conditions (hereinafter referred to as relaxation specific conditions) in which specific conditions are relaxed will be described.
第2の実施の形態の変形例1におけるコンパイラシステムは、図9のコンパイラシステム148Aである。
The compiler system in the first modification of the second embodiment is the
(緩和特定条件の出力)
図14は、第2の実施の形態の変形例1におけるコンパイラ149Aの構成を示す図である。図14に示されるコンパイラ149Aは、図10のコンパイラ149Aと同じ構成を有するので詳細な説明は繰り返さない。
(Output of relaxation specific conditions)
FIG. 14 is a diagram illustrating a configuration of the
図14の特定条件緩和最適化部183は、第2の実施の形態で説明した処理に加え、特定条件を緩和した緩和特定条件の情報を出力する。緩和特定条件の情報は、最適性到達度情報142に登録される。
The specific condition
<第2の実施の形態の変形例2>
次に、緩和特定条件を外部から受け取るための構成について説明する。
<
Next, a configuration for receiving the relaxation specific condition from the outside will be described.
(システム構成)
図15は、第2の実施の形態の変形例2におけるコンパイラシステム148Bの構成を示す図である。コンパイラシステム148Bは、プログラム51が制御部510により実行されることにより実現される。すなわち、プログラム51は、コンパイラシステム148Bを含む。
(System configuration)
FIG. 15 is a diagram illustrating a configuration of a
図15を参照して、コンパイラシステム148Bは、図3のコンパイラシステム148と比較して、コンパイラ149の代わりにコンパイラ149Bを含む点が異なる。それ以外の構成は、コンパイラシステム148と同様なので詳細な説明は繰り返さない。
Referring to FIG. 15,
(緩和特定条件の入力)
図16は、第2の実施の形態の変形例2におけるコンパイラ149Bの構成を示す図である。
(Enter relaxation specific conditions)
FIG. 16 is a diagram illustrating a configuration of the
図16を参照して、コンパイラ149Bは、図10のコンパイラ149Aと比較して、受付部189をさらに含む点が異なる。それ以外の構成は、コンパイラ149Aと同様なので詳細な説明は繰り返さない。コンパイラ149B内の各部は、プログラムモジュールとして実現される。
Referring to FIG. 16,
受付部189は、外部からの指示を受付ける。具体的には、受付部189は、受付けた指示が示す緩和特定条件160を受付ける。受付部189は、受付けた緩和特定条件160を、特定条件緩和最適化部183へ送信する。
The accepting
受付部189は、一例として、コマンドラインによる指示が示す緩和特定条件160を受付ける。コマンドラインによる指示は、コンパイラオプションとしての指示である。コマンドラインによる指示は、例えば、プログラマがキーボード551を操作することにより行われる。
For example, the accepting
また、受付部189は、一例として、ソースプログラム141に記述されている#pragma指令(図7参照)による指示が示す緩和特定条件160を受付ける。この場合、受付部189は、ソースプログラム141から緩和特定条件160を受付ける。
For example, the accepting
なお、コンパイラ149B内の各部は、第2の実施の形態と同様な処理を行うので詳細な説明は繰り返さない。
Note that each part in the
すなわち、特定条件緩和最適化部183は、第1の中間コードに対し、受付部189が受付けた指示が示す緩和特定条件160に基づいた特定条件緩和最適化処理を行うことにより、第3の中間コードを生成する。
That is, the specific condition
<第3の実施の形態>
次に、第3の実施の形態におけるコンパイラシステムについて説明する。
<Third Embodiment>
Next, a compiler system according to the third embodiment will be described.
第3の実施の形態におけるコンパイラシステムは、図1に示されるコンピュータ500において、プログラムが実行されることにより実現される。
The compiler system in the third embodiment is realized by executing a program in the
(システム構成(論理未保証))
図17は、第3の実施の形態におけるコンパイラシステム148Cの構成を示す図である。コンパイラシステム148Cは、プログラム51が制御部510により実行されることにより実現される。すなわち、プログラム51は、コンパイラシステム148Cを含む。
(System configuration (logical unguaranteed))
FIG. 17 is a diagram illustrating a configuration of a compiler system 148C according to the third embodiment. The compiler system 148C is realized by the
図17を参照して、コンパイラシステム148Cは、図3のコンパイラシステム148と比較して、コンパイラ149の代わりにコンパイラ149Cを含む点が異なる。それ以外の構成は、コンパイラシステム148と同様なので詳細な説明は繰り返さない。
17, compiler system 148C is different from
(コンパイラの構成(論理未保証))
図18は、第3の実施の形態におけるコンパイラ149Cの構成を示す図である。
(Compiler configuration (logic not guaranteed))
FIG. 18 is a diagram illustrating a configuration of the
図18を参照して、コンパイラ149Cは、図4のコンパイラ149と比較して、論理未保証最適化部185をさらに含む点と、最適性到達度解析部186の代わりに最適性到達度解析部186Cを含む点とが異なる。それ以外の構成は、コンパイラ149と同様なので詳細な説明は繰り返さない。コンパイラ149C内の各部は、プログラムモジュールとして実現される。
Referring to FIG. 18,
構文解析部182は、前述した第1の中間コードを、論理保証最適化部184および論理未保証最適化部185へ送信する。
The
論理未保証最適化部185は、構文解析部182から受信する第1の中間コードに対して、特定条件の論理の正当性を保証しない最適化処理(以下、論理未保証最適化処理という)を行う。以下においては、論理未保証最適化処理により、論理の保証がされなかった特定条件を、論理未保証条件という。
The logic
なお、後述するが、論理未保証条件は、外部から指定されてもよい。この場合、指定された論理未保証条件は、論理の保証が不要な条件である。すなわち、論理未保証最適化処理は、論理未保証条件に基づいた最適化処理である。この場合、論理未保証条件に基づいた論理未保証最適化処理は、指定された論理未保証条件を保証しない処理である。 As will be described later, the logical unguaranteed condition may be designated from the outside. In this case, the specified logic unguaranteed condition is a condition that does not require a logic guarantee. That is, the logical unguaranteed optimization process is an optimization process based on the logical unguaranteed condition. In this case, the logical unguaranteed optimization process based on the logical unguaranteed condition is a process that does not guarantee the specified logical unguaranteed condition.
論理未保証最適化処理は、例えば、当該論理未保証最適化処理が行われることにより得られる中間コードの論理(アルゴリズム)に矛盾が生じる可能性がある処理である。つまり、論理未保証最適化処理は、中間コードに対して論理保証の制約を緩和した最適化処理である。 The logic unguaranteed optimization process is, for example, a process that may cause a contradiction in the logic (algorithm) of the intermediate code obtained by performing the logic unguaranteed optimization process. That is, the logic unguaranteed optimization process is an optimization process in which the restriction of the logic guarantee is relaxed for the intermediate code.
ここで、一例として、特定条件(論理未保証条件)は、例えば、メモリの割り当てに矛盾がないという条件であるとする。この場合、論理未保証最適化処理が行われることにより、メモリの割り当てに矛盾がないという条件が保証されなくなる。すなわち、論理未保証最適化処理が行われることにより、メモリの割り当てに矛盾が生じる可能性がある。 Here, as an example, the specific condition (logical unguaranteed condition) is, for example, a condition that there is no contradiction in memory allocation. In this case, the logic non-guaranteed optimization process is performed, so that the condition that there is no contradiction in memory allocation cannot be guaranteed. In other words, the logic unguaranteed optimization process may cause inconsistency in memory allocation.
論理未保証条件は、コンパイラに実装される様々な最適化の条件に適用できる。
論理未保証最適化処理は、例えば、前述した見かけのメモリ依存を無視した最適化処理である。この場合、論理未保証条件は、見かけのメモリ依存を保証するという条件である。
The logic unguaranteed condition can be applied to various optimization conditions implemented in the compiler.
The logic unguaranteed optimization process is, for example, an optimization process that ignores the apparent memory dependence described above. In this case, the logical unguaranteed condition is a condition that guarantees an apparent memory dependence.
論理未保証最適化部185は、第1の中間コードに対して論理未保証最適化処理を行うことにより、論理未保証最適化処理が施された中間コード(以下、第4の中間コードという)を出力する。すなわち、論理未保証最適化部185は、第1の中間コードに対して論理未保証最適化処理を行うことにより、第4の中間コードを生成する。
The logic
第4の中間コードは、論理の正当性が保証されない中間コードである。すなわち、第4の中間コードは、論理(アルゴリズム)に矛盾がある可能性がある中間コードである。 The fourth intermediate code is an intermediate code whose logic validity is not guaranteed. That is, the fourth intermediate code is an intermediate code that may have a contradiction in logic (algorithm).
論理未保証最適化部185は、第4の中間コードを、最適性到達度解析部186Cへ送信する。
The logic
論理保証最適化部184は、第1の実施の形態で説明した処理に加え、第2の中間コードを、最適性到達度解析部186Cへ送信する。
In addition to the processing described in the first embodiment, the logic
最適性到達度解析部186Cは、第2の中間コードおよび第4の中間コードを受信する。最適性到達度解析部186Cは、第2の中間コードと、第4の中間コードとの性能の比較が可能なように、第2の中間コードおよび第4の中間コードの性能の分析(解析)を行い、第2の中間コードおよび第4の中間コードの性能の分析結果を示す最適性到達度情報142を出力する。
Optimality
この場合、最適性到達度情報142は、第2の中間コードの性能と、第4の中間コードの性能とが比較可能なように分析結果を示す。
In this case, the optimality
(コンパイラ処理の流れ(論理未保証))
次に、コンパイラ149Cが実行する処理の流れについて説明する。
(Flow of compiler processing (logic not guaranteed))
Next, the flow of processing executed by the
図19は、コンパイラ149Cが実行する処理のフローチャートである。図19において、図5のステップ番号と同じステップ番号の処理は、第1の実施の形態で説明した処理と同様な処理が行なわれるので詳細な説明は繰り返さない。
FIG. 19 is a flowchart of processing executed by the
構文解析部182は、ソースプログラム141の構文解析を行い、第1の中間コードを生成する(S1)。構文解析部182は、第1の中間コードを、論理保証最適化部184および論理未保証最適化部185へ送信する。
The
論理保証最適化部184は、第1の実施の形態と同様に、第1の中間コードに対し前述した論理保証最適化処理を行うことにより、第2の中間コードを生成する。そして、論理保証最適化部184は、第2の中間コードを最適性到達度解析部186Cおよびコード出力部188へ送信する(S2C)。
Similarly to the first embodiment, the logic
特定条件緩和最適化部183は、第1の中間コードに対し前述した論理未保証最適化処理を行うことにより、第4の中間コードを生成し、第4の中間コードを、最適性到達度解析部186Cへ送信する(S7)。
The specific condition
最適性到達度解析部186Cは、第2の中間コードおよび第4の中間コードの最適性の到達度を解析(分析)し、解析(分析)の結果を示す最適性到達度情報142を出力する(S3Cの最適性到達度解析処理C)。すなわち、最適性到達度解析部186Cは、第2の中間コードおよび第4の中間コードの性能の分析結果を示す最適性到達度情報142を出力する。
Optimality
(最適性到達度解析処理Cの詳細な流れ(論理未保証))
次に、図19のステップS3Cの最適性到達度解析処理Cについて詳細に説明する。
(Detailed flow of optimality achievement analysis process C (logical unguaranteed))
Next, the optimum reachability analysis process C in step S3C of FIG. 19 will be described in detail.
図20は、最適性到達度解析処理Cのフローチャートである。図20において、図12のステップ番号と同じステップ番号の処理は、第2の実施の形態で説明した処理と同様な処理が行なわれるので詳細な説明は繰り返さない。 FIG. 20 is a flowchart of the optimality achievement analysis process C. In FIG. 20, the processing with the same step number as the step number of FIG. 12 is performed in the same manner as the processing described in the second embodiment, and therefore detailed description will not be repeated.
ステップS31,S32,S33,S36では、第2の実施の形態で説明した処理が最適性到達度解析部186Cにより行なわれるので詳細な説明は繰り返さない。これにより、最適性到達度解析部186Cは、関数シンボル名を主キーとして、基本ブロックを特定する番号と、サイクル情報としての論理保証サイクル数とを対応づけて性能解析情報データベース211Dに登録する。
In steps S31, S32, S33, and S36, since the process described in the second embodiment is performed by the optimality achievement
図20のステップS31〜S36と同様に、最適性到達度解析部186Cは、以下の処理を行う。
Similarly to steps S31 to S36 in FIG. 20, the optimality achievement
まず、最適性到達度解析部186Cは、第4の中間コードを、関数(手続き)毎に分割して第4の中間コードを解析する(S71)。
First, the optimality
次に、最適性到達度解析部186Cは、ステップS71にて関数毎に分割された第4の中間コードを、基本ブロック毎に分割して、分割された各第4の中間コードを解析する(S72)。
Next, the optimality achievement
次に、最適性到達度解析部186Cは、基本ブロック毎に分割された各第4の中間コードに対応するDAG情報を生成する(S73)。
Next, the optimality achievement
次に、最適性到達度解析部186Cは、生成されたDAG情報が示すDAGの高さを解析することにより、サイクル情報としてのサイクル数(以下、論理未保証サイクル数という)を求める(S74)。
Next, the optimality achievement
また、最適性到達度解析部186Cは、関数シンボル名を主キーとして、基本ブロックを特定する番号と、サイクル情報としての論理未保証サイクル数とを対応づけて性能解析情報データベース222Dに登録する(S74)。
Further, the optimality
次に、ステップS35Cにて、最適性到達度解析部186Cは、性能解析情報データベース211Dおよび性能解析情報データベース222Dの各々から、主キーの関数名毎に基本ブロック番号およびサイクル情報を整形し、整形された後の情報を示す最適性到達度情報142を出力する。この場合、制御部510は、最適性到達度情報142を、例えば、表示部540に表示させるための処理を行う。そして、この最適性到達度解析処理Cは終了する。
Next, in step S35C, the optimality achievement
ここで、ソースプログラム141が、一例として、図7に示されるプログラムであるとする。この場合、図19の処理および図20の最適性到達度解析処理Cが行われることにより出力される最適性到達度情報142は、一例として、図21に示される情報である。
Here, it is assumed that the
図21は、第3の実施の形態における一例としての最適性到達度情報142を示す図である。
FIG. 21 is a diagram showing the optimality
図21において、「BasicBlockNum」とは、基本ブロック番号である。「論理保証サイクル数」とは、最適性到達度解析処理Cにより得られた、分割された第2の中間コードに対応する、サイクル情報としての論理保証サイクル数である。「論理未保証サイクル数」とは、最適性到達度解析処理Cにより得られた、分割された第4の中間コードに対応する、サイクル情報としての論理保証サイクル数である。 In FIG. 21, “BasicBlockNum” is a basic block number. The “number of logic guarantee cycles” is the number of logic guarantee cycles as cycle information corresponding to the divided second intermediate code obtained by the optimum reachability analysis process C. The “number of logical unguaranteed cycles” is the number of logically guaranteed cycles as cycle information corresponding to the divided fourth intermediate code obtained by the optimum reachability analysis process C.
図21の「最適性到達度」は、(論理未保証サイクル数/論理保証サイクル数)の式により算出される値である。「最適性到達度」は、ステップS35Cの処理において、最適性到達度解析部186Cが算出する。なお、最適性到達度解析部186Cは、論理未保証サイクル数が論理保証サイクル数より大きい場合、最適性到達度を100とする。
21 is a value calculated by the formula (number of logical unguaranteed cycles / number of logically guaranteed cycles). The “optimum achievement level” is calculated by the optimality
図21の「最適性到達度」は、図8で説明した「最適性到達度」と同様なので詳細な説明は繰り返さない。つまり、基本ブロックに対応する最適性到達度が100(%)に近い値であるほど、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードが、ターゲットプロセッサのハードウエア資源を、より効率的に使用できていることになる。すなわち、最適性到達度は、ソースプログラム141に記述されている、当該基本ブロックに対応する部分のソースコードのアルゴリズムの最適度を示す。
The “optimum achievement level” in FIG. 21 is the same as the “optimum achievement level” described with reference to FIG. 8, and therefore, detailed description thereof will not be repeated. That is, the closer the optimality achievement degree corresponding to the basic block is to a value close to 100 (%), the more the source code of the part corresponding to the basic block described in the
図21に示される情報(最適性到達度情報142)が、表示部540に表示されることにより、プログラマは、作成しているソースプログラム141に記述されているソースコードのアルゴリズムの最適度を把握することができる。
The information shown in FIG. 21 (optimum achievement level information 142) is displayed on the
以上説明したように、本実施の形態においても、第1の実施の形態と同様な効果を得ることができる。すなわち、プログラマは、作成しているソースプログラム141に記述されているソースコードのアルゴリズムの最適度を把握することができる。その結果、プログラマは、開発の工程数を無駄にすることなく、ソースプログラム141のチューニングを実施することができる。
As described above, also in this embodiment, the same effect as that of the first embodiment can be obtained. That is, the programmer can grasp the optimum degree of the algorithm of the source code described in the
すなわち、図21に示される情報(最適性到達度情報142)が、表示部540に表示(出力)されることにより、プログラマに対し、ソースプログラムの効率的なチューニングを支援することができる。
That is, the information (optimum reachability information 142) shown in FIG. 21 is displayed (output) on the
<第3の実施の形態の変形例1>
次に、論理未保証条件の情報を出力する構成について説明する。
<
Next, a configuration for outputting information on logical unguaranteed conditions will be described.
第3の実施の形態の変形例1におけるコンパイラシステムは、図17のコンパイラシステム148Cである。 The compiler system in the first modification of the third embodiment is a compiler system 148C in FIG.
(論理未保証条件の出力)
図22は、第3の実施の形態の変形例1におけるコンパイラ149Cの構成を示す図である。図22に示されるコンパイラ149Cは、図18のコンパイラ149Cと同じ構成を有するので詳細な説明は繰り返さない。
(Logical unguaranteed condition output)
FIG. 22 is a diagram illustrating a configuration of the
図22の論理未保証最適化部185は、第3の実施の形態で説明した処理に加え、論理未保証条件の情報を出力する。論理未保証条件の情報は、最適性到達度情報142に登録される。
The logical
<第3の実施の形態の変形例2>
次に、論理未保証条件を外部から受け取るための構成について説明する。
<
Next, a configuration for receiving a logical unguaranteed condition from the outside will be described.
(システム構成)
図23は、第3の実施の形態の変形例2におけるコンパイラシステム148Dの構成を示す図である。コンパイラシステム148Dは、プログラム51が制御部510により実行されることにより実現される。すなわち、プログラム51は、コンパイラシステム148Dを含む。
(System configuration)
FIG. 23 is a diagram illustrating a configuration of a
図23を参照して、コンパイラシステム148Dは、図3のコンパイラシステム148と比較して、コンパイラ149の代わりにコンパイラ149Dを含む点が異なる。それ以外の構成は、コンパイラシステム148と同様なので詳細な説明は繰り返さない。
Referring to FIG. 23,
(論理未保証条件の入力)
図24は、第3の実施の形態の変形例2におけるコンパイラ149Dの構成を示す図である。
(Input of logical unguaranteed conditions)
FIG. 24 is a diagram illustrating a configuration of the
図24を参照して、コンパイラ149Dは、図18のコンパイラ149Cと比較して、受付部189Dをさらに含む点が異なる。それ以外の構成は、コンパイラ149Cと同様なので詳細な説明は繰り返さない。コンパイラ149D内の各部は、プログラムモジュールとして実現される。
Referring to FIG. 24,
受付部189Dは、外部からの指示を受付ける。具体的には、受付部189Dは、受付けた指示が示す論理未保証条件161を受付ける。受付部189Dが受付けた論理未保証条件161は、論理の保証が不要な条件である。受付部189Dは、受付けた論理未保証条件161を、論理未保証最適化部185へ送信する。
The accepting
受付部189Dは、一例として、コマンドラインによる指示が示す論理未保証条件161を受付ける。コマンドラインによる指示は、コンパイラオプションとしての指示である。コマンドラインによる指示は、例えば、プログラマがキーボード551を操作することにより行われる。
As an example, the accepting
また、受付部189Dは、一例として、ソースプログラム141に記述されている#pragma指令(図7参照)による指示が示す論理未保証条件161を受付ける。この場合、受付部189Dは、ソースプログラム141から論理未保証条件161を受付ける。
For example, the accepting
なお、コンパイラ149D内の各部は、第3の実施の形態と同様な処理を行うので詳細な説明は繰り返さない。
Note that each unit in the
すなわち、論理未保証最適化部185は、第1の中間コードに対し、受付部189Dが受付けた指示が示す論理未保証条件161に基づいた論理未保証最適化処理を行う。すなわち、論理未保証最適化部185は、第1の中間コードに対して、論理未保証条件161を保証しない論理未保証最適化処理を行うことにより、第4の中間コードを生成する。
That is, the logic
以上、本発明の各実施の形態におけるコンパイルシステムについて、実施の形態に基づいて説明したが、本発明は、上記実施の形態に限定されるものではない。例えば、最適性到達度情報142は、サイクル数に基づく最適性到達度に限定されることなく、命令サイズ、スタックサイズ等のチューニングに有用な情報であれば他のパラメータに基づく最適性到達度を示す情報であってもよい。
As mentioned above, although the compile system in each embodiment of this invention was demonstrated based on embodiment, this invention is not limited to the said embodiment. For example, the
また、第1の実施の形態の図6のS34の処理において、比較対象とするものは、IPCに限らず、レジスタ使用効率など性能比較に有用な情報であれば他のパラメータであってもよい。 In the process of S34 in FIG. 6 of the first embodiment, the comparison target is not limited to the IPC, and may be other parameters as long as the information is useful for performance comparison such as register use efficiency. .
また、図10の最適性到達度解析部186Aおよび図18の最適性到達度解析部186Cの各々が比較対象とするものは、サイクル数に限られず、チューニングに有用な情報であれば他のパラメータであってもよい。
Also, what is to be compared by each of the optimality achievement
また、チューニングポイントとなる最適性到達度情報の着目ポイントのサイクル数は一例であり、サイクル数以外にも、命令数、コードサイズ、メモリサイズ、バス占有率、キャッシュヒット率、コンパイル時間など様々な最適性の観点があることは言うまでもない。 In addition, the number of cycles of the target point of the optimality achievement level information that is the tuning point is an example. Besides the number of cycles, there are various instructions such as the number of instructions, code size, memory size, bus occupancy, cache hit rate, and compile time. Needless to say, there is an optimality viewpoint.
なお、本発明は、このような特徴的な情報を生成するコンパイラとして実現することができるだけでなく、コンパイラがコンピュータを機能させるための特徴的な手段を備えるコンパイル装置として実現したり、当該手段をステップとするコンパイル方法として実現したりすることもできる。 Note that the present invention can be realized not only as a compiler that generates such characteristic information, but also as a compile device including characteristic means for the compiler to function the computer, It can also be realized as a compilation method with steps.
そして、このようなコンパイラは、CD−ROM等の記録媒体やインターネット等の伝送媒体を介して流通させることができるのは言うまでもない。 It goes without saying that such a compiler can be distributed via a recording medium such as a CD-ROM or a transmission medium such as the Internet.
以上、本発明におけるコンパイラ又はコンパイラシステムについて、実施の形態に基づいて説明したが、本発明は、これらの実施の形態に限定されるものではない。本発明の趣旨を逸脱しない限り、当業者が思いつく各種変形を本実施の形態に施したもの、あるいは異なる実施の形態における構成要素を組み合わせて構築される形態も、本発明の範囲内に含まれる。 As described above, the compiler or the compiler system according to the present invention has been described based on the embodiments. However, the present invention is not limited to these embodiments. Unless it deviates from the meaning of this invention, the form which carried out various deformation | transformation which those skilled in the art can think to this embodiment, or the structure constructed | assembled combining the component in different embodiment is also contained in the scope of the present invention. .
今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は上記した説明ではなくて特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。 The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.
本発明は、意ソースプログラムの効率的なチューニングを支援するプログラム変換装置およびプログラム変換システムとして、利用することができる。 The present invention can be used as a program conversion device and a program conversion system that support efficient tuning of a source program.
また、本発明は、最適性到達度情報を出力するコンパイラ、OS(Operating System)、プロセッサで実行されるプロセス等に適用できる。 Further, the present invention can be applied to a compiler that outputs optimality reachability information, an OS (Operating System), a process executed by a processor, and the like.
148,148A,148B,148C,148D コンパイラシステム
149,149A,149B,149C,149D コンパイラ
150 アセンブラ
151 リンカ
160 緩和特定条件
161 論理未保証条件
182 構文解析部
183 特定条件緩和最適化部
184 論理保証最適化部
185 論理未保証最適化部
186,186A,186C 最適性到達度解析部
188 コード出力部
189,189D 受付部
500 コンピュータ
510 制御部
148, 148A, 148B, 148C,
Claims (13)
前記ソースプログラムから第1の中間コードを生成する中間コード生成部と、
前記第1の中間コードに対し前記ターゲットプロセッサに応じた最適化処理を行うことにより、第2の中間コードを生成する最適化部と、
前記第2の中間コードの性能の分析を行い、性能分析の結果を示す最適性到達度情報を出力する解析部と
を備える、プログラム変換装置。 A program conversion device that converts a source program written in a high-level language into a code for a target processor,
An intermediate code generator for generating a first intermediate code from the source program;
An optimization unit that generates a second intermediate code by performing an optimization process on the first intermediate code according to the target processor;
A program conversion apparatus comprising: an analysis unit that analyzes the performance of the second intermediate code and outputs optimum reachability information indicating a result of the performance analysis.
前記第1の中間コードに対し、特定の条件を.緩和させた最適化処理である特定条件緩和最適化処理を行うことにより、第3の中間コードを生成する特定条件緩和最適化部を備え、
前記解析部は、さらに、前記第3の中間コードの性能を分析し、前記第2の中間コードおよび前記第3の中間コードの性能の分析結果を示す前記最適性到達度情報を出力する、
請求項1に記載のプログラム変換装置。 The program conversion device further includes:
A specific condition relaxation optimization unit that generates a third intermediate code by performing a specific condition relaxation optimization process that is an optimization process in which a specific condition is relaxed for the first intermediate code;
The analysis unit further analyzes the performance of the third intermediate code and outputs the optimality attainment information indicating the analysis results of the performance of the second intermediate code and the third intermediate code.
The program conversion apparatus according to claim 1.
請求項2に記載のプログラム変換装置。 The specific condition relaxation optimizing unit further outputs information on a condition in which the specific condition is relaxed,
The program conversion apparatus according to claim 2.
指示を受付ける受付部を備え、
前記特定条件緩和最適化部は、前記受付部が受付けた指示が示す条件に基づいた前記特定条件緩和最適化処理を行う、
請求項2に記載のプログラム変換装置。 The program conversion device further includes:
It has a reception unit that accepts instructions,
The specific condition relaxation optimization unit performs the specific condition relaxation optimization process based on a condition indicated by an instruction received by the reception unit;
The program conversion apparatus according to claim 2.
請求項4に記載のプログラム変換装置。 The instruction received by the reception unit is an instruction by a command line.
The program conversion apparatus according to claim 4.
請求項4に記載のプログラム変換装置。 The instruction received by the reception unit is an instruction included in the source program.
The program conversion apparatus according to claim 4.
前記第1の中間コードに対し、論理の正当性を保証しない最適化処理である論理未保証最適化処理を行うことにより、第4の中間コードを生成する論理未保証最適化部を備え、
前記解析部は、さらに、前記第4の中間コードの性能を分析し、前記第2の中間コードおよび前記第4の中間コードの性能の分析結果を示す前記最適性到達度情報を出力する、
請求項1に記載のプログラム変換装置。 The program conversion device further includes:
A logic unguaranteed optimization unit that generates a fourth intermediate code by performing a logic unguaranteed optimization process that is an optimization process that does not guarantee the logical correctness of the first intermediate code;
The analysis unit further analyzes the performance of the fourth intermediate code and outputs the optimality attainment information indicating the analysis results of the performance of the second intermediate code and the fourth intermediate code.
The program conversion apparatus according to claim 1.
請求項7に記載のプログラム変換装置。 The logic unguaranteed optimization unit further outputs information on conditions that do not guarantee the validity of the logic,
The program conversion apparatus according to claim 7.
指示を受付ける受付部を備え、
前記論理未保証最適化部は、前記受付部が受付けた指示が示す、論理の保証が不要な条件に基づいた前記論理未保証最適化処理を行う、
請求項7に記載のプログラム変換装置。 The program conversion device further includes:
It has a reception unit that accepts instructions,
The logical unguaranteed optimization unit performs the logical unguaranteed optimization process based on a condition that does not require a logical guarantee indicated by the instruction received by the accepting unit.
The program conversion apparatus according to claim 7.
請求項9に記載のプログラム変換装置。 The instruction received by the reception unit is an instruction by a command line.
The program conversion apparatus according to claim 9.
請求項9に記載のプログラム変換装置。 The instruction received by the reception unit is an instruction included in the source program.
The program conversion apparatus according to claim 9.
請求項1〜11のいずれかに記載のプログラム変換装置。 The optimality reachability information at least indicates the optimal degree of the second intermediate code for the target processor;
The program conversion apparatus according to claim 1.
前記プログラムから第1の中間コードを生成する中間コード生成部と、
前記第1の中間コードに対し前記ターゲットプロセッサに応じた最適化処理を行うことにより、第2の中間コードを生成する最適化部と、
前記第2の中間コードの性能の分析を行うことにより、性能分析の結果を示す最適性到達度情報を出力する解析部と、
前記第2の中間コードに基づくファイルを使用して前記ターゲットプロセッサで動作する機械語コードを生成する機械語コード生成部と
を備える、プログラム変換システム。 A program conversion system for converting a source program written in a high-level language into a machine language code for a target processor,
An intermediate code generation unit for generating a first intermediate code from the program;
An optimization unit that generates a second intermediate code by performing an optimization process on the first intermediate code according to the target processor;
Analyzing the performance of the second intermediate code to output optimality achievement information indicating the result of the performance analysis; and
A machine language code generation unit that generates a machine language code that operates on the target processor using a file based on the second intermediate code.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009173735A JP2011028523A (en) | 2009-07-24 | 2009-07-24 | Program conversion device and program conversion system |
PCT/JP2010/004473 WO2011010435A1 (en) | 2009-07-24 | 2010-07-09 | Program conversion device and program conversion system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009173735A JP2011028523A (en) | 2009-07-24 | 2009-07-24 | Program conversion device and program conversion system |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011028523A true JP2011028523A (en) | 2011-02-10 |
Family
ID=43498917
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009173735A Pending JP2011028523A (en) | 2009-07-24 | 2009-07-24 | Program conversion device and program conversion system |
Country Status (2)
Country | Link |
---|---|
JP (1) | JP2011028523A (en) |
WO (1) | WO2011010435A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6548836B2 (en) * | 2016-11-22 | 2019-07-24 | 三菱電機株式会社 | INFORMATION PROCESSING APPARATUS, INFORMATION PROCESSING METHOD, AND INFORMATION PROCESSING PROGRAM |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2636665B2 (en) * | 1993-02-26 | 1997-07-30 | 日本電気株式会社 | Execution information collection device |
JP4291306B2 (en) * | 2005-07-22 | 2009-07-08 | 株式会社日立製作所 | Tuning parameter calculation program and method for numerical calculation library |
JP2007114934A (en) * | 2005-10-19 | 2007-05-10 | Matsushita Electric Ind Co Ltd | Compiler system |
JP2008003840A (en) * | 2006-06-22 | 2008-01-10 | Toshiba Corp | System for selecting combination of optimization option of compiler |
JP2008293378A (en) * | 2007-05-25 | 2008-12-04 | Panasonic Corp | Program rewriting device |
-
2009
- 2009-07-24 JP JP2009173735A patent/JP2011028523A/en active Pending
-
2010
- 2010-07-09 WO PCT/JP2010/004473 patent/WO2011010435A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
WO2011010435A1 (en) | 2011-01-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Windh et al. | High-level language tools for reconfigurable computing | |
Verdoolaege et al. | Polyhedral extraction tool | |
Goossens et al. | Embedded software in real-time signal processing systems: Design technologies | |
Kennedy et al. | Telescoping languages: A strategy for automatic generation of scientific problem-solving systems from annotated libraries | |
Huang et al. | Pylog: An algorithm-centric python-based FPGA programming and synthesis flow | |
Morvan et al. | Polyhedral bubble insertion: A method to improve nested loop pipelining for high-level synthesis | |
US20090328016A1 (en) | Generalized expression trees | |
Franke et al. | Array recovery and high-level transformations for DSP applications | |
Khalate et al. | An LLVM-based C++ compiler toolchain for variational hybrid quantum-classical algorithms and quantum accelerators | |
LaMielle et al. | Enabling code generation within the sparse polyhedral framework | |
Oh et al. | Efficient execution of stream graphs on coarse-grained reconfigurable architectures | |
Hohenauer et al. | A SIMD optimization framework for retargetable compilers | |
Silber-Chaussumier et al. | Generating data transfers for distributed GPU parallel programs | |
Schlaak et al. | Optimizing data reshaping operations in functional IRs for high-level synthesis | |
WO2011010435A1 (en) | Program conversion device and program conversion system | |
US11656857B2 (en) | Method and apparatus for optimizing code for field programmable gate arrays | |
Balasa et al. | Storage estimation and design space exploration methodologies for the memory management of signal processing applications | |
Cabrera et al. | Toward evaluating high-level synthesis portability and performance between intel and xilinx fpgas | |
Ferreira et al. | Graph-based code restructuring targeting HLS for FPGAs | |
EP3827336B1 (en) | Method and apparatus for optimizing code for field programmable gate arrays | |
Liao et al. | Automatic parallelization using OpenMP based on STL semantics | |
Plesco et al. | Coupling loop transformations and high-level synthesis | |
Lin et al. | Vector data flow analysis for SIMD optimizations on OpenCL programs | |
Kiemele et al. | Kfusion: Optimizing data flow without compromising modularity | |
Konstantinidis | Source-to-source compilation of loop programs for manycore processors |