JP3246043B2 - Compiler unit - Google Patents

Compiler unit

Info

Publication number
JP3246043B2
JP3246043B2 JP06072593A JP6072593A JP3246043B2 JP 3246043 B2 JP3246043 B2 JP 3246043B2 JP 06072593 A JP06072593 A JP 06072593A JP 6072593 A JP6072593 A JP 6072593A JP 3246043 B2 JP3246043 B2 JP 3246043B2
Authority
JP
Japan
Prior art keywords
unit
translation
chromosome
program
population
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.)
Expired - Fee Related
Application number
JP06072593A
Other languages
Japanese (ja)
Other versions
JPH06274350A (en
Inventor
利行 澁谷
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP06072593A priority Critical patent/JP3246043B2/en
Publication of JPH06274350A publication Critical patent/JPH06274350A/en
Application granted granted Critical
Publication of JP3246043B2 publication Critical patent/JP3246043B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、計算機の原始プログラ
ムを翻訳して目的プログラムを生成する処理を行う装
置、特に目的プログラムの最適化に関する任意選択項目
(オプション)等の指定項目の選択を自動化できるコン
パイラ装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an apparatus for translating a source program of a computer to generate a target program, and in particular, to automate the selection of specified items such as optional items (options) relating to optimization of the target program. Compiler device that can be used.

【0002】[0002]

【従来の技術と発明が解決しようとする課題】公知のよ
うに、計算機のプログラムを、いわゆる高級プログラミ
ング言語で記述した場合に、それを原始プログラムとし
て、その高級プログラミング言語のためのコンパイラ
が、原始プログラムを特定の計算機のための目的プログ
ラムに翻訳し、必要な場合には複数の目的プログラムを
リンクする結合編集処理を経て、計算機で直接に実行可
能な1つのプログラムにされる。
2. Description of the Related Art As is well known, when a computer program is described in a so-called high-level programming language, a compiler for the high-level programming language is used as a source program. The program is translated into a target program for a specific computer, and if necessary, is processed into a single program that can be directly executed by a computer through a combined editing process of linking a plurality of target programs.

【0003】ここで、公知のように翻訳処理に際して
は、目的プログラムの実行効率(実行時の所要メモリ
(主記憶)量、実行時間等)の向上等のために、最適化
技術を適用することが可能であり、コンパイラ技術の進
歩に伴い多数の最適化項目が設けられ、いわゆるコンパ
イルオプションとして選択が可能になっている。
Here, as is well known, in translation processing, optimization techniques are applied in order to improve the execution efficiency of a target program (required memory (main memory) amount during execution, execution time, etc.). With the advancement of compiler technology, a number of optimization items are provided, and can be selected as so-called compile options.

【0004】このような最適化の例には、例えばサブル
ーチン的な機能を関数として持ち、又スタックを使用す
るシステムの目的プログラムにおいて、「関数から復帰
したとき、直ちに引数をポップする」、「算術演算をす
る場合には、予めメモリ上のオペランドをレジスタにコ
ピーしてレジスタ間演算にする」、「算術演算をする場
合には、予めメモリ上のオペランドのアドレスをレジス
タにコピーしておく」、「フレームポインタをレジスタ
に保存しておく」、或いは「関数をプログラム中に展開
しておく」その他がある。
Examples of such optimization include, for example, in an object program of a system having a subroutine-like function as a function and using a stack, "when an operation returns from a function, an argument is immediately popped" or "arithmetic". When performing an operation, copy the operand on the memory to a register in advance to perform inter-register operation "," When performing an arithmetic operation, copy the address of the operand on the memory in advance to the register ", There are "saving a frame pointer in a register", "expanding a function in a program", and others.

【0005】これらの最適化には、例えば簡単な例とし
て「関数をプログラム中に展開しておく」最適化を考え
ると、関数を展開しておけば、実行時の関数呼出のオー
バヘッドを無くして効率が良いが、他方で当然プログラ
ムが大きくなるというように、一般に実行効率上のトレ
ードオフがある。
For these optimizations, for example, considering a simple example of “optimizing a function in a program”, if the function is expanded, the overhead of function call at the time of execution can be eliminated. In general, there is a trade-off in execution efficiency, such as high efficiency, but of course a large program.

【0006】従って、各最適化項目について、それぞれ
そのようなトレードオフと作成するプログラムの状況を
勘案して、最適化を行うか否か指定する必要があるが、
従来は各最適化項目ごとについて、そのような状況の観
念的な認識に基づいて適当に指定する他無く、まして各
種最適化の相互の影響等まで考慮することはできず、豊
富な最適化技術を有効に利用することができていない。
Therefore, for each optimization item, it is necessary to specify whether or not to perform optimization in consideration of such a trade-off and the situation of a program to be created.
Conventionally, there is no other choice but to specify each optimization item appropriately based on the idea recognition of such a situation. Even more, it is not possible to consider the mutual influence of various optimizations, etc. Has not been used effectively.

【0007】目的プログラムの生成において選択できる
事項としては、以上のようなコンパイルオプションの他
に、プログラミング言語によっては特徴の異なる複数の
コンパイラが有って、コンパイラを選択できる場合があ
り、又複数モジュールをリンクする場合には、モジュー
ルをつなぐ順序が実行効率に影響する場合がある。
[0007] In addition to the compile options described above, there are a plurality of compilers having different characteristics depending on the programming language, and there are cases where the compiler can be selected as a matter that can be selected in generating the target program. When linking, the order in which modules are connected may affect execution efficiency.

【0008】これらについても、観念的な認識に基づい
て適当に選択しているので、それらの機能を有効に利用
して、適切な目的プログラムを得ているとは言えない。
本発明は、目的プログラムの生成において選択可能な指
定項目を、適切な目的プログラムを得るように自動的に
選択してコンパイルするコンパイラ装置を目的とする。
[0008] Since these are also appropriately selected based on the idea recognition, it cannot be said that an appropriate purpose program is obtained by effectively utilizing those functions.
SUMMARY OF THE INVENTION It is an object of the present invention to provide a compiler apparatus for automatically selecting and compiling designated items that can be selected in generating a target program so as to obtain an appropriate target program.

【0009】[0009]

【課題を解決するための手段】図1は、本発明の構成を
示すブロック図である。図はコンパイラ装置の構成であ
って、所定のプログラミング言語で記述された原始プロ
グラムを目的プログラムに翻訳し、該翻訳処理を制御
し、該翻訳の結果に影響を与える可能性のある複数の指
定項目を選択可能である装置であって、集団生成部1
と、デコード部2と、翻訳部3と、評価部4と、遺伝的
操作部5とを有する。
FIG. 1 is a block diagram showing the configuration of the present invention. The figure shows the configuration of a compiler device, which translates a source program described in a predetermined programming language into a target program, controls the translation process, and has a plurality of designated items that may affect the result of the translation. Is a device capable of selecting a group generation unit 1
, A decoding unit 2, a translation unit 3, an evaluation unit 4, and a genetic operation unit 5.

【0010】第1の発明では、集団生成部1は、遺伝的
アルゴリズムの染色体の各遺伝子座を、該指定項目のう
ちの予め定める各該指定項目に対応させて、各当該指定
項目の指定内容を表す値を持たせ、該予め定めたすべて
の該指定項目に対応する該遺伝子座を有する染色体とし
てコード化して、所定個数の該染色体のコードを遺伝的
アルゴリズムの集団として生成する。
In the first invention, the population generating unit 1 associates each locus of a chromosome of the genetic algorithm with each of the predetermined specified items among the specified items, and specifies the specified contents of each of the specified items. Is encoded as a chromosome having the locus corresponding to all of the predetermined designated items, and a predetermined number of codes of the chromosome are generated as a group of the genetic algorithm.

【0011】デコード部2は、集団生成部1が生成した
該集団、及び遺伝的操作部5が操作した結果の該集団に
ついて、当該集団の各該染色体のコードを順次該指定項
目にデコードして翻訳部3に渡す。
The decoding unit 2 sequentially decodes the codes of the chromosomes of the population into the designated items for the population generated by the population generation unit 1 and the population as a result of the operation performed by the genetic operation unit 5. Hand over to translator 3.

【0012】翻訳部3は、デコード部2から渡される該
染色体ごとの該指定項目に従って、所与の該原始プログ
ラムを翻訳して、各該染色体ごとに対応する各該目的プ
ログラムを生成する処理を実行する。
The translating unit 3 translates a given source program in accordance with the designated item for each chromosome passed from the decoding unit 2 and generates each target program corresponding to each chromosome. Execute.

【0013】評価部4は、各該染色体ごとについて、翻
訳部3の該翻訳処理結果の正常性と、該目的プログラム
が生成された場合に該目的プログラムを所定条件下で実
行させて、該目的プログラムの大きさ及び実行状況とに
基づいて、所定の評価値を生成する。
The evaluator 4 executes, for each of the chromosomes, the normality of the translation processing result of the translator 3 and, when the target program is generated, executes the target program under predetermined conditions. A predetermined evaluation value is generated based on the size and execution status of the program.

【0014】 遺伝的操作部5は、デコード部2が現に
デコード処理した該集団に対して、当該集団の各該染色
体に対応して評価部4によって付与された該評価値に基
づいて、遺伝的アルゴリズムの所定の操作を実行して該
集団を更新し、更新結果の該集団をデコード部2に渡す
ことを、所定回数繰り返して、所定回数に達したことを
検知したとき、該遺伝的アルゴリズムの所定の操作の実
行を終了する
The genetic operation unit 5 performs, based on the evaluation value given by the evaluation unit 4 corresponding to each chromosome of the population, to the population that has been decoded by the decoding unit 2, The group is updated by executing a predetermined operation of the algorithm, and the group resulting from the update is passed to the decoding unit 2
Is repeated a predetermined number of times,
When detected, execution of the predetermined operation of the genetic algorithm
End line .

【0015】第2の発明では、前記原始プログラムが複
数のモジュールに分割される場合において、集団生成部
1は、各前記指定項目に対応させる遺伝子座を、該モジ
ュールごとに個別に設けて、前記各染色体のコードを生
成し、デコード部2は、該集団生成部が生成した集団の
各該染色体のコードを順次該指定項目にデコードして、
該モジュール別に区分して翻訳部3に渡す。
In the second invention, in the case where the source program is divided into a plurality of modules, the group generation unit 1 provides a locus corresponding to each of the designated items individually for each of the modules. The code of each chromosome is generated, and the decoding unit 2 sequentially decodes the code of each chromosome of the group generated by the group generation unit to the designated item,
The data is divided into modules and passed to the translation unit 3.

【0016】翻訳部3は、デコード部2から渡される該
染色体ごとの該モジュール別の該指定項目を、各該モジ
ュールに個別に適用して前記翻訳処理を実行する。第3
の発明では、前記第1及び第2の発明における予め定め
る指定項目には、少なくとも目的プログラムの最適化処
理の適用可否に関する複数の指定項目を含むようにす
る。
The translation unit 3 executes the translation process by individually applying the designated items for each module for each chromosome passed from the decoding unit 2 to each module. Third
In the present invention, the predetermined specification items in the first and second inventions include at least a plurality of specification items regarding whether or not the optimization processing of the target program can be applied.

【0017】第4の発明では、前記第1〜第3の発明に
おいて、翻訳部3は相異なる翻訳処理を行う複数のコン
パイラを有し、前記の予め定める指定項目には、少なく
とも該コンパイラのうちの1つを選択するための指定項
目を含むようにする。
According to a fourth aspect, in the first to third aspects, the translation unit 3 has a plurality of compilers for performing different translation processes, and the predetermined specification item includes at least one of the compilers. To include one of the specified items.

【0018】第5の発明では、前記第1〜第4の発明に
おいて、前記原始プログラムが複数のモジュールに分割
されていて、前記の予め定める指定項目には、少なくと
も各該モジュールから生成される目的プログラムをリン
クする場合の該モジュールの順位を指定するための指定
項目を含み、前記評価部4は前記デコード部2がデコー
ドした結果の該リンク順位に従って目的プログラムをリ
ンクして実行させるようにする。
In a fifth aspect based on the first to fourth aspects, the source program is divided into a plurality of modules, and at least one of the predetermined designation items is generated from each of the modules. The evaluation unit 4 includes a designation item for designating the order of the module when linking a program, and the evaluation unit 4 links and executes the target program according to the link order as a result of decoding by the decoding unit 2.

【0019】[0019]

【作用】本発明のコンパイラ装置により、コンパイルオ
プション等の選択可能な指定項目の各々を染色体の遺伝
子座に対応付けて、例えば0、1の値で、その指定項目
を指定するか否かを表すようにコード化する。
With the compiler device of the present invention, each selectable specification item such as a compile option is associated with a chromosome locus, and for example, a value of 0 or 1 represents whether or not the specification item is specified. Code as follows.

【0020】先ず、集団生成部1が、一定の個数の染色
体コードを適当に生成して、初期の集団としてデコード
部2に渡す。デコード部2は、各染色体ごとのコードを
1組のコンパイルオプション等の指定項目にデコードし
て、翻訳部3に渡す。
First, the group generation unit 1 appropriately generates a certain number of chromosome codes, and passes it to the decoding unit 2 as an initial group. The decoding unit 2 decodes the code for each chromosome into a set of designated items such as a compile option, and passes it to the translating unit 3.

【0021】翻訳部3は、所与の原始プログラムについ
て、各染色体ごとに対応して、その1組の指定項目に従
った翻訳処理を実行し、指定項目に矛盾がなければ、翻
訳結果の目的プログラムを生成する。この場合に、指定
項目にコンパイラの指定を含む場合には、以上の翻訳処
理を実行するコンパイラが染色体ごとに選択されること
になる。
The translation unit 3 executes a translation process for a given source program corresponding to each chromosome in accordance with the set of designated items. Generate a program. In this case, when the specification item includes the specification of the compiler, the compiler that executes the above translation processing is selected for each chromosome.

【0022】評価部4は、生成された目的プログラムに
ついて実行評価を行って、予め定めるところに従って評
価点を付け、目的プログラムを生成できなかった場合を
含め、集団のすべての染色体について各評価値を与え
る。
The evaluation unit 4 performs execution evaluation on the generated target program, assigns an evaluation score according to a predetermined place, and evaluates each evaluation value for all chromosomes of the population including the case where the target program cannot be generated. give.

【0023】遺伝的操作部5は、集団について評価値を
反映する遺伝的アルゴリズムの操作を施すことにより、
集団の構成する染色体を更新し、結果の集団をデコード
部2に渡し、デコード部2によるデコードにより以上の
処理が繰り返される。
The genetic operation unit 5 performs an operation of a genetic algorithm that reflects an evaluation value for a group,
The chromosomes constituting the group are updated, the resulting group is passed to the decoding unit 2, and the above processing is repeated by decoding by the decoding unit 2.

【0024】遺伝的アルゴリズムの操作とは公知のよう
に(例えば David E.Goldberg,"Genetic Algorithms in
Search,Optimization,and Machine Learning"ADDISON-
WESLEY PUBLISHING COMPANY,INC.1989) 、集団(populat
ion)について、集団の染色体に付された評価値に基づい
て、再生(reproduction)、配合(crossover) 、突然変移
(mutation)からなる操作を行うものである。
The operation of a genetic algorithm is well known (for example, see David E. Goldberg, "Genetic Algorithms in
Search, Optimization, and Machine Learning "ADDISON-
WESLEY PUBLISHING COMPANY, INC. 1989), group (populat
ion), based on the evaluation value assigned to the chromosome of the population, reproduction, crossover, and sudden transition
(mutation).

【0025】ここで、再生は集団の染色体のうち評価値
の悪いものを捨てて、良いもののコピーからなる集団を
つくる操作、配合は再生した集団の染色体相互間で所定
の規約により遺伝子(染色体コードの各桁の値)を交換
する操作、突然変移は更に遺伝子を確率的に変化する操
作である。
Here, the regeneration is an operation of discarding a chromosome with a low evaluation value among the chromosomes of the population and forming a population of copies of a good chromosome. The operation of exchanging the value of each digit) is an operation of changing the gene stochastically.

【0026】 以上の処理を繰り返すことにより、遺伝
的アルゴリズム操作により遺伝的な進歩/淘汰がシミュ
レートされて、集団の染色体のコードが、逐次より良い
評価値を得るように更新されることが期待できるので、
適当な回数を繰り返すことにより、自動的に適切なオプ
ションの選択が行われるようになる。
By repeating the above processing, genetic progress / selection is simulated by the genetic algorithm operation, and it is expected that the code of the chromosome of the population is updated so as to obtain a better evaluation value sequentially. So you can
By repeating the appropriate number of times, an appropriate option is automatically selected.

【0027】[0027]

【実施例】図2(a) は、本発明の実施のために、前記の
ようなコンパイルオプションを染色体にコード化する例
であり、図はコードについて、例えば1行目は左端の欄
から右へ順次、次のことを示している。
FIG. 2 (a) shows an example in which the compile options as described above are encoded on a chromosome for implementing the present invention. FIG. 2 (a) shows the code. Sequentially indicates the following.

【0028】即ち、第1桁が第1の遺伝子座であって、
フラグ「-fno-defer-pop」で表されるコンパイルオプシ
ョンの指定項目に対応付けられ、そのフラグが有効な場
合の意味する機能は「関数から復帰したら、すぐに引数
をポップする(ように目的プログラムを生成する)」こ
とを指定するものであり、値「1」で指定の有効(yes)
を、「0」で無効(no)を表す。
That is, the first digit is the first locus,
The function associated with the compile option specified by the flag "-fno-defer-pop" and the meaning of the flag when it is valid is "pop the argument immediately after returning from the function. Generate a program) ”and the value“ 1 ”is valid (yes)
Is invalid (no) by “0”.

【0029】従ってコードが例えば「11001 」であれ
ば、引数のポップと、オペランドのレジスタへのコピー
と、関数の展開とを行い、メモリアドレス定数のコピー
と、フレームポインタの保存とは行わないことを指定す
るものである。
Therefore, if the code is, for example, "11001", pop the argument, copy the operand to the register, and expand the function, but do not copy the memory address constant and save the frame pointer. Is specified.

【0030】この場合には、デコード部2によるデコー
ド結果として、有効フラグを示す内容の「-fno-defer-p
op -fforce-mem -inline-function 」が翻訳部3に渡
される。
In this case, as a result of decoding by the decoding unit 2, "-fno-defer-p
op-fforce-mem-inline-function "is passed to the translation unit 3.

【0031】図2(b) は、第2の発明のように、原始プ
ログラムを構成する複数のモジュールに対応して染色体
のコード化を行う場合の例であり、(a)の例と同様のコ
ンパイルオプションを指定項目とし、2個のモジュール
sga.cとio.cがある場合に対応する。
FIG. 2 (b) shows an example in which a chromosome is encoded corresponding to a plurality of modules constituting a source program as in the second invention. Two modules with compile options as specified items
Corresponds to sga.c and io.c.

【0032】この例で、例えばコードが「1100101100」
であれば、翻訳部3には第1のモジュールについては
「-fno-dfer-pop -fforce-mem -inline-functions 」
が渡され、第2のモジュールについては「-fforce-mem
-fforce-addr 」が渡されることになる。
In this example, for example, the code is "1100101100"
If so, the translation unit 3 has "-fno-dfer-pop -fforce-mem -inline-functions" for the first module.
Is passed, and for the second module, "-fforce-mem
-fforce-addr "will be passed.

【0033】図3(c) は、第4の発明のように、複数の
コンパイラを持つシステムで、コンパイラも自動選択す
るようにする場合の例であり、この例では2種のコンパ
イラgcc及びpccを有し、図2(a) の例と同様のコンパイ
ルオプションと共にコンパイラの指定をコード化した場
合を示す。
FIG. 3 (c) shows an example in which a system having a plurality of compilers and a compiler is automatically selected as in the fourth invention. In this example, two types of compilers gcc and pcc are used. 2 shows a case where the compiler specification is coded together with the same compile options as in the example of FIG.

【0034】この例で、例えばコードが「110010」であ
れば、翻訳部3にはコンパイルオプションの指定として
「-fno-dfer-pop -fforce-mem -inline-functions 」
が渡され、コンパイラ指定としてコンパイラ名「pcc 」
が指定される。
In this example, for example, if the code is "110010", the translation unit 3 specifies "-fno-dfer-pop -fforce-mem -inline-functions" as a compile option.
Is passed, and the compiler name "pcc" is specified as the compiler specification
Is specified.

【0035】図3(d) は、第5の発明のように、目的プ
ログラムの複数のモジュールのリンク順位を自動指定す
るようにする場合の例であり、この例では2個のモジュ
ールsga.cとio.cとを有し、図2(a)の例と同様のコンパ
イルオプションと共にリンク順序の指定をコード化した
場合を示す。
FIG. 3D shows an example in which the link order of a plurality of modules of the target program is automatically specified as in the fifth invention. In this example, two modules sga.c are used. 2 and io.c, where the specification of the link order is coded together with the same compile options as in the example of FIG.

【0036】このコードでは、第6桁が「1」であれば
先頭をsga.c 、2番目をio.cとするようにデコード部2
から翻訳部3を経て評価部4に対し、リンク順序の指定
情報としてモジュール名の並び「sga.c io.c 」が渡さ
れ、「0」であれば逆にio.cを先頭にするように「io.c
sga.c」指定される。
In this code, if the sixth digit is "1", the decoding unit 2 sets the first to sga.c and the second to io.c.
From the module 3 to the evaluator 4 via the translator 3, a list of module names “sga.c io.c” is passed as designation information of the link order, and if “0”, the io.c is set first. `` Io.c
sga.c "is specified.

【0037】図4は本発明の処理の一例を詳細に説明す
る処理の流れ図であり、先ず図1の集団生成部1が処理
ステップ10で、繰り返し回数のカウンタKを0にクリア
する等の初期設定を行った後、処理ステップ11で集団の
初期値を、例えば次のようにして生成する。
FIG. 4 is a flowchart of a process for explaining an example of the process of the present invention in detail. First, the group generation unit 1 of FIG. After the setting, the initial value of the group is generated in the processing step 11 as follows, for example.

【0038】即ち、一例として、図2(a)の染色体コー
ドによって説明するとして、集団の個体数を例えば4と
してある場合には、例えば適当な乱数発生機構により、
4個の乱数を取り出して、各乱数の2進表示の下5桁を
各染色体のコードとすることにより、図5(a)に例示す
るような、4個の染色体のコードからなるコード群を遺
伝的アルゴリズム上の集団とする。
That is, as an example, as described with reference to the chromosome code of FIG. 2 (a), when the number of individuals in a group is, for example, four, for example, by an appropriate random number generating mechanism,
By taking out four random numbers and using the lower five digits of each random number as a code of each chromosome as a code of each chromosome, a code group consisting of the codes of the four chromosomes as illustrated in FIG. A group based on the genetic algorithm.

【0039】この集団を受け取ってデコード部2は、処
理ステップ12で、各染色体について前記のようにデコー
ドして翻訳部3に渡すので、翻訳部3のコンパイラ機能
が、処理ステップ13で通常のように原始プログラムのコ
ンパイル処理を実行し、生成した目的プログラム又はコ
ンパイル処理でエラーが出た場合はその結果を評価部4
に渡す。
Upon receiving this group, the decoding unit 2 decodes each chromosome in the processing step 12 as described above and passes it to the translating unit 3, so that the compiler function of the translating unit 3 is normally executed in the processing step 13. Compiles the source program, and if an error occurs in the generated target program or compile processing, the result is evaluated by the evaluation unit 4.
Pass to.

【0040】評価部4は処理ステップ14で、目的プログ
ラムを予め指定されている一定の条件で実行し、実行状
況について、必要なメモリ量、実行時間、実行結果の正
さ(例えば出力データが予定のデータと一致するか否か
等)等の実行結果評価データを採取する。
In the processing step 14, the evaluation unit 4 executes the target program under predetermined conditions specified in advance, and determines the necessary memory amount, execution time, and correctness of the execution result (for example, when the output data is (E.g., whether or not the data matches the data of the execution result) is collected.

【0041】評価部4は必要な評価データを採取し終わ
ると、処理ステップ15でそのデータから評価値を算出し
て、当該染色体についての評価値Fとして保持する。評
価値Fは、例えば次の式で求める値とする。
When the necessary evaluation data has been collected, the evaluation unit 4 calculates an evaluation value from the data in a processing step 15 and holds it as an evaluation value F for the chromosome. The evaluation value F is, for example, a value obtained by the following equation.

【0042】F=実行時間+α×メモリ量+β+γ 但し、αは実行時間とメモリ量との評価上の重みを与え
るための定数であり、βはコンパイルがエラー無しで終
わった場合に0、エラーの有る場合∞(無限大)を取る
変数、γはプログラムの実行結果が正しければ0、正し
く無ければ∞を取る変数とする。
F = execution time + α × memory amount + β + γ where α is a constant for giving an evaluation weight between the execution time and the memory amount, β is 0 when the compilation ends without error, and If there is, a variable that takes ∞ (infinity), γ is a variable that takes 0 if the execution result of the program is correct, and γ if it is not correct.

【0043】評価値を求めると、処理ステップ16で、集
団のすべての染色体について処理したか識別し、未処理
があれば処理ステップ12に戻り、以上のようにしてすべ
ての染色体に対応して評価値を求めると、評価部4は遺
伝的操作部5に集団と評価値を渡す。
When the evaluation value is obtained, it is determined whether or not all chromosomes of the population have been processed in processing step 16, and if there is no processing, the process returns to processing step 12, and evaluation is performed for all chromosomes as described above. After obtaining the values, the evaluation unit 4 passes the population and the evaluation value to the genetic operation unit 5.

【0044】遺伝的操作部5は、処理ステップ17で繰り
返し回数のカウンタKが所定回数値に達したか識別し達
していれば、処理ステップ20で結果(例えばそのときの
集団及び評価値のデータ)を出力して処理を終わる。
The genetic operation unit 5 discriminates whether or not the counter K of the number of repetitions has reached a predetermined value in processing step 17 and, if it has reached the result, in processing step 20 (for example, the data of the group and evaluation value at that time) ) Is output and the processing is terminated.

【0045】Kが所定回数値に達したか識別し達してい
なければ、遺伝的操作部5は処理ステップ18でKを1増
加した後、評価部4から受け取った集団と評価値につい
て、処理ステップ19で遺伝的アルゴリズムに従う集団の
操作処理を実行する。
If K has reached the predetermined number of times or if it has not been identified, the genetic operation unit 5 increments K by 1 in processing step 18 and then processes the group and the evaluation value received from the evaluation unit 4 in the processing step. At 19, the group is processed according to the genetic algorithm.

【0046】例えば、集団生成部が図5(a)に例示する
集団を生成し、この集団について以上の処理で評価した
結果として、評価部4から遺伝的操作部5が(b)のデー
タを受け取ったとして以下に遺伝的操作の例を説明す
る。
For example, as a result of the group generation unit generating the group illustrated in FIG. 5A and evaluating this group by the above processing, the genetic operation unit 5 transmits the data of FIG. An example of a genetic manipulation as received will now be described.

【0047】遺伝的操作部5は先ず再生操作において、
最も評価値の悪いデータを死滅させて、最も良いデータ
を複製するものとし、その結果(b)の集団の2番データ
を死滅させて、1番データを2番に複製した(c)の集団
を得る。この操作により集団の平均評価値も当然図示の
ように改善される。
The genetic operation unit 5 first performs a reproducing operation,
The data with the worst evaluation value is killed and the best data is duplicated. As a result, the second data in the group (b) is killed and the group in (c) where the first data is duplicated in the second. Get. By this operation, the average evaluation value of the group is naturally improved as shown in the figure.

【0048】次に遺伝的操作部5は、配合操作により、
再生した集団についてランダムに選ぶ2データの、ラン
ダムに定める位置を境界として、境界で左右に分かれる
ビット列の一方を両データ間で交換する。
Next, the genetic operation unit 5 performs
With two data randomly selected for the reproduced group, one of the bit strings that are divided into right and left at the boundary is exchanged between the two data with the position determined at random as the boundary.

【0049】 即ち、(c) の集団について、2番と3番
のデータが選ばれ、3ビット目と4ビット目の間に境界
を置くようにランダムに決定したとすると、2番データ
の右の「11」と3番データの右の「00」とを交換す
ることにより、(d) に示す集団となる
That is, for the group (c), if the second and third data are selected and randomly determined so as to place a boundary between the third and fourth bits, the right of the second data By exchanging "11" of " 3 " with "00" on the right of the third data, the group shown in (d) is obtained .

【0050】次に遺伝的操作部5は突然変異操作とし
て、(d)の集団のデータからランダムに選択する1ビッ
トを反転することとし、例えば(d)で*を付けたビット
がランダムに選ばれると、突然変異により(e)に示す集
団となる。
Next, as a mutation operation, the genetic operation unit 5 inverts one bit selected at random from the data of the group (d), and for example, the bits marked with * in (d) are randomly selected. Then, the mutations result in the population shown in (e).

【0051】遺伝的操作部5は、以上のようにして図5
(e)のような新たな集団を得ると、これをデコード部2
に渡し、再び前記のようにして、この集団の評価を行う
ための処理を開始する。
As described above, the genetic operation unit 5
When a new group as shown in (e) is obtained, the new group is decoded.
And the process for evaluating this group is started again as described above.

【0052】[0052]

【発明の効果】以上の説明から明らかなように本発明に
よれば、計算機の原始プログラムをコンパイルする場合
に、最適化のコンパイルオプションその他の選択事項に
ついて、自動的に適切な選択が行われ、オプションを有
効にりようすることが可能になるという著しい工業的効
果がある。
As is apparent from the above description, according to the present invention, when compiling a source program of a computer, appropriate selections are automatically made for compile options for optimization and other selection items. There is a significant industrial effect that it is possible to activate the option.

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

【図1】 本発明の構成を示すブロック図FIG. 1 is a block diagram showing the configuration of the present invention.

【図2】 染色体のコード例を説明する図(その1)FIG. 2 illustrates a chromosome code example (part 1)

【図3】 染色体のコード例を説明する図(その2)FIG. 3 illustrates a chromosome code example (part 2)

【図4】 本発明の処理の流れ図FIG. 4 is a flowchart of the process of the present invention.

【図5】 本発明の処理例を説明する図FIG. 5 is a diagram illustrating a processing example of the present invention.

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

1 集団生成部 2 デコード部 3 翻訳部 4 評価部 5 遺伝的操作部 10〜20 処理ステップ DESCRIPTION OF SYMBOLS 1 Group generation part 2 Decoding part 3 Translation part 4 Evaluation part 5 Genetic operation part 10-20 Processing steps

フロントページの続き (56)参考文献 S.Beaty,”Genetic Algorithms and Ins truction Schedulin g”,Proceedings of 24th annual interna tional symposium o n Microarchitectur e,1991,p.206−211 S.Beaty他,”Motivat ion and framework for Using Genetic Algorithms for Mic rocode Compactio n”,Proceedings of 23rd annual worksho p and symposium on Microprogramming and microarchitect ure,1990,p.117−124 発明協会公開技報公技番号93−8695号 (58)調査した分野(Int.Cl.7,DB名) G06F 9/45 G06N 3/00 Continuation of front page (56) References Beaty, "Genetic Algorithms and Instru- ment Scheduling", Proceedings of 24th annual international symposium on Microarchitecture, 1991. 206-211 S.C. Beaty et al., "Motion and framework for Usage Genetic Algorithms for Microcode Compaction", Proceedings of the nation's general insurance program. 117-124 Invention Technical Publication No. 93-8695 (58) Fields investigated (Int.Cl. 7 , DB name) G06F 9/45 G06N 3/00

Claims (5)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 所定のプログラミング言語で記述された
原始プログラムを目的プログラムに翻訳し、該翻訳処理
を制御し、該翻訳の結果に影響を与える可能性のある複
数の指定項目を選択可能である装置であって、 集団生成部と、デコード部と、翻訳部と、評価部と、遺
伝的操作部とを有し、前記集団生成部 は、遺伝的アルゴリズムの染色体の各遺
伝子座を、前記指定項目のうちの予め定める各前記指定
項目に対応させて、各当該指定項目の指定内容を表す値
を持たせ、前記予め定めたすべての前記指定項目に対応
する前記遺伝子座を有する染色体としてコード化して、
所定個数の前記染色体のコードを遺伝的アルゴリズムの
集団として生成し、前記デコード部 は、前記集団生成部が生成した前記集
団、及び前記遺伝的操作部が操作した結果の前記集団
ついて、当該集団の各前記染色体のコードを順次前記指
定項目にデコードして前記翻訳部に渡し、前記翻訳部 は、前記デコード部から渡される前記染色体
ごとの前記指定項目に従って、所与の前記原始プログラ
を翻訳して、各前記染色体ごとに対応する各前記目的
プログラムを生成する処理を実行し、前記評価部 は、各前記染色体ごとについて、前記翻訳部
前記翻訳処理結果の正常性と、前記目的プログラム
生成された場合に前記目的プログラムを所定条件下で実
行させて、前記目的プログラムの大きさ及び実行状況と
に基づいて、所定の評価値を生成し、前記遺伝的操作部 は、前記デコード部が現にデコード処
理した前記集団に対して、当該集団の各前記染色体に対
応して前記評価部によって付与された前記評価値に基づ
いて、遺伝的アルゴリズムの所定の操作を実行して前記
集団を更新し、更新結果の前記集団を前記デコード部に
渡すことを、所定回数繰り返して、所定回数に達したこ
とを検知したとき、前記遺伝的アルゴリズムの所定の操
作の実行を終了するように構成したことを特徴とするコ
ンパイラ装置。
1. A source program written in a predetermined programming language is translated into a target program, the translation process is controlled, and a plurality of designated items that may affect the result of the translation can be selected. An apparatus, comprising: a population generation unit, a decoding unit, a translation unit, an evaluation unit, and a genetic operation unit, wherein the population generation unit specifies each locus of a chromosome of a genetic algorithm by the designation. pre-defined specification each said of the items
Corresponding to the item , giving a value representing the specified content of each of the specified items, encoding as a chromosome having the locus corresponding to all the predetermined specified items ,
The code of the chromosome of a predetermined number to generate a population of the genetic algorithm, the decoding unit, the collection of the population generating unit has generated
Dan, and said with <br/> said population of results genetic manipulation portion is manipulated, sequentially the finger code of each of the chromosomes of the population
Passing the said translation unit decodes the constant fields, said translation unit in accordance with the designated entry for each of the chromosomes <br/> passed from the decode unit, given the primitive program
Each said the purpose of translating the beam, corresponding to each of the chromosome
Performs a process of generating a program, the evaluation unit, for each said chromosome, and health of the translation processing result of the translation section <br/>, the object program when the object program is generated by running under a predetermined condition, on the basis of the size and state of execution of the object program, it generates a predetermined evaluation value, the genetic manipulation unit, to the population of the decoding unit is currently decoding , based on the evaluation value assigned by the evaluation unit in response to each of said chromosome of the population, the running predetermined operation of the genetic algorithm
Updating the group, and updating the group of the update result to the decoding unit
Repeat this process a specified number of times, and
Is detected, the predetermined operation of the genetic algorithm is performed.
A compiler device configured to terminate execution of a work .
【請求項2】 前記原始プログラムが複数のモジュール
に分割される場合において、前記集団生成部 は、各前記指定項目に対応させる遺伝子
座を、前記モジュールごとに個別に設けて、前記各染色
体のコードを生成し、 前記デコード部は、前記集団生成部が生成した集団の
前記染色体のコードを順次前記指定項目にデコードし
て、前記モジュール別に区分して、前記翻訳部に渡し、 前記翻訳部は、前記デコード部から渡される前記染色体
ごとの前記モジュール別の前記指定項目を、各前記モジ
ュールに個別に適用して前記翻訳処理を実行する、請求
項1記載のコンパイラ装置。
In the case where wherein said source program is divided into a plurality of modules, said population generation unit, a locus to correspond to each of said designated item, individually provided for each of the module, the code of each chromosome The decoding unit, each of the group generated by the group generation unit
Decoding sequentially the designated item code of the chromosome, by dividing by the module passes the translation unit, said translation unit, by the module of each of the chromosomes <br/> passed from the decoding unit the specified items, each of the character of
Executing the translation processing is applied separately to Yuru, wherein
Item 7. The compiler device according to item 1.
【請求項3】 前記の予め定める指定項目には、少なく
とも目的プログラムの最適化処理の適用可否に関する複
数の指定項目を含む、請求項1又は請求項2記載のコン
パイラ装置。
3. The compiler apparatus according to claim 1, wherein the predetermined specification items include at least a plurality of specification items regarding whether or not the optimization processing of the target program can be applied.
【請求項4】 前記翻訳部は相異なる翻訳処理を行う複
数のコンパイラを有し、前記の予め定める指定項目に
は、少なくとも前記コンパイラのうちの1つを選択する
ための指定項目を含む、請求項1、請求項2又は請求項
3記載のコンパイラ装置。
4. The translation unit has a plurality of compilers that perform different translation processes, and the predetermined specification item includes at least a specification item for selecting one of the compilers. 4. The compiler device according to claim 1, 2 or 3.
【請求項5】 前記原始プログラムが複数のモジュール
に分割されていて、前記の予め定める指定項目には、少
なくとも各前記モジュールから生成される目的プログラ
ムをリンクする場合の前記モジュールの順位を指定する
ための項目に従って目的プログラムをリンクして実
行させる、請求項1、請求項2、請求項3又は請求項4
記載のコンパイラ装置。
5. The program according to claim 1, wherein the source program is divided into a plurality of modules, and the predetermined specification item specifies at least the order of the modules when linking a target program generated from each of the modules. It is executed by linking the object program according to the specified item, according to claim 1, claim 2, claim 3 or claim 4
Compiler device as described.
JP06072593A 1993-03-19 1993-03-19 Compiler unit Expired - Fee Related JP3246043B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP06072593A JP3246043B2 (en) 1993-03-19 1993-03-19 Compiler unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP06072593A JP3246043B2 (en) 1993-03-19 1993-03-19 Compiler unit

Publications (2)

Publication Number Publication Date
JPH06274350A JPH06274350A (en) 1994-09-30
JP3246043B2 true JP3246043B2 (en) 2002-01-15

Family

ID=13150548

Family Applications (1)

Application Number Title Priority Date Filing Date
JP06072593A Expired - Fee Related JP3246043B2 (en) 1993-03-19 1993-03-19 Compiler unit

Country Status (1)

Country Link
JP (1) JP3246043B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005032018A (en) * 2003-07-04 2005-02-03 Semiconductor Energy Lab Co Ltd Microprocessor using genetic algorithm
JP2007226589A (en) * 2006-02-24 2007-09-06 Oki Electric Ind Co Ltd Program conversion system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
S.Beaty,"Genetic Algorithms and Instruction Scheduling",Proceedings of 24th annual international symposium on Microarchitecture,1991,p.206−211
S.Beaty他,"Motivation and framework for Using Genetic Algorithms for Microcode Compaction",Proceedings of 23rd annual workshop and symposium on Microprogramming and microarchitecture,1990,p.117−124
発明協会公開技報公技番号93−8695号

Also Published As

Publication number Publication date
JPH06274350A (en) 1994-09-30

Similar Documents

Publication Publication Date Title
US5805795A (en) Method and computer program product for generating a computer program product test that includes an optimized set of computer program product test cases, and method for selecting same
US8065669B2 (en) Apparatus for automatically converting numeric data to a processor efficient format for performing arithmetic operations
US6496922B1 (en) Method and apparatus for multiplatform stateless instruction set architecture (ISA) using ISA tags on-the-fly instruction translation
Proebsting et al. Krakatoa: Decompilation in Java (does bytecode reveal source?)
JP4766540B2 (en) Method and apparatus for performing verification of program code conversion
EP0428560A4 (en) Machine process for translating programs in binary machine language into another binary machine language
KR20010086159A (en) Method for platform specific efficiency enhancement of java programs and software product therefor
Coleman et al. The mobile programming system, Janus
JP3539613B2 (en) Array summary analysis method for loops containing loop jump statements
JP3246043B2 (en) Compiler unit
WO2021161426A1 (en) Program generation device, program generation method, and program
Mazzotta et al. Compilation of aggregates in ASP systems
Crepeau Genetic evolution of machine language software
JPH09223023A (en) Compile system and compiler
Ray et al. Evolving parallel computation
JPH06309193A (en) Method and device for verifying operation of machine language program
Koopman et al. Operational machine specification in a functional programming language
JP7468209B2 (en) PROGRAM GENERATION DEVICE, PROGRAM GENERATION METHOD, AND PROGRAM
JPH02236638A (en) Register allocation managing system
JP3195211B2 (en) Compilation method
WO2021161427A1 (en) Program generation device, program generation method, and program
JP3658771B2 (en) Compiler device
JP3594106B2 (en) Automatic programming device, automatic programming method and recording medium
Piumarta Delayed Code Generation in a Smalltalk-80 Compiler
JP2001184227A (en) Simulation device

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20011002

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

Free format text: PAYMENT UNTIL: 20081102

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20081102

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20091102

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20101102

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees