JP2010186487A - Compiler apparatus and system therefor - Google Patents

Compiler apparatus and system therefor Download PDF

Info

Publication number
JP2010186487A
JP2010186487A JP2010100372A JP2010100372A JP2010186487A JP 2010186487 A JP2010186487 A JP 2010186487A JP 2010100372 A JP2010100372 A JP 2010100372A JP 2010100372 A JP2010100372 A JP 2010100372A JP 2010186487 A JP2010186487 A JP 2010186487A
Authority
JP
Japan
Prior art keywords
instruction
optimization
machine language
unit
compiler
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2010100372A
Other languages
Japanese (ja)
Inventor
Hajime Ogawa
一 小川
Takehito Heiji
岳人 瓶子
Toshiyuki Sakata
俊幸 坂田
Shuichi Takayama
秀一 高山
Shohei Domoto
昌平 道本
Tomoo Hamada
智雄 濱田
Ryoko Miyaji
涼子 宮地
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 JP2010100372A priority Critical patent/JP2010186487A/en
Publication of JP2010186487A publication Critical patent/JP2010186487A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a highly flexible compiler which allows a user to precisely control optimization by the compiler. <P>SOLUTION: The compiler includes: an analysis part 110 for detecting instructions (option and pragma) from a user to the compiler 100; and an optimization part 120 or the like comprising a processing part (global area allocation part 121, software pipelining part 122, loop unrolling part 123, if conversion part 124 and pair instruction generation part 125) for performing individual optimization processing specified by the option and the pragma by the user. When the instruction on guaranteeing that the number of times of repetition of specified loop processing is a set of values equal to or larger than a certain specified value in a source program is detected, the loop unrolling part 123 performs the optimization processing of suppressing the generation of an escape code to be needed when the number of times of the repetition is zero when the guaranteed set of the values is the set of the values ≥1. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、C言語等の高級言語で記述されたソースプログラムを機械語プログラムに変換するコンパイラに関し、特に、コンパイラによる最適化についての指示に関する。   The present invention relates to a compiler 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 the compiler.

従来のコンパイラは、主に制御処理アプリケーション向けに作られている。制御処理アプリケーションでは、精密な実行性能及びコードサイズのチューニングはそれほど必要とされておらず、むしろ開発工数削減の観点から、ユーザは、「性能優先」、「コードサイズ優先」、あるいは、「性能とコードサイズのバランス」といった大雑把な指示(コンパイル時に指定するオプション等)のみ与えて、その最適化戦略のほとんどをコンパイラに任せている。   Conventional compilers are primarily made for control processing applications. In control processing applications, precise execution performance and code size tuning are not so much required. Rather, from the viewpoint of reducing development man-hours, users can select “performance priority”, “code size priority”, or “performance and Only rough instructions (such as options to be specified at compile time) such as "Balance of code size" are given, and most of the optimization strategy is left to the compiler.

一方、クリティカルな実行性能及びコードサイズが要求されるメディア処理アプリケーションの分野では、アセンブリ言語によるハンドコーディングを行うことにより、要求性能及びコードサイズを実現することを第一目標に開発が行われている。   On the other hand, in the field of media processing applications where critical execution performance and code size are required, development is being conducted with the primary goal of realizing the required performance and code size by performing hand coding in assembly language. .

しかしながら、近年、メディア処理アプリケーションの増大化、多様化により、開発工数が増大し、メディア処理分野においても高級言語によるアプリケーション開発が必要とされるようになってきている。そのために、高級言語によるメディア処理アプリケーション開発を実現する試みが行われている。その際、ユーザは、高級言語開発であっても、より精密なチューニングができることを期待しており、コンパイラが行う最適化戦略を詳細に制御することが必要となる。   However, in recent years, development man-hours have increased due to the increase and diversification of media processing applications, and application development using high-level languages has become necessary in the media processing field. For this reason, attempts are being made to develop media processing applications in high-level languages. At that time, the user expects that fine tuning can be performed even in high-level language development, and it is necessary to control in detail the optimization strategy performed by the compiler.

したがって、従来のような大雑把な指示ではなく、コンパイラによる各種最適化の種類ごとにON/OFFやその程度を指定したり、プログラム中の変数やループ処理等の単位で最適化をON/OFFさせたりする等のきめ細かい制御が必要とされる。   Therefore, it is not a rough instruction as in the past, but ON / OFF and its degree are specified for each type of optimization by the compiler, and optimization is turned on / off in units such as variables and loop processing in the program. It is necessary to have fine-tuned control.

そこで、本発明は、このような状況に鑑みてなされたものであり、コンパイラによる最適化をユーザが緻密に制御することが可能な柔軟性の高いコンパイラ等を提供することを目的とする。   Therefore, the present invention has been made in view of such a situation, and an object thereof is to provide a highly flexible compiler or the like that allows a user to precisely control optimization by the compiler.

上記目的を達成するために、本発明に係るコンパイラは、ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数の最低値を保証することについての指示を検出し、前記最適化手段は、保証した前記最低値が1以上である場合に、繰り返し回数がゼロの場合に必要となるエスケープコードの生成を抑制することを特徴とする。   In order to achieve the above object, a compiler according to the present invention is a compiler device that translates a source program into a machine language program, an instruction acquisition unit that acquires an instruction to optimize a generated machine language program, An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction, and the instruction acquisition unit sets a minimum value of the number of repetitions of a specific loop process in the source program. An instruction for guaranteeing is detected, and the optimization means suppresses generation of an escape code required when the number of iterations is zero when the guaranteed minimum value is 1 or more. To do.

また、本発明に係るコンパイラは、ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数の最低値を保証することについての指示を検出し、前記最適化手段は、保証した前記最低値がループアンローリングによる展開数以上の値である場合に、ループアンローリングによる最適化を行うことを特徴とする。   The compiler according to the present invention is a compiler device that translates a source program into a machine language program, an instruction acquisition unit that acquires an instruction to optimize a generated machine language program, and a machine according to the acquired instruction. Optimization means for performing optimization by generating a word instruction sequence, wherein the instruction acquisition means is an instruction for guaranteeing a minimum number of repetitions of a specific loop process in the source program. And the optimization means performs optimization by loop unrolling when the guaranteed minimum value is equal to or greater than the number of expansions by loop unrolling.

また、本発明に係るコンパイラは、ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数が奇数値あるいは偶数値の集合であることを保証することについての指示を検出し、前記最適化手段は、保証した前記値の集合が、偶数値のみによる集合であるか奇数値のみによる集合であるかに応じてループアンローリングによる最適化を行うことを特徴とする。   The compiler according to the present invention is a compiler device that translates a source program into a machine language program, an instruction acquisition unit that acquires an instruction to optimize a generated machine language program, and a machine according to the acquired instruction. Optimization means for performing optimization by generating a word instruction sequence, wherein the instruction acquisition means is a set of odd values or even values in which the number of repetitions of a specific loop process is set in the source program The optimization means detects an indication of guaranteeing that, and the optimization means optimizes by loop unrolling depending on whether the guaranteed set of values is a set of only even values or a set of only odd values It is characterized by performing.

また、本発明に係るコンパイラは、ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、前記指示取得手段は、前記ソースプログラムの中において、特定の変数名で示されるポインタ変数が指すデータが、あるアライメントの値であることを保証することについての指示を検出し、前記最適化手段は、前記指示取得手段によって検出された指示の対象となったポインタ変数が指すデータについては、保証された前記アライメントの値でメモリ領域に配置されているものとして、前記最適化を施すことを特徴とする。   The compiler according to the present invention is a compiler device that translates a source program into a machine language program, an instruction acquisition unit that acquires an instruction to optimize a generated machine language program, and a machine according to the acquired instruction. And an optimization unit that performs optimization by generating a word instruction sequence, and the instruction acquisition unit includes, in the source program, data indicated by a pointer variable indicated by a specific variable name in a certain alignment. An instruction for guaranteeing that the value is a value is detected, and the optimization unit is configured to guarantee the alignment value for the data indicated by the pointer variable that is the target of the instruction detected by the instruction acquisition unit. The above optimization is performed on the assumption that the data is arranged in the memory area.

なお、本発明は、上記のようなコンパイラ装置として実現することができるだけでなく、このようなコンパイラ装置が備える手段をステップとするプログラムとして実現したり、コンパイラへの指示が含まれたソースプログラムとして実現したり、ターゲットプロセッサとソースプログラムをターゲットプロセッサ向けの機械語プログラムに翻訳するコンパイラ装置とを備えたシステムとして実現することもできる。そして、そのようなプログラムは、CD−ROM等の記録媒体やインターネット等の伝送媒体を介して広く流通させることができるのは言うまでもない。   Note that the present invention can be realized not only as a compiler apparatus as described above, but also as a program having steps as means provided in such a compiler apparatus, or as a source program including instructions to the compiler. It can also be realized as a system including a target processor and a compiler device that translates a source program into a machine language program for the target processor. Needless to say, such a program can be widely distributed via a recording medium such as a CD-ROM or a transmission medium such as the Internet.

具体的には、本発明に係るコンパイラ及びシステムの一形態として、以下の構成を備えてもよい。   Specifically, the following configuration may be provided as one form of the compiler and system according to the present invention.

本発明に係るコンパイラは、変数のグローバル領域への割り付けに関する指示を受け付け、その指示に基づいて、各種変数のグローバル領域へのマッピングを行う。   The compiler according to the present invention receives an instruction regarding the allocation of variables to the global area, and maps various variables to the global area based on the instruction.

その1つとして、ユーザは、コンパイル時のオプションによって、グローバル領域に割り付ける変数の最大データサイズを指定することができる。これによって、ユーザは、グローバル領域に配置させる変数のデータサイズを制御することが可能となり、グローバル領域を有効活用するように最適化を図ることができる。   As one of them, the user can specify the maximum data size of a variable to be allocated to the global area by a compile time option. As a result, the user can control the data size of the variable to be arranged in the global area, and can optimize the global area effectively.

また、ユーザは、ソースプログラム中に置くプラグマ指令によって、変数ごとに、グローバル領域への割り付けをする/しない旨の指定をすることができる。これによって、グローバル領域に優先的に割り付けるべき変数、割り付けてはいけない変数を個々に区別して、最適なグローバル領域の割付けをユーザが管理することができる。   Further, the user can specify whether or not to allocate to the global area for each variable by a pragma command placed in the source program. As a result, the variable that should be preferentially allocated to the global area and the variable that should not be allocated are individually distinguished, and the user can manage the optimal global area allocation.

また、本発明に係るコンパイラは、ソフトウェアパイプライニングの指示を受け付け、その指示に従ったソフトウェアパイプライニングによる最適化を行う。   The compiler according to the present invention receives an instruction for software pipelining, and performs optimization by software pipelining according to the instruction.

その1つとして、ユーザは、コンパイル時のオプションによって、ソフトウェアパイプライニングをしない旨の指定をすることができる。これによって、ソフトウェアパイプライニングによるコードサイズの増加が抑制される。またソフトウェアパイプライニングが行われたアセンブラコードは複雑なので、プログラムの機能検証のために、ソフトウェアパイプライニングを抑制することで、デバッグが容易となる。   As one of them, the user can specify that software pipelining is not performed by a compile-time option. As a result, an increase in code size due to software pipelining is suppressed. Also, since the assembler code subjected to software pipelining is complicated, debugging is facilitated by suppressing software pipelining for the purpose of program function verification.

また、ユーザは、ソースプログラム中のプラグマ指令によって、ループ処理ごとに、ソフトウェアパイプライニングをする/しない旨の指定をしたり、プロログ部及びエピログ部を除去して/除去しないでソフトウェアパイプライニングをする旨の指定をしたりすることができる。これによって、ループ処理ごとにソフトウェアパイプライニングをするか否かを選択したり、コードサイズ重視(プロローグエピローグ除去する)又はスピード重視(プロローグエピローグ除去しない)のソフトウェアパイプライニングを選択したりすることが可能となる。   Further, the user designates whether or not to perform software pipelining for each loop processing by a pragma instruction in the source program, or performs software pipelining without or without removing the prolog portion and the epilog portion. Can be specified. This makes it possible to select whether or not to perform software pipelining for each loop processing, or to select software pipelining that emphasizes code size (removes prologue epilogue) or speed (removes prologue epilogue). It becomes.

また、本発明に係るコンパイラは、ループアンローリングの指示を受け付け、その指示に従ったループアンローリングによる最適化を行う。   The compiler according to the present invention receives an instruction for loop unrolling and performs optimization by loop unrolling according to the instruction.

その1つとして、ユーザは、コンパイル時のオプションによって、ループアンローリングをしない旨の指示をすることができる。これによって、ループアンローリングによるコードサイズの増加が回避される。   As one of them, the user can instruct the loop unrolling not to be performed by an option at the time of compilation. This avoids an increase in code size due to loop unrolling.

また、ユーザは、ソースプログラム中のプラグマ指令によって、ループ処理ごとに、ループアンローリングをする/しない旨の指示をすることができる。これによって、ユーザは、ループ処理ごとに、その繰り返し回数等を勘案し、実行速度を重視するか、コードサイズを重視するかの最適化を選択することができる。   Further, the user can instruct whether or not to perform loop unrolling for each loop process by a pragma command in the source program. As a result, the user can select the optimization for placing importance on the execution speed or the code size in consideration of the number of repetitions for each loop process.

また、本発明に係るコンパイラは、ループ処理の繰り返し回数に関する指示を受け付け、その指示に従った最適化を行う。   The compiler according to the present invention receives an instruction regarding the number of loop processing iterations, and performs optimization in accordance with the instruction.

その1つとして、ユーザは、ソースプログラム中のプラグマ指令によって、ループ処理ごとに、最低の繰り返し回数を保証することができる。これによって、繰り返し回数が0である場合に必要とされるコード(エスケープコード)を生成する必要がなくなるとともに、ソフトウェアパイプライニングやループアンロールによる最適化が可能となる。   As one of them, the user can guarantee the minimum number of repetitions for each loop process by a pragma command in the source program. As a result, it is not necessary to generate a code (escape code) required when the number of repetitions is 0, and optimization by software pipelining or loop unrolling is possible.

また、ユーザは、ソースプログラム中のプラグマ指令によって、ループ処理ごとに、繰り返し回数が偶数回/奇数回であることを保証することができる。これによって、たとえ繰り返し回数が不明であっても、ループ処理ごとに、ループアンロールによる最適化が可能となり、実行速度が向上され得る。   In addition, the user can guarantee that the number of repetitions is an even number / odd number for each loop process by a pragma command in the source program. As a result, even if the number of repetitions is unknown, optimization by loop unrolling is possible for each loop process, and the execution speed can be improved.

また、本発明に係るコンパイラは、if変換に関する指示を受け付け、その指示に従ったif変換による最適化を行う。   In addition, the compiler according to the present invention receives an instruction regarding if conversion and performs optimization by if conversion according to the instruction.

その1つとして、ユーザは、コンパイル時のオプションによって、if変換をしない旨の指示をすることができる。これによって、if構造のthen側とelse側で命令数のバランスが悪い場合に、if変換によって命令数の少ない側の実行が命令数の多い側に制約されてしまうという不具合の発生を防ぐことができる。   As one of them, the user can give an instruction not to perform the if conversion by a compile-time option. As a result, when the number of instructions on the then side and else side of the if structure is imbalanced, the occurrence of a problem that execution on the side with a small number of instructions is restricted to the side with a large number of instructions by if conversion is prevented. it can.

また、ユーザは、ソースプログラム中のプラグマ指令によって、ループ処理ごとに、if変換をする/しない旨の指示をすることができる。これによって、個々のループ処理の特性(then側とelse側それぞれの命令数のバランス、予想される発生頻度のバランス等)を考慮して、より実行速度が向上されると予測される選択(if変換をする/しない)を行うことができる。   Further, the user can instruct whether or not to perform the if conversion for each loop process by a pragma command in the source program. As a result, the selection (if for which the execution speed is expected to be further improved in consideration of the characteristics of each loop processing (the balance of the number of instructions on each of the then side and the else side, the balance of the expected occurrence frequency, etc.)) Conversion / not conversion).

また、本発明に係るコンパイラは、配列データのメモリ領域への配置におけるアライメントに関する指示を受け付け、その指示に従った最適化を行う。   Further, the compiler according to the present invention receives an instruction regarding alignment in arrangement of array data in a memory area, and performs optimization in accordance with the instruction.

その1つとして、ユーザは、コンパイル時のオプションによって、特定の型の配列データについて、バイト数によるアラインを指定することができる。これによって、2つのデータに対するメモリ・レジスタ間の転送を同時に行うペア命令が生成され、実行速度が向上される。   As one of them, the user can specify alignment by the number of bytes for array data of a specific type by a compile-time option. As a result, a pair instruction for simultaneously transferring two data between the memory and the register is generated, and the execution speed is improved.

また、ユーザは、ソースプログラム中のプラグマ指令によって、ポインタ変数が指すデータのアラインを指定することができる。これによって、データごとに、ペア命令が生成されることを可能にすることができ、実行速度が向上される。   Further, the user can specify the alignment of the data pointed to by the pointer variable by a pragma command in the source program. As a result, a pair instruction can be generated for each data, and the execution speed is improved.

以上のように、本発明に係るコンパイラ及びそのシステムにより、ユーザは、従来のような大雑把な指示ではなく、コンパイラによる各種最適化の種類ごとにON/OFFやその程度を指定したり、プログラム中の変数やループ処理等の単位で最適化をON/OFFさせたりする等のきめ細かい制御が可能となり、特に、精密な最適化のチューニングが必要とされるメディア処理のアプリケーション開発に有効であり、その実用的価値は極めて高い。   As described above, the compiler and the system according to the present invention allow the user to specify ON / OFF and the degree of each optimization type by the compiler, rather than the rough instruction as in the past. Detailed control such as turning on / off optimization in units of variable variables and loop processing, etc. is possible, especially effective for media processing application development that requires precise optimization tuning. The practical value is extremely high.

本発明に係るコンパイラの対象となるプロセッサの概略ブロック図である。It is a schematic block diagram of the processor used as the object of the compiler which concerns on this invention. 同プロセッサの算術論理・比較演算器の概略図を示す。A schematic diagram of an arithmetic logic / comparison arithmetic unit of the processor is shown. 同プロセッサのバレルシタの構成を示すブロック図である。It is a block diagram which shows the structure of the barrel cutter of the processor. 同プロセッサの変換器の構成を示すブロック図である。It is a block diagram which shows the structure of the converter of the processor. 同プロセッサの除算器の構成を示すブロック図である。It is a block diagram which shows the structure of the divider of the processor. 同プロセッサの乗算・積和演算器の構成を示すブロック図である。It is a block diagram which shows the structure of the multiplication / product-sum calculator of the processor. 同プロセッサの命令制御部の構成を示すブロック図である。It is a block diagram which shows the structure of the instruction control part of the processor. 同プロセッサの汎用レジスタ(R0〜R31)の構造を示す図である。It is a figure which shows the structure of the general purpose register | resistor (R0-R31) of the processor. 同プロセッサのリンクレジスタ(LR)の構造を示す図である。It is a figure which shows the structure of the link register (LR) of the processor. 同プロセッサの分岐レジスタ(TAR)の構造を示す図である。It is a figure which shows the structure of the branch register (TAR) of the processor. 同プロセッサのプログラム状態レジスタ(PSR)の構造を示す図である。It is a figure which shows the structure of the program status register (PSR) of the processor. 同プロセッサの条件フラグレジスタ(CFR)の構造を示す図である。It is a figure which shows the structure of the condition flag register (CFR) of the processor. 同プロセッサのアキュムレータ(M0,M1)の構造を示す図である。It is a figure which shows the structure of the accumulator (M0, M1) of the processor. 同プロセッサのプログラムカウンタ(PC)の構造を示す図である。It is a figure which shows the structure of the program counter (PC) of the processor. 同プロセッサのPC退避用レジスタ(IPC)の構造を示す図である。It is a figure which shows the structure of the register | resistor for PC saving (IPC) of the processor. 同プロセッサのPSR退避用レジスタ(IPSR)の構造を示す図である。It is a figure which shows the structure of the PSR save register (IPSR) of the processor. 同プロセッサのパイプライン動作を示すタイミング図である。FIG. 10 is a timing chart showing a pipeline operation of the processor. 同プロセッサによる命令実行時の各パイプライン動作を示すタイミング図である。It is a timing chart showing each pipeline operation at the time of instruction execution by the processor. 同プロセッサの並列動作を示す図である。It is a figure which shows the parallel operation | movement of the processor. 同プロセッサが実行する命令のフォーマットを示す図である。It is a figure which shows the format of the command which the processor performs. カテゴリー「ALUadd(加算)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "ALUadd (addition) system". カテゴリー「ALUsub(減算)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "ALUsub (subtraction) system". カテゴリー「ALUlogic(論理演算)系ほか」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to a category "ALUlogic (logic operation) system etc.". カテゴリー「CMP(比較演算)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "CMP (comparison operation) system". カテゴリー「mul(乗算)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "mul (multiplication) system". カテゴリー「mac(積和演算)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "mac (product-sum operation) system". カテゴリー「msu(積差演算)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "msu (product difference operation) system". カテゴリー「MEMld(メモリ読み出し)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "MEMld (memory read) system". カテゴリー「MEMstore(メモリ書き出し)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "MEMstore (memory writing) system". カテゴリー「BRA(分岐)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "BRA (branch) system". カテゴリー「BSasl(算術バレルシフト)系ほか」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "BSasl (arithmetic barrel shift) system etc.". カテゴリー「BSlsr(論理バレルシフト)系ほか」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "BSlsr (logical barrel shift) system etc.". カテゴリー「CNVvaln(算術変換)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "CNVvaln (arithmetic conversion) system". カテゴリー「CNV(一般変換)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "CNV (general conversion) system". カテゴリー「SATvlpk(飽和処理)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to the category "SATvlpk (saturation processing) system". カテゴリー「ETC(その他)系」に属する命令を説明する図である。It is a figure explaining the instruction which belongs to a category "ETC (others) system". 本発明に係るコンパイラの構成を示す機能ブロック図である。It is a functional block diagram which shows the structure of the compiler which concerns on this invention. (a)は、グローバル領域におけるデータ等の配置例、(b)は、グローバル領域以外の領域におけるデータの配置例を示す図である。(A) is an example of arrangement of data in the global area, and (b) is a diagram showing an example of arrangement of data in an area other than the global area. グローバル領域割り付け部の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a global area | region allocation part. グローバル領域割り付け部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a global area | region allocation part. グローバル領域割り付け部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a global area | region allocation part. グローバル領域割り付け部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a global area | region allocation part. ソフトウェアパイプライニング最適化を説明する図である。It is a figure explaining software pipelining optimization. ソフトウェアパイプライニング部の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a software pipelining part. ソフトウェアパイプライニング部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a software pipelining part. ループアンローリング部の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a loop unrolling part. ループアンローリング部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a loop unrolling part. ループアンローリング部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a loop unrolling part. ループアンローリング部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a loop unrolling part. ループアンローリング最適化が適用できない例を示す図である。It is a figure which shows the example which cannot apply loop unrolling optimization. ループアンローリング部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a loop unrolling part. if変換部の動作を示すフローチャートである。It is a flowchart which shows operation | movement of an if conversion part. if変換部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by an if conversion part. ペア命令生成部の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a pair instruction generation part. ペア命令生成部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a pair instruction generation part. ペア命令生成部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a pair instruction generation part. ペア命令生成部による最適化の具体例を示す図である。It is a figure which shows the specific example of the optimization by a pair instruction generation part.

以下、本発明に係るコンパイラの実施の形態について図面を用いて詳細に説明する。
本実施の形態におけるコンパイラは、C言語等の高級言語で記述されたソースプログラムを特定のプロセッサが実行できる機械語プログラムに翻訳するクロスコンパイラであり、生成する機械語プログラムのコードサイズや実行時間に関する最適化の指示をきめ細かく指定することができるという特徴を有する。
Hereinafter, embodiments of a compiler according to the present invention will be described in detail with reference to the drawings.
The compiler in the present embodiment is a cross compiler that translates a source program written in a high-level language such as C language into a machine language program that can be executed by a specific processor, and relates to the code size and execution time of the machine language program to be generated. It has a feature that an instruction for optimization can be specified in detail.

まず、本実施の形態におけるコンパイラの対象となるプロセッサの一例について、図1〜図36を用いて説明する。   First, an example of a processor that is a target of a compiler in this embodiment will be described with reference to FIGS.

本実施の形態におけるコンパイラの対象となるプロセッサは、例えば、通常のマイコンに比べて実行可能な命令の並列性が高く、AVメディア系信号処理技術分野をターゲットとして開発された汎用プロセッサである。   The processor that is the target of the compiler in the present embodiment is, for example, a general-purpose processor that has higher parallelism of instructions that can be executed than a normal microcomputer and has been developed targeting the AV media signal processing technology field.

図1は、そのようなプロセッサの概略ブロック図の一例である。このプロセッサ1は、命令制御部10、デコード部20、レジスタファイル30、演算部40、I/F部50、命令メモリ部60、データメモリ部70、拡張レジスタ部80及びI/Oインターフェース部90から構成される。演算部40は、SIMD型命令の演算を実行する算術論理・比較演算器41〜43、乗算・積和演算器44、バレルシフタ45、除算器46及び変換器47からなる。乗算・積和演算器44は、ビット精度を落とさないように、最長で65ビットで累算する。また、乗算・積和演算器44は、算術論理・比較演算器41〜43と同様、SIMD型命令の実行が可能である。更に、このプロセッサ1は、算術論理・比較演算命令が最大3並列実行可能である。   FIG. 1 is an example of a schematic block diagram of such a processor. The processor 1 includes an instruction control unit 10, a decoding unit 20, a register file 30, an operation unit 40, an I / F unit 50, an instruction memory unit 60, a data memory unit 70, an expansion register unit 80, and an I / O interface unit 90. Composed. The arithmetic unit 40 includes arithmetic logic / comparison arithmetic units 41 to 43 for executing arithmetic operations of SIMD type instructions, a multiplication / product-sum arithmetic unit 44, a barrel shifter 45, a divider 46 and a converter 47. The multiplication / product-sum calculator 44 accumulates up to 65 bits so as not to degrade the bit precision. Further, the multiplication / product-sum operation unit 44 can execute SIMD type instructions similarly to the arithmetic logic / comparison operation units 41 to 43. Further, the processor 1 can execute a maximum of three arithmetic logic / comparison operation instructions in parallel.

図2は、算術論理・比較演算器41〜43の概略図を示す。算術論理・比較演算器41〜43それぞれは、ALU部41a、飽和処理部41b及びフラグ部41cから構成される。ALU部41aは、算術演算器、論理演算器、比較器、TST器からなる。対応する演算データのビット幅は、8ビット(演算器を4並列で使用)、16ビット(演算器を2並列で使用)、32ビットである(全演算器で32ビットデータ処理)。更に算術演算結果に対しては、フラグ部41c等により、オーバーフローの検出とコンディションフラグの生成が行われる。各演算器、比較器、TST器の結果は、算術右シフト、飽和処理部41bによる飽和、最大・最小値検出、絶対値生成処理が行われる。   FIG. 2 shows a schematic diagram of the arithmetic logic / comparison arithmetic units 41-43. Each of the arithmetic logic / comparison arithmetic units 41 to 43 includes an ALU unit 41a, a saturation processing unit 41b, and a flag unit 41c. The ALU unit 41a includes an arithmetic operation unit, a logical operation unit, a comparator, and a TST unit. The corresponding arithmetic data has a bit width of 8 bits (4 arithmetic units are used in parallel), 16 bits (2 arithmetic units are used in parallel), and 32 bits (32-bit data processing in all arithmetic units). Further, for the arithmetic operation result, overflow detection and condition flag generation are performed by the flag unit 41c and the like. The arithmetic unit, the comparator, and the TST unit are subjected to arithmetic right shift, saturation by the saturation processing unit 41b, maximum / minimum value detection, and absolute value generation processing.

図3は、バレルシフタ45の構成を示すブロック図である。バレルシフタ45は、セレクタ45a、45b、上位バレルシフタ45c、下位バレルシフタ45d及び飽和処理部45eから構成され、データの算術シフト(2の補数体系のシフト)または、論理シフト(符号なしシフト)を実行する。通常は、32ビットもしくは、64ビットのデータを入出力としている。レジスタ30a、30bに格納された被シフトデータに対して、別のレジスタまたは即値でシフト量が指定される。データは、左63ビット〜右63ビットの算術または論理シフトが行われ、入力ビット長で出力される。   FIG. 3 is a block diagram showing the configuration of the barrel shifter 45. The barrel shifter 45 includes selectors 45a and 45b, an upper barrel shifter 45c, a lower barrel shifter 45d, and a saturation processing unit 45e, and executes an arithmetic shift (shift of 2's complement system) or logical shift (unsigned shift) of data. Normally, 32-bit or 64-bit data is input / output. For the data to be shifted stored in the registers 30a and 30b, the shift amount is designated by another register or an immediate value. The data is arithmetically or logically shifted from the left 63 bits to the right 63 bits and output with an input bit length.

また、バレルシフタ45は、SIMD型命令に対して、8、16、32、64ビットのデータをシフトすることができる。例えば、8ビットデータのシフトを4並列で処理することができる。   In addition, the barrel shifter 45 can shift 8, 16, 32, and 64-bit data with respect to the SIMD type instruction. For example, a shift of 8-bit data can be processed in 4 parallel.

算術シフトは、2の補数体系のシフトであり、加算や減算時の小数点の位置合わせや、2のべき乗の乗算(2、2の2乗、2の(−1)乗、2の(−2)乗倍など)等のために行われる。   Arithmetic shift is a shift of 2's complement system, and alignment of decimal point at the time of addition or subtraction, multiplication by power of 2 (2, 2 squared, 2 (-1) power, 2 (-2) Etc.) etc.

図4は、変換器47の構成を示すブロック図である。変換器47は、飽和ブロック(SAT)47a、BSEQブロック47b、MSKGENブロック47c、VSUMBブロック47、BCNTブロック47e及びILブロック47fから構成される。   FIG. 4 is a block diagram showing the configuration of the converter 47. The converter 47 includes a saturation block (SAT) 47a, a BSEQ block 47b, an MSKGEN block 47c, a VSUMB block 47, a BCNT block 47e, and an IL block 47f.

飽和ブロック(SAT)47aは、入力データに対する飽和処理を行う。32ビットデータを飽和処理するブロックを2つ持つことにより、2並列のSIMD型命令をサポートする。   The saturation block (SAT) 47a performs saturation processing on the input data. By having two blocks that saturate 32-bit data, two parallel SIMD instructions are supported.

BSEQブロック47bは、MSBから連続する0か1をカウントする。
MSKGENブロック47cは、指定されたビット区間を1、それ以外を0として出力する。
The BSEQ block 47b counts consecutive 0s or 1s from the MSB.
The MSKGEN block 47c outputs the designated bit interval as 1, and outputs the other as 0.

VSUMBブロック47dは、入力データを指定されたビット幅に区切り、その総和を出力する。   The VSUMB block 47d divides input data into designated bit widths and outputs the sum.

BCNTブロック47eは、入力データで1となっているビットの数をカウントする。
ILブロック47fは、入力データを指定されたビット幅に区切り、各データブロックを入れ換えた値を出力する。
The BCNT block 47e counts the number of bits that are 1 in the input data.
The IL block 47f divides the input data into a designated bit width and outputs a value obtained by replacing each data block.

図5は、除算器46の構成を示すブロック図である。除算器46は、被除数を64ビット、除数を32ビットとし、商と剰余を32ビットずつ出力する。商と剰余を求めるまでに34サイクルを必要とする。符号付き、符号なし、両方のデータを扱うことが可能である。ただし、被除数と除数において符号の有無の設定は共通とする。その他、オーバーフローフラグ、0除算フラグを出力する機能を有する。   FIG. 5 is a block diagram showing a configuration of the divider 46. The divider 46 sets the dividend to 64 bits and the divisor to 32 bits, and outputs the quotient and the remainder each 32 bits. 34 cycles are required to find the quotient and the remainder. Both signed and unsigned data can be handled. However, the setting of the presence / absence of a sign is common to the dividend and the divisor. In addition, it has a function of outputting an overflow flag and a division by zero flag.

図6は、乗算・積和演算器44の構成を示すブロック図である。乗算・積和演算器44は、2つの32ビット乗算器(MUL)44a、44b、3つの64ビット加算器(Adder)44c〜44e、セレクタ44f及び飽和処理部(Saturation)44gから構成され、以下の乗算、積和演算を行う。   FIG. 6 is a block diagram showing a configuration of the multiplication / product-sum calculator 44. The multiplier / product-sum calculator 44 includes two 32-bit multipliers (MUL) 44a and 44b, three 64-bit adders (Adder) 44c to 44e, a selector 44f, and a saturation processing unit (Saturation) 44g. Multiply and multiply and accumulate.

・32×32ビットのsignedの乗算、積和、積差演算
・32×32ビットのunsignedの乗算
・16×16ビットの2並列のsignedの乗算、積和、積差演算
・32×16ビットの2並列のsignedの乗算、積和、積差演算
32 × 32 bit signed multiplication, product sum, product difference operation 32 × 32 bit unsigned multiplication 16 × 16 bit 2-parallel signed multiplication, product sum, product difference operation 32 × 16 bit 2 parallel signed multiplication, product sum, product difference operation

これらの演算を整数、固定小数点フォーマット(h1、h2、w1、w2)のデータに対して行う。また、これらの演算に対し、丸め、飽和を行う。   These operations are performed on data in integer and fixed-point format (h1, h2, w1, w2). Also, rounding and saturation are performed for these operations.

図7は、命令制御部10の構成を示すブロック図である。命令制御部10は、命令キャッシュ10a、アドレス管理部10b、命令バッファ10c〜10e、ジャンプバッファ10f及びローテーション部(rotation)10gから構成され、通常時及び分岐時の命令供給を行う。128ビットの命令バッファを3つ(命令バッファ10c〜10e)持つことにより、最大並列実行数に対応している。分岐処理に関しては、分岐実行前に、ジャンプバッファ10f等を介して、後述するTARレジスタに予め分岐先アドレスを格納する(settar命令)。TARレジスタに格納された分岐先アドレスを使用して、分岐を行う。   FIG. 7 is a block diagram illustrating a configuration of the instruction control unit 10. The instruction control unit 10 includes an instruction cache 10a, an address management unit 10b, instruction buffers 10c to 10e, a jump buffer 10f, and a rotation unit (rotation) 10g, and supplies instructions at normal time and branch time. By having three 128-bit instruction buffers (instruction buffers 10c to 10e), the maximum number of parallel executions is supported. Regarding branch processing, a branch destination address is stored in advance in a TAR register, which will be described later, via the jump buffer 10f or the like before branch execution (settar instruction). Branch is performed using the branch destination address stored in the TAR register.

なお、本実施の形態におけるコンパイラの対象となるプロセッサ1は、例えば、VLIWアーキテクチャを持つプロセッサである。ここで、VLIWアーキテクチャとは、1つの命令語中に複数の命令(ロード、ストア、演算、分岐など)を格納し、それらを全て同時に実行するアーキテクチャである。プログラマは、並列実行可能な命令を1つの発行グループとして記述することによって、その発行グループを並列処理させることができる。本明細書では、発行グループの区切りを";;"で示す。以下に表記例を示す。   The processor 1 that is the target of the compiler in the present embodiment is, for example, a processor having a VLIW architecture. Here, the VLIW architecture is an architecture that stores a plurality of instructions (load, store, operation, branch, etc.) in one instruction word and executes them all at the same time. The programmer can process the issue groups in parallel by describing instructions that can be executed in parallel as one issue group. In this specification, the issue group delimiters are indicated by ";;". A notation example is shown below.

(例1)
mov r1, 0x23;;
この命令記述は、命令movのみを実行することを意味する。
(Example 1)
mov r1, 0x23 ;;
This instruction description means that only the instruction mov is executed.

(例2)
mov r1, 0x38
add r0, r1, r2
sub r3, r1, r2;;
これらの命令記述は、命令mov、add、subを3並列で実行することを意味する。
(Example 2)
mov r1, 0x38
add r0, r1, r2
sub r3, r1, r2 ;;
These instruction descriptions mean that instructions mov, add, and sub are executed in parallel.

命令制御部10は、発行グループを識別し、デコード部20に送る。デコード部20では、発行グループの命令を解析し、必要な資源を制御する。   The instruction control unit 10 identifies the issue group and sends it to the decoding unit 20. The decoding unit 20 analyzes the instruction of the issuing group and controls necessary resources.

次に、このようなプロセッサ1が備えるレジスタについて説明する。
プロセッサ1のレジスタセットは、以下の表1に示される通りである。
Next, a register included in such a processor 1 will be described.
The register set of the processor 1 is as shown in Table 1 below.

Figure 2010186487
Figure 2010186487

また、このようなプロセッサ1のフラグセット(後述する条件フラグレジスタ等で管理されるフラグ)は、以下の表2に示される通りである。   The flag set of the processor 1 (flags managed by a condition flag register or the like described later) is as shown in Table 2 below.

Figure 2010186487
Figure 2010186487

図8は、汎用レジスタ(R0〜R31)30aの構造を示す図である。汎用レジスタ(R0〜R31)30aは、実行対象となっているタスクのコンテキストの一部を構成し、データまたはアドレスを格納する32ビットのレジスタ群である。なお、汎用レジスタR30およびR31は、それぞれグローバルポインタ、スタックポインタとして、ハードウェアが使用する。   FIG. 8 is a diagram illustrating the structure of the general-purpose registers (R0 to R31) 30a. The general-purpose registers (R0 to R31) 30a constitute a part of the context of the task to be executed and are a 32-bit register group for storing data or addresses. The general-purpose registers R30 and R31 are used by hardware as a global pointer and a stack pointer, respectively.

図9は、リンクレジスタ(LR)30cの構造を示す図である。なお、このリンクレジスタ(LR)30cと関連して、このプロセッサ1は、図示されていない退避レジスタ(SVR)も備える。リンクレジスタ(LR)30cは、関数コール時のリターンアドレスを格納する32ビットのレジスタである。なお、退避レジスタ(SVR)は、関数コール時の条件フラグレジスタのコンディションフラグ(CFR.CF)を退避する16ビットのレジスタである。リンクレジスタ(LR)30cは、後述する分岐レジスタ(TAR)と同様に、ループ高速化にも使用される。下位1ビットは常に0が読み出されるが、書き込み時には0を書き込む必要がある。   FIG. 9 is a diagram illustrating the structure of the link register (LR) 30c. In connection with the link register (LR) 30c, the processor 1 also includes a save register (SVR) not shown. The link register (LR) 30c is a 32-bit register that stores a return address at the time of a function call. The save register (SVR) is a 16-bit register that saves the condition flag (CFR.CF) of the condition flag register at the time of function call. The link register (LR) 30c is also used for increasing the loop speed, similarly to a branch register (TAR) described later. The lower 1 bit is always read as 0, but 0 must be written when writing.

例えば、call(brl, jmpl)命令を実行した場合には、このプロセッサ1は、リンクレジ
スタ(LR)30cに戻りアドレスを退避し、退避レジスタ(SVR)にコンディションフラグ(CFR.CF)を退避する。また、jmp命令を実行した場合には、リンクレジスタ(LR)30cから戻りアドレス(分岐先アドレス)を取り出し、プログラムカウンタ(PC)を復帰させる。さらに、ret(jmpr)命令を実行した場合には、リンクレジスタ(LR)30cから分岐先アドレス(戻りアドレス)を取り出し、プログラムカウンタ(PC)に格納(復帰)する。さらに、退避レジスタ(SVR)からコンディションフラグを取り出し、条件フラグレジスタ(CFR)32のコンディションンフラグ領域CFR.CFに格納(復帰)する。
For example, when a call (brl, jmpl) instruction is executed, the processor 1 returns the address to the link register (LR) 30c and saves the condition flag (CFR.CF) to the save register (SVR). . When the jmp instruction is executed, the return address (branch destination address) is extracted from the link register (LR) 30c, and the program counter (PC) is restored. Further, when the ret (jmpr) instruction is executed, the branch destination address (return address) is extracted from the link register (LR) 30c and stored (returned) in the program counter (PC). Further, the condition flag is extracted from the save register (SVR) and stored (returned) in the condition flag area CFR.CF of the condition flag register (CFR) 32.

図10は、分岐レジスタ(TAR)30dの構造を示す図である。分岐レジスタ(TAR)30dは、分岐ターゲットアドレスを格納する32ビットのレジスタである。主に、ループの高速化に用いられる。下位1ビットは常に0が読み出されるが、書き込み時には0を書き込む必要がある。   FIG. 10 is a diagram showing the structure of the branch register (TAR) 30d. The branch register (TAR) 30d is a 32-bit register that stores a branch target address. Mainly used to speed up loops. The lower 1 bit is always read as 0, but 0 must be written when writing.

例えば、jmp, jloop命令を実行した場合には、プロセッサ1は、分岐レジスタ(TAR)30dから分岐先アドレスを取り出し、プログラムカウンタ(PC)に格納する。分岐レジスタ(TAR)30dに格納されたアドレスの命令が分岐用命令バッファに格納されている場合は、分岐ペナルティが0になる。分岐レジスタ(TAR)30dにループの先頭アドレスを格納しておくことでループを高速化することができる。   For example, when a jmp, jloop instruction is executed, the processor 1 extracts the branch destination address from the branch register (TAR) 30d and stores it in the program counter (PC). When the instruction at the address stored in the branch register (TAR) 30d is stored in the branch instruction buffer, the branch penalty is zero. By storing the top address of the loop in the branch register (TAR) 30d, the speed of the loop can be increased.

図11は、プログラム状態レジスタ(PSR)31の構造を示す図である。プログラム状態レジスタ(PSR)31は、実行対象となっているタスクのコンテキストの一部を構成し、以下に示されるプロセッサ状態情報を格納する32ビットのレジスタである。   FIG. 11 is a diagram showing the structure of the program status register (PSR) 31. The program status register (PSR) 31 is a 32-bit register that constitutes a part of the context of the task to be executed and stores the processor status information shown below.

ビットSWE:VMP(Virtual Multi-Processor)のLP(Logical Processor)切替えイネーブルを示す。「0」はLP切替え不許可を示し、「1」はLP切替え許可を示す。   Bit SWE: indicates an LP (Logical Processor) switching enable of VMP (Virtual Multi-Processor). “0” indicates that LP switching is not permitted, and “1” indicates that LP switching is permitted.

ビットFXP:固定小数点モードを示す。「0」はモード0を示し、「1」はモード1を示す。   Bit FXP: indicates a fixed point mode. “0” indicates mode 0, and “1” indicates mode 1.

ビットIH:割込み処理フラグであり、マスカブル割込み処理中であることを示す。「1」は割込み処理中であることを示し、「0」は割込み処理中でないことを示す。割込みが発生すると自動的にセットされる。rti命令で割込みから復帰したところが、他の割込み処理中かプログラム処理中であるのかを見分けるために使用される。   Bit IH: This is an interrupt processing flag and indicates that maskable interrupt processing is in progress. “1” indicates that interrupt processing is in progress, and “0” indicates that interrupt processing is not in progress. Set automatically when an interrupt occurs. It is used to determine whether the place where the rti instruction has returned from the interrupt is processing another interrupt or program.

ビットEH:エラーまたはNMIを処理中であることを示すフラグである。「0」はエラー/NMI割込み処理中でないことを示し、「1」はエラー/NMI割込み処理中であることを示す。EH=1のとき、非同期エラーまたはNMIが発生した場合は、マスクされる。また、VMPイネーブル時はVMPのプレート切り替えがマスクされる。   Bit EH: a flag indicating that an error or NMI is being processed. “0” indicates that an error / NMI interrupt is not being processed, and “1” indicates that an error / NMI interrupt is being processed. When EH = 1, if an asynchronous error or NMI occurs, it is masked. When VMP is enabled, VMP plate switching is masked.

ビットPL[1:0]:特権レベルを示す。「00」は特権レベル0、つまり、プロセッサアブストラクションレベルを示し、「01」は特権レベル1(設定できない)を示し、「10」は特権レベル2、つまり、システムプログラムレベルを示し、「11」は特権レベル3、つまり、ユーザプログラムレベルを示す。   Bit PL [1: 0]: indicates a privilege level. “00” indicates privilege level 0, that is, processor abstraction level, “01” indicates privilege level 1 (cannot be set), “10” indicates privilege level 2, that is, system program level, and “11” indicates Indicates privilege level 3, that is, the user program level.

ビットLPIE3:LP固有割込み3イネーブルを示す。「1」は割込み許可を示し、「0」は割込み不許可を示す。   Bit LPIE3: indicates LP specific interrupt 3 enable. “1” indicates interrupt permission, and “0” indicates interrupt disapproval.

ビットLPIE2:LP固有割込み2イネーブルを示す。「1」は割込み許可を示し、「0」は割込み不許可を示す。   Bit LPIE2: indicates LP specific interrupt 2 enable. “1” indicates interrupt permission, and “0” indicates interrupt disapproval.

ビットLPIE1:LP固有割込み1イネーブルを示す。「1」は割込み許可を示し、「0」は割込み不許可を示す。   Bit LPIE1: Indicates LP specific interrupt 1 enable. “1” indicates interrupt permission, and “0” indicates interrupt disapproval.

ビットLPIE0:LP固有割込み0イネーブルを示す。「1」は割込み許可を示し、「0」は割込み不許可を示す。   Bit LPIE0: indicates LP specific interrupt 0 enable. “1” indicates interrupt permission, and “0” indicates interrupt disapproval.

ビットAEE:ミスアライメント例外イネーブルを示す。「1」はミスアライメント例外許可を示し、「0」はミスアライメント例外不許可を示す。   Bit AEE: indicates misalignment exception enable. “1” indicates that misalignment exception is permitted, and “0” indicates that misalignment exception is not permitted.

ビットIE:レベル割込みイネーブルを示す。「1」はレベル割込み許可を示し、「0」はレベル割込み不許可を示す。   Bit IE indicates level interrupt enable. “1” indicates that a level interrupt is permitted, and “0” indicates that a level interrupt is not permitted.

ビットIM[7:0]:割込みマスクを示す。レベル0〜7まで定義され、個々のレベルでマスクすることができる。レベル0が最も高いレベルとなる。IMによりマスクされていない割込み要求のうち最も高いレベルを持った割込み要求のみがプロセッサ1に受理される。割込み要求を受理すると受理したレベル以下のレベルはハードウェアで自動的にマスクされる。IM[0]はレベル0のマスクであり、IM[1]はレベル1のマスクであり、IM[2]はレベル2のマスクであり、IM[3]はレベル3のマスクであり、IM[4]はレベル4のマスクであり、IM[5]はレベル5のマスクであり、IM[6]はレベル6のマスクであり、IM[7]はレベル7のマスクである。   Bit IM [7: 0]: indicates an interrupt mask. Levels 0-7 are defined and can be masked at individual levels. Level 0 is the highest level. Only the interrupt request having the highest level among the interrupt requests not masked by the IM is accepted by the processor 1. When an interrupt request is accepted, the level below the accepted level is automatically masked by hardware. IM [0] is a level 0 mask, IM [1] is a level 1 mask, IM [2] is a level 2 mask, IM [3] is a level 3 mask, and IM [ 4] is a level 4 mask, IM [5] is a level 5 mask, IM [6] is a level 6 mask, and IM [7] is a level 7 mask.

reserved:予約ビットを示す。常に0が読み出される。書き込む時は0を書き込む必要がある。   reserved: Indicates a reserved bit. 0 is always read. When writing, it is necessary to write 0.

図12は、条件フラグレジスタ(CFR)32の構造を示す図である。条件フラグレジスタ(CFR)32は、実行対象となっているタスクのコンテキストの一部を構成する32ビットのレジスタであり、コンディションフラグ(条件フラグ)、オペレーションフラグ(演算フラグ)、ベクタコンディションフラグ(ベクタ条件フラグ)、演算命令用ビット位置指定フィールド、SIMDデータアライン情報フィールドから構成される。   FIG. 12 is a diagram showing the structure of the condition flag register (CFR) 32. The condition flag register (CFR) 32 is a 32-bit register that constitutes a part of the context of the task to be executed, and includes a condition flag (condition flag), an operation flag (operation flag), and a vector condition flag (vector). Condition flag), a bit position designation field for operation instructions, and a SIMD data alignment information field.

ビットALN[1:0]:アラインモードを示す。valnvc命令のアラインモードを設定する。   Bit ALN [1: 0]: indicates an alignment mode. Sets the alignment mode of the valnvc instruction.

ビットBPO[4:0]:ビットポジションを示す。ビット位置指定の必要な命令で使用する。   Bit BPO [4: 0]: indicates a bit position. Used in instructions that require bit position specification.

ビットVC0〜VC3:ベクタ条件フラグである。LSB側のバイトあるいはハーフワードから順にVC0に対応し、MSB側がVC3に対応する。   Bits VC0 to VC3: Vector condition flags. The LSB side byte or halfword sequentially corresponds to VC0, and the MSB side corresponds to VC3.

ビットOVS:オーバーフローフラグ(サマリー)である。飽和発生やオーバーフロー検出でセットされる。検出されなかった場合は、命令実行前の値を保持する。クリアはソフトで行う必要がある。   Bit OVS: an overflow flag (summary). Set when saturation occurs or overflow is detected. If not detected, the value before instruction execution is held. Clearing must be done by software.

ビットCAS:キャリーフラグ(サマリー)である。addc命令でキャリーまたはsubc命令でボローが発生した場合セットされる。addc命令でキャリーもしくはsubc命令でボローが発生しなかった場合は、命令実行前の値を保持する。クリアはソフトで行う必要がある。   Bit CAS: carry flag (summary). Set when a carry occurs with the addc instruction or a borrow occurs with the subc instruction. If no carry occurs with the addc instruction or a borrow does not occur with the subc instruction, the value before the instruction execution is retained. Clearing must be done by software.

ビットC0〜C7:コンディションフラグである。条件付き実行命令における条件(TRUE/FALSE)を示す。条件付き命令の条件とビットC0〜C7との対応は、命令に含まれるプレディケート・ビットによって決定される。なお、フラグC7は常に値が1である。フラグC7へのFALSE条件の反映(0書き込み)は無視される。   Bits C0 to C7: Condition flags. A condition (TRUE / FALSE) in a conditional execution instruction is shown. The correspondence between the condition of the conditional instruction and the bits C0 to C7 is determined by the predicate bit included in the instruction. Note that the value of the flag C7 is always 1. Reflecting the FALSE condition (writing 0) to the flag C7 is ignored.

reserved:予約ビットを示す。常に0が読み出される。書き込む時は0を書き込む必要がある。   reserved: Indicates a reserved bit. 0 is always read. When writing, it is necessary to write 0.

図13は、アキュムレータ(M0,M1)30bの構造を示す図である。このアキュムレータ(M0,M1)30bは、実行対象となっているタスクのコンテキストの一部を構成し、図13(a)に示される32ビットレジスタMH0-MH1(乗除算・積和用レジスタ(上位32ビット))と、図13(b)に示される32ビットレジスタML0-ML1乗除算・積和用レジスタ(下位32ビット)とからなる。   FIG. 13 is a diagram showing the structure of the accumulator (M0, M1) 30b. This accumulator (M0, M1) 30b constitutes a part of the context of the task to be executed, and is a 32-bit register MH0-MH1 (multiplication / multiplication / sum of products register (high order) shown in FIG. 13 (a). 32 bits)) and the 32-bit register ML0-ML1 multiplication / division / product-sum register (lower 32 bits) shown in FIG. 13 (b).

レジスタMH0-MHは、乗算命令では結果の上位32ビットを格納するのに使用される。積和命令ではアキュムレータの上位32ビットとして使用される。また、ビットストリームを取り扱う場合に汎用レジスタと組み合わせて使用することができる。レジスタML0-ML1
は、乗算命令では結果の下位32ビットを格納するのに使用される。積和命令ではアキュムレータの下位32ビットとして使用される。
Registers MH0-MH are used to store the upper 32 bits of the result in multiply instructions. In the product-sum instruction, it is used as the upper 32 bits of the accumulator. Further, when handling a bit stream, it can be used in combination with a general-purpose register. Register ML0-ML1
Is used in multiply instructions to store the lower 32 bits of the result. In the product-sum instruction, it is used as the lower 32 bits of the accumulator.

図14は、プログラムカウンタ(PC)33の構造を示す図である。このプログラムカウンタ(PC)33は、実行対象となっているタスクのコンテキストの一部を構成し、実行中の命令のアドレスを保持する32ビットのカウンタである。下位1ビットは常に0が格納される。   FIG. 14 is a diagram showing the structure of the program counter (PC) 33. This program counter (PC) 33 is a 32-bit counter that constitutes a part of the context of the task to be executed and holds the address of the instruction being executed. 0 is always stored in the lower 1 bit.

図15は、PC退避用レジスタ(IPC)34の構造を示す図である。このPC退避用レジスタ(IPC)34は、実行対象となっているタスクのコンテキストの一部を構成する32ビットのレジスタであり、下位1ビットは常に0が読み出されるが、書き込み時には0を書き込む必要がある。   FIG. 15 is a diagram showing the structure of the PC save register (IPC) 34. The PC save register (IPC) 34 is a 32-bit register that constitutes a part of the context of the task to be executed. The lower 1 bit is always read as 0, but 0 must be written when writing. There is.

図16は、PSR退避用レジスタ(IPSR)35の構造を示す図である。このPSR退避用レジスタ(IPSR)35は、実行対象となっているタスクのコンテキストの一部を構成し、プログラム状態レジスタ(PSR)31を退避するための32ビットのレジスタであり、プログラム状態レジスタ(PSR)31の予約ビットに対応する部分は常に0が読み出されるが、書き込み時には0を書き込む必要がある。   FIG. 16 is a diagram showing the structure of the PSR save register (IPSR) 35. The PSR save register (IPSR) 35 is a 32-bit register that constitutes a part of the context of the task to be executed and saves the program status register (PSR) 31. 0 is always read out from the portion corresponding to the reserved bit of (PSR) 31, but it is necessary to write 0 when writing.

次に、本実施の形態におけるコンパイラの対象となるプロセッサ1のメモリ空間について説明する。例えば、プロセッサ1では、4GBのリニアなメモリ空間を32分割し、128MB単位の空間に命令SRAM(Static RAM)とデータSRAMが割り当てられる。この128MBの空間を1ブロックとして、SAR(SRAM Area Register)にアクセスしたいブロックを設定する。アクセスされたアドレスがSARで設定された空間である場合は、直接命令SRAM/データSRAMに対してアクセスを行うが、SARで設定された空間でない場合は、バスコントローラ(BCU)に対してアクセス要求を出する。BCUにはオン・チップ・メモリ(OCM)、外部メモリ、外部デバイス、I/Oポート等が接続されており、それらのデバイスに対して読み書きを行うことができる。   Next, the memory space of the processor 1 that is the target of the compiler in this embodiment will be described. For example, in the processor 1, a 4 GB linear memory space is divided into 32, and an instruction SRAM (Static RAM) and a data SRAM are allocated to a 128 MB unit space. With this 128 MB space as one block, a block to be accessed in the SAR (SRAM Area Register) is set. When the accessed address is a space set by the SAR, the instruction SRAM / data SRAM is directly accessed. When the accessed address is not the space set by the SAR, an access request is sent to the bus controller (BCU). Take out. An on-chip memory (OCM), an external memory, an external device, an I / O port, and the like are connected to the BCU, and reading and writing can be performed on these devices.

図17は、本実施の形態におけるコンパイラの対象となるプロセッサ1のパイプライン動作を示すタイミング図である。このプロセッサ1は、本図に示されるように、例えば、基本的に命令フェッチ、命令割り当て(ディスパッチ)、デコード、実行、書き込みの5段パイプラインで構成されている。   FIG. 17 is a timing chart showing the pipeline operation of the processor 1 that is the target of the compiler in this embodiment. As shown in the figure, the processor 1 is basically composed of, for example, a 5-stage pipeline of instruction fetch, instruction allocation (dispatch), decode, execution, and write.

図18は、このようなプロセッサ1による命令実行時の各パイプライン動作を示すタイミング図である。命令フェッチステージでは、プログラムカウンタ(PC)33で指定されるアドレスの命令メモリをアクセスし、命令を命令バッファ10c〜10e等に転送する。命令割り当てステージでは、分岐系命令に対する分岐先アドレス情報の出力、入力レジスタ制御信号の出力、可変長命令の割り当てを行い、命令をインストラクションレジスタ(IR)に転送する。デコードステージでは、IRをデコード部20に入力し、演算器制御信号、メモリアクセス信号を出力する。実行ステージでは、演算を実行、演算結果をデータメモリか汎用レジスタ(R0〜R31)30aに出力する。書き込みステージでは、データ転送、演算結果を汎用レジスタに格納する。   FIG. 18 is a timing chart showing each pipeline operation at the time of instruction execution by the processor 1. In the instruction fetch stage, the instruction memory at the address specified by the program counter (PC) 33 is accessed, and the instruction is transferred to the instruction buffers 10c to 10e and the like. In the instruction allocation stage, branch destination address information is output to a branch system instruction, an input register control signal is output, a variable length instruction is allocated, and the instruction is transferred to an instruction register (IR). In the decode stage, IR is input to the decode unit 20 and an arithmetic unit control signal and a memory access signal are output. In the execution stage, the operation is executed, and the operation result is output to the data memory or the general-purpose register (R0 to R31) 30a. In the write stage, data transfer and operation results are stored in general purpose registers.

本実施の形態におけるコンパイラの対象となるプロセッサ1は、例えば、VLIWアーキテクチャにより上記の処理を最高3並列で行うことができる。したがって、図18に示された動作については、本プロセッサ1は、図19に示されるタイミングで並列に実行する。   The processor 1 that is the target of the compiler in the present embodiment can perform the above-described processing in up to three parallels by using, for example, the VLIW architecture. Therefore, the processor 1 executes the operations shown in FIG. 18 in parallel at the timing shown in FIG.

次に、以上のように構成されたプロセッサ1の命令セットの例について説明する。
以下の表3〜表5は、本実施の形態におけるコンパイラの対象となるプロセッサ1が実行する命令をカテゴリー別に分類した表である。
Next, an example of an instruction set of the processor 1 configured as described above will be described.
Tables 3 to 5 below are tables in which instructions executed by the processor 1 that is a target of the compiler according to the present embodiment are classified by category.

Figure 2010186487
Figure 2010186487

Figure 2010186487
Figure 2010186487

Figure 2010186487
Figure 2010186487

なお、表中の「演算器」は、その命令が使用する演算器を示す。演算器の略号の意味は次の通りである。つまり、「A」はALU命令、「B」は分岐命令、「C」は変換命令、「DIV」は除算命令、「DBGM」はデバッグ命令、「M」はメモリアクセス命令、「S1」、「S2」はシフト命令、「X1」、「X2」は乗算命令を意味する。   Note that “operator” in the table indicates an arithmetic unit used by the instruction. The meaning of the abbreviation of the arithmetic unit is as follows. That is, “A” is an ALU instruction, “B” is a branch instruction, “C” is a conversion instruction, “DIV” is a division instruction, “DBGM” is a debug instruction, “M” is a memory access instruction, “S1”, “ “S2” means a shift instruction, and “X1” and “X2” mean a multiplication instruction.

図20は、このようなプロセッサ1が実行する命令のフォーマットの例を示す図である。そのフォーマットには、図20(a)に示される16ビット命令フォーマットと、図20(b)に示される32ビット命令フォーマットとがある。   FIG. 20 is a diagram showing an example of the format of an instruction executed by such a processor 1. The formats include a 16-bit instruction format shown in FIG. 20A and a 32-bit instruction format shown in FIG.

なお、図中における略号の意味は次の通りである。つまり、「E」はエンドビット(並列実行の境界)、「F」はフォーマットビット(00、01、10:16ビット命令フォーマット、11:32ビット命令フォーマット)、「P」はプレディケート(実行条件:8個の条件フラグC0〜C7のいずれかを指定)、「OP」はオペコードフィールド、「R」はレジスタフィールド、「I」は即値フィールド、「D」ディスプースメントフィールドを意味する。なお、「E」フィールドはVLIWに特有のもので、E=0の命令は次の命令と並列に実行される。つまり、「E」フィールドによって並列度が可変のVLIWを実現している。   In addition, the meaning of the symbol in the figure is as follows. That is, “E” is an end bit (parallel execution boundary), “F” is a format bit (00, 01, 10:16 bit instruction format, 11:32 bit instruction format), and “P” is a predicate (execution condition: "OP" means an operation code field, "R" means a register field, "I" means an immediate field, and "D" a displacement field. Note that the “E” field is unique to VLIW, and an instruction with E = 0 is executed in parallel with the next instruction. That is, a VLIW having a variable parallelism is realized by the “E” field.

図21〜図36は、プロセッサ1が実行する命令の概略的な機能を説明する図である。つまり、図21は、カテゴリー「ALUadd(加算)系」に属する命令を説明する図であり、図22は、カテゴリー「ALUsub(減算)系」に属する命令を説明する図であり、図23は、カテゴリー「ALUlogic(論理演算)系ほか」に属する命令を説明する図であり、図24は、カテゴリー「CMP(比較演算)系」に属する命令を説明する図であり、図25は、カテゴリー「mul(乗算)系」に属する命令を説明する図であり、図26は、カテゴリー「mac(積和演算)系」に属する命令を説明する図であり、図27は、カテゴリー「msu(積差演算)系」に属する命令を説明する図であり、図28は、カテゴリー「MEMld(メモリ読み出し)系」に属する命令を説明する図であり、図29は、カテゴリー「MEMstore(メモリ書き出し)系」に属する命令を説明する図であり、図30は、カテゴリー「BRA(分岐)系」に属する命令を説明する図であり、図31は、カテゴリー「BSasl(算術バレルシフト)系ほか」に属する命令を説明する図であり、図32は、カテゴリー「BSlsr(論理バレルシフト)系ほか」に属する命令を説明する図であり、図33は、カテゴリー「CNVvaln(算術変換)系」に属する命令を説明する図であり、図34は、カテゴリー「CNV(一般変換)系」に属する命令を説明する図であり、図35は、カテゴリー「SATvlpk(飽和処理)系」に属する命令を説明する図であり、図36は、カテゴリー「ETC(その他)系」に属する命令を説明する図である。   FIG. 21 to FIG. 36 are diagrams illustrating schematic functions of instructions executed by the processor 1. That is, FIG. 21 is a diagram for explaining instructions belonging to the category “ALUadd (addition) system”, FIG. 22 is a diagram for explaining instructions belonging to the category “ALUsub (subtraction) system”, and FIG. FIG. 24 is a diagram illustrating instructions belonging to the category “ALUlogic (logical operation) system, etc.”, FIG. 24 is a diagram illustrating instructions belonging to the category “CMP (comparison operation) system”, and FIG. FIG. 26 is a diagram illustrating instructions belonging to the category “mac (product-sum operation) system”, and FIG. 27 is a category “msu (product-difference operation)”. FIG. 28 is a diagram illustrating instructions belonging to the category “MEMld (memory read) system”, and FIG. 29 is a category “MEMstore (memory write) system”. Diagram explaining the instruction to which it belongs FIG. 30 is a diagram for explaining instructions belonging to the category “BRA (branch) system”, and FIG. 31 is a diagram for explaining instructions belonging to the category “BSasl (arithmetic barrel shift) system, etc.” 32 is a diagram for explaining instructions belonging to the category “BSlsr (logical barrel shift) system, etc.”, FIG. 33 is a diagram for explaining instructions belonging to the category “CNVvaln (arithmetic conversion) system”, and FIG. FIG. 35 is a diagram illustrating instructions belonging to the category “SATvlpk (saturation processing) system”, and FIG. 36 is a diagram illustrating the category “ETC”. It is a figure explaining the instruction which belongs to (others) type | system | group.

これらの図において、項目「SIMD」は、その命令の型(SISD(SINGLE)かSIMDかの区別)を示し、項目「サイズ」は、演算の対象となる個々のオペランドのサイズを示し、項目「命令」は、その命令のオペコードを示し、項目「オペランド」は、その命令のオペランドを示し、項目「CFR」は、条件フラグレジスタの変化を示し、項目「PSR」は、プロセッサ状態レジスタの変化を示し、項目「代表的な動作」は、動作の概要を示し、項目「演算器」は、使用される演算器を示し、項目「3116」は、命令のサイズを示す。   In these figures, item “SIMD” indicates the type of instruction (distinguishing between SISD (SINGLE) and SIMD), item “size” indicates the size of each operand to be operated, and item “SIMD” "Instruction" indicates the opcode of the instruction, item "operand" indicates the operand of the instruction, item "CFR" indicates a change in the condition flag register, and item "PSR" indicates a change in the processor status register The item “representative operation” indicates an outline of the operation, the item “operation unit” indicates the operation unit to be used, and the item “3116” indicates the size of the instruction.

以下に、後述する具体例で使用される主な命令についてのプロセッサ1の動作を説明する。   Hereinafter, the operation of the processor 1 with respect to main instructions used in specific examples to be described later will be described.

ld Rb,(Ra,D10)
レジスタRaにディスプレースメント値(D10)を加算したアドレスからワードデータをレ
ジスタRbにロードする。
ld Rb, (Ra, D10)
The word data is loaded into the register Rb from the address obtained by adding the displacement value (D10) to the register Ra.

ldh Rb,(Ra+)I9
レジスタRaが示すアドレスからハーフワードデータを符号拡張してロードする。さらに、レジスタRaに即値(I9)を加算し、レジスタRaに格納する。
ldh Rb, (Ra +) I9
Halfword data is sign-extended and loaded from the address indicated by the register Ra. Further, the immediate value (I9) is added to the register Ra and stored in the register Ra.

ldp Rb:Rb+1,(Ra+)
レジスタRaが示すアドレスからレジスタRbとRb+1に2 つのワードデータを符号拡張してロードする。さらに、レジスタRaに 8 を加算し、レジスタRaに格納する。
ldp Rb: Rb + 1, (Ra +)
Two word data are sign-extended and loaded into the registers Rb and Rb + 1 from the address indicated by the register Ra. Further, 8 is added to the register Ra and stored in the register Ra.

ldhp Rb:Rb+1, (Ra+)
レジスタRaが示すアドレスから 2 つのハーフワードデータを符号拡張してロードする。さらに、レジスタRaに 4 を加算し、レジスタRaに格納する。
ldhp Rb: Rb + 1, (Ra +)
Two halfword data are sign-extended and loaded from the address indicated by the register Ra. Further, 4 is added to the register Ra and stored in the register Ra.

setlo Ra,I16
レジスタRaに即値(I16)を符号拡張して格納する。
setlo Ra, I16
The immediate value (I16) is sign-extended and stored in the register Ra.

sethi Ra,I16
レジスタRaの上位 16 bitに即値(I16)を格納する。レジスタRaの下位 16 bitには影響しない。
sethi Ra, I16
Store immediate value (I16) in upper 16 bits of register Ra. It does not affect the lower 16 bits of register Ra.

ld Rb,(Ra)
レジスタRaが示すアドレスからワードデータをレジスタRbにロードする。
ld Rb, (Ra)
Word data is loaded into the register Rb from the address indicated by the register Ra.

add Rc,Ra,Rb
レジスタRaとRbを加算し、レジスタRbに格納する。
add Rc, Ra, Rb
Registers Ra and Rb are added and stored in register Rb.

addu Rb,GP,I13
レジスタGPに即値(I13)を加算し、レジスタRbに格納する。
addu Rb, GP, I13
The immediate value (I13) is added to the register GP and stored in the register Rb.

st (GP,D13),Rb
レジスタGPにディスプレースメント値(D13)を加算したアドレスに、レジスタRbに格納されたハーフワードデータをストアする。
st (GP, D13), Rb
The halfword data stored in the register Rb is stored at the address obtained by adding the displacement value (D13) to the register GP.

sth (Ra+)I9,Rb
レジスタRaが示すアドレスに、レジスタRbに格納されたハーフワードデータをストアする。さらに、レジスタRaに即値(I9)を加算し、レジスタRaに格納する。
sth (Ra +) I9, Rb
The halfword data stored in the register Rb is stored at the address indicated by the register Ra. Further, the immediate value (I9) is added to the register Ra and stored in the register Ra.

stp (Ra+),Rb:Rb+1
レジスタRaが示すアドレスに、レジスタRbとRb+1に格納された 2 つのワードデータをストアする。さらに、レジスタRaに 8 を加算し、レジスタRaに格納する。
stp (Ra +), Rb: Rb + 1
The two word data stored in the registers Rb and Rb + 1 are stored at the address indicated by the register Ra. Further, 8 is added to the register Ra and stored in the register Ra.

Ret
サブルーチンコールからのリターンに使用する。LRに格納されているアドレスに分岐する。SVR.CFをCFR.CFに転送する。
Ret
Used for return from subroutine call. Branches to the address stored in LR. Transfer SVR.CF to CFR.CF.

mov Ra,I16
レジスタRaに値(I16)を符号拡張して格納する。
mov Ra, I16
The value (I16) is sign-extended and stored in the register Ra.

settar C6,D9
以下の処理を行う。 (1) PCとディスプレースメント値(D9)を加算したアドレスを分岐レジスタTARに格納する。 (2) そのアドレスの命令をフェッチして分岐用命令バッファに格納する。 (3) C6を 1 にセットする。
settar C6, D9
The following processing is performed. (1) The address obtained by adding the PC and the displacement value (D9) is stored in the branch register TAR. (2) Fetch the instruction at that address and store it in the branch instruction buffer. (3) Set C6 to 1.

settar C6,Cm,D9
以下の処理を行う。 (1) PCとディスプレースメント値(D9)を加算したアドレスを分岐レジスタTARに格納する。 (2) そのアドレスの命令をフェッチして分岐用命令バッファに格納する。 (3) C6を 1 に、Cmを 0 にセットする。
settar C6, Cm, D9
The following processing is performed. (1) The address obtained by adding the PC and the displacement value (D9) is stored in the branch register TAR. (2) Fetch the instruction at that address and store it in the branch instruction buffer. (3) Set C6 to 1 and Cm to 0.

settar C6,C2:C4,D9
以下の処理を行う。 (1) PCとディスプレースメント値(D9)を加算したアドレスを分岐レジスタTARに格納する。 (2) そのアドレスの命令をフェッチして分岐用命令バッファに格納する。 (3) C4とC6を 1 に、C2とC3を 0 にセットする。
settar C6, C2: C4, D9
The following processing is performed. (1) The address obtained by adding the PC and the displacement value (D9) is stored in the branch register TAR. (2) Fetch the instruction at that address and store it in the branch instruction buffer. (3) Set C4 and C6 to 1 and set C2 and C3 to 0.

jloop C6,TAR,Ra2,-1
ループで使用する。以下の処理を行う。 (1) レジスタRa2に -1 を加算し、レジスタRa2に格納する。レジスタRa2が 0 より小さくなるとC6に 0 をセットする。 (2) 分岐レジスタTARが示すアドレスにジャンプする。
jloop C6, TAR, Ra2, -1
Use in a loop. The following processing is performed. (1) Add −1 to the register Ra2 and store it in the register Ra2. When register Ra2 becomes smaller than 0, C6 is set to 0. (2) Jump to the address indicated by the branch register TAR.

jloop C6,Cm,TAR,Ra2,-1
ループで使用する。以下の処理を行う。 (1) Cm に 1 をセットする。 (2) レジスタRa2に -1 を加算し、レジスタRa2に格納する。レジスタRa2が 0 より小さくなるとC6に 0 をセットする。 (3) 分岐レジスタTARが示すアドレスにジャンプする。
jloop C6, Cm, TAR, Ra2, -1
Use in a loop. The following processing is performed. (1) Set 1 to Cm. (2) Add −1 to the register Ra2 and store it in the register Ra2. When register Ra2 becomes smaller than 0, C6 is set to 0. (3) Jump to the address indicated by the branch register TAR.

jloop C6,C2:C4,TAR,Ra2,-1
ループで使用する。以下の処理を行う。(1) C3をC2に転送し、C4をC3とC6に転送する。(2) レジスタRa2に -1 を加算し、レジスタRa2に格納する。レジスタRa2が 0 より小さくなるとC4に 0 をセットする。(3) 分岐レジスタTARが示すアドレスにジャンプする。
jloop C6, C2: C4, TAR, Ra2, -1
Use in a loop. The following processing is performed. (1) Transfer C3 to C2, and transfer C4 to C3 and C6. (2) Add −1 to the register Ra2 and store it in the register Ra2. When register Ra2 becomes smaller than 0, C4 is set to 0. (3) Jump to the address indicated by the branch register TAR.

mul Mm,Rb,Ra,I8
レジスタRaと即値(I8)を符号付乗算し、結果をレジスタMmとレジスタRbに格納する。
mul Mm, Rb, Ra, I8
The register Ra is multiplied by the immediate value (I8) with a sign, and the result is stored in the register Mm and the register Rb.

mac Mm,Rc,Ra,Rb,Mn
レジスタRaとRbを整数乗算し、レジスタMnと加算する。結果をレジスタMmとレジスタRcに格納する。
mac Mm, Rc, Ra, Rb, Mn
The registers Ra and Rb are multiplied by an integer and added to the register Mn. The result is stored in register Mm and register Rc.

lmac Mm,Rc,Ra,Rb,Mn
レジスタRbをハーフワードベクタ形式で扱う。レジスタRaとRbの下位 16 bitを整数乗算し、レジスタMnと加算する。結果をレジスタMmとレジスタRcに格納する。
lmac Mm, Rc, Ra, Rb, Mn
Handle register Rb in halfword vector format. The lower 16 bits of registers Ra and Rb are multiplied by integer and added to register Mn. The result is stored in register Mm and register Rc.

jloop C6,C2:C4,TAR,Ra2,-1
ループで使用する。以下の処理を行う。(1) C3をC2に転送し、C4をC3とC6に転送する。(2) レジスタRa2に -1 を加算し、レジスタRa2に格納する。レジスタRa2が 0 より小さくなるとC4に 0 をセットする。(3) 分岐レジスタTARが示すアドレスにジャンプする。
jloop C6, C2: C4, TAR, Ra2, -1
Use in a loop. The following processing is performed. (1) Transfer C3 to C2, and transfer C4 to C3 and C6. (2) Add −1 to the register Ra2 and store it in the register Ra2. When register Ra2 becomes smaller than 0, C4 is set to 0. (3) Jump to the address indicated by the branch register TAR.

asr Rc,Ra,Rb
レジスタRaをRbが示すビット数だけ算術右シフトする。レジスタRbは±31 以内に飽和され、負の場合は算術左シフトになる。
asr Rc, Ra, Rb
The register Ra is shifted to the right by the number of bits indicated by Rb. Register Rb is saturated within ± 31, and if negative, it is an arithmetic left shift.

br D9
現在のPCに、ディスプレースメント値(D9)を加算し、そのアドレスに分岐する。
br D9
Add the displacement value (D9) to the current PC and branch to that address.

jmpf TAR
分岐レジスタTARに格納されているアドレスに分岐する。
jmpf TAR
Branches to the address stored in the branch register TAR.

cmpCC Cm,Ra,I5
CC には次のCC比較条件を記述可能である。
cmpCC Cm, Ra, I5
The following CC comparison conditions can be described in CC.

eq/ne/gt/ge/gtu/geu/le/lt/leu/ltu
CCがeq/ne/gt/ge/le/ltの場合、I5は符号付きの値で、符号拡張して比較する。CCがgtu/geu/leu/ltuの場合、I5は符号なしの値である。
eq / ne / gt / ge / gtu / geu / le / lt / leu / ltu
When CC is eq / ne / gt / ge / le / lt, I5 is a signed value and is compared with a sign extension. When CC is gtu / geu / leu / ltu, I5 is an unsigned value.

[コンパイラ]
次に、以上のプロセッサ1をターゲットとする本実施の形態におけるコンパイラについて説明する。
[compiler]
Next, a compiler in the present embodiment targeting the above processor 1 will be described.

図37は、本実施の形態におけるコンパイラ100の構成を示す機能ブロック図である。このコンパイラ100は、C言語等の高級言語で記述指定されたソースプログラム101を、上述のプロセッサ1をターゲットプロセッサとする機械語プログラム102に変換するクロスコンパイラであり、パーソナルコンピュータ等のコンピュータ上で実行されるプログラムによって実現され、大きく分けて、解析部110と、最適化部120と、出力部130とから構成される。   FIG. 37 is a functional block diagram showing the configuration of the compiler 100 in the present embodiment. The compiler 100 is a cross compiler that converts a source program 101 specified in a high-level language such as C language into a machine language program 102 using the processor 1 as a target processor, and is executed on a computer such as a personal computer. The analysis unit 110, the optimization unit 120, and the output unit 130 are roughly implemented.

解析部110は、コンパイルの対象となるソースプログラム101及びこのコンパイラ100に対するユーザからの指示等を字句解析することによって、コンパイラ100に対する指示(オプション及びプラグマ)については最適化部120や出力部130に伝達し、コンパイルの対象となるプログラムについては内部形式データに変換したりする。   The analysis unit 110 performs lexical analysis on the source program 101 to be compiled and instructions from the user to the compiler 100, and the instructions (options and pragmas) to the compiler 100 are sent to the optimization unit 120 and the output unit 130. The program to be transmitted and compiled is converted to internal format data.

なお、「オプション」とは、コンパイラ100を起動する際に、コンパイルの対象となるソースプログラム101の指定とともに、ユーザが任意に指定することができるコンパイラ100への指示であり、生成する機械語プログラム102のコードサイズ及び実行時間を最適化するための指示等が含まれる。例えば、ユーザは、ソースプログラム101「sample.c」をコンパイルするときに、コマンド「ammmp-cc」を用いて、コンピュータ上で、
c:\>ammmp-cc -o -max-gp-datasize=40 sample.c
と入力することができる。このコマンドにおける付加的な指示「-o」及び「-max-gp-datasize=40」がオプションである。このようなオプションによる指示は、ソースプログラム101全体に対する指示として扱われる。
The “option” is an instruction to the compiler 100 that can be arbitrarily specified by the user along with the specification of the source program 101 to be compiled when the compiler 100 is started. Instructions for optimizing the code size and execution time of 102 are included. For example, when compiling the source program 101 “sample.c”, the user uses the command “ammmp-cc” on the computer,
c: \> ammmp-cc -o -max-gp-datasize = 40 sample.c
Can be entered. Additional instructions “-o” and “-max-gp-datasize = 40” in this command are optional. An instruction with such an option is handled as an instruction for the entire source program 101.

また、「プラグマ(又は、プラグマ指令)」とは、ソースプログラム101中にユーザが任意に指定(配置)することができるコンパイラ100への指示であり、オプションと同様に、生成する機械語プログラム102のコードサイズ及び実行時間を最適化するための指示等が含まれる。本実施の形態におけるコンパイラ100では、「#pragma」で始まる文字列である。例えば、ユーザは、ソースプログラム101中に、
#pragma_no_gp_access 変数名
というステートメントを記述しておくことができる。このステートメントがプラグマ(プラグマ指令)である。このようなプラグマは、オプションと異なり、当該プラグマの直後に配置された変数やループ処理等だけに対する個別的な指示として扱われる。
The “pragma (or pragma command)” is an instruction to the compiler 100 that can be arbitrarily designated (placed) by the user in the source program 101, and the machine language program 102 to be generated is the same as the option. Instructions for optimizing the code size and execution time are included. In the compiler 100 according to the present embodiment, the character string starts with “#pragma”. For example, the user may include in the source program 101
A statement called #pragma_no_gp_access variable name can be described. This statement is a pragma (pragma directive). Unlike an option, such a pragma is treated as an individual instruction only for a variable, a loop process, or the like arranged immediately after the pragma.

最適化部120は、解析部110から出力されたソースプログラム101(内部形式データ)に対して、解析部110からの指示等に従って、(1)実行速度の向上を優先した最適化、(2)コードサイズの削減を優先した最適化、(3)実行速度とコードサイズの両方の最適化、の中から選択された最適化を実現するための全体的な最適化処理を行うことに加えて、ユーザによるオプション及びプラグマによって指定された個別的な最適化処理を行う処理部(グローバル領域割り付け部121、ソフトウェアパイプライニング部122、ループアンローリング部123、if変換部124及びペア命令生成部125)を有する。   The optimization unit 120 performs, on the source program 101 (internal format data) output from the analysis unit 110, according to an instruction from the analysis unit 110, (1) optimization that prioritizes improvement in execution speed, and (2) In addition to performing optimization that gives priority to code size reduction, and (3) optimization of both execution speed and code size, overall optimization processing to achieve optimization selected from A processing unit (global area allocation unit 121, software pipelining unit 122, loop unrolling unit 123, if conversion unit 124, and pair instruction generation unit 125) that performs individual optimization processing specified by options and pragmas by the user. Have.

グローバル領域割り付け部121は、グローバル領域(共通のデータ領域として関数を超えて参照可能なメモリ領域)に配置する変数(配列)の最大データサイズの指定、グローバル領域に配置させる変数の指定、及び、グローバル領域に配置させない変数の指定に関するオプション及びプラグマに従った最適化処理を行う。   The global area allocating unit 121 specifies a maximum data size of a variable (array) to be arranged in a global area (a memory area that can be referenced beyond a function as a common data area), designation of a variable to be arranged in the global area, and Performs optimization processing according to options and pragmas related to the designation of variables that are not placed in the global area.

ソフトウェアパイプライニング部122は、ソフトウェアパイプライニングを行わない旨の指示、プロログ部・エピログ部が除去できる範囲でソフトウェアパイプライニングを行う旨の指示、及び、プロログ部・エピログ部を除去せずに可能な範囲でソフトウェアパイプライニングを行う旨の指示に関するオプション及びプラグマに従った最適化処理を行う。   The software pipelining unit 122 can do without removing the software pipelining, the instruction to perform the software pipelining within the range where the prolog / epilog can be removed, and without removing the prolog / epilog. Performs optimization processing according to the option and pragma regarding the instruction to perform software pipelining in the range.

ループアンローリング部123は、ループアンローリングを行う旨の指示、ループアンローリングを行わない旨の指示、ループが繰り返される最低回数の保証、ループが偶数回繰り返される旨の保証、及び、ループが奇数回繰り返される旨の保証に関するオプション及びプラグマに従った最適化処理を行う。   The loop unrolling unit 123 includes an instruction to perform loop unrolling, an instruction to not perform loop unrolling, a guarantee of the minimum number of times the loop is repeated, a guarantee that the loop is repeated even times, and an odd number of loops. Performs optimization processing according to the option and pragma regarding the guarantee that it will be repeated.

if変換部124は、if変換を行う旨の指示、及び、if変換を行わない旨の指示に関するオプション及びプラグマに従った最適化処理を行う。   The if conversion unit 124 performs optimization processing according to an option and pragma regarding an instruction to perform if conversion and an instruction to not perform if conversion.

ペア命令生成部125は、配列と構造体の先頭アドレスのアラインの指定、及び、関数引数のポインタ変数やローカルポインタ変数の指すデータのアライメントの保証に関するプラグマに従った最適化処理を行う。   The pair instruction generation unit 125 performs an optimization process according to a pragma related to the specification of the alignment of the start address of the array and the structure, and the alignment guarantee of the data indicated by the pointer variable of the function argument or the local pointer variable.

出力部130は、最適化部120による最適化処理が施されたソースプログラム101に対して、内部形式データを対応する機械語命令に置き換えたり、ラベルやモジュール等のアドレスを解決したりすることで、機械語プログラム102を生成し、ファイル等として出力する。   The output unit 130 replaces the internal format data with a corresponding machine language instruction for the source program 101 that has been optimized by the optimization unit 120, or resolves addresses such as labels and modules. The machine language program 102 is generated and output as a file or the like.

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

[グローバル領域割り付け部121]
まず、グローバル領域割り付け部121の動作とその意義について説明する。グローバル領域割り付け部121は、大きく分けて、(1)グローバル領域配置の最大データサイズの指定に関する最適化と、(2)グローバル領域配置の指定に関する最適化とを行う。
[Global area allocation unit 121]
First, the operation of the global area allocation unit 121 and its significance will be described. The global area allocating unit 121 roughly performs (1) optimization relating to designation of the maximum data size of global area arrangement and (2) optimization relating to designation of global area arrangement.

まず、(1)グローバル領域配置の最大データサイズの指定に関する最適化について説明する。   First, (1) optimization relating to designation of the maximum data size of the global area arrangement will be described.

上記プロセッサ1には、グローバルポインタレジスタ(gp;汎用レジスタR30)が用意されており、グローバル領域(以下gp領域とする)の先頭のアドレスを保持している。gp領域先頭からのディスプレースメントが最大14ビットの範囲については、1命令でアクセスすることが可能である。   The processor 1 is provided with a global pointer register (gp; general-purpose register R30), and holds the head address of the global area (hereinafter referred to as gp area). In the range where the displacement from the top of the gp area is 14 bits at the maximum, it can be accessed with one instruction.

このgp領域には、外部変数・静的変数等の配列を配置することが可能である。ただし、1命令でアクセスできる範囲を超えた場合、逆に性能が低下するため注意が必要である。   In this gp region, an array of external variables, static variables, etc. can be arranged. However, if the range that can be accessed with one instruction is exceeded, the performance will be degraded.

図38(a)は、グローバル領域におけるデータ等の配置例を示す図である。ここでは、配列Aのデータサイズは、最大データサイズを超えない値であり、配列Cのデータサイズは、最大データサイズを超える値である。   FIG. 38A is a diagram illustrating an arrangement example of data and the like in the global area. Here, the data size of the array A is a value that does not exceed the maximum data size, and the data size of the array C is a value that exceeds the maximum data size.

gp領域に実体が収まっている配列Aへのアクセスは、以下の例のように、1命令で可能である。   Access to the array A whose entities are contained in the gp area is possible with one instruction as in the following example.

例:ld r1,(gp,_A - .MN.gptop);;
なお、この例において、「.MN.gptop」は、グローバルポインタレジスタと同じアドレスを指すセクション名(ラベル)である。
Example: ld r1, (gp, _A-.MN.gptop) ;;
In this example, “.MN.gptop” is a section name (label) indicating the same address as the global pointer register.

一方、gp領域配置の最大データサイズを超える配列Cの場合は、gp領域以外に実体
が配置され、配列Cのアドレスのみがgp領域に配置される(なお、後述の、#pragma _no_gp_access指令を使用した場合は、gp領域に実体もアドレスも格納されない)。
On the other hand, in the case of the array C exceeding the maximum data size of the gp area arrangement, the entity is arranged in addition to the gp area, and only the address of the array C is arranged in the gp area. In this case, neither an entity nor an address is stored in the gp area).

この場合、配列Cへのアクセスは、以下の例のように、複数命令必要になる。   In this case, access to the array C requires a plurality of instructions as in the following example.

例: gpアドレス間接アクセスの場合
ld r1,(gp,_C$ - .MN.gptop);;
ld r1,(r1,8);;
Example: For gp address indirect access
ld r1, (gp, _C $-.MN.gptop) ;;
ld r1, (r1,8) ;;

例: 絶対アドレスアクセスの場合
setlo r0,LO(_C+8);;
sethi r0,HI(_C+8);;
ld r0,(r0);;
Example: Absolute address access
setlo r0, LO (_C + 8) ;;
sethi r0, HI (_C + 8) ;;
ld r0, (r0) ;;

なお、図38(b)に示されるグローバル領域以外の領域における配置例のように、gp領域の1命令でアクセスできる範囲外に実体が配置された配列Zの場合でも、以下のようなコードが生成される。   Even in the case of the array Z in which entities are arranged outside the range accessible by one instruction in the gp area, as in the arrangement example in the area other than the global area shown in FIG. Generated.

ld r0,(gp,_Z - .MN.gptop);;   ld r0, (gp, _Z-.MN.gptop) ;;

このコードは、1命令でアクセスできる範囲を超えているため、リンカにより複数命令に展開される。よって、1命令アクセスにはならない。   Since this code exceeds the range accessible by one instruction, it is expanded into a plurality of instructions by the linker. Therefore, it is not one instruction access.

なお、gp領域の1命令アクセス範囲は、最大14ビット範囲であるが、オブジェクトの型サイズにより、その範囲は異なる。つまり、8バイト型であれば14ビット範囲であり、4バイト型であれば13ビット範囲であり、2バイト型であれば12ビット範囲であり、1バイト型であれば11ビット範囲である。   The one instruction access range of the gp area is a maximum 14-bit range, but the range varies depending on the type size of the object. That is, the 8-byte type has a 14-bit range, the 4-byte type has a 13-bit range, the 2-byte type has a 12-bit range, and the 1-byte type has an 11-bit range.

コンパイラ100は、最大データサイズ(デフォルト32バイト)以下の配列・構造体の実体をgp領域に配置する。一方、グローバル領域配置の最大データサイズを超えるオブジェクトに関しては、gp領域以外に実体を配置し、gp領域にはオブジェクトの先頭アドレスのみを配置する。   The compiler 100 places an array / structure entity having a maximum data size (default 32 bytes) or less in the gp area. On the other hand, for an object that exceeds the maximum data size of the global area arrangement, an entity is arranged outside the gp area, and only the top address of the object is arranged in the gp area.

ここで、gp領域に余裕があれば、データサイズ32バイト以上のオブジェクトも配置させた方が、より良いコードを生成することが可能である。   Here, if there is room in the gp area, it is possible to generate a better code by arranging objects having a data size of 32 bytes or more.

そこで、以下のオプションを用いることで、ユーザは、この最大データサイズを任意の値に指定することが可能となっている。   Therefore, by using the following option, the user can designate the maximum data size as an arbitrary value.

・コンパイルオプション
-mmax-gp-datasize=NUM
・ Compile options
-mmax-gp-datasize = NUM

ここで、NUMは、グローバル領域に配置できる、一つの配列および構造体の最大データサイズの指定バイト(デフォルト32バイト)である。   Here, NUM is a designated byte (default 32 bytes) of the maximum data size of one array and structure that can be arranged in the global area.

図39は、グローバル領域割り付け部121の動作を示すフローチャートである。解析部110によって上記オプションが検出された場合には(ステップS100、S101)、グローバル領域割り付け部121は、ソースプログラム101で宣言されている指定されたサイズ(NUMバイト)以下の全ての変数(配列)については、グローバル領域に配置し、NUMバイトを超える変数については、その先頭アドレスだけをグローバル領域に配置し、その実体をグローバル領域以外のメモリ領域に配置する(ステップS102)。このオプションによって、速度向上とサイズ削減という最適化が可能となる。   FIG. 39 is a flowchart showing the operation of the global area allocating unit 121. When the above option is detected by the analysis unit 110 (steps S100 and S101), the global area allocation unit 121 determines that all variables (arrays) that are equal to or less than the specified size (NUM bytes) declared in the source program 101 are displayed. ) Is placed in the global area, and for variables exceeding NUM bytes, only the head address is placed in the global area, and the entity is placed in a memory area other than the global area (step S102). This option allows for optimization of speed and size reduction.

なお、この-mmax-gp-datasizeオプションでは、変数個々の配置指定はできない。個々
の変数に対してgp領域に配置する/しないを指定するには、後述する#pragma _gp_access指令を使用すればよい。また、外部変数・静的変数は、可能な限り1命令アクセス可能なgp領域に配置することが好ましい。さらに、extern宣言を使用して、他のファイルで定義される外部変数にアクセスする場合は、その外部変数のサイズを省略せずに、明記することが好ましい。例えば、外部変数の定義が、
int a[8];
とされている場合、使用するファイルでは、
extern int a[8];
と宣言することが好ましい。
Note that with this -mmax-gp-datasize option, you cannot specify the placement of individual variables. In order to specify whether or not to be placed in the gp area for each variable, a #pragma_gp_access command described later may be used. Further, it is preferable that the external variable / static variable is arranged in a gp area accessible by one instruction as much as possible. Furthermore, when using an extern declaration to access an external variable defined in another file, it is preferable to specify the size of the external variable without omitting it. For example, the definition of an external variable is
int a [8];
If the file used is
extern int a [8];
It is preferable to declare

なお、extern宣言外部変数に #pragma _gp_access指令を使用する場合、定義の指定(配置する領域)と使用側の指定(アクセスする方法)を必ず合わせる必要がある。   When using the #pragma _gp_access directive for an extern declaration external variable, it is necessary to match the definition specification (area to be allocated) with the specification on the use side (access method).

次に、このようなオプション用いることによる最適化の具体例を示す。
図40は、最大データサイズを変更した場合の最適化の具体例を示す図である。つまり、デフォルトの状態でコンパイルし、その結果、まだgp領域に空きがあるので、以下のコマンド例のように、最大データサイズを変更してコンパイルした場合における両ケースで得られる生成コードの例が示されている。
Next, a specific example of optimization using such an option will be shown.
FIG. 40 is a diagram illustrating a specific example of optimization when the maximum data size is changed. In other words, since the gp area is still empty as a result of compiling in the default state, examples of generated code obtained in both cases when compiling with the maximum data size changed are as shown in the following command example. It is shown.

c:\>ammmp-cc -O -mmax-gp-datasize=40 sample.c   c: \> ammmp-cc -O -mmax-gp-datasize = 40 sample.c

ここでは、配列cのオブジェクトサイズが、40バイトであるとする。本図の左欄は、デフォルトの状態でコンパイルされた場合に生成されるコードの例であり、本図の右欄は、最大データサイズを40に変更してコンパイルされた場合に生成されるコードの例である。なお、本図の最上段、中上段、中下段、最下段は、それぞれ、各欄のタイトル、サンプルプログラム(ソースプログラム101)、そこから生成されるコード(機械語プログラム102)、その生成コードのサイクル数及びコードサイズを示している(以下、最適化の具体例を示す他の図についても同様)。   Here, it is assumed that the object size of the array c is 40 bytes. The left column of this figure is an example of code generated when compiled in the default state, and the right column of this figure shows code generated when compiled with the maximum data size changed to 40 It is an example. The uppermost, middle upper, middle lower, and lowermost rows in the figure are the title of each column, sample program (source program 101), code generated therefrom (machine language program 102), and generated code, respectively. The number of cycles and the code size are shown (hereinafter the same applies to other figures showing specific examples of optimization).

本図の左欄の生成コードから分かるように、配列cの実体がgp領域以外に配置されているため、複数命令での絶対アドレスアクセスになっている。一方、本図の右欄の生成コードから分かるように、配列cの実体がgp領域に置かれるように最大データサイズ(40)が指定されたので、配列cの実体がgp領域に配置され、1命令アクセスでのgp相対アクセスになり、実行速度が向上される。つまり、デフォルトでは、10サイクルで実行される8バイトのコードが生成されるのに対し、最大データサイズの変更によって、7サイクルで実行される5バイトのコードが生成される。   As can be seen from the generated code in the left column of the figure, since the entity of the array c is arranged outside the gp area, absolute address access is performed with a plurality of instructions. On the other hand, as can be seen from the generated code in the right column of this figure, since the maximum data size (40) is specified so that the entity of the array c is placed in the gp region, the entity of the array c is placed in the gp region, Gp-relative access with one instruction access improves execution speed. That is, by default, an 8-byte code that is executed in 10 cycles is generated, whereas a 5-byte code that is executed in 7 cycles is generated by changing the maximum data size.

もう一つの具体例として、ファイル外定義の外部変数の場合の具体例を図41に示す。ここでは、gp領域配置の最大データサイズは40であるとする。本図の左欄は、ファイル外定義の外部変数に関してサイズ指定がない場合に生成されるコードの例を示し、本図の右欄は、サイズ指定がある場合に生成されるコードの例を示している。   As another specific example, FIG. 41 shows a specific example in the case of an external variable defined outside a file. Here, it is assumed that the maximum data size of the gp region arrangement is 40. The left column of this figure shows an example of code that is generated when no size is specified for an external variable defined outside the file, and the right column of this figure shows an example of code that is generated when a size is specified. ing.

本図の左欄に示されるように、外部定義配列aと外部定義配列cのサイズが共に不明なので、gp領域に配置されているのか否かコンパイラ100では判断できず、複数命令での絶対アドレスアクセスのコードが生成されている。   As shown in the left column of this figure, since the sizes of the externally defined array a and the externally defined array c are both unknown, the compiler 100 cannot determine whether they are arranged in the gp area, and the absolute address in a plurality of instructions. An access code has been generated.

一方、本図の右欄に示されるように、配列aの定義サイズが40バイト以下なので、gp領域に実体を配置し、グローバルポインタレジスタ(gp)を用いて1命令でのgp相対アクセスのコードが生成されている。また、外部定義配列cのサイズも明示的に指定されており、gp領域配置の最大データサイズ以下であるため、配列cの実体がgp領域に配置されているものとし、gp相対アクセスのコードが生成されている。このように、ファイル外定義の外部変数のサイズを指定しない場合には、10サイクルで実行される12バイトのコードが生成されるのに対し、最大データサイズの変更と外部変数のサイズ指定とを行った場合には、7サイクルで実行される5バイトのコードが生成される。   On the other hand, as shown in the right column of the figure, since the definition size of the array a is 40 bytes or less, the entity is placed in the gp area and the gp relative access code with one instruction using the global pointer register (gp). Has been generated. In addition, since the size of the externally defined array c is also explicitly specified and is less than or equal to the maximum data size of the gp area arrangement, it is assumed that the entity of the array c is arranged in the gp area, and the gp relative access code is Has been generated. In this way, when the size of the external variable defined outside the file is not specified, a 12-byte code that is executed in 10 cycles is generated, whereas the change of the maximum data size and the specification of the size of the external variable are If done, a 5-byte code that is executed in 7 cycles is generated.

次に、グローバル領域割り付け部121による、(2)グローバル領域配置の指定に関する最適化について説明する。   Next, (2) optimization related to designation of global area arrangement by the global area allocating unit 121 will be described.

前述の、グローバル領域配置の最大データサイズ指定( -mmax-gp-datasizeオプション)では、最大データサイズでのみ、gp領域の配置を指定するため、期待しない変数までgp領域に配置されることがある。   In the above-described maximum data size specification (-mmax-gp-datasize option) for global area arrangement, since the arrangement of the gp area is specified only at the maximum data size, an unexpected variable may be arranged in the gp area. .

そこで、変数ごとにgp領域の配置を指定する#pragma指令が用意されている。
・#pragma指令
#pragma _no_gp_access 変数名 [,変数名,...]
#pragma _gp_access 変数名 [,変数名,...]
Therefore, a #pragma directive that specifies the arrangement of the gp area for each variable is prepared.
#Pragma directive
#pragma _no_gp_access variable-name [, variable-name, ...]
#pragma _gp_access variable name [, variable name, ...]

ここで、[]内は省略可能を意味する。複数指定する場合、","(カンマ)で変数名を区
切ればよい。なお、オプションとプラグマ指令とが重複又は矛盾した場合は、プラグマ指令が優先する。
Here, the inside of [] means that it can be omitted. When specifying multiple variables, the variable names can be separated by "," (comma). If the option and the pragma command overlap or contradict each other, the pragma command takes precedence.

このようなプラグマ指令に対して、コンパイラ100は次のように動作する。つまり、図39において、解析部110によってプラグマ指令「#pragma _no_gp_access 変数名 [,変数名,...]」が検出された場合には(S100、S101)、グローバル領域割り付け部121は、ここで指定された変数については、オプション指定にかかわらず、グローバル領域に配置させないコードを生成し(ステップS103)、一方、解析部110によってプラグマ指令「#pragma _gp_access 変数名 [,変数名,...]」が検出された場合には(S100、S101)、グローバル領域割り付け部121は、ここで指定された変数については、オプション指定にかかわらず、グローバル領域に配置させるコードを生成する(ステップS104)。これらの#pragma指令によって、速度向上とサイズ削減という最適化が可能となる。   In response to such a pragma command, the compiler 100 operates as follows. That is, in FIG. 39, when the analysis unit 110 detects the pragma command “#pragma _no_gp_access variable name [, variable name,...]” (S100, S101), the global area allocation unit 121 For the specified variable, regardless of the option specification, a code that is not placed in the global area is generated (step S103). On the other hand, the analysis unit 110 uses the pragma command “#pragma _gp_access variable name [, variable name, ...]. "Is detected (S100, S101), the global area allocating unit 121 generates a code to be arranged in the global area regardless of the option designation for the variable designated here (step S104). These #pragma directives enable optimization of speed improvement and size reduction.

なお、#pragma _no_gp_access指令が指定された場合は、グローバル領域割り付け部121は、その変数については、gp領域に実体もアドレスも配置しない。また、最大データサイズ指定よりも、#pragma _gp_access指令の方を優先する。もし、同一の変数に関して異なる指定が現れた場合には、コンパイラ100の動作は不定となる。外部変数・静的変数については、可能な限り1命令アクセス可能なgp領域に配置することが好ましい。   When the #pragma_no_gp_access directive is specified, the global area allocating unit 121 does not place an entity or address in the gp area for the variable. The #pragma_gp_access directive takes precedence over the maximum data size specification. If different designations appear for the same variable, the operation of the compiler 100 is undefined. It is preferable that the external variable / static variable be arranged in the gp area accessible by one instruction as much as possible.

次に、このようなプラグマ指令用いることによる最適化の具体例を示す。#pragma _gp_access指令を使用すると、gp領域配置の最大データサイズ以上の外部変数・静的変数をgp領域に配置させることができので、その好適例を示す。   Next, a specific example of optimization using such a pragma command will be shown. When the #pragma_gp_access directive is used, an external variable / static variable larger than the maximum data size of the gp area arrangement can be arranged in the gp area.

図42は、#pragma _no_gp_access指令を用いた場合に生成されるコードの例(左欄)と、#pragma _gp_access指令を用いた場合に生成されるコードの例(右欄)とを示す図である。   FIG. 42 is a diagram illustrating an example of code generated when the #pragma_no_gp_access directive is used (left column) and an example of code generated when the #pragma _gp_access directive is used (right column). .

本図の左欄に示されるように、配列cのサイズは40バイトなのでデフォルトの場合、先頭アドレスのみgp領域に配置され、実体はgp領域に配置されない。また、外部定義されている配列aのサイズが32バイトなのでデフォルトの場合は、gp領域に実体が配置されているとコンパイラ100は判断する。   As shown in the left column of the figure, since the size of the array c is 40 bytes, in the case of default, only the top address is arranged in the gp area, and the entity is not arranged in the gp area. In addition, since the size of the externally defined array a is 32 bytes, the compiler 100 determines that the entity is arranged in the gp area in the default case.

しかし、#pragma _no_gp_access指令により、配列cについては、gp領域には先頭アドレスも実体も配置されずに、gp領域以外に実体が配置され、絶対アドレスアクセスのコードが生成される。外部定義の配列aについても、gp領域以外に実体が配置されているとして、絶対アドレスアクセスのコードが生成される。   However, with the #pragma_no_gp_access command, for the array c, the top address and the entity are not arranged in the gp area, but the entity is arranged outside the gp area, and an absolute address access code is generated. Also for the externally defined array a, an absolute address access code is generated on the assumption that entities are located outside the gp area.

一方、本図の右欄に示されるように、配列cはサイズが40バイトなので、デフォルトの場合ではgp領域に配置されないが、#pragma _gp_access指令により配列cの実体がgp領域に配置される。ファイル外定義の配列aは、サイズが不明であるが#pragma指令により、gp領域に配置されているものとし、gp相対アクセスコードが生成される。   On the other hand, as shown in the right column of the figure, since the size of the array c is 40 bytes, it is not arranged in the gp area by default, but the entity of the array c is arranged in the gp area by the #pragma_gp_access command. The array a defined outside the file has an unknown size, but is arranged in the gp area by the #pragma directive, and a gp relative access code is generated.

このように、#pragma _no_gp_access指令を用いた場合には、10サイクルで実行される12バイトのコードが生成されるのに対し、#pragma _gp_access指令を用いた場合には、7サイクルで実行される5バイトのコードが生成される。   Thus, when the #pragma_no_gp_access command is used, a 12-byte code is generated that is executed in 10 cycles, whereas when the #pragma_gp_access command is used, it is executed in 7 cycles. A 5-byte code is generated.

なお、extern宣言外部変数に#pragma _gp_access指令を使用する場合、定義の指定(配置する領域)と使用側の指定(アクセスする方法)を必ず合わせておくことが好ましい。   When using the #pragma_gp_access directive for an extern declaration external variable, it is preferable to always match the definition specification (area to be allocated) with the specification on the use side (access method).

[ソフトウェアパイプライニング部122]
次に、ソフトウェアパイプライニング部122の動作とその意義について説明する。
[Software pipelining unit 122]
Next, the operation of the software pipelining unit 122 and its significance will be described.

ソフトウェアパイプライニング最適化は、ループ高速化手法の1つである。この最適化が行われると、ループ構造がプロログ部、カーネル部、エピログ部に変換される。なお、ソフトウェアパイプライニング最適化は、それによって実行速度が向上されると判断された場合に行われる。カーネル部は、各イタレーション(繰り返し)をその前後のイタレーションとオーバーラップさせる。これにより、1イタレーション毎の平均処理時間が削減される。   Software pipelining optimization is one of loop acceleration methods. When this optimization is performed, the loop structure is converted into a prolog part, a kernel part, and an epilog part. The software pipelining optimization is performed when it is determined that the execution speed is improved. The kernel unit overlaps each iteration (repetition) with the previous and subsequent iterations. This reduces the average processing time for each iteration.

図43(a)は、ループ処理におけるプロログ部・カーネル部・エピログ部の概念図である。ここでは、イタレーション間で依存関係のない命令X、Y、Zが5回繰り返される場合の命令コード、実行イメージ、生成コードイメージの例が示されている。なお、ループ処理とは、for文、while文、do文等による繰り返し処理である。   FIG. 43A is a conceptual diagram of a prolog part, a kernel part, and an epilog part in the loop processing. Here, an example of an instruction code, an execution image, and a generated code image when instructions X, Y, and Z having no dependency relationship between iterations are repeated five times is shown. The loop process is an iterative process using a for statement, a while statement, a do statement, or the like.

ここで、プロログ部、エピログ部は、可能であれば、図43(b)及び(c)のプロセスに示されるように、除去される。しかし、不可能であれば除去されず、コードサイズが増加することがある。そのため、ソフトウェアパイプライニング最適化の動作を指定するオプション及び#pragma指令が用意されている。   Here, the prolog part and the epilog part are removed as shown in the processes of FIGS. 43B and 43C if possible. However, if it is not possible, the code size may increase without being removed. Therefore, an option to specify the operation of software pipelining optimization and #pragma directive are prepared.

図43(b)は、ループ処理におけるプロログ部・エピログ部を除去するための処理を示す概念図である。つまり、図43(a)で示されたイタレーション間で依存関係のない命令X、Y、Zの5回の繰り返しについて、前記のプロログ部・カーネル部・エピログ部の概念図で示したループの生成コードイメージを並び替えたものが示されている。ただし、図中の [] のついた命令は、読み込まれるが実行されないとする。   FIG. 43B is a conceptual diagram showing processing for removing the prolog portion and epilog portion in the loop processing. That is, for the five iterations of the instructions X, Y, and Z that have no dependency relationship between the iterations shown in FIG. 43 (a), the loop shown in the conceptual diagram of the prolog portion, kernel portion, and epilog portion described above. A reordered generated code image is shown. However, instructions with [] in the figure are read but not executed.

このようにすると、プロログ部・エピログ部は、カーネル部と同じ命令並びになることがわかる。よって、ループ回数は、プロログ部・エピログ部の実行分(4回)だけ増えるが、[]のついた命令をプレディケート(実行条件)によって制御することにより、図43(c)に示されるように、カーネル部だけでコードを生成することができる。   In this way, it can be seen that the prolog part and epilog part have the same instructions as the kernel part. Therefore, the number of loops increases by the amount of execution (4 times) of the prolog part and epilog part, but as shown in FIG. 43 (c) by controlling the instruction with [] according to the predicate (execution condition). The code can be generated only by the kernel part.

図43(c)に示された生成コードの実行順序は、以下のようになる。   The execution order of the generated code shown in FIG. 43 (c) is as follows.

1回目においては、プレディケート[C2]、[C3]の付加された命令は実行されない。よって、[C4]X のみ実行される。   In the first time, the instruction with the predicates [C2] and [C3] is not executed. Therefore, only [C4] X is executed.

2回目においては、プレディケート[C2]の付加された命令は実行されない。よって、[C3]Y 、[C4]X のみ実行される。   In the second time, the instruction with the predicate [C2] is not executed. Therefore, only [C3] Y and [C4] X are executed.

3〜5回目においては、[C2]Z、 [C3]Y、 [C4]X すべてが実行される。   In the third to fifth rounds, [C2] Z, [C3] Y, and [C4] X are all executed.

6回目においては、プレディケート[C4]の付加された命令は実行されない。よって、[C2]Zと [C3]Y のみ実行される。   In the sixth time, the instruction with the predicate [C4] is not executed. Therefore, only [C2] Z and [C3] Y are executed.

7回目においては、プレディケート[C3]、[C4]の付加された命令は実行されない。よって、[C2]Z のみ実行される。   In the seventh time, the instructions with the predicates [C3] and [C4] are not executed. Therefore, only [C2] Z is executed.

このように、カーネル部のループ1回目、2回目でプロログ部を、6回目、7回目でエピログ部を実行していることになる。   Thus, the prolog part is executed in the first and second loops of the kernel part, and the epilog part is executed in the sixth and seventh times.

よって、プロログ部・エピログ部のあるループでは、コードサイズが増加するが、ループ回数が減少するため、実行速度向上を期待できる。逆に、プロログ部・エピログ部を除去したループでは、コードサイズを削減できるが、ループ回数が増加するため、実行サイクル数が増加する。   Therefore, in a loop having a prolog part and an epilog part, the code size increases, but since the number of loops decreases, an improvement in execution speed can be expected. Conversely, in the loop from which the prolog part and epilog part are removed, the code size can be reduced, but the number of execution cycles increases because the number of loops increases.

そこで、このような最適化の選択を指定可能にするために、以下のコンパイルオプションとプラグマ指令が用意されている。   Therefore, the following compile options and pragma directives are prepared in order to be able to specify such optimization selection.

・コンパイルオプション
-fno-software-pipelining
・#pragma指令
#pragma _no_software_pipelining
#pragma _software_pipelining_no_proepi
#pragma _software_pipelining_with_proepi
・ Compile options
-fno-software-pipelining
#Pragma directive
#pragma _no_software_pipelining
#pragma _software_pipelining_no_proepi
#pragma _software_pipelining_with_proepi

なお、オプションとプラグマ指令が重複又は矛盾した場合には、プラグマ指令が優先する。   If the option and the pragma command overlap or contradict each other, the pragma command takes precedence.

図44は、ソフトウェアパイプライニング部122の動作を示すフローチャートである。解析部110によってオプション「-fno-software-pipelining」が検出された場合には(ステップS110、S111)、ソフトウェアパイプライニング部122は、対象となるソースプログラム101中の全てのループ処理に対してソフトウェアパイプライニング最適化を行わない(ステップS112)。このオプションによって、コードサイズが増加してしまうことが回避される。   FIG. 44 is a flowchart showing the operation of the software pipelining unit 122. When the option “-fno-software-pipelining” is detected by the analysis unit 110 (steps S110 and S111), the software pipelining unit 122 performs software for all the loop processes in the target source program 101. Pipelining optimization is not performed (step S112). This option avoids increasing the code size.

また、解析部110によってプラグマ指令「#pragma _no_software_pipelining」が検
出された場合には(ステップS110、S111)、ソフトウェアパイプライニング部122は、オプション指定にかかわらず、この指定の直後に置かれている1つのループ処理について、ソフトウェアパイプライニング最適化を行わない(ステップS113)。これによって、コードサイズが削減される。
When the analysis unit 110 detects the pragma command “#pragma_no_software_pipelining” (steps S110 and S111), the software pipelining unit 122 is placed immediately after this specification regardless of the option specification. Software pipelining optimization is not performed for the two loop processes (step S113). This reduces the code size.

また、解析部110によってプラグマ指令「#pragma _software_pipelining_no_proepi」が検出された場合には(ステップS110、S111)、ソフトウェアパイプライニング部122は、オプション指定にかかわらず、この指定の直後に置かれている1つのループ処理について、プロログ部・エピログ部が除去できる範囲でソフトウェアパイプライニング最適化を行う(ステップS114)。これによって、速度の向上とサイズの削減化が図られる。   If the pragma command “#pragma_software_pipelining_no_proepi” is detected by the analysis unit 110 (steps S110 and S111), the software pipelining unit 122 is placed immediately after this specification regardless of the option specification. For one loop process, software pipelining optimization is performed within a range in which the prolog part and epilog part can be removed (step S114). This improves speed and reduces size.

また、解析部110によってプラグマ指令「#pragma _software_pipelining_with_proepi」が検出された場合には(ステップS110、S111)、ソフトウェアパイプライニング部122は、オプション指定にかかわらず、この指定の直後に置かれている1つのループ処理について、プロログ部・エピログ部を除去せずに、可能な範囲で、ソフトウェアパイプライニング最適化を行う(ステップS115)。これによって、速度が向上される。   If the pragma command “#pragma_software_pipelining_with_proepi” is detected by the analysis unit 110 (steps S110 and S111), the software pipelining unit 122 is placed immediately after this specification regardless of the option specification. For one loop process, software pipelining optimization is performed as much as possible without removing the prolog part and the epilog part (step S115). This improves the speed.

なお、ソフトウェアパイプライニング部122は、#pragma _software_pipelining_no_proepi指令に対しては、プロログ部・エピログ部を除去できる範囲でソフトウェアパイプライニング最適化を行うが、#pragma _software_pipelining_with_proepi指令に対しては、プロログ部・エピログ部の除去が可能であっても、除去しない。プロログ部・エピログ部の除去可能なループであっても、図45に示される例のように、プロログ部・エピログ部の除去を抑制することにより、コードサイズは増加するが、実行速度の向上を期待できるからである。また、後述するように、ループ処理の最低繰り返し回数がソフトウェアパイプライニングによって重なり合うイタレーション数以上である場合には、ソフトウェアパイプライニング部122は、ソフトウェアパイプライニングによる最適化を行う。   The software pipelining unit 122 performs software pipelining optimization for the #pragma _software_pipelining_no_proepi command within the range that can remove the prolog and epilog units. Even if the part can be removed, it is not removed. Even in the loop where the prolog / epilog can be removed, as shown in the example shown in FIG. 45, by suppressing the removal of the prolog / epilog, the code size increases, but the execution speed is improved. Because it can be expected. As will be described later, when the minimum number of iterations of the loop processing is equal to or greater than the number of iterations overlapped by software pipelining, the software pipelining unit 122 performs optimization by software pipelining.

図45は、ソフトウェアパイプライニング最適化の例を示す図である。なお、この例では、ソフトウェアパイプライニング最適化を行うために、コンパイルオプション-O(実行速度とコードサイズ削減の最適化)をつけてコンパイルされている。   FIG. 45 is a diagram illustrating an example of software pipelining optimization. In this example, in order to perform software pipelining optimization, compilation is performed with the compile option -O (optimization of execution speed and code size reduction).

本図の左欄の中下段に示された機械語プログラム102の例から分かるように、デフォルトのソフトウェアパイプライニング最適化が行われた場合には、プロログ部・エピログ部のコードも除去され、ループ回数が101回でカーネル部のサイクル数が2サイクルとなり、合計207サイクルで実行され、ループの性能が向上している。   As can be seen from the example of the machine language program 102 shown in the middle and lower part of the left column of this figure, when the default software pipelining optimization is performed, the code of the prolog part and the epilog part is also removed, and the loop The number of times is 101 and the number of cycles of the kernel part is 2, which is executed in a total of 207 cycles, improving the loop performance.

一方、本図の右欄の中上段に示されたソースプログラム101から分かるように、左欄のソースプログラム101に対して #pragma _software_pipelining_with_proepi指令が追加指定され、ループのプロログ部・エピログ部の除去を抑制した例となっている。これにより、右欄の中下段に示された機械語プログラム102の例から分かるように、プロログ部・エピログ部のコードが生成されるため、左側と比べコードサイズが増加しているが、ループ回数が99回に減少しており、カーネル部サイクル数が2サイクルであるため、合計204サイクルで実行され、左欄の場合よりも更に実行速度が向上している。なお、プロログ部・エピログ部が周辺コードと並列実行可能な場合には、プロログ部・エピログ部による速度低下の影響は隠蔽できる。   On the other hand, as can be seen from the source program 101 shown in the upper middle of the right column of this figure, the #pragma_software_pipelining_with_proepi directive is additionally specified for the source program 101 in the left column, and the prolog and epilog portions of the loop are removed This is a suppressed example. As a result, as can be seen from the example of the machine language program 102 shown in the lower middle part of the right column, the code size of the prolog part and the epilog part is generated, so the code size is increased compared to the left side. Is reduced to 99 times, and the number of kernel part cycles is 2. Therefore, the execution is performed in a total of 204 cycles, and the execution speed is further improved as compared with the case of the left column. If the prolog part / epilog part can be executed in parallel with the peripheral code, the influence of the speed reduction by the prolog part / epilog part can be concealed.

[ループアンローリング部123]
次に、ループアンローリング部123の動作とその意義について説明する。ループアンローリング部123は、大きく分けて、(1)ループアンローリングの指定に関する最適化と、(2)ループの繰り返し回数についての保証に関する最適化とを行う。
[Loop unrolling section 123]
Next, the operation of the loop unrolling unit 123 and its significance will be described. The loop unrolling unit 123 roughly performs (1) optimization relating to designation of loop unrolling and (2) optimization relating to guarantees regarding the number of loop iterations.

まず、(1)ループアンローリングの指定に関する最適化について説明する。
ループアンローリング最適化とは、ループ高速化手法の1つである。複数のイタレーションを同時に実行することでループ内の実行を高速化する。ループアンローリング最適化を行うことにより、ldp/stp命令の生成や並列度の向上により、実行速度の向上を図ることができる。しかし、コードサイズが増加することと、場合によっては、レジスタ不足によるスピルが発生し、逆に性能が低下してしまう場合がある。
First, (1) optimization related to designation of loop unrolling will be described.
Loop unrolling optimization is one of loop acceleration methods. Speed up execution in a loop by running multiple iterations simultaneously. By performing loop unrolling optimization, it is possible to improve execution speed by generating ldp / stp instructions and improving parallelism. However, the code size increases and, depending on the case, a spill due to a shortage of registers may occur, and conversely, the performance may be degraded.

なお、ロードペア(ストアペア)命令(ldp/stp命令)とは、二つのロード命令(ストア命令)を1命令で実現した命令である。また、「スピル」とは、空きレジスタを確保する為に、使用されているレジスタを一時的にスタックに退避させることである。この場合には、レジスタの退避・復帰のためにロード・ストア命令が生成される。   The load pair (store pair) instruction (ldp / stp instruction) is an instruction that realizes two load instructions (store instructions) with one instruction. Further, “spill” is to temporarily save a used register in the stack in order to secure an empty register. In this case, a load / store instruction is generated for saving and restoring the register.

このようなループアンローリング最適化の動作を指定するオプション及び#pragma指令が用意されている。   Options and #pragma directives are provided to specify such loop unrolling optimization behavior.

・コンパイルオプション
-fno-loop-unroll
・#pragma指令
#pragma _loop_unroll
#pragma _no_loop_unroll
・ Compile options
-fno-loop-unroll
#Pragma directive
#pragma _loop_unroll
#pragma _no_loop_unroll

図46は、ループアンローリング部123の動作を示すフローチャートである。解析部110によってオプション「-fno-loop-unroll」が検出された場合には(ステップS120、S121)、ループアンローリング部123は、対象となるソースプログラム101中の全てのループ処理に対してループアンローリング最適化を行わない(ステップS122)。このオプションによって、コードサイズが増加してしまうことが回避される。   FIG. 46 is a flowchart showing the operation of the loop unrolling unit 123. If the option “-fno-loop-unroll” is detected by the analysis unit 110 (steps S120 and S121), the loop unrolling unit 123 performs loop processing for all loop processes in the target source program 101. Unrolling optimization is not performed (step S122). This option avoids increasing the code size.

また、解析部110によってプラグマ指令「#pragma _loop_unroll」が検出された場合には(ステップS120、S121)、ループアンローリング部123は、直後に置かれている1つのループ処理に対してループアンローリング最適化を行う(ステップS123)。これによって、速度が向上される。   Further, when the pragma command “#pragma_loop_unroll” is detected by the analysis unit 110 (steps S120 and S121), the loop unrolling unit 123 performs loop unrolling with respect to one loop process placed immediately after. Optimization is performed (step S123). This improves the speed.

また、解析部110によってプラグマ指令「#pragma _no_loop_unroll」が検出された
場合には(ステップS120、S121)、ループアンローリング部123は、直後に置かれている1つのループ処理に対してループアンローリング最適化を行わない(ステップS124)。これによってコードサイズの増加が回避される。
In addition, when the pragma command “#pragma_no_loop_unroll” is detected by the analysis unit 110 (steps S120 and S121), the loop unrolling unit 123 performs loop unrolling with respect to one loop process placed immediately after. Optimization is not performed (step S124). This avoids an increase in code size.

なお、最適化レベル指定に-O/-Ot(実行速度を優先した最適化)が指定されている場合は、ループアンローリング部123は、ループアンローリング最適化が可能であるなら、デフォルトでループアンローリング最適化を行う。最適化レベル指定に-Os(コードサイズ削減を優先した最適化)が指定されている場合は、ループアンローリング部123は、ループアンローリング最適化を行わない。よって、ユーザは、これらの最適化レベル指定コンパイルオプションと組み合わせて、個々のループのループアンローリング最適化の適用を、#pragma _no_loop_unroll指令及び#pragma _loop_unroll 指令で制御することが可能である。   If -O / -Ot (optimization with priority on execution speed) is specified in the optimization level specification, the loop unrolling unit 123 defaults to loop if loop unrolling optimization is possible. Perform unrolling optimization. When -Os (optimization with priority given to code size reduction) is designated as the optimization level designation, the loop unrolling unit 123 does not perform loop unrolling optimization. Therefore, the user can control the application of the loop unrolling optimization of each loop with the #pragma_no_loop_unroll instruction and the #pragma_loop_unroll instruction in combination with these optimization level specification compilation options.

図47は、#pragma _loop_unroll指令による最適化の例を示す図である。本図の左欄は、最適化レベル指定コンパイルオプション -Oのみをつけてコンパイルした場合の例であり、本図の右欄は、#pragma _loop_unroll指令を組み合わせてコンパイルした場合の例である。   FIG. 47 is a diagram illustrating an example of optimization by the #pragma_loop_unroll command. The left column of this figure is an example when compiling with only the optimization level specification compilation option -O, and the right column of this figure is an example when compiling with the #pragma _loop_unroll directive.

本図の左欄の中下段に示された機械語プログラム102の例から分かるように、プロログ部・エピログ部が除去されたソフトウェアパイプライニング最適化が適用されている。そのため、カーネル部の3命令(2サイクル)が101回実行され、全体として合計207サイクルかかっている。   As can be seen from the example of the machine language program 102 shown in the middle and lower part of the left column of this figure, software pipelining optimization in which the prolog part and the epilog part are removed is applied. Therefore, 3 instructions (2 cycles) in the kernel part are executed 101 times, and it takes a total of 207 cycles.

一方、右欄の中下段に示された機械語プログラム102の例から分かるように、左側と同様にソフトウェアパイプライニング最適化が行われ、プロログ部・エピログ部が削除されている。それに、この右欄の機械語プログラム102では、ループアンローリング最適化により、ループ回数が半減しているため、カーネル部の6命令(2サイクル)が52回実行され、全体として合計110サイクルで実行され、速度が向上している。   On the other hand, as can be seen from the example of the machine language program 102 shown in the middle and lower part of the right column, software pipelining optimization is performed as in the left side, and the prolog part and epilog part are deleted. In addition, in the machine language program 102 in the right column, since the number of loops is halved by the loop unrolling optimization, 6 instructions (2 cycles) of the kernel part are executed 52 times, and executed in total 110 cycles. And the speed has been improved.

次に、ペアメモリアクセス命令(ldp/stp)の生成によりループアンローリング最適化
をより効果的に使用する方法を示す。
Next, a method of using loop unrolling optimization more effectively by generating a pair memory access instruction (ldp / stp) will be described.

ループアンローリング最適化では、現在のイタレーションと次のイタレーションを同時に実行するため、以下のような連続する領域のデータのロード・ストアが生成される場合がある。   In the loop unrolling optimization, the current iteration and the next iteration are executed at the same time. Therefore, the following data load / store of the continuous region may be generated.

ld r1,(r4);;
ld r2,(r4,4);;
ld r1, (r4) ;;
ld r2, (r4,4) ;;

アクセスするデータが、必ず8バイトアラインされて配置されているならば、以下のようなペアメモリアクセス命令(ldp命令)を生成することができる。   If the data to be accessed is always arranged with 8-byte alignment, the following pair memory access instruction (ldp instruction) can be generated.

ldp r1:r2,(r4+);;   ldp r1: r2, (r4 +) ;;

図48は、ペアメモリアクセス命令(ldp/stp)の生成によりループアンローリング最適化をより効果的に使用する例を示す図である。ここでは、ソフトウェアパイプライニング最適化が適用されている。   FIG. 48 is a diagram illustrating an example in which loop unrolling optimization is more effectively used by generating a pair memory access instruction (ldp / stp). Here, software pipelining optimization is applied.

本図の右欄の例では、中下段に示された機械語プログラム102の例から分かるように、ループアンローリング最適化によりループ回数が半減されている。また、#pragma _align_local_pointer指令を使用して、ポインタ変数 pa、pbが8バイトアラインされているアドレスと明示することにより、ロードペア(ストアペア)命令が生成される。   In the example in the right column of this figure, as can be seen from the example of the machine language program 102 shown in the middle and lower sections, the number of loops is halved by the loop unrolling optimization. Also, by using the #pragma_align_local_pointer directive, the load variables (store pair) instructions are generated by specifying the pointer variables pa and pb as 8-byte aligned addresses.

これらの最適化により、左欄の例では、カーネル部の5命令3サイクルが101回実行され、全体として合計308サイクルであるが、右欄の例では、カーネル部の7命令3サイクルが半分の51回実行され、全体として合計158サイクルで実行され、速度が向上している。   As a result of these optimizations, in the example in the left column, 5 instructions and 3 cycles in the kernel part are executed 101 times, and the total is 308 cycles, but in the example in the right column, 7 instructions and 3 cycles in the kernel part are halved. It is executed 51 times, and it is executed in a total of 158 cycles, and the speed is improved.

次に、ループアンローリング部123による、(2)ループの繰り返し回数の保証に関する最適化について説明する。   Next, (2) optimization related to guaranteeing the number of loop iterations by the loop unrolling unit 123 will be described.

プログラムの記述上、コンパイラ100ではループ回数を特定することができない場合、ループ高速化の各最適化を効果的に行うことができない。   If the compiler 100 cannot specify the number of loops in the description of the program, each optimization of loop speedup cannot be performed effectively.

そこで、ユーザは、下記に示す#pragma指令にて、ループ回数の情報を提供することにより、より効果的にソフトウェアパイプライニング等のループ高速化の最適化を行わせることができる。   Therefore, the user can optimize the loop speedup such as software pipelining more effectively by providing information on the number of loops with the #pragma directive shown below.

・#pragma指令
#pragma _min_iteration=NUM
#pragma _iteration_even
#pragma _iteration_odd
#Pragma directive
#pragma _min_iteration = NUM
#pragma _iteration_even
#pragma _iteration_odd

図46において、解析部110によってプラグマ指令「#pragma _min_iteration=NUM」が検出された場合には(ステップS120、S121)、ループアンローリング部123は、直後に置かれている1つのループ処理が最低NUM回繰り返されることを前提に、ループアンローリング最適化を行う(ステップS125)。例えば、例えば、保証された繰り返し最低回数がループアンローリングによる展開数以上である場合に、ループアンローリング部123は、そのループ処理のループアンロールを行う。これによって、速度の向上とサイズの削減が図られる。   In FIG. 46, when the pragma command “# pragma_min_iteration = NUM” is detected by the analysis unit 110 (steps S120 and S121), the loop unrolling unit 123 determines that one loop process immediately after is the lowest. The loop unrolling optimization is performed on the assumption that NUM is repeated (step S125). For example, for example, when the guaranteed minimum number of repetitions is equal to or greater than the number of expansions by loop unrolling, the loop unrolling unit 123 performs loop unrolling of the loop processing. This improves speed and reduces size.

また、解析部110によってプラグマ指令「#pragma _iteration_even」が検出された場合には(ステップS120、S121)、ループアンローリング部123は、直後に置かれている1つのループ処理が偶数回繰り返されることを前提に、ループアンローリング最適化を行う(ステップS126)。これによって、実行速度が向上される。   Further, when the pragma command “#pragma_iteration_even” is detected by the analysis unit 110 (steps S120 and S121), the loop unrolling unit 123 repeats an even number of loop processes immediately after the loop processing. As a premise, loop unrolling optimization is performed (step S126). As a result, the execution speed is improved.

また、解析部110によってプラグマ指令「#pragma _iteration_odd」が検出された場合には(ステップS120、S121)、ループアンローリング部123は、直後に置かれている1つのループ処理が奇数回繰り返されることを前提に、ループアンローリング最適化を行う(ステップS126)。これによって、実行速度が向上される。   Further, when the pragma command “#pragma_iteration_odd” is detected by the analysis unit 110 (steps S120 and S121), the loop unrolling unit 123 repeats an odd number of loop processes immediately after it. As a premise, loop unrolling optimization is performed (step S126). As a result, the execution speed is improved.

なお、#pragma _min_iteration指令で1以上の値を指定した場合、1回もループを通らない場合のために生成されるエスケープコードを除去できるという効果もある。また、繰り返し回数が不明なループに対して、ループアンローリング最適化を期待する場合、遇数回ループか奇数回ループかが決まっているならば、_iteration_even /#pragma _iteration_odd指令を使用することにより、ループアンローリング最適化の適用が可能になるため、実行速度向上を期待することができる。   Note that when a value of 1 or more is specified by the #pragma_min_iteration command, there is an effect that an escape code generated for the case where the loop does not pass once can be removed. Also, when loop unrolling optimization is expected for a loop whose number of iterations is unknown, if it is decided whether the loop is an even number of times or an odd number of times, by using the _iteration_even / # pragma _iteration_odd directive, Since loop unrolling optimization can be applied, an improvement in execution speed can be expected.

図49は、#pragma _min_iteration指令による最適化の例を示す図である。ここでは、繰り返し回数が不明なループでの、#pragma _min_iteration指令の使用効果が示されている。ただし、サイクル比較のため、引数endの値を100とする。   FIG. 49 is a diagram illustrating an example of optimization by the #pragma_min_iteration command. Here, the effect of using the #pragma_min_iteration directive in a loop where the number of iterations is unknown is shown. However, the value of the argument end is set to 100 for cycle comparison.

本図の左欄では、中下段に示された機械語プログラム102の例から分かるように、ループ回数が不明なため、一度もループを実行しない場合にループ本体を飛び越すための cmple/br 命令(エスケープコード)が生成されている。また、ループ命令の生成を行うことができないため、加算命令・比較命令・ジャンプ命令でループが生成されている。サイクル数は、ループ部が7命令4サイクルの100回繰り返しとなり、全体として合計405サイクルとなっている。   In the left column of this figure, as can be seen from the example of the machine language program 102 shown in the lower middle part, since the number of loops is unknown, the cmple / br instruction (for jumping over the loop body when the loop is never executed) Escape code) is generated. Since a loop instruction cannot be generated, a loop is generated with an addition instruction, a comparison instruction, and a jump instruction. As for the number of cycles, the loop part is repeated 100 times of 4 cycles of 7 instructions, and the total number is 405 cycles.

一方、本図の右欄では、中上段に示されたソースプログラム101の例から分かるように、繰り返し回数が不明であるが、最低4回繰り返されることが#pragma _min_iteration指令で指定されている。これにより、ループ回数が0回の場合を考慮する必要が無いため、ループアンローリング部123は、エスケープコードを生成する必要がなくなる。   On the other hand, in the right column of this figure, as can be seen from the example of the source program 101 shown in the upper middle part, the number of repetitions is unknown, but it is specified by the #pragma_min_iteration command that it is repeated at least four times. Thereby, since it is not necessary to consider the case where the number of loops is 0, the loop unrolling unit 123 does not need to generate an escape code.

また、ループ最低回数を考慮して、ループアンローリング部123は、ループ命令を生成することができる。例えば、保証された繰り返し最低回数(4)がループアンローリングによる展開数(この例では、3サイクル)以上であるので、ループアンローリング部123は、ループアンロールを行う。   In consideration of the minimum number of loops, the loop unrolling unit 123 can generate a loop instruction. For example, since the guaranteed minimum number of repetitions (4) is equal to or greater than the number of expansions by loop unrolling (3 cycles in this example), the loop unrolling unit 123 performs loop unrolling.

さらに、この例では、さらにソフトウェアパイプライニング最適化が可能になっている。これは、保証されたループの繰り返し最低回数(4)がソフトウェアパイプライニングによって重なり合うイタレーション数以上であったために、ソフトウェアパイプライニング部122がソフトウェアパイプライニングによる最適化を行ったためである。   Furthermore, in this example, further software pipelining optimization is possible. This is because the minimum number of loop iterations (4) guaranteed is equal to or greater than the number of iterations overlapped by software pipelining, so that the software pipelining unit 122 performs optimization by software pipelining.

右欄の中下段に示された機械語プログラム102の例から分かるように、サイクル数は、ループ部が5命令3サイクルの101回繰り返しとなり、全体として合計308サイクルとなり、実行速度とサイズ削減が実現されている。   As can be seen from the example of the machine language program 102 shown in the middle and lower part of the right column, the number of cycles is 101 times of 5 instructions and 3 cycles in the loop part, and the total number of cycles is 308 cycles. It has been realized.

図50及び図51は、#pragma _iteration_even/#pragma _iteration_odd指令による最適化の例を示す図である。図50は、ループ回数が不明の場合におけるソースプログラム101の例(左欄)と、そこから生成される機械語プログラム102の例(右欄)を示す図である。本図から分かるように、実際のループ回数が不明な場合、ループアンローリング最適化は適用できない。これは、ループ回数が偶数回の場合と奇数回の場合では、ループアンローリング最適化によって生成されるコードが異なるためである。   50 and 51 are diagrams showing an example of optimization by the # pragma_iteration_even / # pragma_iteration_odd command. FIG. 50 is a diagram illustrating an example of the source program 101 (left column) when the number of loops is unknown and an example of the machine language program 102 generated from the source program 101 (right column). As can be seen from this figure, when the actual number of loops is unknown, loop unrolling optimization cannot be applied. This is because the codes generated by the loop unrolling optimization differ between the case where the number of loops is an even number and the case where the number of loops is an odd number.

ところが、図51に示されるように、繰り返し回数が不明なループの場合でも、遇数回ループか奇数回ループかを指定することにより、ループアンローリング最適化を適用することができる。   However, as shown in FIG. 51, even in the case of a loop whose number of iterations is unknown, loop unrolling optimization can be applied by designating whether the loop is an even number or an odd number.

本図の左欄では、ループ回数が偶数回であることを、#pragma _iteration_even指令で指定されているため、ループアンローリング部123によるループアンローリング最適化が行われ、左欄の中下段に示された機械語プログラム102の例から分かるように、偶数回用のコードが生成されている。   In the left column of this figure, the loop unrolling optimization is performed by the loop unrolling unit 123 because the number of loops is specified by the #pragma _iteration_even directive, and is shown in the middle and lower part of the left column. As can be seen from the example of the machine language program 102, a code for an even number of times is generated.

また、本図の右欄では、ループ回数が奇数回であることを、#pragma _iteration_odd指令により指定されているため、ループアンローリング部123によるループアンローリング最適化が行われ、右欄の中下段に示された機械語プログラム102の例から分かるように、奇数回用のコードが生成されている。この右欄の例から分かるように、左欄に示された偶数回の場合の生成コードと初期化部・ループ部はほぼ同じで、後処理部に、ループの最後の一回分を実行するコードが生成されている。   Also, in the right column of this figure, since the number of loops is an odd number is specified by the #pragma_iteration_odd directive, loop unrolling optimization by the loop unrolling unit 123 is performed, As can be seen from the example of the machine language program 102 shown in FIG. As can be seen from the example in the right column, the generated code for the even number of times shown in the left column and the initialization unit / loop unit are almost the same, and the code for executing the last one loop in the post-processing unit Has been generated.

このように、ループ回数が不明であっても、偶数回であるか奇数回であるかを保証することで、ループアンローリング部123は、ループアンローリング最適化を行うことができ、これによって実行速度が向上される。   In this way, even if the number of loops is unknown, the loop unrolling unit 123 can perform the loop unrolling optimization by guaranteeing whether it is an even number or an odd number. Speed is improved.

[if変換部124]
次に、if変換部124の動作とその意義について説明する。
[If conversion unit 124]
Next, the operation of the if conversion unit 124 and its significance will be described.

通常、C言語プログラムのif構造をコンパイルすると、分岐命令(br命令)が生成される。これに対して、if変換とは、C言語プログラムのif構造を分岐命令を用いることなく、条件付き実行命令だけに書き換えることである。これによって、実行順序が固定化される(順次実行となる)るので、パイプラインの乱れが回避され、実行速度が向上され得る。なお、条件付き実行命令とは、その命令に含まれる条件(プレディケート)がプロセッサ1の状態(コンディションフラグ)と一致している場合にだけ実行される命令である。   Normally, when an if structure of a C language program is compiled, a branch instruction (br instruction) is generated. On the other hand, if conversion refers to rewriting the if structure of a C language program to only conditional execution instructions without using branch instructions. As a result, the execution order is fixed (becomes sequential execution), so that the disturbance of the pipeline can be avoided and the execution speed can be improved. The conditional execution instruction is an instruction that is executed only when the condition (predicate) included in the instruction matches the state (condition flag) of the processor 1.

if変換により、if構造のワーストケースにおける実行時間は短縮されるが、ベストケースにおける実行時間は(短縮後の)ワースト実行時間と等しくなる。そのために、if構造の特性(条件成立・不成立それぞれの発生頻度や各パスの実行サイクル数)に応じて、if変換を適用すべき場合とすべきでない場合がある。   The if conversion reduces the execution time in the worst case of the if structure, but the execution time in the best case becomes equal to the worst execution time (after reduction). Therefore, there are cases where the if conversion should or should not be applied depending on the characteristics of the if structure (the occurrence frequency of each of the conditions and whether or not the condition is satisfied and the number of execution cycles of each path).

このため、ユーザは、適用の可否をコンパイルオプションや#pragma指令で指示することができる。   For this reason, the user can instruct whether or not it is applicable with a compile option or #pragma directive.

・コンパイルオプション
-fno-if-conversion
・#pragma指令
#pragma _if_conversion
#pragma _no_if_conversion
・ Compile options
-fno-if-conversion
#Pragma directive
#pragma _if_conversion
#pragma _no_if_conversion

なお、オプションとプラグマ指令が重複又は矛盾した場合には、プラグマ指令が優先する。   If the option and the pragma command overlap or contradict each other, the pragma command takes precedence.

図52は、if変換部124の動作を示すフローチャートである。解析部110によってオプション「-fno-if-conversion」が検出された場合には(ステップS130、S131)、if変換部124は、対象となるソースプログラム101中の全てのif構造文に対してif変換を行わない(ステップS132)。なお、本オプションが検出されない場合は、if変換部124は、if変換が可能であり、かつ、そのワーストケースの時間がif変換前に対して短いif構造文である場合に、そのif構造文をif変換する。   FIG. 52 is a flowchart showing the operation of the if conversion unit 124. If the option “-fno-if-conversion” is detected by the analysis unit 110 (steps S130 and S131), the if conversion unit 124 determines if for all the if structure statements in the target source program 101. Conversion is not performed (step S132). If this option is not detected, the if conversion unit 124 can perform the if conversion, and the if structure sentence when the worst case time is an if structure sentence shorter than that before the if conversion. Is converted.

また、解析部110によってプラグマ指令「#pragma _if_conversion」が検出された場合には(ステップS130、S131)、if変換部124は、オプション指定にかかわらず、直後に置かれている1つのif構造文に対して、可能であればif変換を行う(ステップS133)。これによって、速度が向上される。   Also, when the pragma command “#pragma_if_conversion” is detected by the analysis unit 110 (steps S130 and S131), the if conversion unit 124 sets one if structure statement immediately after it regardless of the option designation. If possible, if conversion is performed (step S133). This improves the speed.

また、解析部110によってプラグマ指令「#pragma _no_if_conversion」が検出された場合には(ステップS130、S131)、if変換部124は、オプション指定にかかわらず、直後に置かれている1つのif構造文に対して、if変換を行わない(ステップS134)。これによって、速度が向上される。   Also, when the pragma command “#pragma_no_if_conversion” is detected by the analysis unit 110 (steps S130 and S131), the if conversion unit 124 sets one if structure statement immediately after it regardless of the option designation. In contrast, if conversion is not performed (step S134). This improves the speed.

図53は、#pragma _no_if_conversion指令でコンパイルした場合と、#pragma _if_conversion指令でコンパイルした場合の機械語プログラム102の例を示す図である。   FIG. 53 is a diagram illustrating an example of the machine language program 102 when compiled with the #pragma_no_if_conversion command and when compiled with the #pragma_if_conversion command.

本図の左欄では、中下段の機械語プログラム102の例から分かるように、if変換を抑制したことにより、分岐命令が生成されている(実行サイクル数:5あるいは7、 コードサイズ:12バイト)。   In the left column of this figure, as can be seen from the example of the machine language program 102 in the lower middle part, branch instructions are generated by suppressing if conversion (the number of execution cycles: 5 or 7, code size: 12 bytes) ).

一方、本図の右欄では、中下段の機械語プログラム102の例から分かるように、#pragma指令によってif変換を行うこととしたことにより、分岐命令が、条件付き命令(プレディケート付き命令)に置き換わっている(実行サイクル数:4、 コードサイズ:8バイト)。このように、if変換を実施することで、実行速度比1.25倍、 コードサイズ比67%が達成されている。   On the other hand, in the right column of the figure, as can be seen from the example of the machine language program 102 in the lower middle part, the branch instruction is changed to a conditional instruction (an instruction with a predicate) by performing the if conversion by the #pragma instruction. Has been replaced (number of execution cycles: 4, code size: 8 bytes). In this way, by executing the if conversion, an execution speed ratio of 1.25 times and a code size ratio of 67% are achieved.

[ペア命令生成部125]
次に、ペア命令生成部125の動作とその意義について説明する。ペア命令生成部125は、大きく分けて、(1)配列・構造体のアラインメントの設定に関する最適化と、(2)仮引数ポインタ・ローカルポインタのアラインの保証に関する最適化とを行う。
[Pair instruction generator 125]
Next, the operation of the pair instruction generation unit 125 and its significance will be described. The pair instruction generation unit 125 is roughly divided into (1) optimization related to the setting of alignment of arrays and structures, and (2) optimization related to guarantee of alignment of dummy argument pointers and local pointers.

まず、(1)配列・構造体のアラインメントの設定に関する最適化について説明する。
ユーザは、以下のオプションを用いて、配列と構造体の先頭アドレスのアラインを指定することができる。アラインメントを調整することで、メモリアクセス命令のペアリング(2つのレジスタとメモリ間の転送をひとつの命令で行うこと)が可能となり、実行速度の向上が期待できる。その反面、アラインメント値を大きくすると、データの未使用領域が増加し、データサイズが増大する可能性がある。
First, (1) optimization related to setting of alignment of arrays / structures will be described.
The user can specify the alignment of the start address of the array and structure using the following options: By adjusting the alignment, it becomes possible to pair memory access instructions (transfer between two registers and memory with one instruction), and an improvement in execution speed can be expected. On the other hand, when the alignment value is increased, the unused area of data increases, and the data size may increase.

・コンパイルオプション
-falign_char_array=NUM (NUM=2,4または8)
-falign_short_array=NUM (NUM=4または8)
-falign_int_array=NUM (NUM=8)
-falign_all_array=NUM (NUM=2,4または8)
-falign_struct=NUM (NUM=2,4または8)
・ Compile options
-falign_char_array = NUM (NUM = 2,4 or 8)
-falign_short_array = NUM (NUM = 4 or 8)
-falign_int_array = NUM (NUM = 8)
-falign_all_array = NUM (NUM = 2,4 or 8)
-falign_struct = NUM (NUM = 2,4 or 8)

上記オプションは、上から順に、char型の配列、short型整数、int型整数、それら3つののデータ型全ての配列、構造体のアラインメントを指定している。また、"NUM"は、アラインするサイズ(バイト)を示す。   The above options specify, from the top, an array of char type, a short type integer, an int type integer, an array of all three data types, and an alignment of structures. “NUM” indicates the size (bytes) to be aligned.

図54は、ペア命令生成部125の動作を示すフローチャートである。解析部110によって上記オプションのいずれかが検出された場合には(ステップS140、S141)、ペア命令生成部125は、対象となるソースプログラム101で宣言されている指定された型の全ての配列又は構造体について、その先頭アドレスが指定されたNUMバイトのアラインとなるように配列又は構造体をメモリに配置し、その配列又は構造体にアクセスする命令については、可能な場合に、ペアリング(2つのレジスタとメモリ間の転送を並行して行う命令の生成)を行う(ステップS142)。これによって、実行速度が向上される。   FIG. 54 is a flowchart showing the operation of the pair instruction generation unit 125. When any of the above options is detected by the analysis unit 110 (steps S140 and S141), the pair instruction generation unit 125 selects all the arrays of the specified type declared in the target source program 101 or For a structure, an array or structure is arranged in a memory so that the start address is aligned with a specified NUM byte, and for instructions that access the array or structure, pairing (2 (Generation of an instruction for transferring data between one register and a memory in parallel) (step S142). As a result, the execution speed is improved.

図55は、サンプルプログラムをオプションなしでコンパイルした場合と、オプション'-falign-short-array=4'でコンパイルした場合のアセンブリコードを示す図である。   FIG. 55 is a diagram showing assembly code when the sample program is compiled without an option and when it is compiled with the option “-falign-short-array = 4”.

本図の左欄に示されたオプションなしの場合、中下段に示された機械語プログラム102の例から分かるように、アラインメントが不明のため、ロード命令のペアリング(2つのレジスタとメモリ間の転送をひとつの命令で行う)ができない(実行サイクル数:25、 コードサイズ:22)。   In the case of no option shown in the left column of this figure, since the alignment is unknown as can be seen from the example of the machine language program 102 shown in the lower middle part, pairing of load instructions (between two registers and memory) Transfer cannot be performed with one instruction) (number of execution cycles: 25, code size: 22).

一方、本図の右欄に示されたオプションありの場合、配列が4バイトでアラインされるため、中下段に示された機械語プログラム102の例から分かるように、最適化部120によるペアリングが実現されている(実行サイクル数:15、 コードサイズ:18)。このように、アラインメントの指定によって、実行速度比1.67倍、 コードサイズ比
82%が達成されている。
On the other hand, in the case of the option shown in the right column of the figure, since the array is aligned with 4 bytes, as can be seen from the example of the machine language program 102 shown in the middle and lower rows, pairing by the optimization unit 120 is performed. Is realized (number of execution cycles: 15, code size: 18). As described above, the execution speed ratio of 1.67 times and the code size ratio of 82% are achieved by specifying the alignment.

次に、ペア命令生成部125による、(2)仮引数ポインタ・ローカルポインタのアラインの保証に関する最適化を説明する。   Next, (2) optimization related to guaranteeing alignment of the dummy argument pointer / local pointer by the pair instruction generation unit 125 will be described.

ユーザは、以下のプラグマ指令を用いて、関数引数のポインタ変数の指すデータのアラインメントや、ローカルポインタ変数の指すデータのアラインメントを保証することで、最適化部120によるメモリアクセス命令のペアリングが可能となり、実行速度の向上が期待できる。   The user can perform pairing of memory access instructions by the optimization unit 120 by guaranteeing the alignment of the data pointed to by the pointer variable of the function argument and the alignment of the data pointed to by the local pointer variable using the following pragma directive Therefore, improvement in execution speed can be expected.

・#pragma指令
#pragma _align_parm_pointer=NUM 変数名 [, 変数名, …]
#pragma _align_local_pointer=NUM 変数名 [, 変数名, …]
#Pragma directive
#pragma _align_parm_pointer = NUM variable name [, variable name,…]
#pragma _align_local_pointer = NUM variable name [, variable name,…]

なお、"NUM"はアラインするサイズ(2,4又は8バイト)を表す。また、上記#pragma指令で保証されたポインタ変数の指すデータが指定されたバイト境界にアラインされていなかった場合には、プログラムの正常動作は保証されない。   “NUM” represents the size to be aligned (2, 4 or 8 bytes). If the data pointed to by the pointer variable guaranteed by the #pragma directive is not aligned to the specified byte boundary, the normal operation of the program is not guaranteed.

図54において、解析部110によってプラグマ指令「#pragma _align_parm_pointer=NUM 変数名 [, 変数名, …]」が検出された場合には(ステップS140、S141)、ペア命令生成部125は、"変数名"で示される引数のポインタ変数の指すデータが引数渡しの時点でNUMバイトにアラインされているものとし、その配列にアクセスする命令については、可能な場合に、ペアリングを行う(ステップS143)。これによって、実行速度が向上される。   54, when the analysis unit 110 detects the pragma command “# pragma_align_parm_pointer = NUM variable name [, variable name,...]” (Steps S140 and S141), the pair instruction generation unit 125 displays “variable name”. It is assumed that the data pointed to by the pointer variable of the argument indicated by “is aligned to the NUM byte at the time of argument passing, and the instruction for accessing the array is paired if possible (step S143). As a result, the execution speed is improved.

また、解析部110によってプラグマ指令「#pragma _align_local_pointer=NUM 変数
名[, 変数名, …]」が検出された場合には(ステップS140、S141)、ペア命令生成部125は、"変数名"で示されるローカルポインタ変数の指すデータが関数内部で常にNUMバイトでアラインされているものとし、その配列にアクセスする命令については、可能な場合に、ペアリングを行う(ステップS144)。これによって、実行速度が向上される。
When the analysis unit 110 detects the pragma command “# pragma_align_local_pointer = NUM variable name [, variable name,...]” (Steps S140 and S141), the pair instruction generation unit 125 sets the “variable name”. It is assumed that the data pointed to by the indicated local pointer variable is always aligned with NUM bytes inside the function, and instructions that access the array are paired if possible (step S144). As a result, the execution speed is improved.

図56は、プラグマ指令「#pragma _align_parm_pointer=NUM 変数名 [, 変数名, …]」による最適化の例を示す図である。   FIG. 56 is a diagram illustrating an example of optimization by the pragma command “# pragma_align_parm_pointer = NUM variable name [, variable name,...]”.

本図の左欄に示されるように、#pragma _align_parm_pointerを与えない場合、ポインタ変数srcの指すデータのアラインメントが不明なため、中下段に示された機械語プログラム102の例から分かるように、各データはそれぞれ独立にロードされる(実行サイクル数160、コードサイズ:24バイト)。   As shown in the left column of this figure, when #pragma _align_parm_pointer is not given, the alignment of the data pointed to by the pointer variable src is unknown, so as can be seen from the example of the machine language program 102 shown in the lower middle part, Data is loaded independently (160 execution cycles, code size: 24 bytes).

一方、本図の右欄に示されるように、#pragma指令を与えると、データは4バイト境界にアラインされるため、中下段の機械語プログラム102の例から分かるように、メモリ読み出しのペアリングが行われる(実行サイクル数:107、 コードサイズ:18バイト)。このように、アライメントを指定することで、実行速度比1.50倍、 コードサイズ比43%が達成される。   On the other hand, as shown in the right column of this figure, when the #pragma directive is given, the data is aligned on a 4-byte boundary. (Number of execution cycles: 107, code size: 18 bytes). Thus, by specifying the alignment, an execution speed ratio of 1.50 times and a code size ratio of 43% are achieved.

図57は、プラグマ指令「#pragma _align_local_pointer=NUM 変数名 [, 変数名, …]」による最適化の例を示す図である。   FIG. 57 is a diagram showing an example of optimization by the pragma command “# pragma_align_local_pointer = NUM variable name [, variable name,...]”.

本図の左欄に示されるように、#pragma _align_local_pointerを与えない場合、ポインタ変数from、toの指すデータのアラインメントが不明なため、中下段に示された機械語プログラム102の例から分かるように、配列要素はそれぞれ独立にロードされる(実行サイクル数:72、 コードサイズ:30)。   As shown in the left column of this figure, if #pragma _align_local_pointer is not given, the alignment of the data pointed to by pointer variables from and to is unknown, so as can be seen from the example of the machine language program 102 shown in the middle and lower rows The array elements are loaded independently (number of execution cycles: 72, code size: 30).

一方、本図の右欄に示されるように、#pragma _align_parm_pointerを与えることで、中下段に示された機械語プログラム102の例から分かるように、ポインタ変数from、toの指すデータが4バイト境界にアラインされていることを利用したメモリ読み出しのペアリングが可能となる。(実行サイクル数:56、 コードサイズ:22)。このように、アライメントを指定することで、実行速度比1.32倍、 コードサイズ比73%が達成される。   On the other hand, as shown in the right column of this figure, by giving #pragma _align_parm_pointer, the data pointed to by pointer variables from and to is a 4-byte boundary, as can be seen from the example of the machine language program 102 shown in the middle and lower row. It is possible to perform pairing of memory reading using the fact that they are aligned with each other. (Number of execution cycles: 56, code size: 22). Thus, by specifying the alignment, an execution speed ratio of 1.32 times and a code size ratio of 73% are achieved.

本発明のコンパイラによれば、コンパイラによる各種最適化の種類ごとにON/OFFやその程度を指定したり、プログラム中の変数やループ処理等の単位で最適化をON/OFFさせたりする等のきめ細かい制御が可能となり、特に、精密な最適化のチューニングが必要とされるメディア処理のアプリケーション開発に有用である。   According to the compiler of the present invention, it is possible to specify ON / OFF and its degree for each type of optimization by the compiler, to turn optimization on / off in units such as variables and loop processing in the program, etc. Fine control is possible, and it is particularly useful for developing media processing applications that require precise optimization tuning.

1 プロセッサ
10 命令制御部
20 デコード部
30 レジスタファイル
31 プログラム状態レジスタ(PSR)
32 条件フラグレジスタ(CFR)
33 プログラムカウンタ(PC)
34 PC退避用レジスタ(IPC)
35 PSR退避用レジスタ(IPSR)
40 演算部
41〜43 算術論理・比較演算器
44 積和演算器
45 バレルシフタ
46 除算器
47 変換器
50 I/F部
60 命令メモリ部
70 データメモリ部
80 拡張レジスタ部
90 I/Oインターフェース部
100 コンパイラ
101 ソースプログラム
102 機械語プログラム
110 解析部
120 最適化部
121 グローバル領域割り付け部
122 ソフトウェアパイプライニング部
123 ループアンローリング部
124 if変換部
125 ペア命令生成部
130 出力部
1 Processor 10 Instruction Control Unit 20 Decoding Unit 30 Register File 31 Program Status Register (PSR)
32 Condition flag register (CFR)
33 Program counter (PC)
34 PC save register (IPC)
35 PSR save register (IPSR)
40 arithmetic units 41 to 43 arithmetic logic / comparison arithmetic unit 44 multiply-add arithmetic unit 45 barrel shifter 46 divider 47 converter 50 I / F unit 60 instruction memory unit 70 data memory unit 80 extension register unit 90 I / O interface unit 100 compiler DESCRIPTION OF SYMBOLS 101 Source program 102 Machine language program 110 Analysis part 120 Optimization part 121 Global area allocation part 122 Software pipelining part 123 Loop unrolling part 124 If conversion part 125 Pair instruction generation part 130 Output part

Claims (14)

ターゲットプロセッサと、ソースプログラムを前記ターゲットプロセッサ向けの機械語プログラムに翻訳するコンパイラ装置とを備えたシステムであって、
前記コンパイラ装置は、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数がある指定された値以上の値の集合であることを保証することについての指示を検出し、
前記最適化手段は、保証した前記値の集合が1以上の値の集合である場合に、繰り返し回数がゼロの場合に必要となるエスケープコードの生成を抑制する
ことを特徴とするシステム。
A system comprising a target processor and a compiler device that translates a source program into a machine language program for the target processor,
The compiler apparatus includes:
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition means detects an instruction in the source program for guaranteeing that the number of repetitions of a specific loop process is a set of values greater than or equal to a specified value,
The optimization unit suppresses generation of an escape code required when the number of iterations is zero when the guaranteed set of values is a set of one or more values.
ターゲットプロセッサと、ソースプログラムを前記ターゲットプロセッサ向けの機械語プログラムに翻訳するコンパイラ装置とを備えたシステムであって、
前記コンパイラ装置は、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数がある指定された値以上の値の集合であることを保証することについての指示を検出し、
前記最適化手段は、保証した前記値の集合がループアンローリングによる展開数以上の値の集合である場合に、ループアンローリングによる最適化を行う
ことを特徴とするシステム。
A system comprising a target processor and a compiler device that translates a source program into a machine language program for the target processor,
The compiler apparatus includes:
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition means detects an instruction in the source program for guaranteeing that the number of repetitions of a specific loop process is a set of values greater than or equal to a specified value,
The optimization means performs optimization by loop unrolling when the guaranteed set of values is a set of values greater than or equal to the number of expansions by loop unrolling.
ターゲットプロセッサと、ソースプログラムを前記ターゲットプロセッサ向けの機械語プログラムに翻訳するコンパイラ装置とを備えたシステムであって、
前記コンパイラ装置は、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数がある指定された値以上の値の集合であることを保証することについての指示を検出し、
前記最適化手段は、保証した前記値の集合が、偶数値のみによる集合であるか奇数値のみによる集合であるかに応じてループアンローリングによる最適化を行う
ことを特徴とするシステム。
A system comprising a target processor and a compiler device that translates a source program into a machine language program for the target processor,
The compiler apparatus includes:
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition means detects an instruction in the source program for guaranteeing that the number of repetitions of a specific loop process is a set of values greater than or equal to a specified value,
The optimization unit performs optimization by loop unrolling according to whether the set of guaranteed values is a set of only even values or a set of only odd values.
ターゲットプロセッサと、ソースプログラムを前記ターゲットプロセッサ向けの機械語プログラムに翻訳するコンパイラ装置とを備えたシステムであって、
前記コンパイラ装置は、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定の変数名で示されるポインタ変数が指すデータが、あるアライメントの値であることを保証することについての指示を検出し、
前記最適化手段は、前記指示取得手段によって検出された指示の対象となったポインタ変数が指すデータについては、保証された前記アライメントの値でメモリ領域に配置されているものとして、前記最適化を施す
ことを特徴とするシステム。
A system comprising a target processor and a compiler device that translates a source program into a machine language program for the target processor,
The compiler apparatus includes:
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition means detects an instruction for guaranteeing that data indicated by a pointer variable indicated by a specific variable name is a value of an alignment in the source program,
The optimization unit assumes that the data indicated by the pointer variable that is the target of the instruction detected by the instruction acquisition unit is arranged in the memory area with the guaranteed alignment value, and performs the optimization. System characterized by applying.
前記ポインタ変数は引数であることを特徴とする請求項4に記載のシステム。   The system of claim 4, wherein the pointer variable is an argument. 前記ポインタ変数はローカル変数であることを特徴とする請求項4に記載のシステム。   The system of claim 4, wherein the pointer variable is a local variable. 前記最適化手段は、メモリ領域に配置した前記データにアクセスするメモリアクセス命令については、2以上のデータを同時に転送するペア命令を生成することを特徴とする請求項4〜6のいずれか1項に記載のシステム。   The said optimization means produces | generates the pair instruction | indication which transfers two or more data simultaneously about the memory access instruction | indication which accesses the said data arrange | positioned in the memory area. The system described in. ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数の最低値を保証することについての指示を検出し、
前記最適化手段は、保証した前記最低値が1以上である場合に、繰り返し回数がゼロの場合に必要となるエスケープコードの生成を抑制する
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition unit detects an instruction for guaranteeing a minimum value of the number of repetitions of a specific loop process in the source program,
The optimizing unit suppresses generation of an escape code necessary when the guaranteed minimum value is 1 or more and the number of repetitions is zero.
ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数の最低値を保証することについての指示を検出し、
前記最適化手段は、保証した前記最低値がループアンローリングによる展開数以上の値である場合に、ループアンローリングによる最適化を行う
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition unit detects an instruction for guaranteeing a minimum value of the number of repetitions of a specific loop process in the source program,
The compiler device, wherein the optimization means performs optimization by loop unrolling when the guaranteed minimum value is a value equal to or greater than the number of expansions by loop unrolling.
ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定のループ処理の繰り返し回数が奇数値あるいは偶数値の集合であることを保証することについての指示を検出し、
前記最適化手段は、保証した前記値の集合が、偶数値のみによる集合であるか奇数値のみによる集合であるかに応じてループアンローリングによる最適化を行うことを特徴とするコンパイラ装置。
A compiler device that translates a source program into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition means detects an instruction for ensuring that the number of repetitions of a specific loop process is an odd value or a set of even values in the source program,
The compiler apparatus according to claim 1, wherein the optimization unit performs optimization by loop unrolling according to whether the guaranteed set of values is a set of only even values or a set of only odd values.
ソースプログラムを機械語プログラムに翻訳するコンパイラ装置であって、
生成する機械語プログラムを最適化する旨の指示を取得する指示取得手段と、
取得された指示に従って機械語命令列を生成することにより、最適化を施す最適化手段とを備え、
前記指示取得手段は、前記ソースプログラムの中において、特定の変数名で示されるポインタ変数が指すデータが、あるアライメントの値であることを保証することについての指示を検出し、
前記最適化手段は、前記指示取得手段によって検出された指示の対象となったポインタ変数が指すデータについては、保証された前記アライメントの値でメモリ領域に配置されているものとして、前記最適化を施す
ことを特徴とするコンパイラ装置。
A compiler device that translates a source program into a machine language program,
An instruction acquisition means for acquiring an instruction to optimize the machine language program to be generated;
An optimization unit that performs optimization by generating a machine language instruction sequence according to the acquired instruction,
The instruction acquisition means detects an instruction for guaranteeing that data indicated by a pointer variable indicated by a specific variable name is a value of an alignment in the source program,
The optimization unit assumes that the data indicated by the pointer variable that is the target of the instruction detected by the instruction acquisition unit is arranged in the memory area with the guaranteed alignment value, and performs the optimization. A compiler device characterized by being applied.
前記ポインタ変数は引数であることを特徴とする請求項11に記載のコンパイラ装置。   The compiler apparatus according to claim 11, wherein the pointer variable is an argument. 前記ポインタ変数はローカル変数であることを特徴とする請求項11に記載のコンパイラ装置。   The compiler apparatus according to claim 11, wherein the pointer variable is a local variable. 前記最適化手段は、メモリ領域に配置した前記データにアクセスするメモリアクセス命令については、2以上のデータを同時に転送するペア命令を生成することを特徴とする請求項11〜13のいずれか1項に記載のコンパイラ装置。   The said optimization means produces | generates the pair instruction | command which transfers two or more data simultaneously about the memory access instruction | indication which accesses the said data arrange | positioned in the memory area. The compiler apparatus described in 1.
JP2010100372A 2010-04-23 2010-04-23 Compiler apparatus and system therefor Pending JP2010186487A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010100372A JP2010186487A (en) 2010-04-23 2010-04-23 Compiler apparatus and system therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010100372A JP2010186487A (en) 2010-04-23 2010-04-23 Compiler apparatus and system therefor

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2006013131A Division JP4879589B2 (en) 2006-01-20 2006-01-20 Compiler device

Publications (1)

Publication Number Publication Date
JP2010186487A true JP2010186487A (en) 2010-08-26

Family

ID=42767067

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010100372A Pending JP2010186487A (en) 2010-04-23 2010-04-23 Compiler apparatus and system therefor

Country Status (1)

Country Link
JP (1) JP2010186487A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05224944A (en) * 1992-02-12 1993-09-03 Oki Electric Ind Co Ltd Alignment matching method
JPH06222928A (en) * 1993-01-27 1994-08-12 Hitachi Ltd Loop optimizing method
JPH06290057A (en) * 1993-04-05 1994-10-18 Hitachi Ltd Loop optimizing method
JPH08328870A (en) * 1995-05-30 1996-12-13 Fujitsu Ltd Compiling processor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05224944A (en) * 1992-02-12 1993-09-03 Oki Electric Ind Co Ltd Alignment matching method
JPH06222928A (en) * 1993-01-27 1994-08-12 Hitachi Ltd Loop optimizing method
JPH06290057A (en) * 1993-04-05 1994-10-18 Hitachi Ltd Loop optimizing method
JPH08328870A (en) * 1995-05-30 1996-12-13 Fujitsu Ltd Compiling processor

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSNA200502735001; HITAC プログラムプロダクト HI-UX/MPP for SR8000 最適化FORTRAN77 使用 第12版, 200110, p.73,134,135, 株式会社日立製作所 *
CSND200300567003; 三上直樹: 'C言語によるDSPプログラミング:第6回(最終回)Code Composer Studioの便利な機能' Interface 第27巻,第4号(通巻286号), 20010401, pp.185〜186, CQ出版株式会社 *
JPN6012032884; HITAC プログラムプロダクト HI-UX/MPP for SR8000 最適化FORTRAN77 使用 第12版, 200110, p.73,134,135, 株式会社日立製作所 *
JPN6012032885; 三上直樹: 'C言語によるDSPプログラミング:第6回(最終回)Code Composer Studioの便利な機能' Interface 第27巻,第4号(通巻286号), 20010401, pp.185〜186, CQ出版株式会社 *

Similar Documents

Publication Publication Date Title
JP3847672B2 (en) Compiler apparatus and compiling method
JP3801545B2 (en) COMPILER PROGRAM, COMPILER DEVICE, AND COMPILING METHOD
Sreraman et al. A vectorizing compiler for multimedia extensions
Eichenberger et al. Using advanced compiler technology to exploit the performance of the Cell Broadband Engine™ architecture
Leupers et al. Retargetable compiler technology for embedded systems: tools and applications
US7840954B2 (en) Compilation for a SIMD RISC processor
KR100294016B1 (en) Vector processor programming and parallel programming in asymmetric duplex processor having vector processor and risc processor
Hwu et al. Compiler technology for future microprocessors
JP3974063B2 (en) Processor and compiler
JPH11296381A (en) Virtual machine and compiler
JP2004118470A (en) Processor
JP2008536240A (en) Microprocessor access using native instructions to the operand stack as a register file
JP2005525651A (en) Method and apparatus for adding advanced instructions in an extensible processor architecture
Kretz Extending C++ for explicit data-parallel programming via SIMD vector types
Fog Optimizing software in C++
Gross et al. Measurement and evaluation of the MIPS architecture and processor
Pokam et al. SWARP: a retargetable preprocessor for multimedia instructions
JP4879589B2 (en) Compiler device
Pol et al. Trimedia CPU64 application development environment
JP2010186487A (en) Compiler apparatus and system therefor
Veronis Survey of advanced microprocessors
Manilov et al. Free rider: A source-level transformation tool for retargeting platform-specific intrinsic functions
Nelson Computer Architecture
Lin et al. Effective code generation for distributed and ping-pong register files: a case study on PAC VLIW DSP cores
Ericsson Lecture Notes on High Performance Computing

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120531

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120703

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20121030