JP2012113518A - Compiler device, code generation method and program - Google Patents
Compiler device, code generation method and program Download PDFInfo
- Publication number
- JP2012113518A JP2012113518A JP2010262072A JP2010262072A JP2012113518A JP 2012113518 A JP2012113518 A JP 2012113518A JP 2010262072 A JP2010262072 A JP 2010262072A JP 2010262072 A JP2010262072 A JP 2010262072A JP 2012113518 A JP2012113518 A JP 2012113518A
- Authority
- JP
- Japan
- Prior art keywords
- code
- data area
- register
- program
- area
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
Description
本発明は、コンパイラ装置に関し、特に非対称型マルチコア・プロセッサ向けコンパイラ装置に関する。 The present invention relates to a compiler apparatus, and more particularly to a compiler apparatus for an asymmetric multi-core processor.
近年、半導体集積回路が多くの製品に搭載されて複雑な制御を行うようになり、処理能力を向上するために1つの半導体集積回路に複数のプロセッサ・コアを実装したマルチコア・プロセッサが採用されるようになってきた。 In recent years, semiconductor integrated circuits have been installed in many products to perform complex control, and a multi-core processor in which a plurality of processor cores are mounted on one semiconductor integrated circuit is adopted in order to improve processing capability. It has become like this.
マルチコア・プロセッサは、複数のプロセッサ・コアを実装することによる処理能力の向上と、複数のプロセッサを1つにすることによる省消費電力化を期待できる。 A multi-core processor can be expected to improve processing capability by mounting a plurality of processor cores and to reduce power consumption by combining a plurality of processors.
その流れの中で、マルチコア・プロセッサを制御するためのプログラムを開発するための開発ツールであるコンパイラ装置も、各PE(Proccer Element:演算ユニットの単位(ここでは、コア))間で制御できるオブジェクトコード(以下、コードと呼ぶ)の生成の必要性が高まってきた。 In that flow, a compiler device that is a development tool for developing a program for controlling a multi-core processor is also an object that can be controlled between each PE (Processor Element: a unit of arithmetic unit (here, core)). The need to generate code (hereinafter referred to as code) has increased.
特に、コア間で共有するプログラムからメモリアクセスを行う場合に、絶対アドレス参照を行うプログラムが一般的であるが、コードの効率が良いレジスタ相対アクセスも使用可能にする要求が高まっている。 In particular, when performing memory access from a program shared between cores, a program that performs absolute address reference is common, but there is an increasing demand for enabling register relative access with high code efficiency.
<特許文献1>
特許文献1(特開2006−058991号公報)には、従来のコンパイラ装置の例が開示されている。
<
Japanese Unexamined Patent Application Publication No. 2006-058991 discloses an example of a conventional compiler apparatus.
従来のコンパイラ装置は、データ領域へのデータ割り付けの最適化を目的とし、データのアクセス回数をコンパイル時に調査し、アクセス回数が多い順に並び替えてデータ領域に配置する機能を有し、データへのアクセスを可能な限り相対アクセスで行うコードを出力する。 The conventional compiler device has the function of optimizing the data allocation to the data area, checking the number of data accesses at the time of compilation, and rearranging them in the descending order of the number of accesses and placing them in the data area. Outputs code that performs relative access as much as possible.
[従来のコンパイラ装置]
図1に示すように、従来のコンパイラ装置は、構文解析処理部1と、中間言語レベル最適化部2と、コード生成処理部3と、ソースプログラム格納部4と、中間言語格納部5と、オブジェクトプログラム格納部6を備える。
[Conventional compiler equipment]
As shown in FIG. 1, a conventional compiler apparatus includes a syntax
構文解析処理部1は、ソースプログラム格納部4に格納されている高級言語で記述されたソースプログラムを入力して構文解析を行う。構文解析処理部1は、構文解析結果を、中間言語格納部5に格納する。
The syntax
中間言語レベル最適化部2は、中間言語格納部5に格納されている構文解析処理部1による構文解析結果を入力し、コード生成時の効率を上げるための最適化を行う。中間言語レベル最適化部2は、最適化結果を、中間言語格納部5に格納する。
The intermediate language
コード生成処理部3は、中間言語格納部5に格納されている中間言語レベル最適化部2による最適化結果を入力してコードを生成する。コード生成処理部3は、生成されたコードを、オブジェクトプログラム格納部6に格納する。
The code
[コード生成処理部]
図2に示すように、コード生成処理部3は、ノード変換処理部7と、レジスタ割り付け処理部8と、アドレス割り付け処理部9と、コード出力処理部10を備える。
[Code generation processing section]
As shown in FIG. 2, the code
ノード変換処理部7は、中間言語格納部5に格納されている中間言語レベル最適化部2による最適化結果を入力してノード変換処理を行う。ノード変換処理部7は、ノード変換結果を、ノード格納部11に格納する。
The node
レジスタ割り付け処理部8は、データのレジスタ割り付け処理を行う。レジスタ割り付け処理部8は、レジスタ割り付け結果を、ノード格納部11に格納する。
The register
アドレス割り付け処理部9は、レジスタが割り付かなかったデータのアドレス割り付け処理を行う。アドレス割り付け処理部9は、アドレス割り付け結果を、ノード格納部11に格納する。
The address
コード出力処理部10は、コードの出力処理を行う。
The code
[アドレス割り付け処理部]
図3に示すように、アドレス割り付け処理部9は、データ管理情報テーブル連鎖機構13と、データアクセス回数登録処理部14と、データ管理情報テーブル連鎖並べ替え処理部15と、データのアドレス割り付け処理部16を備える。
[Address assignment processing section]
As shown in FIG. 3, the address
データ管理情報テーブル連鎖機構13は、データ毎のデータ管理情報テーブル12(12−i、i=1〜n:nはテーブル数)を有する。
The data management information
データ管理情報テーブル12(12−i、i=1〜n)の各々は、次のデータ管理情報テーブルを指すポインタを書き換え可能に保持し、当該ポインタにより連鎖の並びを有する。データ管理情報テーブル12(12−i、i=1〜n)は、次のデータ管理情報テーブルを指すポインタを書き換え可能に保持する。また、データ管理情報テーブル12(12−i、i=1〜n)には、データの管理情報や、データのアクセス回数が登録される。 Each of the data management information tables 12 (12-i, i = 1 to n) holds a pointer to the next data management information table in a rewritable manner, and has a chain sequence by the pointer. The data management information table 12 (12-i, i = 1 to n) holds a pointer indicating the next data management information table in a rewritable manner. Data management information and the number of data accesses are registered in the data management information table 12 (12-i, i = 1 to n).
データアクセス回数登録処理部14は、データ管理情報テーブル12(12−i、i=1〜n)に、データ毎のデータアクセス回数を登録する。
The data access count
データ管理情報テーブル連鎖並べ替え処理部15は、データアクセス回数登録処理部14によるデータ管理情報テーブル12(12−i、i=1〜n)へのデータアクセス回数の登録終了後、データ管理情報テーブル12(12−i、i=1〜n)の連鎖の並びをデータアクセス回数の多い順番に並べ替える。
The data management information table chain
データのアドレス割り付け処理部16は、データ管理情報テーブル連鎖並べ替え処理部15によるデータ管理情報テーブル12(12−i、i=1〜n)の連鎖の並べ替え後に、データのアドレス割り付け処理を行う。
The data address
[従来のコンパイラ装置の特徴]
以上のように、従来のコンパイラ装置では、データ毎のデータ管理情報テーブル12(12−i、i=1〜n)が用意され、データアクセス回数登録部14によりデータ管理情報テーブル12(12−i、i=1〜n)にデータ毎のデータアクセス回数が登録され、その後、データ管理情報テーブル連鎖並べ替え処理部15により、登録されたデータアクセス回数が多い順となるようにデータ管理情報テーブルの連鎖が並べ替えられる。
[Characteristics of conventional compiler equipment]
As described above, in the conventional compiler apparatus, the data management information table 12 (12-i, i = 1 to n) for each data is prepared, and the data management information table 12 (12-i) is registered by the data access
そして、データのアドレス割り付け処理部16により、アドレス回数が多いデータほどベースアドレスに近い位置に配置されるように、アクセス回数の多いデータ用のデータ管理情報テーブルの順にベースアドレスからの相対距離が割り付けられるので、事前のアドレス計算や相対距離のレジスタへの転送の出現回数が減少することになる。
Then, the data address
<特許文献2>
また、関連する技術として、特許文献2(特開2000−029717号公報)には、オブジェクト生成方法及びその処理手順を記憶した媒体、及びにオブジェクト生成装置が開示されている。この関連技術では、高級言語を機械命令に翻訳する際に、変数のアドレスをそのアドレスの全体によって表現した場合と、基点のアドレスとしてのベースポインタの値をレジスタに保持し、そのレジスタの値からの相対値としての表現した場合との効率を比較し、比較結果に基づき、より効率の良い表現を採用したオブジェクトを生成する。
<
Further, as a related technique, Patent Document 2 (Japanese Patent Laid-Open No. 2000-029717) discloses an object generation method, a medium storing a processing procedure thereof, and an object generation apparatus. In this related technology, when a high-level language is translated into a machine instruction, the address of the variable is expressed by the entire address, and the value of the base pointer as the base address is held in the register. Compare the efficiency with the relative value expressed as a relative value, and generate an object that adopts a more efficient expression based on the comparison result.
従来のコンパイラ装置には、非対称マルチコア・プロセッサのようにコア毎のデータ領域とコア間で共有する共有データ領域等の複数のデータ領域がある場合に、全ての領域に対してレジスタ相対アクセスを使用してアクセスすることができないという問題がある。 Conventional compiler devices use register-relative access to all areas when there are multiple data areas such as a data area for each core and a shared data area shared between cores as in an asymmetric multi-core processor. And cannot be accessed.
その理由は、非対称マルチコア・プロセッサでは、コア毎のデータ領域と共有のデータ領域は、通常は連続ではない離れた領域に配置されているため、レジスタ相対アクセスでアクセスできる範囲に、これら全ての領域が収まらず、コア毎のデータ領域と共有のデータ領域の両方に対してレジスタ相対アクセスすることができないためである。 The reason for this is that in an asymmetric multi-core processor, the data area for each core and the shared data area are usually arranged in separate areas that are not continuous, so all these areas are within the range accessible by register-relative access. This is because the register relative access to both the data area for each core and the shared data area is impossible.
本発明のコンパイラ装置は、非対称型マルチコア・プロセッサ向けコンパイラ装置であって、原始プログラムの構文解析結果を基に、変数のアクセス解析を行い、変数の参照元及び参照回数の解析情報を取得する手段と、当該解析情報を基に、変数の配置を行った後、中間言語(Intermediate language)で中間コードを作成する手段と、当該中間コードからオブジェクトコードを生成する際、共通プログラムか否か判断し、共通プログラムである場合、共通プログラム領域から共有データ領域にレジスタ相対アクセスするコードを追加する手段とを具備する。 The compiler apparatus according to the present invention is a compiler apparatus for an asymmetric multi-core processor, and is a means for performing variable access analysis based on a syntax analysis result of a source program and obtaining analysis information of a variable reference source and a reference count Based on the analysis information, after arranging the variables, a means for creating intermediate code in an intermediate language and whether or not the object code is generated from the intermediate code is a common program. In the case of a common program, a means for adding a register relative access from the common program area to the shared data area is provided.
本発明のコード生成方法は、非対称型マルチコア・プロセッサ向けコンパイラ装置により実施されるコード生成方法であって、原始プログラムの構文解析結果を基に、変数のアクセス解析を行い、変数の参照元及び参照回数の解析情報を取得することと、当該解析情報を基に、変数の配置を行った後、中間言語で中間コードを作成することと、当該中間コードからオブジェクトコードを生成する際、共通プログラムか否か判断し、共通プログラムである場合、共通プログラム領域から共有データ領域にレジスタ相対アクセスするコードを追加することとを含む。 The code generation method of the present invention is a code generation method implemented by a compiler device for an asymmetric multi-core processor, and performs access analysis of a variable based on a result of syntax analysis of a source program, and a variable reference source and reference When obtaining the analysis information of the number of times, arranging the variables based on the analysis information, creating intermediate code in the intermediate language, and generating object code from the intermediate code If it is a common program, adding a code for register relative access from the common program area to the shared data area is included.
本発明のプログラムは、上記のコード生成方法における処理を、計算機に実行させるためのプログラムである。なお、本発明のプログラムは、記憶装置や記憶媒体に格納することが可能である。 The program of the present invention is a program for causing a computer to execute the processing in the above code generation method. Note that the program of the present invention can be stored in a storage device or a storage medium.
非対称マルチコア・プロセッサのようにコア毎のデータ領域とコア間で共有する共有データ領域等の複数のデータ領域がある場合に、全ての領域に対してレジスタ相対アクセスを使用してアクセスすることができる。 When there are multiple data areas such as a data area for each core and a shared data area shared between cores as in an asymmetric multi-core processor, all areas can be accessed using register relative access. .
以下に、本発明の第1実施形態について添付図面を参照して説明する。
図4に示すように、本発明のコンパイラ装置100は、読み込み部101と、字句解析部102と、構文解析部103と、変数アクセス解析部104と、変数配置部105と、中間語作成部106と、最適化部107と、コード生成部108を備える。
Hereinafter, a first embodiment of the present invention will be described with reference to the accompanying drawings.
As shown in FIG. 4, the
読み込み部101は、原始プログラムを読み込む。原始プログラムは、原始プログラム格納部110に格納されているソースプログラム(ソースコード)である。
The
字句解析部102は、原始プログラムの字句解析を行い、字句(トークン)を作成する。字句解析部102は、字句(トークン)を中間データ格納部120に格納する。
The
構文解析部103は、字句解析部102で作成した字句(トークン)を基に構文解析を行い、字句(トークン)の並びが文法に照らして正しいかのエラー・チェックを行う。構文解析部103は、構文解析結果を中間データ格納部120に格納する。
The
変数アクセス解析部104は、構文解析部103で得た構文解析結果を基に、変数のアクセス解析を行い、変数の参照元と参照回数の解析情報を得る。変数アクセス解析部104は、この解析情報を中間データ格納部120に格納する。
The variable
変数配置部105は、変数アクセス解析部104で得た解析情報を基に、変数の配置を行う。変数配置部105は、変数の配置結果を中間データ格納部120に格納する。
The
中間語作成部106は、変数の配置が行われた後、原始プログラムを基に、中間言語(Intermediate language)で中間コードを作成する。中間語作成部106は、中間コードを中間データ格納部120に格納する。
After the variables are arranged, the intermediate
最適化部107は、中間データ格納部120に格納されている各種情報を基に、中間コードの最適化を行い、中間コードの高速化、サイズの低減を行う。最適化部107は、最適化された中間コードを中間データ格納部120に格納する。
The
コード生成部108は、最適化された中間コードに基づいてコードを生成し、目的プログラムが完成すると、目的プログラムを目的プログラム格納部130に格納する。目的プログラムは、実行可能な形式で記述されたオブジェクトプログラム(オブジェクトコード)である。
The
[ハードウェアの例示]
コンパイラ装置100の例として、PC(パソコン)、アプライアンス(appliance)、ワークステーション、メインフレーム、スーパーコンピュータ等の計算機を想定している。なお、コンパイラ装置100は、物理マシン上に構築された仮想マシン(Virtual Machine(VM))でも良い。
[Hardware example]
As an example of the
読み込み部101の例として、外部の入力装置や記憶装置、或いは他の計算機から情報を取得するためのインターフェース(I/F:interface)を想定している。入力装置の例として、KVM(キーボード・ビデオ・マウス)、コンソール(console)、タッチパネル(touch panel)、タブレット(tablet)、又は各種の情報伝達媒体の読取装置等が考えられる。
As an example of the
字句解析部102、構文解析部103、変数アクセス解析部104、変数配置部105、中間語作成部106、最適化部107、及びコード生成部108は、プログラムに基づいて駆動し所定の処理を実行するプロセッサと、当該プログラムや各種データを記憶するメモリとによって実現される。
The
上記のプロセッサの例として、CPU(Central Processing Unit)、マイクロプロセッサ(microprocessor)、マイクロコントローラ、或いは、専用の機能を有する半導体集積回路(Integrated Circuit(IC))等が考えられる。 As an example of the above processor, a CPU (Central Processing Unit), a microprocessor (microprocessor), a microcontroller, or a semiconductor integrated circuit (Integrated Circuit (IC)) having a dedicated function can be considered.
上記のメモリの例として、RAM(Random Access Memory)、ROM(Read Only Memory)、EEPROM(Electrically Erasable and Programmable Read Only Memory)やフラッシュメモリ等の半導体記憶装置、HDD(Hard Disk Drive)やSSD(Solid State Drive)等の補助記憶装置、又は、DVD(Digital Versatile Disk)等のリムーバブルディスクや、SDメモリカード(Secure Digital memory card)等の記憶媒体(メディア)等が考えられる。 Examples of the above memory include a semiconductor storage device such as a RAM (Random Access Memory), a ROM (Read Only Memory), an EEPROM (Electrically Erasable and Programmable Read Only Memory), a flash memory, and an HDD (HoldSold). An auxiliary storage device such as State Drive), a removable disk such as a DVD (Digital Versatile Disk), a storage medium such as an SD memory card (Secure Digital memory card), or the like is conceivable.
なお、上記のプロセッサ及び上記のメモリは、一体化していても良い。例えば、近年では、マイコン等の1チップ化が進んでいる。従って、計算機等に搭載される1チップマイコンが、プロセッサ及びメモリを備えている事例が考えられる。 Note that the processor and the memory may be integrated. For example, in recent years, a single chip such as a microcomputer has been developed. Therefore, a case where a one-chip microcomputer mounted on a computer or the like includes a processor and a memory can be considered.
原始プログラム格納部110、中間データ格納部120、及び目的プログラム格納部130の例として、上記のメモリや、周辺機器(外付けHDD等)及び外部のサーバ(Webサーバやファイルサーバ等)に設置された記憶装置、或いは、DAS(Direct Attached Storage)、FC−SAN(Fibre Channel − Storage Area Network)、NAS(Network Attached Storage)、IP−SAN(IP − Storage Area Network)等を用いたストレージ装置が考えられる。
Examples of the source
但し、実際には、これらの例に限定されない。 However, actually, it is not limited to these examples.
[目的プログラムの実行時のアドレス空間]
図5を参照して、非対称マルチコア・プロセッサにおいて、本発明のコンパイラ装置で生成した目的プログラムが実行される際に、プログラム及びデータが配置されるアドレス空間について説明する。
[Address space when executing the target program]
With reference to FIG. 5, an address space in which a program and data are arranged when an object program generated by the compiler apparatus of the present invention is executed in an asymmetric multi-core processor will be described.
当該アドレス空間200は、PE1用プログラム領域201と、PE2用プログラム領域202と、共通プログラム領域203と、PE1用データ領域204と、PE2用データ領域205と、共有データ領域206を有する。
The
PE1用プログラム領域201及びPE2用プログラム領域202は、コア毎のプログラム領域である。
The
共通プログラム領域203は、コア間で共有する共通プログラム領域である。
The
PE1用データ領域204及びPE2用データ領域205は、コア毎のデータ領域である。
The
共有データ領域206は、コア間で共有する共有データ領域である。
The shared
PE1用プログラム領域201、PE2用プログラム領域202、及び共通プログラム領域203と、PE1用データ領域204と、PE2用データ領域205と、共有データ領域206は、離れたアドレスに配置されている。
The
図5では、「0x」で始まる表記を16進数とする。 In FIG. 5, the notation starting with “0x” is a hexadecimal number.
PE1用プログラム領域201は、「0x000000」番地から「0x003FFF」番地までとする。
The
PE2用プログラム領域202は、「0x004000」番地から「0x007FFF」番地までとする。
The
共通プログラム領域203は、「0x008000」番地から「0x009FFF」番地までとする。
The
PE1用データ領域204は、「0x100000」番地から「0x13FFFF」番地までとする。
The
PE2用データ領域205は、「0x200000」番地から「0x23FFFF」番地までとする。
The
共有データ領域206は、「0x300000」番地から「0x33FFFF」番地までとする。
The shared
[アクセス方法を選択するコード生成処理]
図6を参照して、従来のようにアクセス方法を選択するコード生成処理について説明する。
[Code generation process to select access method]
With reference to FIG. 6, a code generation process for selecting an access method as in the prior art will be described.
(1)ステップS101
読み込み部101は、原始プログラムを読み込む。
(1) Step S101
The
(2)ステップS102
字句解析部102は、原始プログラムの字句解析を行う。
(2) Step S102
The
(3)ステップS103
構文解析部103は、原始プログラムの構文解析を行う。
(3) Step S103
The
(4)ステップS104
変数アクセス解析部104は、構文解析結果を基に、変数のアクセス解析を行い、変数の参照元と参照回数の解析情報を取得する。
(4) Step S104
The variable
(5)ステップS105
変数配置部105は、上記の解析情報を基に、変数の配置を行う。
(5) Step S105
The
(6)ステップS106
中間語作成部106は、変数の配置が行われた後、中間言語で、原始プログラムの中間コードを作成する。
(6) Step S106
After the variables are arranged, the intermediate
(7)ステップS107
最適化部107は、中間コードの最適化を行う。
(7) Step S107
The
(8)ステップS108
コード生成部108は、最適化された中間コードに基づいてコード生成を行う際に、共通プログラムであるか否かを判断する。なお、共通プログラムとは、コア間で共有する共通領域のプログラム(共通プログラム領域に格納されたプログラム)である。共通プログラムは、いずれのコアからも実行可能である。ここでは、共通プログラムは、共通プログラム領域に格納されるものとする。
(8) Step S108
The
(9)ステップS109
コード生成部108は、共通プログラムである場合、変数のアクセス方法を絶対アドレス参照に決定する。
(9) Step S109
In the case of a common program, the
(10)ステップS110
コード生成部108は、共通プログラムでない場合、変数のアクセス方法をレジスタ相対アクセスに決定する。
(10) Step S110
If the
(11)ステップS111
コード生成部108は、決定した変数のアクセス方法に従ってコードの生成を行い、目的プログラムが完成すると、処理を終了する。
(11) Step S111
The
[全ての領域に対してレジスタ相対アクセスを使用するコード生成処理]
図7を参照して、全ての領域に対してレジスタ相対アクセスを使用するコード生成処理について説明する。
[Code generation process using register relative access for all areas]
With reference to FIG. 7, a code generation process using register relative access to all areas will be described.
(1)ステップS201
読み込み部101は、原始プログラムを読み込む。
(1) Step S201
The
(2)ステップS202
字句解析部102は、原始プログラムの字句解析を行う。
(2) Step S202
The
(3)ステップS203
構文解析部103は、原始プログラムの構文解析を行う。
(3) Step S203
The
(4)ステップS204
変数アクセス解析部104は、構文解析結果を基に、変数のアクセス解析を行い、変数の参照元と参照回数の解析情報を取得する。
(4) Step S204
The variable
(5)ステップS205
変数配置部105は、上記の解析情報を基に、変数の配置を行う。
(5) Step S205
The
(6)ステップS206
中間語作成部106は、変数の配置が行われた後、中間言語で、原始プログラムの中間コードを作成する。
(6) Step S206
After the variables are arranged, the intermediate
(7)ステップS207
最適化部107は、中間コードの最適化を行う。
(7) Step S207
The
(8)ステップS208
コード生成部108は、最適化された中間コードに基づいてコード生成を行う際に、コア間で共有する共通プログラムであるか否かを判断する。ここでは、共通プログラムの場合はステップS209に進み、共通プログラム以外の場合はステップS213に進む。
(8) Step S208
When generating code based on the optimized intermediate code, the
(9)ステップS209
コード生成部108は、共通プログラムである場合、共通データ領域の先頭アドレスをデータとして保持するシンボルを生成する。
(9) Step S209
In the case of a common program, the
(10)ステップS210
コード生成部108は、共通プログラム領域203に配置された関数の先頭アドレスに、レジスタ相対アクセス用レジスタの値を退避先(コア毎のデータ領域等)に退避させるコードを追加する。
(10) Step S210
The
(11)ステップS211
コード生成部108は、レジスタ相対アクセス用レジスタの値に、共有データ領域の先頭アドレスをデータとして保持したシンボル(ステップS209で生成されたシンボル)を上書きするコードを追加する。
(11) Step S211
The
(12)ステップS212
コード生成部108は、共通プログラム領域に配置された関数の呼び出し元に分岐する処理の直前に、レジスタ相対アクセス用レジスタの値を退避先から復帰させる(退避させた値に書き戻す)コードを追加する。
(12) Step S212
The
(13)ステップS213
コード生成部108は、上記のコード追加処理が終了した場合、又は共通プログラム以外の場合、レジスタ相対アクセスのコードを生成する。コード生成部108は、全ての中間コードをコードとして生成し、目的プログラムが完成すると、処理を終了する。
(13) Step S213
The
[全ての領域に対してレジスタ相対アクセスを使用する目的プログラムの実行処理]
図8を参照して、非対称マルチコア・プロセッサが、上記の目的プログラムを実行した際の動作について説明する。
[Execution processing of target program using register relative access to all areas]
With reference to FIG. 8, an operation when the asymmetric multi-core processor executes the above-described target program will be described.
(1)ステップS301
非対称マルチコア・プロセッサは、PE1用プログラム領域201又はPE2用プログラム領域202の処理から、共通プログラム領域203の処理に分岐する。ここでは、非対称マルチコア・プロセッサは、コアの1つであるPE1において、PE1用プログラム領域201の「0x000500」番地に配置されたPE1のメイン関数を実行して、共通プログラム領域203の「0x008500」番地に配置されたサブ関数を呼び出す。
(1) Step S301
The asymmetric multi-core processor branches from processing in the
(2)ステップS302
非対称マルチコア・プロセッサは、サブ関数を実行して、レジスタ相対アクセス用レジスタの値「0x100000」を、退避先であるPE1用データ領域204の「0x10F000」番地に退避させる。これにより、非対称マルチコア・プロセッサは、PE1用データ領域204の「0x10F000」番地において、レジスタ相対アクセス用レジスタの値「0x100000」を保持する。
(2) Step S302
The asymmetric multi-core processor executes the subfunction to save the register relative access register value “0x100000” to the address “0x10F000” in the
(3)ステップS303
非対称マルチコア・プロセッサは、サブ関数を実行して、レジスタ相対アクセス用レジスタの値「0x100000」を、共有データ領域206の先頭アドレス「0x300000」に書き換える(上書きする)。すなわち、非対称マルチコア・プロセッサは、共有データ領域206の先頭アドレス「0x300000」をデータとして保持するシンボルを生成し、レジスタ相対アクセス用レジスタの値に、このシンボル(共有データ領域206の先頭アドレス)を上書きする。
(3) Step S303
The asymmetric multi-core processor executes the subfunction and rewrites (overwrites) the register relative access register value “0x100000” to the start address “0x300000” of the shared
(4)ステップS304
非対称マルチコア・プロセッサは、サブ関数を実行して、共通プログラム領域203の「0x008600」番地の命令のレジスタ相対メモリアクセス命令を実行し、共有データ領域206の「0x300100」番地に配置されたデータにアクセスする。
(4) Step S304
The asymmetric multi-core processor executes the subfunction, executes the register relative memory access instruction of the instruction at address “0x008600” in the
(5)ステップS305
非対称マルチコア・プロセッサは、サブ関数を実行して、退避先であるPE1用データ領域204の「0x10F000」番地に退避させた値「0x100000」を、レジスタ相対アクセス用レジスタの値に書き戻す(上書きする)。これにより、非対称マルチコア・プロセッサは、PE1用データ領域204の「0x10F000」番地において保持していたレジスタ相対アクセス用レジスタの値「0x100000」を復帰させる。
(5) Step S305
The asymmetric multi-core processor executes the subfunction to write back (overwrite) the value “0x100000” saved in the “0x10F000” address of the
(6)ステップS306
非対称マルチコア・プロセッサは、サブ関数を実行して、共通プログラム領域203の「0x008800」番地から、PE1の「0x000504」番地のメイン関数に戻る。
(6) Step S306
The asymmetric multi-core processor executes the subfunction and returns from the address “0x008800” of the
上記のように、共通プログラム領域のプログラム実行時に、レジスタ相対アクセス用レジスタが保持するアドレスを共有データ領域の先頭アドレスに配置できるため、レジスタ相対アクセスにて共有データ領域にアクセスすることができ、共通プログラム領域のプログラム実行時にレジスタ相対アクセスにて共有データ領域にアクセスすることができる効果がある。 As mentioned above, when executing a program in the common program area, the address held by the register relative access register can be placed at the start address of the shared data area, so the shared data area can be accessed by register relative access, There is an effect that the shared data area can be accessed by register relative access when executing the program in the program area.
また、レジスタ相対アクセスを使用することにより、コード数を削減することができ、生成したコードの実行を高速化することができる効果もある。 In addition, by using register relative access, the number of codes can be reduced, and the generated code can be executed more quickly.
<本発明の特徴>
本発明のコンパイラ装置は、非対称型マルチコア・プロセッサ用のコンパイラ装置であって、中間コードからオブジェクトコードを生成する際、共通プログラムか否か判断し、共通プログラムである場合、共通プログラム領域から共有データ領域にレジスタ相対アクセスするコードを生成することを特徴とする。
<Features of the present invention>
The compiler apparatus of the present invention is a compiler apparatus for an asymmetric multi-core processor, and determines whether or not a common program is used when generating object code from intermediate code. A code for register-relative access to an area is generated.
具体的には、本発明のコンパイラ装置は、非対称型マルチコア・プロセッサ向けコンパイラ装置であって、コア毎のデータ領域とコア間で共有する共有データ領域等の複数のデータ領域がある場合に、共有データ領域の先頭アドレスをデータとして保持するシンボルを生成する手段と、共通プログラム領域の関数の先頭アドレスに、レジスタ相対アクセス用レジスタの値を、退避先(コア毎のデータ領域等)に退避させるコードを追加し、レジスタ相対アクセス用レジスタの値に、生成されたシンボル(共有データ領域の先頭アドレス)を上書きするコードを追加する手段と、共通プログラムの関数呼び出し元に分岐する処理の直前に、レジスタ相対アクセス用レジスタの値に、退避先に退避させた値を書き戻す(上書きする)コードを追加する手段とを具備する。 Specifically, the compiler apparatus of the present invention is a compiler apparatus for an asymmetric multi-core processor, and is shared when there are a plurality of data areas such as a data area for each core and a shared data area shared between the cores. A means for generating a symbol that holds the start address of the data area as data, and a code for saving the value of the register relative access register to the save destination (data area for each core, etc.) at the start address of the function in the common program area To add a code that overwrites the generated symbol (the start address of the shared data area) to the register relative access register value, and immediately before processing to branch to the function call source of the common program Added code to write back (overwrite) the value saved in the save destination to the relative access register value ; And a that means.
また、本発明のコード生成方法は、非対称型マルチコア・プロセッサ用コンパイラ装置のコード生成方法であって、共有データ領域の先頭アドレスをデータとして保持するシンボルを生成する工程と、共通プログラム領域の関数の先頭アドレスに、レジスタ相対アクセス用レジスタの値を、退避先(コア毎のデータ領域等)に退避させるコードを追加する工程と、レジスタ相対アクセス用レジスタの値に、当該シンボル(共有データ領域の先頭アドレス)を上書きするコードを追加する工程と、共通プログラムの関数呼び出し元に分岐する処理の直前に、レジスタ相対アクセス用レジスタの値に、退避先に退避させた値を書き戻す(上書きする)コードを追加する工程とを有することを特徴とする。 The code generation method of the present invention is a code generation method for a compiler device for an asymmetric multi-core processor, which includes a step of generating a symbol that holds the start address of a shared data area as data, and a function of a common program area. Adding a code that saves the register-relative access register value to the save address (data area for each core, etc.) at the start address, and the register-relative access register value to the symbol (the head of the shared data area) Code that overwrites the value saved in the save destination in the register relative access register value immediately before the process of adding the code that overwrites the address) and the process that branches to the function call source of the common program And a step of adding.
これにより、全ての領域に対してレジスタ相対アクセスができる。 This allows register relative access to all areas.
以上、本発明の実施形態を詳述してきたが、実際には、上記の実施形態に限られるものではなく、本発明の要旨を逸脱しない範囲の変更があっても本発明に含まれる。 As mentioned above, although embodiment of this invention was explained in full detail, actually, it is not restricted to said embodiment, Even if there is a change of the range which does not deviate from the summary of this invention, it is included in this invention.
1… 構文解析処理部
2… 中間言語レベル最適化部
3… コード生成処理部
4… ソースプログラム格納部
5… 中間言語格納部
6… オブジェクトプログラム格納部
7… ノード変換処理部
8… レジスタ割り付け処理部
9… アドレス割り付け処理部
10… コード出力処理部
11… ノード格納部
12(12−i、i=1〜n)… データ管理情報テーブル
13… データ管理情報テーブル連鎖機構
14… データアクセス回数登録部
15… データ管理情報テーブル連鎖並べ替え処理部
16… データのアドレス割り付け処理部
100… コンパイラ装置
101… 読み込み部
102… 字句解析部
103… 変数アクセス解析部
104… 構文解析部
105… 変数配置部
106… 中間語作成部
107… 最適化部
108… コード生成部
110… 原始プログラム格納部
120… 中間データ格納部
130… 目的プログラム格納部
200… アドレス空間
201… PE1用プログラム領域
202… PE2用プログラム領域
203… 共通プログラム領域
204… PE1用データ領域
205… PE2用データ領域
206… 共有データ領域
DESCRIPTION OF
Claims (5)
原始プログラムの構文解析結果を基に、変数のアクセス解析を行い、変数の参照元及び参照回数の解析情報を取得する手段と、
前記解析情報を基に、変数の配置を行った後、中間言語で中間コードを作成する手段と、
前記中間コードからオブジェクトコードを生成する際、共通プログラムか否か判断し、共通プログラムである場合、共通プログラム領域から共有データ領域にレジスタ相対アクセスするコードを追加する手段と
を具備する
コンパイラ装置。 A compiler device for an asymmetric multi-core processor,
Based on the syntax analysis result of the source program, a means for performing variable access analysis and obtaining analysis information of the variable reference source and the reference count;
Means for creating an intermediate code in an intermediate language after arranging variables based on the analysis information;
A compiler apparatus comprising: means for determining whether or not the object code is a common program when generating the object code from the intermediate code, and in the case of the common program, adding a code for register relative access from the common program area to the shared data area.
コア毎のデータ領域とコア間で共有する共有データ領域との複数のデータ領域がある場合に、前記共有データ領域の先頭アドレスをデータとして保持するシンボルを生成する手段と、
共通プログラム領域の関数の先頭アドレスに、レジスタ相対アクセス用レジスタの値を前記コア毎のデータ領域に退避させるコードを追加する手段と、
前記レジスタ相対アクセス用レジスタの値に、前記シンボルを上書きするコードを追加する手段と、
前記関数の呼び出し元に分岐する処理の直前に、前記レジスタ相対アクセス用レジスタの値を、前記コア毎のデータ領域に退避させた値に書き戻すコードを追加する手段と
を更に具備する
コンパイラ装置。 The compiler apparatus according to claim 1,
Means for generating a symbol that retains the start address of the shared data area as data when there is a plurality of data areas of a data area for each core and a shared data area shared between the cores;
Means for adding a code for saving the value of the register relative access register to the data area for each core at the start address of the function of the common program area;
Means for adding a code for overwriting the symbol to a value of the register relative access register;
A compiler apparatus further comprising means for adding a code for rewriting the value of the register relative access register to the value saved in the data area for each core immediately before the process of branching to the function caller.
原始プログラムの構文解析結果を基に、変数のアクセス解析を行い、変数の参照元及び参照回数の解析情報を取得することと、
前記解析情報を基に、変数の配置を行った後、中間言語で中間コードを作成することと、
前記中間コードからオブジェクトコードを生成する際、共通プログラムか否か判断し、共通プログラムである場合、共通プログラム領域から共有データ領域にレジスタ相対アクセスするコードを追加することと
を含む
コード生成方法。 A code generation method implemented by a compiler device for an asymmetric multi-core processor,
Based on the syntax analysis result of the source program, access analysis of the variable is performed, and analysis information of the variable reference source and the reference count is obtained.
Based on the analysis information, after arranging variables, creating intermediate code in an intermediate language;
A code generation method comprising: determining whether a common program is generated when generating an object code from the intermediate code, and adding a code for register relative access from a common program area to a shared data area if the program is a common program.
コア毎のデータ領域とコア間で共有する共有データ領域との複数のデータ領域がある場合に、前記共有データ領域の先頭アドレスをデータとして保持するシンボルを生成することと、
共通プログラム領域の関数の先頭アドレスに、レジスタ相対アクセス用レジスタの値を前記コア毎のデータ領域に退避させるコードを追加することと、
前記レジスタ相対アクセス用レジスタの値に、前記シンボルを上書きするコードを追加することと、
前記関数の呼び出し元に分岐する処理の直前に、前記レジスタ相対アクセス用レジスタの値を、前記コア毎のデータ領域に退避させた値に書き戻すコードを追加することと
を更に含む
コード生成方法。 The code generation method according to claim 3,
When there are a plurality of data areas including a data area for each core and a shared data area shared between the cores, generating a symbol that holds the start address of the shared data area as data;
Adding a code for saving the value of the register relative access register to the data area for each core at the start address of the function of the common program area;
Adding a code to overwrite the symbol to the register relative access register value;
A code generation method further comprising adding a code for rewriting the value of the register relative access register to a value saved in the data area for each core immediately before the process of branching to the function caller.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010262072A JP2012113518A (en) | 2010-11-25 | 2010-11-25 | Compiler device, code generation method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010262072A JP2012113518A (en) | 2010-11-25 | 2010-11-25 | Compiler device, code generation method and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2012113518A true JP2012113518A (en) | 2012-06-14 |
Family
ID=46497667
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010262072A Withdrawn JP2012113518A (en) | 2010-11-25 | 2010-11-25 | Compiler device, code generation method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2012113518A (en) |
-
2010
- 2010-11-25 JP JP2010262072A patent/JP2012113518A/en not_active Withdrawn
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Lin et al. | ASTRO: Synthesizing application-specific reconfigurable hardware traces to exploit memory-level parallelism | |
TWI691898B (en) | Simulation device, simulation method and storage medium for storing simulation program | |
JP7088897B2 (en) | Data access methods, data access devices, equipment and storage media | |
US8266416B2 (en) | Dynamic reconfiguration supporting method, dynamic reconfiguration supporting apparatus, and dynamic reconfiguration system | |
JP2020500368A (en) | Data prefetching method, apparatus, and system | |
US8949777B2 (en) | Methods and systems for mapping a function pointer to the device code | |
US20080244221A1 (en) | Exposing system topology to the execution environment | |
US20080077930A1 (en) | Workload Partitioning in a Parallel System with Hetergeneous Alignment Constraints | |
Halstead et al. | Compiling irregular applications for reconfigurable systems | |
JP5936135B2 (en) | Information processing apparatus, information processing method, and program | |
JP3863544B1 (en) | Arithmetic processing device and arithmetic processing method | |
JP2012103923A (en) | Compiler device, compiling method and compiler program | |
JP2012113518A (en) | Compiler device, code generation method and program | |
Yuan et al. | Automatic enhanced CDFG generation based on runtime instrumentation | |
JP2010140233A (en) | Emulation system and emulation method | |
JP2017091070A (en) | Executable code generation program and executable code generation device | |
Che et al. | Scheduling of synchronous data flow models onto scratchpad memory-based embedded processors | |
KR102457183B1 (en) | Multi-core simulation system and method based on shared translation block cache | |
JP6217386B2 (en) | Program generation method for multiprocessor | |
JP2020140284A (en) | Vector arithmetic processing device, array variable initialization method by vector arithmetic processing device, and array variable initialization program using vector arithmetic processing device | |
Maccarone et al. | Fuzzy mathematical morphology to analyse astronomical images | |
JP2018151827A (en) | Information processing device, control method for information processing device and control program for information processing device | |
TW201317780A (en) | Method for identifying memory of virtual machine and computer system using the same | |
Yilmazer-Metin | Graph-Waving architecture: Efficient execution of graph applications on GPUs | |
Balasundaram et al. | Reducing Energy Consumption by Code Repositioning for Memory Levels |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20140204 |