JP2011081836A - Compiler device - Google Patents

Compiler device Download PDF

Info

Publication number
JP2011081836A
JP2011081836A JP2010283836A JP2010283836A JP2011081836A JP 2011081836 A JP2011081836 A JP 2011081836A JP 2010283836 A JP2010283836 A JP 2010283836A JP 2010283836 A JP2010283836 A JP 2010283836A JP 2011081836 A JP2011081836 A JP 2011081836A
Authority
JP
Japan
Prior art keywords
cache memory
instruction
machine language
program
intermediate code
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
JP2010283836A
Other languages
Japanese (ja)
Other versions
JP5238797B2 (en
Inventor
Takehito Heiji
岳人 瓶子
Hajime Ogawa
一 小川
Shohei Domoto
昌平 道本
Yasuhiro Yamamoto
康博 山本
Kenji Hattori
謙司 服部
Teruo Kawabata
輝雄 川端
Kiyoshi Nakajima
聖志 中島
Michiko Hattori
享子 服部
Hirotetsu Tomita
浩徹 富田
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.)
Panasonic Corp
Original Assignee
Panasonic Corp
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 Panasonic Corp filed Critical Panasonic Corp
Priority to JP2010283836A priority Critical patent/JP5238797B2/en
Publication of JP2011081836A publication Critical patent/JP2011081836A/en
Application granted granted Critical
Publication of JP5238797B2 publication Critical patent/JP5238797B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a compiler for reducing the development man-hours for a program. <P>SOLUTION: A compiler 58 which translates a source program 72 described in a high level language into a machine language program is provided with an instruction acquiring part which acquires an instruction to optimize the generated machine language program, a parser part 76 which analyzes the source program 72, an intermediate code conversion part 78 which converts the source program 72 into an intermediate code based on the analysis result of the parser part 76, an optimizing part 68 which optimizes the intermediate code according to the instruction, and a code generation part 90 which converts the intermediate code into the machine language program. The instruction is the optimization instruction taking a processor using a cache memory, as a target processor. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、C言語等の高級言語で記述されたソースプログラムを機械語プログラムに変換するコンパイラ装置に関し、特に、コンパイラによる最適化についての指示に関する。   The present invention relates to a compiler apparatus that converts a source program written in a high-level language such as C language into a machine language program, and more particularly to an instruction for optimization by a compiler.

従来、高級言語で記述されたソースプログラムを機械語命令列にコンパイルする高級言語用コンパイラは各種提案されている(例えば、特許文献1参照。)。   Conventionally, various high-level language compilers that compile a source program written in a high-level language into a machine language instruction sequence have been proposed (for example, see Patent Document 1).

このような高級言語で記述されたソースプログラムを機械語命令列にコンパイルする高級言語用コンパイラでは、キャッシュメモリ等のハードウェア構成を考慮して、実行速度の向上等を図るための機械語命令列の最適化を実現することができなかった。   In a high-level language compiler that compiles a source program written in such a high-level language into a machine language instruction sequence, a machine language instruction sequence for improving the execution speed in consideration of the hardware configuration such as a cache memory Could not be optimized.

このため、ハードウェア構成を考慮した機械語命令列を作成するためには、アセンブリ言語でプログラムを作成したり、ハードウェア構成を考慮したアルゴリズムを作成し、そのアルゴリズムに基づいてソースプログラムを作成したりしている。   For this reason, to create a machine language instruction sequence that takes into account the hardware configuration, create a program in assembly language, create an algorithm that takes into account the hardware configuration, and create a source program based on that algorithm. It is.

特開2003−99269号公報JP 2003-99269 A

しかしながら、アセンブリ言語でプログラムを開発するには、開発工数が非常にかかるという課題がある。   However, there is a problem that it takes a lot of development man-hours to develop a program in assembly language.

また、アセンブリ言語で記述されたプログラムは移植性に乏しいため、資産性が低いという課題もある。   Another problem is that programs written in assembly language have poor portability because of their poor portability.

さらに、ハードウェアが大規模化、複雑化している今日においては、ハードウェアを考慮したアルゴリズムを人手で作成して性能をチューニングするのは非常に困難であるという課題もある。   Furthermore, in today's hardware becoming larger and more complex, there is a problem that it is very difficult to manually tune the performance by manually creating an algorithm that considers hardware.

本発明は、上述の課題を解決するためになされたもので、プログラムの開発工数がかからないコンパイラ装置を提供することを第1の目的とする。   The present invention has been made to solve the above-described problems, and a first object of the present invention is to provide a compiler apparatus that does not require a program development man-hour.

また、プログラムの資産性が高いコンパイラ装置を提供することを第2の目的とする。   It is a second object of the present invention to provide a compiler apparatus having a high program asset.

さらに、人手で性能をチューニングする必要のないコンパイラ装置を提供することを第3の目的とする。   It is a third object of the present invention to provide a compiler device that does not require performance tuning manually.

上記目的を達成するために、本発明に係るコンパイラ装置は、高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、前記ソースプログラムを解析するパーサー手段と、前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、前記指示に従って、前記中間コードを最適化する最適化手段と、前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、前記指示は、キャッシュメモリを利用するプロセッサをターゲットプロセッサとする最適化指示である。   In order to achieve the above object, a compiler apparatus according to the present invention is a compiler apparatus that translates a source program written in a high-level language into a machine language program, and issues an instruction to optimize the machine language program to be generated. Instruction acquisition means for acquiring; parser means for analyzing the source program; intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means; and the intermediate code in accordance with the instructions. Optimizing means for optimizing and code generating means for converting the intermediate code into the machine language program, wherein the instruction is an optimization instruction for a processor that uses a cache memory as a target processor.

この構成によると、最適化のための指示に基づいて、中間コードの最適化が行なわれる。このため、アセンブリ言語でプログラムを開発しなくても、指示を与えるだけで、キャッシュメモリを効率よく利用可能な機械語プログラムを生成することができる。そのため、アセンブリ言語でプログラムを開発する場合に比べ、開発工数がかからない。また、ソースプログラムは高級言語で記述され、かつ上述のように指示を与えるだけで、キャッシュメモリを効率よく利用可能な機械語プログラムを生成することができる。このため、指示を様々に変えることにより、様々な最適化が行なわれる。このため、プログラムの資産性が向上する。さらに、人手で性能をチューニングする必要もなくなる。   According to this configuration, the intermediate code is optimized based on the optimization instruction. Therefore, it is possible to generate a machine language program that can efficiently use the cache memory only by giving an instruction without developing a program in assembly language. For this reason, development man-hours are not required as compared with the case of developing a program in assembly language. The source program is written in a high-level language, and a machine language program that can efficiently use the cache memory can be generated simply by giving an instruction as described above. For this reason, various optimizations are performed by changing the instructions in various ways. For this reason, the asset of the program is improved. Furthermore, there is no need to manually tune performance.

好ましくは、前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理を当該ループ処理に含まれるオブジェクトが所定の容量ごとに前記キャッシュメモリに配置されるように複数のループ処理に分割する旨の指示を取得し、前記最適化手段は、前記指示取得手段によって取得された指示の対象となったループ処理を前記指示に従い複数のループ処理に分割する。   Preferably, the instruction acquisition unit divides a specific loop process in the source program into a plurality of loop processes so that an object included in the loop process is arranged in the cache memory for each predetermined capacity. The optimization unit divides the loop processing that is the target of the instruction acquired by the instruction acquisition unit into a plurality of loop processes according to the instruction.

ループ処理に含まれるオブジェクトがキャッシュメモリに一度に配置されるように、ループ分割が行なわれる。このため、大量のオブジェクトを一度に処理しようとするために、それらのオブジェクトをキャッシュメモリに一度に乗せることができないために起こるヒットミスを防ぐことができる。   The loop division is performed so that the objects included in the loop processing are arranged in the cache memory at a time. For this reason, since a large number of objects are to be processed at a time, it is possible to prevent hit mistakes that occur because these objects cannot be placed in the cache memory at a time.

さらに好ましくは、前記指示取得手段は、前記ソースプログラムの中において、特定のオブジェクトを、当該オブジェクト参照時までに前記キャッシュメモリに予め格納する旨の指示を取得し、前記最適化手段は、前記オブジェクトを当該オブジェクト参照時までに前記キャッシュメモリに予め格納させる。   More preferably, the instruction acquisition unit acquires an instruction to store a specific object in the cache memory in advance in the source program before the object is referred to, and the optimization unit includes the object Are stored in advance in the cache memory before the object is referred to.

この指示を行なうことにより、プログラム実行時に利用しようとするオブジェクトがキャッシュメモリに記憶されていないために起こるヒットミスを防ぐことができる。   By performing this instruction, it is possible to prevent a hit miss that occurs because an object to be used during program execution is not stored in the cache memory.

さらに好ましくは、前記指示取得手段は、前記ソースプログラムの中において、特定のオブジェクトを前記キャッシュメモリのラインデータのサイズごとにグループ分けし、異なるグループに含まれるオブジェクトは前記キャッシュメモリの異なるセット番号のキャッシュエントリーに配置する旨の指示と、前記特定のオブジェクトの名前とを取得し、前記最適化手段は、前記特定のオブジェクトを前記キャッシュメモリのラインデータのサイズごとにグループ分けし、異なるグループに属するオブジェクト同士が前記キャッシュメモリの同じセット番号のキャッシュエントリーに配置されないようにする。   More preferably, the instruction acquisition means groups specific objects in the source program according to the size of the line data of the cache memory, and objects included in different groups have different set numbers of the cache memory. An instruction to place in the cache entry and the name of the specific object are obtained, and the optimization unit groups the specific object according to the size of the line data of the cache memory, and belongs to different groups Objects are not arranged in cache entries having the same set number in the cache memory.

時間的に近いタイミングでアクセスされるオブジェクト同士でキャッシュメモリの同一のセット番号のブロックを奪い合い、互いにオブジェクトを追い出しあう競合状態によるヒットミスを防ぐことができる。   It is possible to prevent hit misses caused by a race condition in which objects accessed at close timings scramble the blocks having the same set number in the cache memory and drive out the objects.

さらに好ましくは、前記キャッシュメモリに含まれる複数のキャッシュエントリーの各々は、前記キャッシュエントリーに格納されたオブジェクトの追い出しやすさを示す値を記憶するウィークフラグを有し、前記プロセッサが使用するメインメモリは、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されるウィーク空間と、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されないキャッシャブル空間とを有し、前記指示取得手段は、前記ソースプログラムの中において、特定のオブジェクトを前記ウィーク空間または前記キャッシャブル空間のいずれに配置するかを示す配置情報に基づいて、前記特定のオブジェクトを前記ウィーク空間または前記キャッシャブル空間に配置する指示と、前記特定のオブジェクトの名前と、前記配置情報とを取得し、前記最適化手段は、特定のオブジェクトを前記配置情報に従い前記ウィーク空間または前記キャッシャブル空間のいずれかに配置させる。   More preferably, each of the plurality of cache entries included in the cache memory has a weak flag for storing a value indicating the easiness of eviction of an object stored in the cache entry, and the main memory used by the processor is The stored object is arranged in the cache memory, and a weak space in which a value that makes the object easy to kick out is set in the weak flag at the time of the arrangement, and the stored object is stored in the cache memory. And a cacheable space in which a value that facilitates expelling the object is not set in the weak flag at the time of the arrangement, and the instruction acquisition unit includes the specific object in the source program. We An instruction to place the specific object in the weak space or the cacheable space, a name of the specific object, and the placement information based on placement information indicating whether to place the space in the space or the cacheable space And the optimization means arranges a specific object in either the weak space or the cacheable space according to the arrangement information.

オブジェクトを適切な空間に配置することにより、例えば、ウィーク空間を利用することにより、あまり利用されないオブジェクトにウィークビットを立て、優先的に追い出すようにすることもできる。これにより、オブジェクト同士でキャッシュメモリの同一のセット番号のブロックを奪い合い、互いにオブジェクトを追い出しあう競合状態によるヒットミスを防ぐことができる。   By arranging the objects in an appropriate space, for example, by using a weak space, a weak bit can be set for an object that is not frequently used, and the object can be preferentially driven out. As a result, it is possible to prevent hit misses due to a race condition in which objects scramble blocks of the same set number in the cache memory and drive out objects from each other.

さらに好ましくは、前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させる。   More preferably, the instruction acquisition unit acquires an instruction to cause the cache memory control unit to execute a dedicated command of the cache memory control unit that controls the cache memory in the source program, and the optimization unit includes: Based on the instruction, the cache memory control unit executes the dedicated command.

キャッシュメモリ制御手段が実行する専用コマンドを指定できるようにすることにより、キャッシュメモリの細かな制御をユーザが指定することができ、キャッシュメモリにおけるヒットミスを防ぐことができる。   By making it possible to designate a dedicated command to be executed by the cache memory control means, the user can designate fine control of the cache memory, and hit misses in the cache memory can be prevented.

なお、本発明は、このような特徴的な手段を備えるコンパイラ装置として実現することができるだけでなく、コンパイラ装置に含まれる特徴的な手段をステップとするコンパイル方法として実現したり、コンパイラ装置が備える各手段としてコンピュータを機能させるためのプログラムとして実現したりすることもできる。そして、そのようなプログラムは、CD−ROM等の記録媒体やインターネット等の伝送媒体を介して流通させることができるのは言うまでもない。   The present invention can be realized not only as a compiler apparatus including such characteristic means, but also as a compile method using the characteristic means included in the compiler apparatus as a step, or provided in the compiler apparatus. It can also be realized as a program for causing a computer to function as each means. Needless to say, such a program can be distributed via a recording medium such as a CD-ROM or a transmission medium such as the Internet.

アセンブリ言語でプログラムを開発する場合に比べ、開発工数がかからない。   Compared to developing a program in assembly language, development man-hours are not required.

また、プログラムの資産性が向上する。   In addition, the asset of the program is improved.

さらに、人手で性能をチューニングする必要もなくなる。   Furthermore, there is no need to manually tune performance.

さらにまた、オブジェクトをキャッシュメモリに一度に乗せることができないために起こるヒットミスを防ぐことができる。   Furthermore, hit misses that occur because objects cannot be placed in the cache memory at once can be prevented.

また、プログラム実行時に利用しようとするオブジェクトがキャッシュメモリに記憶されていないために起こるヒットミスを防ぐことができる。   In addition, it is possible to prevent a hit miss that occurs because an object to be used during program execution is not stored in the cache memory.

さらに、オブジェクト同士でキャッシュメモリの同一のセット番号のブロックを奪い合い、互いにオブジェクトを追い出しあう競合状態によるヒットミスを防ぐことができる。   Further, it is possible to prevent hit misses caused by a race condition in which the objects scramble the blocks having the same set number in the cache memory and drive out the objects.

本発明の実施の形態に係るコンパイルシステムがターゲットとするコンピュータのハードウェア構成の一部を示すブロック図である。It is a block diagram which shows a part of hardware constitutions of the computer targeted by the compilation system which concerns on embodiment of this invention. キャッシュメモリのハードウェア構成を示すブロック図である。It is a block diagram which shows the hardware constitutions of a cache memory. キャッシュエントリーにおける詳細なビット構成を示す図である。It is a figure which shows the detailed bit structure in a cache entry. サブキャッシュメモリのハードウェア構成を示すブロック図である。It is a block diagram which shows the hardware constitutions of a subcache memory. メインメモリに含まれる記憶領域の種類を説明するための図である。It is a figure for demonstrating the kind of storage area contained in the main memory. 機械語プログラムを開発するプログラム開発システムの構成を示すブロック図である。It is a block diagram which shows the structure of the program development system which develops a machine language program. コンパイラの構成を示す機能ブロック図である。It is a functional block diagram which shows the structure of a compiler. タイリング処理を説明するための図である。It is a figure for demonstrating a tiling process. 容量性ミス発生のチェック処理を説明するための図である。It is a figure for demonstrating the check process of capacitive miss generation. プリフェッチ命令挿入処理の指定方法を説明するための図である。It is a figure for demonstrating the designation | designated method of prefetch instruction insertion processing. プリフェッチ命令挿入処理の指定方法を説明するための図である。It is a figure for demonstrating the designation | designated method of prefetch instruction insertion processing. ループ内の配列に対するプラグマ指令によるプリフェッチ命令挿入処理を説明するための図である。It is a figure for demonstrating the prefetch command insertion process by the pragma command with respect to the arrangement | sequence in a loop. プロファイル情報を利用したプリフェッチ命令挿入処理の指定方法を説明するための図である。It is a figure for demonstrating the designation | designated method of the prefetch instruction insertion process using profile information. データ配置処理の概略を説明するための図である。It is a figure for demonstrating the outline of a data arrangement | positioning process. データ配置の指定に関する方法を説明するための図である。It is a figure for demonstrating the method regarding designation | designated of data arrangement | positioning. データ配置を指定するプラグマ指令を含むソースプログラムの一例を示す図である。It is a figure which shows an example of the source program containing the pragma command which designates data arrangement | positioning. グループ分けされたオブジェクトの図である。It is a figure of the object divided into groups. データ配置を指定するプラグマ指令を含むソースプログラムの一例を示す図である。It is a figure which shows an example of the source program containing the pragma command which designates data arrangement | positioning. オブジェクトを特定の空間に配置するための指定方法を示す図である。It is a figure which shows the designation | designated method for arrange | positioning an object in a specific space. 専用レジスタDPTELに格納される情報を示す図である。It is a figure which shows the information stored in the exclusive register DPTEL. 組み込み関数の一覧を示す図である。It is a figure which shows the list of built-in functions. キャッシュコマンド挿入部により生成される中間コード一例を示す図である。It is a figure which shows an example of the intermediate code produced | generated by the cache command insertion part. 図21に示した組み込み関数が有効に機能しているか否かを調べるための組み込み関数の一覧を示す図である。It is a figure which shows the list of the built-in functions for investigating whether the built-in function shown in FIG. 21 is functioning effectively. コンパイラに対して各種情報の入出力を行なうための指定方法を説明するための図である。It is a figure for demonstrating the designation | designated method for inputting / outputting various information with respect to a compiler.

図1は、本発明の実施の形態に係るコンパイルシステムがターゲットとするコンピュータのハードウェア構成の一部を示すブロック図である。コンピュータ10は、プロセッサ1と、メインメモリ2と、キャッシュメモリ3と、サブキャッシュメモリ4と、キャッシュ制御部5とを備えている。プロセッサ1は、機械語プログラムを実行する処理部であり、通常のプロセッサが有する機能に加えて、後述する専用レジスタ6(専用レジスタDPTEL)を有している。   FIG. 1 is a block diagram showing a part of a hardware configuration of a computer targeted by a compile system according to an embodiment of the present invention. The computer 10 includes a processor 1, a main memory 2, a cache memory 3, a sub-cache memory 4, and a cache control unit 5. The processor 1 is a processing unit that executes a machine language program, and includes a dedicated register 6 (dedicated register DPTEL), which will be described later, in addition to the functions of a normal processor.

メインメモリ2は、プロセッサ1で実行される機械語命令や各種データなどを記憶するメモリである。   The main memory 2 is a memory for storing machine language instructions executed by the processor 1 and various data.

キャッシュメモリ3は、4ウェイセットアソシアティブ方式に従い動作し、メインメモリ2よりも高速にデータの読み書きが可能なメモリである。なお、キャッシュメモリ3の記憶容量は、メインメモリ2のそれに比べて少ない。   The cache memory 3 is a memory that operates according to the 4-way set associative method and can read and write data at a higher speed than the main memory 2. Note that the storage capacity of the cache memory 3 is smaller than that of the main memory 2.

サブキャッシュメモリ4は、ダイレクトマッピング方式に従い動作し、メインメモリ2よりも高速にデータの読み書きが可能なメモリである。なお、サブキャッシュメモリ4の記憶容量は、キャッシュメモリ3のそれに比べて少ない。   The sub-cache memory 4 is a memory that operates according to the direct mapping method and can read / write data at a higher speed than the main memory 2. Note that the storage capacity of the sub-cache memory 4 is smaller than that of the cache memory 3.

キャッシュ制御部5は、キャッシュメモリ3およびサブキャッシュメモリ4を制御するための処理部であり、後述する専用レジスタ7〜9(専用レジスタTACM、TACSZおよびTACSTAD)を有している。   The cache control unit 5 is a processing unit for controlling the cache memory 3 and the sub-cache memory 4, and has dedicated registers 7 to 9 (dedicated registers TACM, TACSZ and TACSTAD) which will be described later.

図2は、キャッシュメモリ3のハードウェア構成を示すブロック図である。同図のように、キャッシュメモリ3は、4ウェイセットアソシアティブ方式のキャッシュメモリであり、アドレスレジスタ20と、デコーダ30と、4つのウェイ31a〜31d(以下ウェイ0〜3と略す)と、4つの比較器32a〜32dと、4つのアンド回路33a〜33dと、オア回路34と、セレクタ35と、デマルチプレクサ37とを備える。   FIG. 2 is a block diagram showing a hardware configuration of the cache memory 3. As shown in the figure, the cache memory 3 is a 4-way set associative cache memory, and includes an address register 20, a decoder 30, four ways 31a to 31d (hereinafter abbreviated as ways 0 to 3), and four Comparators 32a to 32d, four AND circuits 33a to 33d, an OR circuit 34, a selector 35, and a demultiplexer 37 are provided.

アドレスレジスタ20は、メインメモリ2へのアクセスアドレスを保持するレジスタである。このアクセスアドレスは32ビットであるものとする。同図に示すように、アクセスアドレスは、最上位ビットから順に、21ビットのタグアドレスと、4ビットのセットインデックス(図中のSI)とを含む。ここで、タグアドレスはウェイにマッピングされるメモリ中の領域を指す。セットインデックス(SI)はウェイ0〜3に跨る複数セットの1つを示す。このセット数は、セットインデックス(SI)が4ビットなので16セットである。タグアドレスおよびセットインデックス(SI)で特定されるブロックは、リプレース単位であり、キャッシュメモリに格納されている場合はラインデータ又はラインとも呼ばれる。ラインデータのサイズは、セットインデックス(SI)よりも下位のアドレスビットで定まるサイズ、すなわち128バイトである。1ワードを4バイトとすると、1ラインデータは32ワードである。アドレスレジスタ20中の最下位から7ビットは、ウェイのアクセス時には無視される。   The address register 20 is a register that holds an access address to the main memory 2. This access address is assumed to be 32 bits. As shown in the figure, the access address includes a 21-bit tag address and a 4-bit set index (SI in the figure) in order from the most significant bit. Here, the tag address indicates an area in the memory mapped to the way. The set index (SI) indicates one of a plurality of sets over the ways 0 to 3. This set number is 16 sets because the set index (SI) is 4 bits. The block specified by the tag address and the set index (SI) is a replacement unit, and is also called line data or a line when stored in the cache memory. The size of the line data is a size determined by address bits lower than the set index (SI), that is, 128 bytes. If one word is 4 bytes, one line data is 32 words. The least significant 7 bits in the address register 20 are ignored when accessing the way.

デコーダ30は、セットインデックス(SI)の4ビットをデコードし、4つのウェイ0〜3に跨る16セット中の1つを選択する。   The decoder 30 decodes 4 bits of the set index (SI), and selects one of 16 sets that straddle the four ways 0 to 3.

4つのウェイ0〜3は、同じ構成を有し、合計4×2kバイトの容量を有する。ウェイ0は、16個のキャッシュエントリーを有する。   The four ways 0 to 3 have the same configuration and have a total capacity of 4 × 2 kbytes. Way 0 has 16 cache entries.

図3に1つのキャッシュエントリーにおける詳細なビット構成を示す。同図のように、1つのキャッシュエントリーは、バリッドフラグV、21ビットのタグ、128バイトのラインデータ、ウィークフラグWおよびダーティフラグDを保持する。バリッドフラグVは、そのキャッシュエントリーが有効か否かを示す。タグは21ビットのタグアドレスのコピーである。ラインデータは、タグアドレスおよびセットインデックス(SI)により特定されるブロック中の128バイトデータのコピーである。ダーティフラグDは、そのキャッシュエントリーに書き込みがあったか否か、つまりキャシュエントリー中にキャッシュされたデータが書き込みによりメモリ中のデータと異なるためメモリに書き戻すこと(ライトバックすること)が必要か否かを示す。ウィークフラグWは、キャッシュエントリーからの追い出し対象を示すフラグであり、キャッシュミスを起こした場合に、ウィークフラグWが1のキャッシュエントリーから優先的にデータが追い出される。   FIG. 3 shows a detailed bit configuration in one cache entry. As shown in the figure, one cache entry holds a valid flag V, a 21-bit tag, 128-byte line data, a weak flag W, and a dirty flag D. The valid flag V indicates whether or not the cache entry is valid. The tag is a copy of the 21-bit tag address. Line data is a copy of 128-byte data in a block specified by a tag address and a set index (SI). The dirty flag D indicates whether or not the cache entry has been written, that is, whether or not it is necessary to write back to the memory (write back) because the data cached during the cache entry differs from the data in the memory due to the write. Indicates. The weak flag W is a flag indicating an object to be evicted from the cache entry, and when a cache miss occurs, data is preferentially evicted from the cache entry having the weak flag W of 1.

ウェイ1〜3についても、ウェイ0と同様である。セットインデックス(SI)の4ビットによってデコーダ30を介して選択される4ウェイに跨る4つのキャッシュエントリーは、「セット」と呼ばれる。   Ways 1 to 3 are the same as way 0. Four cache entries spanning four ways selected through the decoder 30 by the four bits of the set index (SI) are called “sets”.

比較器32aは、アドレスレジスタ20中のタグアドレスと、セットインデックス(SI)により選択されたセットに含まれる4つのタグ中のウェイ0のタグとが一致するか否かを比較する。比較器32b〜32cについても、ウェイ31b〜31dに対応すること以外は同様である。   The comparator 32a compares whether or not the tag address in the address register 20 matches the tag of the way 0 among the four tags included in the set selected by the set index (SI). The comparators 32b to 32c are the same except that they correspond to the ways 31b to 31d.

アンド回路33aは、バリッドフラグVと比較器32aの比較結果とが一致するか否かを比較する。この比較結果をh0をする。比較結果h0が1である場合は、アドレスレジスタ20中のタグアドレスおよびセットインデックス(SI)に対応するラインデータが存在すること、すなわちウェイ0においてヒットしたことを意味する。比較結果h0が0である場合は、ミスヒットしたことを意味する。アンド回路33b〜33dについても、ウェイ31b〜31dに対応すること以外は同様である。その比較結果h1〜h3は、ウェイ1〜3でヒットしたかミスヒットしたかを意味する。   The AND circuit 33a compares whether or not the valid flag V matches the comparison result of the comparator 32a. The comparison result is h0. When the comparison result h0 is 1, it means that there is line data corresponding to the tag address and set index (SI) in the address register 20, that is, a hit in way 0. If the comparison result h0 is 0, it means that a miss-hit has occurred. The AND circuits 33b to 33d are the same except that they correspond to the ways 31b to 31d. The comparison results h1 to h3 mean whether the hits are made in ways 1 to 3 or missed.

オア回路34は、比較結果h0〜h3の論理和をとる。この論理和をhitとする。hitは、キャッシュメモリ3にヒットしたか否かを示す。   The OR circuit 34 calculates the logical sum of the comparison results h0 to h3. Let this logical sum be hit. hit indicates whether or not the cache memory 3 has been hit.

セレクタ35は、選択されたセットにおけるウェイ0〜3のラインデータのうち、ヒットしたウェイのラインデータを選択する。   The selector 35 selects the line data of the hit way among the line data of the ways 0 to 3 in the selected set.

デマルチプレクサ37は、キャッシュエントリーにデータを書き込む際に、ウェイ0〜3の1つに書き込みデータを出力する。   The demultiplexer 37 outputs write data to one of the ways 0 to 3 when writing data to the cache entry.

図4は、サブキャッシュメモリ4のハードウェア構成を示すブロック図である。同図のように、サブキャッシュメモリ4は、ダイレクトマッピング方式(1ウェイセットアソシアティブ方式)のキャッシュメモリであり、アドレスレジスタ44と、デコーダ40と、1つのウェイ41と、比較機42と、アンド回路43とを備える。   FIG. 4 is a block diagram showing a hardware configuration of the sub-cache memory 4. As shown in the figure, the sub cache memory 4 is a direct mapping type (1-way set associative) cache memory, and includes an address register 44, a decoder 40, one way 41, a comparator 42, and an AND circuit. 43.

アドレスレジスタ44は、メインメモリ2へのアクセスアドレスを保持するレジスタである。このアクセスアドレスは32ビットであるものとする。同図に示すように、アクセスアドレスは、最上位ビットから順に、21ビットのタグアドレスと、1ビットのセットインデックス(図中のSI)とを含む。ここで、タグアドレスはウェイにマッピングされるメモリ中の領域を指す。ウェイ41のセット数は、セットインデックス(SI)が1ビットなので2セットである。タグアドレスおよびセットインデックス(SI)で特定されるブロックは、リプレース単位であり、キャッシュメモリに格納されている場合はラインデータ又はラインとも呼ばれる。ラインデータのサイズは、128バイトである。1ワードを4バイトとすると、1ラインデータは32ワードである。アドレスレジスタ20中の最下位から10ビットは、ウェイのアクセス時には無視される。   The address register 44 is a register that holds an access address to the main memory 2. This access address is assumed to be 32 bits. As shown in the figure, the access address includes a 21-bit tag address and a 1-bit set index (SI in the figure) in order from the most significant bit. Here, the tag address indicates an area in the memory mapped to the way. The set number of ways 41 is two sets because the set index (SI) is 1 bit. The block specified by the tag address and the set index (SI) is a replacement unit, and is also called line data or a line when stored in the cache memory. The size of the line data is 128 bytes. If one word is 4 bytes, one line data is 32 words. The least significant 10 bits in the address register 20 are ignored when accessing the way.

デコーダ40は、セットインデックス(SI)の1ビットをデコードし、2セット中の1つを選択する。1つのキャッシュエントリーは、図3に示したものと同様である。   The decoder 40 decodes one bit of the set index (SI) and selects one of the two sets. One cache entry is the same as that shown in FIG.

比較器42は、アドレスレジスタ44中のタグアドレスと、セットインデックス(SI)により選択されたセットに含まれるタグとが一致するか否かを比較する。   The comparator 42 compares whether or not the tag address in the address register 44 matches the tag included in the set selected by the set index (SI).

アンド回路43は、バリッドフラグVと比較器42の比較結果とが一致するか否かを比較する。この比較結果をhitとする。比較結果hitが1である場合は、アドレスレジスタ44中のタグアドレスおよびセットインデックス(SI)に対応するラインデータが存在すること、すなわちヒットしたことを意味する。比較結果hitが0である場合は、ミスヒットしたことを意味する。   The AND circuit 43 compares whether or not the valid flag V matches the comparison result of the comparator 42. Let this comparison result be hit. When the comparison result hit is 1, it means that line data corresponding to the tag address and set index (SI) in the address register 44 exists, that is, hit. If the comparison result hit is 0, it means that a miss-hit has occurred.

図5は、メインメモリ2に含まれる記憶領域の種類を説明するための図である。当該記憶領域は、キャッシャブル空間と、ウィーク空間と、サブキャッシュ空間と、アンキャッシャブル空間との4種類の記憶領域を有する。キャッシャブル空間およびウィーク空間に配置された命令またはデータは、キャッシュメモリ3との間で読み書きされる。特に、ウィーク空間に配置されたデータは、キャッシュメモリ3に配置される際にウィークビットWに1が設定される。サブキャッシュ空間に配置された命令またはデータはサブキャッシュメモリ4との間で読み書きされる。アンキャッシャブル空間に配置された命令またはデータは、キャッシュメモリ3およびサブキャッシュメモリ4には配置されずプロセッサ1との間で直接やり取りされる。   FIG. 5 is a diagram for explaining the types of storage areas included in the main memory 2. The storage area has four types of storage areas: a cacheable space, a weak space, a sub-cache space, and an uncacheable space. Instructions or data arranged in the cacheable space and the weak space are read from and written to the cache memory 3. In particular, when the data arranged in the weak space is arranged in the cache memory 3, the weak bit W is set to 1. Instructions or data arranged in the sub-cache space are read from and written to the sub-cache memory 4. Instructions or data arranged in the uncacheable space are exchanged directly with the processor 1 without being arranged in the cache memory 3 and the sub-cache memory 4.

図6は、コンピュータ10のプロセッサ1において実行される機械語プログラムを開発するプログラム開発システム50の構成を示すブロック図である。プログラム開発システム50は、デバッガ52と、シミュレータ54と、プロファイラ56と、コンパイラ58とを備えている。   FIG. 6 is a block diagram showing a configuration of a program development system 50 that develops a machine language program to be executed by the processor 1 of the computer 10. The program development system 50 includes a debugger 52, a simulator 54, a profiler 56, and a compiler 58.

コンパイラ58は、ソースプログラムおよびプロファイラ56より出力されるプロファイル情報64を読み込み、機械語プログラムへ変換するためのプログラムであり、機械語命令を最適化するための最適化部68をその内部に備えている。コンパイラ58の詳細については、後に詳述する。   The compiler 58 is a program for reading the profile information 64 output from the source program and the profiler 56 and converting it into a machine language program, and has an optimization unit 68 for optimizing machine language instructions therein. Yes. Details of the compiler 58 will be described later.

デバッガ52は、コンパイラ58におけるソースプログラムのコンパイル時に見つかったバグの位置や原因を特定するためのプログラムである。シミュレータ54は、機械語プログラムを仮想的に実行するプログラムであり、実行結果は実行ログ情報62として出力される。なお、シミュレータ54は、キャッシュメモリ3およびサブキャッシュメモリ4のヒットおよびミスヒット等のシミュレート結果を実行ログ情報62に含めて出力するキャッシュメモリ用シミュレータ60を内部に備えている。   The debugger 52 is a program for specifying the position and cause of the bug found when compiling the source program in the compiler 58. The simulator 54 is a program that virtually executes the machine language program, and the execution result is output as execution log information 62. The simulator 54 internally includes a cache memory simulator 60 that outputs simulation results such as hits and miss hits of the cache memory 3 and the sub-cache memory 4 in the execution log information 62 and outputs them.

プロファイラ56は、実行ログ情報62を解析するとともに、コンパイラ58における最適化等のヒント情報となるプロファイル情報64を出力するプログラムである。   The profiler 56 is a program that analyzes the execution log information 62 and outputs profile information 64 that serves as hint information such as optimization in the compiler 58.

図7は、コンパイラ58の構成を示す機能ブロック図である。このコンパイラはC言語やC++言語等の高級言語で記述されたソースプログラム72を、上述のプロセッサ1をターゲットプロセッサとする機械語プログラム92に変換するクロスコンパイラであり、パーソナルコンピュータ等のコンピュータ上で実行されるプログラムによって実現され、大きく分けて、パーサー部76と、中間コード変換部78と、最適化部68と、コード生成部90とから構成される。   FIG. 7 is a functional block diagram showing the configuration of the compiler 58. This compiler is a cross compiler that converts a source program 72 described in a high-level language such as C language or C ++ language into a machine language program 92 using the processor 1 as a target processor, and is executed on a computer such as a personal computer. This is realized by a program to be executed and roughly divided into a parser unit 76, an intermediate code conversion unit 78, an optimization unit 68, and a code generation unit 90.

なお、パーサー部76は、コンパイルの対象となるソースプログラム72に対して、予約語(キーワード)等を抽出して字句解析する前置処理部である。   The parser unit 76 is a preprocessing unit that extracts reserved words (keywords) and the like from the source program 72 to be compiled and performs lexical analysis.

中間コード変換部78は、パーサー部76から渡されたソースプログラム72の各ステートメントを一定規則に基づいて中間コードに変換する処理部である。ここで、中間コードは、典型的には、関数呼び出しの形式で表現されるコード(例えば、「+(int a, int b)」を示すコード;「整数aに整数bを加算する」ことを示す。)である。ただし、中間
コードには、このような関数呼び出し形式のコードだけでなく、プロセッサ1の機械語命令も含まれる。中間コード変換部78は、中間コードを生成する際に、プロファイル情報64を参照して、最適な中間コードを生成する。
The intermediate code conversion unit 78 is a processing unit that converts each statement of the source program 72 passed from the parser unit 76 into an intermediate code based on a certain rule. Here, the intermediate code is typically a code expressed in the form of a function call (for example, a code indicating “+ (int a, int b)”; “adding an integer b to an integer a” It is shown.) However, the intermediate code includes not only such a function call type code but also a machine language instruction of the processor 1. The intermediate code conversion unit 78 refers to the profile information 64 when generating the intermediate code, and generates an optimal intermediate code.

最適化部68は、中間コード変換部78より出力された中間コードについて、命令結合、冗長除去、命令並べ替え、レジスタ割り付け等の処理を行なうことにより、実行速度の向上やコードサイズの削減等を行なう処理部であり、通常の最適化処理に加え、本コンパイラ58特有の最適化を行なう処理部(タイリング部84、プリフェッチ命令挿入部86、配置セット情報設定部87、キャッシュコマンド挿入部88)を有する。タイリング部84、プリフェッチ命令挿入部86、配置セット情報設定部87、キャッシュコマンド挿入部88の実行する処理については後に詳述する。なお、最適化部68は、キャッシュメモリ3のキャッシュミスに関する情報など、ユーザがソースプログラム72を再作成する際のヒントとなるチューニングヒント情報94を合わせて出力する。   The optimization unit 68 performs processing such as instruction combination, redundancy removal, instruction rearrangement, and register allocation on the intermediate code output from the intermediate code conversion unit 78, thereby improving the execution speed and reducing the code size. This is a processing unit that performs optimization processing peculiar to the compiler 58 in addition to normal optimization processing (tiling unit 84, prefetch instruction insertion unit 86, arrangement set information setting unit 87, cache command insertion unit 88). Have Processing executed by the tiling unit 84, the prefetch instruction insertion unit 86, the arrangement set information setting unit 87, and the cache command insertion unit 88 will be described in detail later. The optimization unit 68 also outputs tuning hint information 94 that serves as a hint when the user re-creates the source program 72, such as information on a cache miss in the cache memory 3.

コード生成部90は、最適化部68から出力された中間コードに対して、内部に保持する変換テーブル等を参照することで、全てのコードを機械語命令に置き換えることで、機械語プログラム92を生成する。   The code generator 90 refers to the intermediate code output from the optimizing unit 68 and refers to a conversion table or the like held therein, thereby replacing all the codes with machine language instructions, thereby Generate.

コンパイラ58では、特に、キャッシュメモリ3におけるキャッシュミスを削減することを狙いとしている。キャッシュミスは、(1)初期ミス、(2)容量性ミスおよび(3)競合性ミスの3つに大きく分けることができる。「初期ミス」とは、プログラム実行時に利用しようとするオブジェクトがキャッシュメモリ3に記憶されていないために起こるヒットミスを指す。「容量性ミス」とは、大量のオブジェクトを一度に処理しようとするために、それらのオブジェクトをキャッシュメモリ3に一度に乗せることができないために起こるヒットミスを指す。「競合性ミス」とは、キャッシュメモリ3中のキャッシュエントリーを異なるオブジェクトが同時に使用しようとして、互いにキャッシュエントリーからの追い出し合いを行なうことにより発生するヒットミスを指す。   The compiler 58 specifically aims to reduce cache misses in the cache memory 3. Cache misses can be broadly divided into three categories: (1) initial miss, (2) capacitive miss, and (3) competitive miss. “Initial miss” refers to a hit miss that occurs because an object to be used during program execution is not stored in the cache memory 3. A “capacity miss” refers to a hit miss that occurs because a large number of objects are to be processed at one time and cannot be placed in the cache memory 3 at a time. The “competitiveness miss” refers to a hit miss that occurs when different objects try to use cache entries in the cache memory 3 at the same time, and perform mutual pursuit from the cache entries.

次に、以上のように構成されたコンパイラ58の特徴的な動作について、具体的な例を示しながら説明する。   Next, a characteristic operation of the compiler 58 configured as described above will be described with a specific example.

(1)タイリング処理
タイリング処理とは、ループ処理において、容量性ミスが生じている場合に、1つのループを複数のループに分割することにより、一度に処理されるオブジェクトの容量をキャッシュメモリ3の容量以下に抑える手法である。このタイリング処理は、タイリング部84において実行される。
(1) Tiling processing Tiling processing means that when a capacity error occurs in loop processing, one loop is divided into a plurality of loops, so that the capacity of objects processed at one time is cache memory. This is a technique for suppressing the capacity to 3 or less. This tiling process is executed in the tiling unit 84.

図8は、タイリング処理を説明するための図である。   FIG. 8 is a diagram for explaining the tiling process.

図8(a)および図8(b)は、タイリング処理の実行を指定するためのプラグマの一例を示す図である。なお、「プラグマ(又は、プラグマ指令)」とは、ソースプログラム72中にユーザが任意に指定(配置)することができるコンパイラ58への指示であり、「#pragma」で始まる文字列である。   FIGS. 8A and 8B are diagrams illustrating an example of a pragma for designating execution of the tiling process. The “pragma (or pragma command)” is an instruction to the compiler 58 that can be arbitrarily designated (placed) by the user in the source program 72, and is a character string starting with “#pragma”.

図8(a)で示されるプラグマ指令は、ループ処理で使用されるオブジェクトの容量が一定(NUMで指定されたバイト容量)となるようなタイリング処理の実行を指定する。なお、容量NUMを指定しなかった場合には、予め定められた(デフォルトの)容量となるようなタイリング処理の実行の指定となる。   The pragma command shown in FIG. 8A designates execution of tiling processing in which the capacity of an object used in loop processing is constant (byte capacity designated by NUM). If the capacity NUM is not designated, execution of the tiling process is designated so as to have a predetermined (default) capacity.

図8(b)で示されるプラグマ指令は、ループ処理のループ回数が一定(NUMで指定された回数)となるようなタイリング処理の実行を指定する。なお、回数NUMを指定しなかった場合には、デフォルトの回数となるようなタイリング処理の実行の指定となる。   The pragma command shown in FIG. 8B designates execution of tiling processing so that the number of loop processing loops is constant (number of times specified by NUM). If the number of times NUM is not specified, the execution of the tiling process is specified to be the default number of times.

なお、上述のプラグマ指令では、プラグマ指令の直後に記載されたループ処理が処理の対象となる。   Note that in the above-described pragma command, the loop process described immediately after the pragma command is a processing target.

図8(c)は、プラグマ指令を含まないループ処理の一例を示す図である。図8(d)は、このループ処理におけるループカウンタの値の変化を模式的に示す図である。図8(d)に示すように、このループ処理では、ループカウンタiが1ずつ増加するたびに、ループカウンタjが0から999まで1ずつ増加する。したがって、オブジェクトcがメインメモリ2のキャッシャブル空間またはウィーク空間に配置されている場合には、オブジェクトc(1000個の配列要素)を一度にキャッシュメモリ3に配置しようとし、容量性ミスを発生させてしまう。   FIG. 8C is a diagram illustrating an example of a loop process that does not include a pragma command. FIG. 8D is a diagram schematically showing changes in the value of the loop counter in this loop processing. As shown in FIG. 8D, in this loop process, every time the loop counter i increases by 1, the loop counter j increases by 1 from 0 to 999. Therefore, when the object c is arranged in the cacheable space or the weak space of the main memory 2, the object c (1000 array elements) is tried to be arranged in the cache memory 3 at a time, causing a capacity error. End up.

このため、図8(e)に示すように、ソースプログラム72の2番目のループ処理の直前に「#pragma _loop_tiling_times=100」というプラグマ指令を挿入することにより、
図8(c)に示すソースプログラム72が図8(f)に示すようなソースプログラム72に変換される。すなわち、ループカウンタjを0から999まで1ずつ1000回増加させる代わりに、ループカウンタkを100回増加させる処理を10回ループさせる処理に変換される。図8(g)は、変換後のループカウンタの値の変化を模式的に示す図である。図8(g)に示すように、ループカウンタkを100回ずつ増加させる処理を10回繰返す。これにより、キャッシュメモリ3に一度に配置されるオブジェクトを配列cの100個の要素に減らすことができ、容量性ミスの発生を防ぐことができる。なお、タイリング処理は、上述のようにタイリング部84が行なっている。このため、図8(e)に示すソースプログラム72から図8(f)に示すソースプログラム72への変換は、実際には中間コード形式において実行される。
Therefore, as shown in FIG. 8E, by inserting a pragma command “# pragma_loop_tiling_times = 100” immediately before the second loop processing of the source program 72,
The source program 72 shown in FIG. 8C is converted into the source program 72 as shown in FIG. That is, instead of incrementing the loop counter j from 0 to 999 by 1000 times, the process of incrementing the loop counter k by 100 times is converted into a process of looping 10 times. FIG. 8G is a diagram schematically showing changes in the value of the loop counter after conversion. As shown in FIG. 8G, the process of incrementing the loop counter k by 100 times is repeated 10 times. As a result, the objects placed in the cache memory 3 at a time can be reduced to 100 elements of the array c, and the occurrence of a capacitive miss can be prevented. Note that the tiling process is performed by the tiling unit 84 as described above. Therefore, the conversion from the source program 72 shown in FIG. 8 (e) to the source program 72 shown in FIG. 8 (f) is actually executed in the intermediate code format.

なお、プラグマ指令によれば、キャッシュメモリ3の容量等のハードウェア構成が変更になった場合であっても、容量NUMまたは回数NUMの値を変えて、再コンパイルするだけでよい。このため、ソースプログラムの資産性を向上させることが可能である。   According to the pragma command, even if the hardware configuration such as the capacity of the cache memory 3 is changed, it is only necessary to change the value of the capacity NUM or the number of times NUM and recompile. For this reason, it is possible to improve the asset property of the source program.

なお、タイリング部84に、容量性ミスが発生していないかどうかをチェックさせるようにしてもよい。図9は、容量性ミス発生のチェック処理を説明するための図である。たとえば、容量性ミスが発生しているか否かの情報をチューニングヒント情報94として出力させるためのプラグマを図9(a)のように定義し、このプラグマをソースプログラム72のチェックしたいループの直前に記載することにより、指定されたループに対して容量性ミスが発生しているか否かの情報がチューニングヒント情報94として出力される。   Note that the tiling unit 84 may check whether a capacitive error has occurred. FIG. 9 is a diagram for explaining a check process for occurrence of a capacitive miss. For example, a pragma for outputting information as to whether or not a capacitive error has occurred as tuning hint information 94 is defined as shown in FIG. 9A, and this pragma is immediately before the loop of the source program 72 to be checked. By describing, information indicating whether or not a capacitive error has occurred in the designated loop is output as tuning hint information 94.

図9(b)は、ループ処理を含むソースプログラム72の一例を示す図であり、図9(c)は、図9(b)に示したソースプログラム72に含まれる2つのループの直前に図9(a)に示したプラグマ指令を挿入したソースプログラム72の一例である。図9(d)に示すように、図9(c)に示したソースプログラムをコンパイルすることにより、2つのループ処理において、容量性ミスが発生しているか否かの情報がチューニングヒント情報94に出力される。ユーザは、出力されたチューニングヒント情報94を参照することにより、容量性ミスが発生しているか否かを知ることができ、図8(a)または図8(b)に示したプラグマ指令をソースプログラム72中に挿入することにより、タイリング処理を実行させ、容量性ミスを防ぐことができる。   FIG. 9B is a diagram showing an example of the source program 72 including loop processing, and FIG. 9C is a diagram immediately before two loops included in the source program 72 shown in FIG. 9B. This is an example of the source program 72 in which the pragma command shown in FIG. As shown in FIG. 9 (d), by compiling the source program shown in FIG. 9 (c), information on whether or not a capacitive error has occurred in the two loop processes is displayed in the tuning hint information 94. Is output. The user can know whether or not a capacitive error has occurred by referring to the output tuning hint information 94. The pragma command shown in FIG. 8A or FIG. By inserting it into the program 72, it is possible to execute a tiling process and prevent a capacitive error.

なお、図8(a)または図8(b)に示したプラグマ指令と図9(a)に示したプラグマ指令とを同じループに対して同時に指定することも可能である。   Note that the pragma command shown in FIG. 8 (a) or FIG. 8 (b) and the pragma command shown in FIG. 9 (a) can be simultaneously specified for the same loop.

なお、図9(a)に示したプラグマ指令をループの直前に挿入することにより、タイリング部84が、容量性ミスが発生しているか否かを調べるとともに、容量性ミスが発生しないように、自動的にタイリング処理を実行するようにしてもよい。   In addition, by inserting the pragma command shown in FIG. 9A immediately before the loop, the tiling unit 84 checks whether or not a capacitive error has occurred, and prevents a capacitive error from occurring. The tiling process may be automatically executed.

(2)プリフェッチ命令挿入処理
プリフェッチ命令挿入処理とは、メインメモリ2に記憶された指定された領域のオブジェクトを予めキャッシュメモリ3にプリフェッチするための命令を、中間コードに挿入するための処理である。このプリフェッチ層命令挿入処理は、プリフェッチ命令挿入部86において実行される。
(2) Prefetch instruction insertion process The prefetch instruction insertion process is a process for inserting an instruction for prefetching an object in a specified area stored in the main memory 2 into the cache memory 3 in the intermediate code in advance. . This prefetch layer instruction insertion processing is executed in the prefetch instruction insertion unit 86.

図10および図11は、プリフェッチ命令挿入処理の指定方法を説明するための図である。図10(a)〜図10(d)は、特定の変数に対するプリフェッチ命令挿入処理の指定の仕方を示している。   10 and 11 are diagrams for explaining a designation method of the prefetch instruction insertion processing. FIG. 10A to FIG. 10D show how to specify prefetch instruction insertion processing for a specific variable.

図10(a)および図10(b)は、プラグマ指令によるプリフェッチ命令挿入処理の指定を示しており、指定した変数名の値を予めキャッシュメモリ3にプリフェッチする命令の挿入指示である。なお、図10(b)に示すようにサイクル数を指定した場合には、指定した変数が参照されるよりも当該サイクル数だけ前にプリフェッチ命令が挿入される。図10(a)に示すようにサイクル数が指定されなかった場合には、指定された変数が参照されるよりも予め定められたサイクル数(デフォルトサイクル数)だけ前にプリフェッチ命令が挿入される。すなわち、図10(e)に示すように、例えば、実際に変数aがアクセスされるよりも指定サイクル数またはデフォルトサイクル数だけ前に変数aをプリフェッチするプリフェッチ命令が挿入される。   FIGS. 10A and 10B show designation of prefetch instruction insertion processing by a pragma instruction, and is an instruction insertion instruction for prefetching the value of the designated variable name in the cache memory 3 in advance. When the number of cycles is designated as shown in FIG. 10B, the prefetch instruction is inserted by the number of cycles before the designated variable is referred to. As shown in FIG. 10A, when the number of cycles is not specified, the prefetch instruction is inserted before the specified variable is referred to by a predetermined number of cycles (default number of cycles). . That is, as shown in FIG. 10E, for example, a prefetch instruction for prefetching the variable a is inserted before the actual access of the variable a by the designated cycle number or the default cycle number.

図10(c)および図10(d)は、組み込み関数によるプリフェッチ命令挿入処理の指定を示しており、アドレスとサイズを引数することにより、当該アドレスをスタートアドレスとするメインメモリ2中の当該サイズで指定される領域の値を予めキャッシュメモリ3にプリフェッチする命令の挿入指示である。なお、図10(d)に示すようにサイクル数を指定した場合には、図10(b)のプラグマ指令と同様の処理が行なわれ、図10(c)に示すようにサイクル数を指定しなかった場合には、図10(a)のプラグマ指令と同様の処理が行なわれる。   FIG. 10C and FIG. 10D show the specification of the prefetch instruction insertion processing by the built-in function, and the size in the main memory 2 having the address as the start address by specifying the address and the size as arguments. Is an instruction to insert an instruction for prefetching the value of the area specified in (1) into the cache memory 3 in advance. When the number of cycles is designated as shown in FIG. 10 (d), the same processing as the pragma command in FIG. 10 (b) is performed, and the number of cycles is designated as shown in FIG. 10 (c). If not, the same process as the pragma command in FIG. 10A is performed.

図11(a)および図11(b)は、プラグマ指令によるループ内の配列に対するプリフェッチ命令挿入処理の指定の仕方を示している。プラグマ指令の直後に記載されたループ処理が処理の対象となる。図11(b)に示すように、サイクル数を指定した場合には、キャッシュメモリ3のレイテンシを考慮して、実際に配列の要素が参照されるよりも、指定されたサイクル数だけ前に当該要素をプリフェッチするような命令が挿入される。図11(a)に示すように、サイクル数が指定されなかった場合には、デフォルトサイクル数だけ前に当該要素をプリフェッチするような命令が挿入される。   FIG. 11A and FIG. 11B show how to specify prefetch instruction insertion processing for an array in a loop by a pragma instruction. The loop processing described immediately after the pragma command is the target of processing. As shown in FIG. 11B, when the number of cycles is specified, the latency of the cache memory 3 is taken into consideration, and the corresponding number of cycles before the element of the array is actually referred to before Instructions that prefetch elements are inserted. As shown in FIG. 11A, when the number of cycles is not specified, an instruction for prefetching the element is inserted by the number of default cycles.

図12は、ループ内の配列に対するプラグマ指令によるプリフェッチ命令挿入処理を説明するための図である。図12(a)に示すようなソースプログラム72のループ処理において、図12(b)に示すように配列aをプリフェッチするプラグマを記載した場合には、図12(c)に示すようにプリフェッチ命令挿入コマンドdpref()が挿入される。「dpref(&a[0])」および「dpref(&a[4])」が実行されることにより、ループカウンタiがi=0およびi=1のときに参照される配列の値a[0]〜a[7]がキャッシュメモリ3にプリフェッチされる。その後、ループ処理が開始され、「dpref(&a[i+1])」を実行することにより、2回後のループ処理で使用される配列の要素がキャッシュメモリ3にプリフェッチされる。このように、ループ処理の繰り返し(イタレーション)を跨いで要素がプリフェッチされる。すなわち、配列の要素が参照されるイタレーションよりも前のイタレーションにおいて当該要素がプリフェッチされる。なお、実際には、プリフェッチ命令挿入部86は、中間コードに対してプリフェッチ命令を挿入する。   FIG. 12 is a diagram for explaining prefetch instruction insertion processing by a pragma instruction for an array in a loop. In the loop processing of the source program 72 as shown in FIG. 12A, when a pragma for prefetching the array a as shown in FIG. 12B is described, a prefetch instruction as shown in FIG. The insert command dpref () is inserted. By executing “dref (& a [0])” and “dpref (& a [4])”, the array value a [0] referred to when the loop counter i is i = 0 and i = 1. ˜a [7] is prefetched into the cache memory 3. Thereafter, loop processing is started, and by executing “dpref (& a [i + 1])”, the elements of the array used in the loop processing two times later are prefetched into the cache memory 3. In this way, elements are prefetched across loop processing iterations (iterations). That is, the element is prefetched in an iteration before the iteration in which the element of the array is referenced. Actually, the prefetch instruction insertion unit 86 inserts a prefetch instruction into the intermediate code.

以上説明したような、プリフェッチ命令挿入処理を実行することにより、初期ミスを防ぐことができる。   By executing the prefetch instruction insertion process as described above, an initial miss can be prevented.

なお、プロファイル情報64を利用してプリフェッチ命令を自動挿入するようにしてもよい。図13は、プロファイル情報64を利用したプリフェッチ命令挿入処理の指定方法を説明するための図である。   Note that a prefetch instruction may be automatically inserted using the profile information 64. FIG. 13 is a diagram for explaining a designation method for prefetch instruction insertion processing using profile information 64.

図13(a)は、コンパイルオプションによる指定方法である。コンパイル時にこのオプションが付いていた場合には、プロファイル情報64より初期ミスを起こしているオブジェクトが調べられ、当該オブジェクトをプリフェッチする命令が挿入される。なお、このコンパイルオプションでは、上述の指定方法と同様に、プリフェッチ命令を挿入する位置のサイクル数を指定することも可能である。   FIG. 13A shows a designation method using compile options. When this option is attached at the time of compiling, an object causing an initial error is checked from the profile information 64, and an instruction for prefetching the object is inserted. With this compile option, it is also possible to specify the number of cycles at the position where the prefetch instruction is inserted, as in the above-described specification method.

図13(b)〜図13(d)は、プラグマによる指定方法である。図13(e)に示されるように、図13(b)に示すプラグマと図13(c)に示すプラグマとは対となって使用され、「#pragma _prof_insert_dpref on」と「#pragma _prof_insert_dpref off」とで区切られた範囲について、プロファイル情報64に基づいてプリフェッチ命令が
挿入される。
FIG. 13B to FIG. 13D are designation methods using pragmas. As shown in FIG. 13 (e), the pragma shown in FIG. 13 (b) and the pragma shown in FIG. A prefetch instruction is inserted based on the profile information 64 for the range delimited by.

図13(d)に示すプラグマがソースプログラム72中で指定された場合には、それ以降の命令は、コンパイルオプションに従うことを示している。すなわち、図13(a)に示したコンパイルオプションが設定されている場合には、そのオプションに従い、プロファイル情報64に基づいてプリフェッチ命令が挿入されるが、コンパイルオプションが設定されていない場合には、プリフェッチ命令の挿入は行なわれない。なお、図13(b)〜(d)に示すプラグマは、組み込み関数として書いてもよい。   When the pragma shown in FIG. 13D is specified in the source program 72, it indicates that the subsequent instructions follow the compile option. That is, when the compile option shown in FIG. 13A is set, a prefetch instruction is inserted based on the profile information 64 according to the option, but when the compile option is not set, No prefetch instruction is inserted. Note that the pragmas shown in FIGS. 13B to 13D may be written as built-in functions.

図13(f)および図13(g)は、組み込み関数による指定方法である。アドレスとサイズを引数することにより、当該アドレスをスタートアドレスとするメインメモリ2中の当該サイズで指定される領域が、初期ミスを起こしている場合には、当該領域の値を予めキャッシュメモリ3にプリフェッチする命令の挿入指示である。なお、図13(g)に示すように、上述の指定方法と同様に、プリフェッチ命令を挿入する位置のサイクル数を指定することも可能である。これらの指定は、プラグマ指令としてもよい。   FIG. 13 (f) and FIG. 13 (g) are designation methods using built-in functions. If an area specified by the size in the main memory 2 having the address as the start address by causing the address and size to be an argument, an initial miss has occurred, and the value of the area is stored in the cache memory 3 in advance. This is an instruction to insert a prefetch instruction. As shown in FIG. 13G, it is also possible to specify the number of cycles at the position where the prefetch instruction is inserted, as in the above-described specification method. These designations may be pragma commands.

以上説明したように、プリフェッチ命令を挿入することにより、キャッシュメモリ3のレイテンシを考慮して、特定のオブジェクトに対する初期ミスを防止することができる。特に、プロファイル情報64を考慮したプリフェッチ命令の挿入処理においては、例えばプリフェッチされる変数がアクセスされるよりも前に他の命令が無いような場合には、指定されたサイクル数またはデフォルトサイクル数を空けてプリフェッチ命令を挿入することができない。このため、そのような場合には、プリフェッチ命令を挿入しても無駄であるため、当該命令の挿入は行なわれない。また、すでにキャッシュメモリ3に格納されているオブジェクトについては、プリフェッチする必要がないため、その場合にもプリフェッチ命令の挿入は行なわれない。これらの情報は、プロファイル情報64を見ることにより分かる。   As described above, by inserting a prefetch instruction, it is possible to prevent an initial miss for a specific object in consideration of the latency of the cache memory 3. In particular, in the prefetch instruction insertion process considering the profile information 64, for example, when there is no other instruction before the prefetched variable is accessed, the designated cycle number or default cycle number is set. It is not possible to insert a prefetch instruction because it is empty. Therefore, in such a case, since it is useless to insert a prefetch instruction, the instruction is not inserted. Further, since there is no need to prefetch an object already stored in the cache memory 3, no prefetch instruction is inserted in this case. Such information can be understood by looking at the profile information 64.

(3)データ配置指定処理
図14は、データ配置処理の概略を説明するための図である。図14(a)に示すように、ソースプログラムに含まれる変数のうち、時間的に近いタイミングでアクセスされる変数(例えば生存区間が重なり合う変数)のグループが3つあったとする(変数グループA〜C)。ここで、1つの変数グループに含まれるデータサイズは、キャッシュメモリ3のラインデータのサイズ、すなわち128バイトであるものとする。コンパイルシステムでは、これら3つの変数グループがキャッシュメモリ3に書込みされる際には、異なるセット番号のブロックに書き込まれるような機械語命令を生成する。例えば、変数グループA、BおよびCをキャッシュメモリ3のセット0、1および15のブロックにそれぞれ配置するものとすると、図14(b)に示されるように、変数グループA、BおよびCは、キャッシュメモリ3に書き込まれた場合にセット0、1および15のブロックに書き込まれるようなメインメモリ2の記憶領域に記憶される。このため、図14(c)に示されるように、変数グループA、BおよびCは、メインメモリ2からキャッシュメモリ3に書き込まれる際には、セット0、1および15のブロックにそれぞれ書き込まれることとなる。このようにすることにより、時間的に近いタイミングでアクセスされるオブジェクト同士でキャッシュメモリの同一のセット番号のブロックを奪い合い、互いにオブジェクトを追い出しあう競合状態が生じない。よって、競合性ミスを低減させることができる。
(3) Data Placement Specifying Process FIG. 14 is a diagram for explaining the outline of the data placement process. As shown in FIG. 14A, it is assumed that there are three groups of variables (for example, variables with overlapping life spans) that are accessed at close timings among variables included in the source program (variable groups A to A). C). Here, it is assumed that the data size included in one variable group is the size of the line data in the cache memory 3, that is, 128 bytes. In the compiling system, when these three variable groups are written into the cache memory 3, machine language instructions are generated so as to be written into blocks having different set numbers. For example, if variable groups A, B, and C are arranged in blocks 0, 1, and 15 of cache memory 3, respectively, as shown in FIG. When written in the cache memory 3, it is stored in the storage area of the main memory 2 which is written in the blocks of the sets 0, 1, and 15. Therefore, as shown in FIG. 14C, when the variable groups A, B, and C are written from the main memory 2 to the cache memory 3, they are written to the blocks of the sets 0, 1, and 15, respectively. It becomes. By doing so, objects that are accessed at timings close to each other compete for a block having the same set number in the cache memory, and a conflicting state in which the objects are driven out from each other does not occur. Therefore, competitive mistakes can be reduced.

図15は、データ配置の指定に関する方法を説明するための図である。図15(a)に示すプラグマによりオブジェクト名を並べて指定した場合には、これらのオブジェクトサイズの総和がラインデータのサイズ(128バイト)以下の場合には、キャッシュメモリ3の同一のセットにそれらのオブジェクトを配置するような最適化が行なわれる。128以上の場合には、128バイトごとにオブジェクトをグループ分けし、異なるグループのオブジェクトはキャッシュメモリ3の異なるセットに配置されるような最適化が行なわれる。   FIG. 15 is a diagram for explaining a method related to designation of data arrangement. When the object names are specified side by side by the pragma shown in FIG. 15A, if the sum of these object sizes is equal to or smaller than the size of the line data (128 bytes), the same set of the cache memory 3 Optimization is performed such as placing objects. In the case of 128 or more, the objects are grouped every 128 bytes, and optimization is performed such that objects of different groups are arranged in different sets of the cache memory 3.

例えば、図16に示されるように、「#pragma _overlap_access_object a,b,c」というプラグマ指定により、整数型配列a[32]、b[32]およびc[32]が時間的に近いタイミングでアクセスされることがユーザにより明示的に示されている。配置セット情報設定部87は、このプラグマの指示により、配列a[32]、b[32]およびc[32]を1つのオブジェクト群とした場合に、これらを128バイトごとにグループ分けする。整数型変数は4バイトであるものとすると、配列a[32]、b[32]およびc[32]はそれぞれ128バイトである。このため、このオブジェクト群は、図17に示されるような3つのグループ(グループdata_a、data_bおよびdata_c)に分割され、グループdata_aには配列a[32]が含まれ、グループdata_bには配列b[32]が含まれ、グループdata_cには配列c[32]が含まれることとなる。   For example, as shown in FIG. 16, the integer type arrays a [32], b [32], and c [32] are accessed at close timings by specifying the pragma “#pragma_overlap_access_object a, b, c”. Is explicitly indicated by the user. When the array a [32], b [32], and c [32] are set as one object group according to the instruction of the pragma, the arrangement set information setting unit 87 groups them every 128 bytes. Assuming that the integer type variable is 4 bytes, the arrays a [32], b [32], and c [32] are each 128 bytes. For this reason, this object group is divided into three groups (group data_a, data_b, and data_c) as shown in FIG. 17, the group data_a includes the array a [32], and the group data_b includes the array b [ 32] is included, and the array data [c] is included in the group data_c.

グループ分け処理の後、配置セット情報設定部87は、それぞれのグループに異なるセット番号が付す。例えば、グループdata_a、data_bおよびdata_cにはセット番号0、1および2がそれぞれ付されるものとする。   After the grouping process, the arrangement set information setting unit 87 assigns a different set number to each group. For example, it is assumed that set numbers 0, 1, and 2 are assigned to the groups data_a, data_b, and data_c, respectively.

その後、配置セット情報設定部87は、設定されたセット番号のキャッシュメモリ3のブロックにそのグループのオブジェクトが配置されるよう中間コードを生成する。   Thereafter, the arrangement set information setting unit 87 generates an intermediate code so that the object of the group is arranged in the block of the cache memory 3 having the set number.

図15(b)に示すプラグマによりオブジェクトが配置されるキャッシュメモリ3のセット番号を指定することも可能である。例えば、図18に示すように、ソースプログラム72中にプラグマ「#pragma _cache_set_number=0 i」、「#pragma _cache_set_number=1 j」および「#pragma _cache_set_number=2 k」が指定されている場合には、配列i、jおよびkはそれぞれキャッシュメモリ3のセット番号0、1および2のセットに配置されるような中間コードが生成される。   It is also possible to specify the set number of the cache memory 3 in which the object is arranged by the pragma shown in FIG. For example, as shown in FIG. 18, when pragmas “#pragma _cache_set_number = 0 i”, “#pragma _cache_set_number = 1 j” and “#pragma _cache_set_number = 2 k” are specified in the source program 72, Intermediate codes are generated so that the arrays i, j, and k are arranged in the sets of the set numbers 0, 1, and 2 of the cache memory 3, respectively.

図15(c)に示すプラグマによると、オブジェクト名と番地とを指定することにより、配置セット情報設定部87は、当該オブジェクトをメインメモリ2の指定された番地に格納する中間コードを生成する。例えば、プロファイル情報64やチューニングヒント情報94によりオブジェクトを格納するとよい番地が予め分かっているような場合には、この指定方法を利用する。   According to the pragma shown in FIG. 15C, by specifying the object name and address, the arrangement set information setting unit 87 generates intermediate code for storing the object at the specified address in the main memory 2. For example, this addressing method is used when the address where the object should be stored is known in advance from the profile information 64 and the tuning hint information 94.

図15(d)に示すコンパイルオプションによる指定を行なった場合には、配置セット情報設定部87は、プロファイル情報64に基づいて、生存区間の重なり合うオブジェクトが異なるキャッシュメモリ3のセットに配置されるように、オブジェクトのキャッシュメモリ3上のアドレスを決定し、当該アドレスにオブジェクトを配置するような中間コードを生成する。   When designation is performed using the compile option shown in FIG. 15D, the arrangement set information setting unit 87 arranges the objects with overlapping life intervals in different sets of the cache memory 3 based on the profile information 64. Then, an address of the object on the cache memory 3 is determined, and intermediate code is generated so as to place the object at the address.

以上のようなデータ配置指定処理により、オブジェクト同士でキャッシュメモリの同一のセット番号のブロックを奪い合い、互いにオブジェクトを追い出しあう競合状態を生じさせないようにすることができる。よって、競合性ミスを低減させることができる。   By the data arrangement designation process as described above, it is possible to prevent a conflicting state in which blocks with the same set number in the cache memory are competing with each other and the objects are expelled from each other. Therefore, competitive mistakes can be reduced.

(4)メモリ空間指定処理
上述したようにメインメモリ2には4種類のメモリ空間(キャッシャブル空間、ウィーク空間、サブキャッシュ空間およびアンキャッシャブル空間)を有している。図19は、オブジェクトを特定の空間に配置するための指定方法を示す図である。上述のようにプロセッサ1は、専用レジスタ6(専用レジスタDPTEL)を有している。図20は、専用レジスタDPTELに格納される情報を示す図である。専用レジスタDPTELには、メインメモリ2のページアドレスと、サブキャッシュ空間であるかウィーク空間であるかを示すS/Wフラグとが記憶されている。なお、専用レジスタDPTELは4つ存在し、0番から3番まで番号が付けられているものとする。
(4) Memory Space Designation Processing As described above, the main memory 2 has four types of memory spaces (cashable space, weak space, sub-cache space, and uncacheable space). FIG. 19 is a diagram illustrating a designation method for arranging an object in a specific space. As described above, the processor 1 has the dedicated register 6 (dedicated register DPTEL). FIG. 20 is a diagram illustrating information stored in the dedicated register DPTEL. The dedicated register DPTEL stores a page address of the main memory 2 and an S / W flag indicating whether it is a sub-cache space or a weak space. Note that there are four dedicated registers DPTEL, numbered from 0 to 3.

図19(a)に示すプラグマがソースプログラム72中で指定されている場合には、配置セット情報設定部87は、指定された変数を、指定された番号の専用レジスタDPTELに含まれるページアドレスに配置する中間コードを生成する。なお、当該ページアドレスの種類は専用レジスタDPTELに含まれるS/Wフラグにより、サブキャッシュ空間であるかウィーク空間であるかが指定されている。例えば、S/Wフラグの値が1であればサブキャッシュ空間を指定し、0であればウィーク空間を指定するようにしてもよい。   When the pragma shown in FIG. 19A is specified in the source program 72, the arrangement set information setting unit 87 sets the specified variable to the page address included in the dedicated register DPTEL with the specified number. Generate intermediate code to be deployed. Note that the type of the page address is designated by the S / W flag included in the dedicated register DPTEL as the sub-cache space or the weak space. For example, if the value of the S / W flag is 1, the sub cache space may be specified, and if it is 0, the weak space may be specified.

図19(b)に示すコンパイルオプションがコンパイル時に指定されている場合には、配置セット情報設定部87は、プロファイル情報64に基づいて、メインメモリ2のサブキャッシュ空間、ウィーク空間またはアンキャッシャブル空間に配置すると有効な変数を当該空間に配置する中間コードを生成する。例えば、大きな配列を1回だけ参照するような場合には、当該配列はアクセス頻度が少ないため、サブキャッシュ空間に配置する中間コードを生成する。   When the compile option shown in FIG. 19B is specified at the time of compilation, the arrangement set information setting unit 87 determines the sub-cache space, weak space, or uncacheable space of the main memory 2 based on the profile information 64. If it is placed in, intermediate code that places valid variables in the space is generated. For example, when referring to a large array only once, the array is less frequently accessed, so an intermediate code to be placed in the sub-cache space is generated.

図19(c)に示すプラグマがソースプログラム72中で指定されている場合には、配置セット情報設定部87は、プロファイル情報64に基づいて、プラグマで指定された変数を特定の空間に配置すると有効か否かを調べ、有効な場合には、当該空間に指定された変数を配置する中間コードを生成する。   When the pragma shown in FIG. 19C is designated in the source program 72, the arrangement set information setting unit 87 arranges the variable designated by the pragma in a specific space based on the profile information 64. Whether it is valid or not is checked, and if it is valid, an intermediate code for arranging the designated variable in the space is generated.

このように、オブジェクトを適切な空間に配置することにより、競合性ミスを防ぐことができる。例えば、サブキャッシュ空間を利用することにより、キャッシュメモリ3で頻繁に使用されるオブジェクトを追い出したりすることがなくなる。また、ウィーク空間を利用することにより、あまり利用されないオブジェクトにウィークビットWを立て、優先的に追い出すようにすることもできる。   As described above, by arranging the objects in an appropriate space, it is possible to prevent a competitive error. For example, by using the sub-cache space, objects frequently used in the cache memory 3 are not expelled. In addition, by using the weak space, it is possible to set a weak bit W on an object that is not used so much that it is expelled preferentially.

(5)キャッシュコマンド挿入処理
以下では、キャッシュ制御部5が実行する専用コマンドをソースプログラム72において指定するようにする組み込み関数について説明する。
(5) Cache Command Insertion Processing In the following, a built-in function for specifying a dedicated command to be executed by the cache control unit 5 in the source program 72 is described.

図21は、組み込み関数の一覧を示す図である。   FIG. 21 is a diagram showing a list of built-in functions.

図21(a)に示される関数は、引数で指定されるメインメモリ2の領域を事前にキャッシュメモリ3に先読みする処理(以下、「fill処理」ともいう。)と、ライトバックが必要なラインデータをライトバックする処理(以下、「writeback処理」ともいう。)とをキャッシュ制御部5に実行させる関数である。なお、引数では、変数名(変数の先頭アドレス)またはアドレスと、当該アドレスからのサイズとによりメインメモリ2の領域が指定される。   The function shown in FIG. 21A is a process that pre-reads the area of the main memory 2 specified by the argument into the cache memory 3 (hereinafter also referred to as “fill process”) and a line that requires write back. This is a function that causes the cache control unit 5 to execute a process of writing back data (hereinafter also referred to as “writeback process”). In the argument, the area of the main memory 2 is specified by the variable name (start address of the variable) or address and the size from the address.

図21(b)に示される関数は、fill処理と、ウィークフラグWに1を設定する処理(以下、「weaken処理」ともいう。)とをキャッシュ制御部5に実行させる関数である。   The function shown in FIG. 21B is a function that causes the cache control unit 5 to execute a fill process and a process of setting 1 to the weak flag W (hereinafter also referred to as “weaken process”).

図21(c)に示される関数は、引数で指定されるメインメモリ2に対応するキャッシュエントリーを事前に確保するのみの処理(以下、「touch処理」ともいう。)と、writeback処理とをキャッシュ制御部5に実行させる関数である。   The function shown in FIG. 21C caches a process only for securing a cache entry corresponding to the main memory 2 specified by an argument in advance (hereinafter also referred to as “touch process”) and a writeback process. This is a function to be executed by the control unit 5.

図21(d)に示される関数は、touch処理と、weaken処理とをキャッシュ制御部5に実行させる関数である。   The function shown in FIG. 21D is a function that causes the cache control unit 5 to execute a touch process and a weaken process.

図21(e)に示される関数は、writeback処理と、引数で指定されたメインメモリ2の領域に対応するキャッシュメモリ3のキャッシュエントリーを無効にする処理(以下、「invalidate処理」ともいう。)とをキャッシュ制御部5に実行させる関数である。   The function shown in FIG. 21E is a writeback process and a process for invalidating the cache entry in the cache memory 3 corresponding to the area of the main memory 2 specified by the argument (hereinafter also referred to as “invalidate process”). Is a function that causes the cache control unit 5 to execute.

図21(f)に示される関数は、invalidate処理をキャッシュ制御部5に実行させる関数である。   The function illustrated in FIG. 21F is a function that causes the cache control unit 5 to execute invalidate processing.

図21(g)に示される関数は、touch処理をキャッシュ制御部5に実行させる関数である。   The function illustrated in FIG. 21G is a function that causes the cache control unit 5 to execute the touch process.

図21(h)に示される関数は、fill処理をキャッシュ制御部5に実行させる関数である。   The function shown in FIG. 21H is a function that causes the cache control unit 5 to execute the fill process.

図21(a)〜図21(h)に示される関数がソースプログラム72中に含まれる場合には、キャッシュコマンド挿入部88は、上述した処理をキャッシュ制御部5に実行させるための中間コードを生成する。   When the functions shown in FIGS. 21A to 21H are included in the source program 72, the cache command insertion unit 88 generates intermediate code for causing the cache control unit 5 to execute the above-described processing. Generate.

キャッシュ制御部5に専用コマンドを実行させるためには、キャッシュ制御部5の専用レジスタTACSTADに対象となるメインメモリ2の領域の開始アドレスを登録し、専用レジスタTACTSZに開始アドレスからのサイズを登録し、専用レジスタTACMにコマンドを登録すればよい。   In order to cause the cache control unit 5 to execute a dedicated command, the start address of the target main memory 2 area is registered in the dedicated register TACSTAD of the cache control unit 5, and the size from the start address is registered in the dedicated register TACTSZ. The command may be registered in the dedicated register TACM.

したがって、キャッシュコマンド挿入部88は、例えば、図22に示すような中間コードを生成する。なお、この中間コードは、VLIW(Very Long Instruction Word)アーキテクチャを持つプロセッサ1を想定して記述されたものである。まず、コマンドが一旦汎用レジスタr0に書き込まれた後、専用レジスタTACMに書き込まれる。それと同時にサイズが汎用レジスタr1に書き込まれる。専用レジスタTACMへの書込みが成功した場合には、フラグC0に1が設定され、フラグC1に0が設定される。書込みが失敗した場合には、フラグC0に0が設定され、フラグC1に1が設定される。したがって、専用レジスタTACMへの書込みが成功した場合には、3行目および4行目のコマンドが実行され、専用レジスタTACSZおよび専用レジスタTACSTADにそれぞれサイズおよびスタートアドレスが設定される。専用レジスタTACMへの書込みが失敗した場合には5行目の処理が実行され、再度1行目から処理が実行される。   Therefore, the cache command insertion unit 88 generates an intermediate code as shown in FIG. 22, for example. This intermediate code is described assuming a processor 1 having a VLIW (Very Long Instruction Word) architecture. First, the command is once written in the general-purpose register r0 and then written in the dedicated register TACM. At the same time, the size is written to the general-purpose register r1. When the writing to the dedicated register TACM is successful, 1 is set in the flag C0 and 0 is set in the flag C1. If the writing has failed, 0 is set in the flag C0 and 1 is set in the flag C1. Therefore, when writing to the dedicated register TACM is successful, the commands on the third and fourth lines are executed, and the size and start address are set in the dedicated register TACZ and the dedicated register TACSTAD, respectively. If writing to the dedicated register TACM fails, the process on the fifth line is executed, and the process is executed again from the first line.

以上説明したように、キャッシュ制御部5が実行するコマンドをユーザが指定できるようにすることにより、キャッシュメモリ3の細かな制御をユーザが指定をすることができ、初期ミス、容量性ミスおよび競合性ミスを防止することができる。   As described above, by enabling the user to specify the command to be executed by the cache control unit 5, the user can specify fine control of the cache memory 3, and the initial miss, the capacity miss and the conflict. Sexual errors can be prevented.

なお、fill処理を実行する組み込み関数の場合には、プリフェッチ命令挿入処理の場合と同様に、指定サイクル数またはデフォルトサイクル数前にfill処理を実行するような枠組みを設けてもよい。   In the case of a built-in function that executes a fill process, a framework may be provided in which the fill process is executed before the designated cycle number or the default cycle number, as in the case of the prefetch instruction insertion process.

また、プロファイル情報64を確認することにより、キャッシュ制御部5が実行するコマンドが有効に機能しているか否かを調べるような組み込み関数を設けてもよい。図23は、図21に示した組み込み関数が有効に機能しているか否かを調べるための組み込み関数の一覧を示す図である。すなわち、図23(a)〜図23(h)に示した組み込み関数は、図21(a)〜図21(h)に示した組み込み関数と同じ処理をそれぞれ実行するとともに、各組み込み関数が有効に機能しているか否かをチューニングヒント情報94として、出力する。また、図23(a)〜図23(h)に示した組み込み関数は、自動的に無効なキャッシュコマンド(キャッシュ制御部5に実行させるための中間コード)を削除したり、当該中間コード配置位置を調整したりするようにしてもよい。ユーザは、出力されたチューニングヒント情報94を参照することにより、最適な組み込み関数をソースプログラム中に挿入することができ、キャッシュメモリ3を効率的に利用することができるようになる。   Also, a built-in function may be provided to check whether the command executed by the cache control unit 5 is functioning effectively by checking the profile information 64. FIG. 23 is a diagram showing a list of built-in functions for examining whether or not the built-in functions shown in FIG. 21 are functioning effectively. That is, the built-in functions shown in FIGS. 23A to 23H execute the same processing as the built-in functions shown in FIGS. 21A to 21H, and each built-in function is effective. Is output as tuning hint information 94. In addition, the built-in functions shown in FIGS. 23A to 23H automatically delete invalid cache commands (intermediate codes to be executed by the cache control unit 5), and the intermediate code placement positions. Or may be adjusted. By referring to the output tuning hint information 94, the user can insert an optimal built-in function into the source program, and can efficiently use the cache memory 3.

図24は、以上説明した(1)〜(5)の処理を実行する際に、コンパイラ58に対して各種情報の入出力を行なうための指定方法を説明するための図である。図24(a)は、コンパイラ58へキャッシュメモリ3に関する情報を入力させるためのコンパイルオプションであり、図24(b)に示すように記述することにより、使用される。なお、図24(c)は、キャッシュメモリ3に関する情報の一例を示しており、キャッシュメモリ3のサイズや、ラインデータのサイズ、キャッシュメモリ3のレイテンシのサイクル数などが示されている。   FIG. 24 is a diagram for explaining a designation method for inputting / outputting various information to / from the compiler 58 when executing the processes (1) to (5) described above. FIG. 24A shows a compile option for causing the compiler 58 to input information related to the cache memory 3, and is used by describing as shown in FIG. FIG. 24C shows an example of information related to the cache memory 3, which shows the size of the cache memory 3, the size of the line data, the number of latency cycles of the cache memory 3, and the like.

図24(d)は、コンパイラ58に入力されるプロファイル情報64のファイル名を指定するためのコンパイルオプションである。図24(e)は、コンパイラ58より出力されるチューニングヒント情報94の出力ファイル名を指定するためのコンパイルオプションである。   FIG. 24D shows a compile option for specifying the file name of the profile information 64 input to the compiler 58. FIG. 24E shows compile options for designating the output file name of the tuning hint information 94 output from the compiler 58.

以上説明したように本実施の形態に係るコンパイルシステムによると、キャッシュメモリ3における初期ミス、容量性ミスおよび競合性ミスを防止することが各種指定方法により可能となる。   As described above, according to the compiling system according to the present embodiment, it is possible to prevent the initial miss, the capacity miss, and the competitive miss in the cache memory 3 by various designation methods.

なお、本発明は上述の実施の形態には限定されない。例えば、上述したプラグマ指令によるコンパイラに対する指示を、組み込み関数またはコンパイルオプションを用いてすることができる場合には、そのような指示を行なってもよい。組み込み関数またはコンパイルオプションによるコンパイラに対する指示の場合も同様である。   The present invention is not limited to the embodiment described above. For example, when an instruction to the compiler by the pragma instruction described above can be made using an embedded function or a compile option, such an instruction may be given. The same applies to an instruction to the compiler by an intrinsic function or a compile option.

本発明は、コンパイラに適用でき、特に、キャッシュメモリを利用するプロセッサをターゲットとするコンパイラ等に適用できる。   The present invention can be applied to a compiler, and in particular, can be applied to a compiler that targets a processor that uses a cache memory.

1 プロセッサ
2 メインメモリ
3 キャッシュメモリ
4 サブキャッシュメモリ
5 キャッシュ制御部
10 コンピュータ
50 プログラム開発システム
52 デバッガ
54 シミュレータ
56 プロファイラ
58 コンパイラ
60 キャッシュメモリ用シミュレータ
62 実行ログ情報
64 プロファイル情報
68 最適化部
72 ソースプログラム
76 パーサー部
78 中間コード変換部
84 タイリング部
86 プリフェッチ命令挿入部
87 配置セット情報設定部
88 キャッシュコマンド挿入部
90 コード生成部
92 機械語プログラム
94 チューニングヒント情報
DESCRIPTION OF SYMBOLS 1 Processor 2 Main memory 3 Cache memory 4 Sub cache memory 5 Cache control part 10 Computer 50 Program development system 52 Debugger 54 Simulator 56 Profiler 58 Compiler 60 Cache memory simulator 62 Execution log information 64 Profile information 68 Optimization part 72 Source program 76 Parser section 78 Intermediate code conversion section 84 Tiling section 86 Prefetch instruction insertion section 87 Placement set information setting section 88 Cache command insertion section 90 Code generation section 92 Machine language program 94 Tuning hint information

Claims (10)

高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記キャッシュメモリに含まれる複数のキャッシュエントリーの各々は、前記キャッシュエントリーに格納されたオブジェクトの追い出しやすさを示す値を記憶するウィークフラグを有し、
前記プロセッサが使用するメインメモリは、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されるウィーク空間と、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されないキャッシャブル空間とを有し、
前記指示取得手段は、前記ソースプログラムの中において、特定のオブジェクトを前記ウィーク空間または前記キャッシャブル空間のいずれに配置するかを示す配置情報に基づいて、前記特定のオブジェクトを前記ウィーク空間または前記キャッシャブル空間に配置する指示と、前記特定のオブジェクトの名前と、前記配置情報とを取得し、
前記最適化手段は、特定のオブジェクトを前記配置情報に従い前記ウィーク空間または前記キャッシャブル空間のいずれかに配置させるための命令を生成する
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
Each of the plurality of cache entries included in the cache memory has a weak flag for storing a value indicating the easiness of eviction of the object stored in the cache entry,
The main memory used by the processor is stored in a weak space in which a stored object is placed in the cache memory and a value that makes it easy to drive the object out in the weak flag at the time of the placement. And a cacheable space in which a value that makes it easy to kick out the object is not set in the weak flag at the time of the placement.
The instruction acquisition unit is configured to place the specific object in the weak space or the cashier based on arrangement information indicating whether the specific object is arranged in the weak space or the cacheable space in the source program. An instruction to place in the space, the name of the specific object, and the placement information,
The optimizing unit generates an instruction for arranging a specific object in either the weak space or the cacheable space according to the arrangement information.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記プロセッサは、前記キャッシュメモリよりも容量の少ないサブキャッシュメモリをさらに使用し、
前記キャッシュメモリに含まれる複数のキャッシュエントリーの各々は、前記キャッシュエントリーに格納されたオブジェクトの追い出しやすさを示す値を記憶するウィークフラグを有し、
前記プロセッサが使用するメインメモリは、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されるウィーク空間と、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されないキャッシャブル空間と、記憶されているオブジェクトが前記サブキャッシュメモリに配置されるサブキャッシュ空間とを有し、
前記指示取得手段は、前記ソースプログラムを翻訳する旨の指示とともに、前記機械語プログラムの実行解析結果に基づいて前記ソースプログラムに含まれるオブジェクトを配置する前記メインメモリの空間を決定し、当該空間に前記オブジェクトを配置する旨の指示を取得し、
前記最適化手段は、前記機械語プログラムの実行解析結果に基づいて前記ソースプログラムに含まれるオブジェクトを配置する前記メインメモリの空間を決定し、当該空間に前記オブジェクトを配置するための命令を生成する
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The processor further uses a sub-cache memory having a smaller capacity than the cache memory;
Each of the plurality of cache entries included in the cache memory has a weak flag for storing a value indicating the easiness of eviction of the object stored in the cache entry,
The main memory used by the processor is stored in a weak space in which a stored object is placed in the cache memory and a value that makes it easy to drive the object out in the weak flag at the time of the placement. A cacheable space in which a value that makes it easy to drive out the object is not set in the weak flag and a stored object is placed in the sub-cache memory. Sub-cache space
The instruction acquisition unit determines a space of the main memory in which an object included in the source program is arranged based on an execution analysis result of the machine language program together with an instruction to translate the source program, Get an instruction to place the object,
The optimizing unit determines a space of the main memory in which an object included in the source program is arranged based on an execution analysis result of the machine language program, and generates an instruction for arranging the object in the space. A compiler apparatus characterized by that.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記プロセッサは、前記キャッシュメモリよりも容量の少ないサブキャッシュメモリをさらに使用し、
前記キャッシュメモリに含まれる複数のキャッシュエントリーの各々は、前記キャッシュエントリーに格納されたオブジェクトの追い出しやすさを示す値を記憶するウィークフラグを有し、
前記プロセッサが使用するメインメモリは、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されるウィーク空間と、記憶されているオブジェクトが前記キャッシュメモリに配置されるとともに、当該配置の際に前記ウィークフラグに前記オブジェクトを追い出しやすくする値が設定されないキャッシャブル空間と、記憶されているオブジェクトが前記サブキャッシュメモリに配置されるサブキャッシュ空間とを有し、
前記指示取得手段は、前記ソースプログラムの中において、前記機械語プログラムの実行解析結果に基づいて前記ソースプログラムに含まれるオブジェクトを配置する前記メインメモリの空間を決定し、当該空間に前記オブジェクトを配置する旨の指示を取得し、
前記最適化手段は、前記機械語プログラムの実行解析結果に基づいて前記ソースプログラムに含まれるオブジェクトを配置する前記メインメモリの空間を決定し、当該空間に前記オブジェクトを配置するための命令を生成する
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The processor further uses a sub-cache memory having a smaller capacity than the cache memory;
Each of the plurality of cache entries included in the cache memory has a weak flag for storing a value indicating the easiness of eviction of the object stored in the cache entry,
The main memory used by the processor is stored in a weak space in which a stored object is placed in the cache memory and a value that makes it easy to drive the object out in the weak flag at the time of the placement. A cacheable space in which a value that makes it easy to drive out the object is not set in the weak flag and a stored object is placed in the sub-cache memory. Sub-cache space
The instruction acquisition unit determines a space of the main memory in which an object included in the source program is arranged based on an execution analysis result of the machine language program in the source program, and arranges the object in the space Get instructions to do so,
The optimizing unit determines a space of the main memory in which an object included in the source program is arranged based on an execution analysis result of the machine language program, and generates an instruction for arranging the object in the space. A compiler apparatus characterized by that.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記専用コマンドは、指定されたオブジェクトを前記プロセッサが使用するメインメモリより前記キャッシュメモリの所定のキャッシュエントリーに先読みするとともに、当該キャッシュエントリーに格納されているオブジェクトを前記キャッシュメモリにライトバックする必要がある場合には、当該オブジェクトを前記メインメモリにライトバックするコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
The dedicated command needs to pre-read a specified object from a main memory used by the processor into a predetermined cache entry of the cache memory, and write back an object stored in the cache entry to the cache memory. In some cases, the compiler apparatus is a command for writing back the object to the main memory.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記キャッシュメモリに含まれる複数のキャッシュエントリーの各々は、前記キャッシュエントリーに格納されたオブジェクトの追い出しやすさを示す値を記憶するウィークフラグを有し、
前記専用コマンドは、指定されたオブジェクトを前記プロセッサが使用するメインメモリより前記キャッシュメモリの所定のキャッシュエントリーに先読みするとともに、当該キャッシュエントリーのウィークフラグに格納されたオブジェクトを追い出しやすくする値を設定するコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
Each of the plurality of cache entries included in the cache memory has a weak flag for storing a value indicating the easiness of eviction of the object stored in the cache entry,
The dedicated command pre-reads the designated object from the main memory used by the processor to a predetermined cache entry in the cache memory, and sets a value that facilitates eviction of the object stored in the weak flag of the cache entry. A compiler device characterized by being a command.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記専用コマンドは、指定されたオブジェクトを格納するためのキャッシュエントリーを前記キャッシュメモリに事前に確保するとともに、当該キャッシュエントリーに格納されているオブジェクトを前記キャッシュメモリにライトバックする必要がある場合には、当該オブジェクトを前記メインメモリにライトバックするコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
The dedicated command reserves a cache entry for storing a specified object in the cache memory in advance, and when the object stored in the cache entry needs to be written back to the cache memory. And a command for writing back the object to the main memory.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記キャッシュメモリに含まれる複数のキャッシュエントリーの各々は、前記キャッシュエントリーに格納されたオブジェクトの追い出しやすさを示す値を記憶するウィークフラグを有し、
前記専用コマンドは、指定されたオブジェクトを格納するためのキャッシュエントリーを前記キャッシュメモリに事前に確保するとともに、当該キャッシュエントリーのウィークフラグに格納されたオブジェクトを追い出しやすくする値を設定するコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
Each of the plurality of cache entries included in the cache memory has a weak flag for storing a value indicating the easiness of eviction of the object stored in the cache entry,
The dedicated command is a command that secures a cache entry for storing a specified object in the cache memory in advance and sets a value that makes it easy to eject an object stored in the weak flag of the cache entry. The compiler apparatus characterized by this.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記専用コマンドは、指定されたオブジェクトを格納するためのキャッシュエントリーに格納されているオブジェクトを前記キャッシュメモリにライトバックする必要がある場合には、当該オブジェクトを前記メインメモリにライトバックするとともに、当該キャッシュエントリーを無効化するコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
When it is necessary to write back the object stored in the cache entry for storing the designated object to the cache memory, the dedicated command writes the object back to the main memory and A compiler device characterized by being a command for invalidating a cache entry.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記専用コマンドは、指定されたオブジェクトを格納するためのキャッシュエントリーを無効化するコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
The dedicated device is a command for invalidating a cache entry for storing a specified object.
高級言語で記述されたソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
前記ソースプログラムを解析するパーサー手段と、
前記パーサー手段における解析結果に基づいて、前記ソースプログラムを中間コードに変換する中間コード変換手段と、
前記指示に従って、前記中間コードを最適化する最適化手段と、
前記中間コードを前記機械語プログラムに変換するコード生成手段とを備え、
前記機械語プログラムを実行するプロセッサは、キャッシュメモリを利用するプロセッサであり、
前記指示取得手段は、前記ソースプログラムの中において、前記キャッシュメモリを制御するキャッシュメモリ制御手段の専用コマンドを前記キャッシュメモリ制御手段に実行させる指示を取得し、
前記最適化手段は、前記指示に基づいて前記専用コマンドを前記キャッシュメモリ制御手段に実行させるための命令を生成し、
前記専用コマンドは、指定されたオブジェクトを格納するためのキャッシュエントリーを前記キャッシュメモリに事前に確保するコマンドである
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program written in a high-level language into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
Parser means for analyzing the source program;
Intermediate code conversion means for converting the source program into intermediate code based on the analysis result in the parser means;
Optimization means for optimizing the intermediate code according to the instructions;
Code generation means for converting the intermediate code into the machine language program,
The processor that executes the machine language program is a processor that uses a cache memory;
The instruction acquisition means acquires an instruction for causing the cache memory control means to execute a dedicated command of the cache memory control means for controlling the cache memory in the source program,
The optimization unit generates an instruction for causing the cache memory control unit to execute the dedicated command based on the instruction,
The compiler apparatus according to claim 1, wherein the dedicated command is a command for preallocating a cache entry for storing a specified object in the cache memory.
JP2010283836A 2010-12-20 2010-12-20 Compiler device Expired - Lifetime JP5238797B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010283836A JP5238797B2 (en) 2010-12-20 2010-12-20 Compiler device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010283836A JP5238797B2 (en) 2010-12-20 2010-12-20 Compiler device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2003357323A Division JP4934267B2 (en) 2003-10-17 2003-10-17 Compiler device

Publications (2)

Publication Number Publication Date
JP2011081836A true JP2011081836A (en) 2011-04-21
JP5238797B2 JP5238797B2 (en) 2013-07-17

Family

ID=44075748

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010283836A Expired - Lifetime JP5238797B2 (en) 2010-12-20 2010-12-20 Compiler device

Country Status (1)

Country Link
JP (1) JP5238797B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9483244B2 (en) 2014-05-15 2016-11-01 Fujitsu Limited Compiling method and compiling device
US9830268B2 (en) 2014-05-14 2017-11-28 Fujitsu Limited Arithmetic processing device for disabling an unnecessary prefetch command and control method of arithmetic processing device for disabling an unnecessary prefetch command
CN113703660A (en) * 2020-05-22 2021-11-26 华为技术有限公司 Data prefetching method and data prefetching device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0883213A (en) * 1994-09-14 1996-03-26 Mitsubishi Electric Corp Storage device including cache memory
JPH08166884A (en) * 1994-10-13 1996-06-25 Hudson Soft Co Ltd Compiler system
JPH09120372A (en) * 1995-07-07 1997-05-06 Sun Microsyst Inc Harmonized software control for hardware architecture cache memory using prefetch instruction
JPH1173329A (en) * 1997-06-24 1999-03-16 Matsushita Electric Ind Co Ltd Software development support system
WO1999030231A1 (en) * 1997-12-10 1999-06-17 Hitachi, Ltd. Memory access optimizing method
WO2002008911A1 (en) * 2000-07-24 2002-01-31 Hitachi,Ltd Data processing system
JP2002099427A (en) * 2000-09-25 2002-04-05 Toshiba Corp Method and system of program development, and microprocessor

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0883213A (en) * 1994-09-14 1996-03-26 Mitsubishi Electric Corp Storage device including cache memory
JPH08166884A (en) * 1994-10-13 1996-06-25 Hudson Soft Co Ltd Compiler system
JPH09120372A (en) * 1995-07-07 1997-05-06 Sun Microsyst Inc Harmonized software control for hardware architecture cache memory using prefetch instruction
JPH1173329A (en) * 1997-06-24 1999-03-16 Matsushita Electric Ind Co Ltd Software development support system
WO1999030231A1 (en) * 1997-12-10 1999-06-17 Hitachi, Ltd. Memory access optimizing method
WO2002008911A1 (en) * 2000-07-24 2002-01-31 Hitachi,Ltd Data processing system
JP2002099427A (en) * 2000-09-25 2002-04-05 Toshiba Corp Method and system of program development, and microprocessor

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CSNG200000275004; 佐藤正樹、有田隆也、曽和将容: 'キャッシュ操作明示化の提案' 情報処理学会研究報告 Vol.90,No.7, 19900125, pp.25〜32, 社団法人情報処理学会 *
JPN6009059127; 佐藤正樹、有田隆也、曽和将容: 'キャッシュ操作明示化の提案' 情報処理学会研究報告 Vol.90,No.7, 19900125, pp.25〜32, 社団法人情報処理学会 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9830268B2 (en) 2014-05-14 2017-11-28 Fujitsu Limited Arithmetic processing device for disabling an unnecessary prefetch command and control method of arithmetic processing device for disabling an unnecessary prefetch command
US9483244B2 (en) 2014-05-15 2016-11-01 Fujitsu Limited Compiling method and compiling device
CN113703660A (en) * 2020-05-22 2021-11-26 华为技术有限公司 Data prefetching method and data prefetching device

Also Published As

Publication number Publication date
JP5238797B2 (en) 2013-07-17

Similar Documents

Publication Publication Date Title
JP4934267B2 (en) Compiler device
JP4374221B2 (en) Computer system and recording medium
JP2006260096A (en) Program conversion method and program conversion device
US5805863A (en) Memory pattern analysis tool for use in optimizing computer program code
US6970985B2 (en) Statically speculative memory accessing
US9798528B2 (en) Software solution for cooperative memory-side and processor-side data prefetching
US6721943B2 (en) Compile-time memory coalescing for dynamic arrays
US20040205740A1 (en) Method for collection of memory reference information and memory disambiguation
US8886887B2 (en) Uniform external and internal interfaces for delinquent memory operations to facilitate cache optimization
US7243195B2 (en) Software managed cache optimization system and method for multi-processing systems
US20060206874A1 (en) System and method for determining the cacheability of code at the time of compiling
EP3028149A2 (en) Software development tool
JP2007531075A (en) Method and apparatus for shared code caching for translating program code
CN111159062B (en) Cache data scheduling method and device, CPU chip and server
US8266605B2 (en) Method and system for optimizing performance based on cache analysis
JPH10105411A (en) Method for generating procedure during program execution
Fuchs et al. Loop-aware memory prefetching using code block working sets
US6260191B1 (en) User controlled relaxation of optimization constraints related to volatile memory references
JP5238797B2 (en) Compiler device
JP4047788B2 (en) Compiler device and linker device
US20110145503A1 (en) On-line optimization of software instruction cache
US7313787B2 (en) Compiler and method for optimizing object codes for hierarchical memories
JP2014112327A (en) Conversion program, converter, and converting method
JPH08161169A (en) Vliw type computer system and method for interpreting/ executing vliw
Besnard et al. A framework for automatic and parameterizable memoization

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121009

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121120

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: 20130326

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130401

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 5238797

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160405

Year of fee payment: 3

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

EXPY Cancellation because of completion of term