JP6481515B2 - Information processing apparatus, compiling method, and compiler program - Google Patents

Information processing apparatus, compiling method, and compiler program Download PDF

Info

Publication number
JP6481515B2
JP6481515B2 JP2015110680A JP2015110680A JP6481515B2 JP 6481515 B2 JP6481515 B2 JP 6481515B2 JP 2015110680 A JP2015110680 A JP 2015110680A JP 2015110680 A JP2015110680 A JP 2015110680A JP 6481515 B2 JP6481515 B2 JP 6481515B2
Authority
JP
Japan
Prior art keywords
source program
variable
program
constant
specifier
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.)
Active
Application number
JP2015110680A
Other languages
Japanese (ja)
Other versions
JP2016224724A (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 JP2015110680A priority Critical patent/JP6481515B2/en
Priority to US15/156,717 priority patent/US10545741B2/en
Publication of JP2016224724A publication Critical patent/JP2016224724A/en
Application granted granted Critical
Publication of JP6481515B2 publication Critical patent/JP6481515B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4441Reducing the execution time required by the program code

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Description

本発明は、コンパイル技術に関する。   The present invention relates to a compilation technique.

言語プロセッサであるコンパイラは、ユーザが作成したソースプログラムをコンパイルし、実行可能なアプリケーション(オブジェクトプログラムとも呼ばれる)を生成する。ユーザは、例えば最適化オプションを指定しつつソースプログラムを記述することで、コンパイラに最適化を行わせ、アプリケーションの性能を向上させることができる。特にHPC(High Performance Computing)の分野においては、プログラムの実行時間を短縮することが重要であり、コンパイラによる最適化(コンパイラ最適化と呼ばれる)が注目されている。   A compiler, which is a language processor, compiles a source program created by a user and generates an executable application (also called an object program). For example, by describing a source program while specifying an optimization option, the user can cause the compiler to perform optimization and improve the performance of the application. Particularly in the field of HPC (High Performance Computing), it is important to shorten the execution time of a program, and optimization by a compiler (called compiler optimization) is attracting attention.

コンパイラ最適化として、定数伝播という技術が知られている。定数伝播とは、コンパイル時に数式内の変数等を定数に置き換える技術である。通常、定数伝播に基づく定数計算は、コンパイラのうちミドルエンド或いはバックエンドにおいて実行される。これに対し、フロントエンドにおいては極めて簡単な定数計算が実行される。定数伝播に基づく定数計算の機能がフロントエンドに実装されることもあるが、コンパイル時間の増加につながることがあり、また処理系依存の機能であるため好まれない。   A technique called constant propagation is known as compiler optimization. Constant propagation is a technique that replaces variables in mathematical expressions with constants during compilation. Normally, constant calculation based on constant propagation is executed in the middle end or back end of the compiler. On the other hand, a very simple constant calculation is executed in the front end. A constant calculation function based on constant propagation may be implemented in the front end, but it may lead to an increase in compile time and is not preferred because it is a function dependent on the processing system.

一方、2011年にC++11という規格が策定され、constexpr(generalized CONSTant EXPRessions)という指定子が導入された。ユーザは、ソースプログラム内の変数、関数、及びクラスにconstexprを付加し、コンパイラのフロントエンドにこれらの定数計算を実行させることができる。上記の定数伝播の場合、最適化機能の適用の度に定数計算を行うことになるが、constexprの場合には定数計算を一括して行えるため、コンパイル時間を短縮することができる。   On the other hand, the standard C ++ 11 was formulated in 2011, and a specifier called constexpr (generalized CONSTant EXPRessions) was introduced. The user can add constexpr to variables, functions, and classes in the source program and have the compiler's front end perform these constant calculations. In the case of the above constant propagation, the constant calculation is performed every time the optimization function is applied. However, in the case of constexpr, the constant calculation can be performed all at once, so that the compilation time can be shortened.

但し、C++11のconstexprには言語仕様上の様々な制約があるため、一般のユーザがconstexprを使いこなしソースプログラムを作成するのは難しいという問題がある。従来技術においては、このような問題には着目されていない。   However, there is a problem that it is difficult for a general user to create a source program by using constexpr because there are various restrictions on language specifications in C + 11 constexpr. The prior art does not pay attention to such a problem.

特開平09−006627号公報JP 09-006627 A 特表平06−501579号公報Japanese Translation of National Publication No. 06-501579 特開平10−40114号公報Japanese Patent Laid-Open No. 10-40114

従って、本発明の目的は、1つの側面では、プログラムの実行時間を短縮するための技術を提供することである。   Therefore, the objective of this invention is providing the technique for shortening the execution time of a program in one side.

本発明に係る情報処理装置は、ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定する特定部と、特定された変数をコンパイル時に定数として取り扱うことを宣言する指定子を、ソースプログラムに追加する追加部と、指定子が追加されたソースプログラムをオブジェクトプログラムに変換する変換部とを有する。   The information processing apparatus according to the present invention specifies a specifying unit that specifies a variable that can be handled as a constant during compilation from among one or more variables included in the source program, and handles the specified variable as a constant during compilation. And a conversion unit for converting the source program to which the specifier is added into an object program.

1つの側面では、プログラムの実行時間を短縮できるようになる。   In one aspect, program execution time can be reduced.

図1は、constexprについて説明するための図である。FIG. 1 is a diagram for explaining constexpr. 図2は、constexprについて説明するための図である。FIG. 2 is a diagram for explaining constexpr. 図3は、constexprについて説明するための図である。FIG. 3 is a diagram for explaining constexpr. 図4は、情報処理装置の機能ブロック図である。FIG. 4 is a functional block diagram of the information processing apparatus. 図5は、配置表を生成する処理の処理フローを示す図である。FIG. 5 is a diagram illustrating a processing flow of processing for generating an arrangement table. 図6は、ソースプログラムの一例を示す図である。FIG. 6 is a diagram illustrating an example of a source program. 図7は、構文木の一例を示す図である。FIG. 7 is a diagram illustrating an example of a syntax tree. 図8は、配置表の一例を示す図である。FIG. 8 is a diagram illustrating an example of an arrangement table. 図9は、記号表の一例を示す図である。FIG. 9 is a diagram illustrating an example of a symbol table. 図10は、メインの処理フローを示す図である。FIG. 10 is a diagram showing a main processing flow. 図11は、記号表の一例を示す図である。FIG. 11 is a diagram illustrating an example of a symbol table. 図12は、メインの処理フローを示す図である。FIG. 12 is a diagram showing a main processing flow. 図13は、記号表の一例を示す図である。FIG. 13 is a diagram illustrating an example of a symbol table. 図14は、修正後の構文木の一例を示す図である。FIG. 14 is a diagram illustrating an example of the corrected syntax tree. 図15は、配置表の一例を示す図である。FIG. 15 is a diagram illustrating an example of an arrangement table. 図16は、記号表の一例を示す図である。FIG. 16 is a diagram illustrating an example of a symbol table. 図17は、修正後のソースプログラムの一例を示す図である。FIG. 17 is a diagram illustrating an example of a modified source program. 図18は、本実施の形態の方法と他の方法との違いを説明するための図である。FIG. 18 is a diagram for explaining a difference between the method of the present embodiment and another method. 図19は、コンピュータの機能ブロック図である。FIG. 19 is a functional block diagram of a computer.

図1乃至図3を用いて、constexprについて説明する。   Constexpr will be described with reference to FIGS. 1 to 3.

図1に、constexprを使用して記述されたソースプログラムの一例を示す。図1の例は、円の面積を計算する例であり、変数r、変数pi、及び変数areaにconstexprが付加されている。これにより、定数計算をコンパイル時に実行することが可能になる。なお、C++11より前の規格においても、実行時定数の整数であればコンパイル時定数として取り扱うことができるが、浮動小数点、関数、及びクラスをコンパイル時定数として取り扱うことは規格上不可能である。コンパイル時定数とは、コンパイル時に値が計算される定数であり、実行時定数とは実行時に値が計算される定数である。   FIG. 1 shows an example of a source program described using constexpr. The example of FIG. 1 is an example of calculating the area of a circle, and constexpr is added to a variable r, a variable pi, and a variable area. This allows constant calculations to be performed at compile time. In the standard before C ++ 11, an integer of an execution time constant can be handled as a compile time constant, but it is impossible in the standard to handle a floating point, a function, and a class as a compile time constant. A compile time constant is a constant whose value is calculated at the time of compilation, and an execution time constant is a constant whose value is calculated at the time of execution.

但し、上で述べたように、C++11のconstexprには言語仕様上の様々な制約があるため、ユーザはconstexprを単純に追加すればよいというわけではない。図2に、単純にソースプログラムにconstexprを追加するとエラーが発生する例を示す。図2の例においては、変数aに変数bを加算した結果を返す例が示されている。図2に示したソースプログラムに対して単純にconstexprを追加すると、図3に示すようなプログラムになる。図3に示したプログラムにおいては、変数a及び変数bにconstexprが付加されている。図3に示したプログラムの場合、「a+=b;」というコードより前のコードには問題は無いが、aはconst(定数)であるのでaを更新することができず、「a+=b;」というコードにおいてエラーが発生する。   However, as described above, the C ++ 11 constexpr has various restrictions on the language specifications, and therefore, the user does not have to simply add the constexpr. FIG. 2 shows an example in which an error occurs when constexpr is simply added to the source program. In the example of FIG. 2, an example is shown in which the result of adding the variable b to the variable a is returned. If constexpr is simply added to the source program shown in FIG. 2, the program shown in FIG. 3 is obtained. In the program shown in FIG. 3, constexpr is added to variables a and b. In the case of the program shown in FIG. 3, there is no problem with the code before the code “a + = b;”, but since a is a const (constant), a cannot be updated, and “a + = b An error occurs in the code “;”.

また、ソースプログラムに無理にconstexprを追加した場合、ソースプログラムが読みにくくなったり、本来意図しないソースプログラムを記述することになることがある。さらに、STL(Standard Template Library)或いはユーザが明示的に作成したconstexpr関数が存在していても、渡される引数がconstexpr宣言された変数或いはリテラルでなければ、コンパイル時に計算されることはない。   If constexpr is forcibly added to the source program, the source program may be difficult to read or a source program that is not originally intended may be described. Further, even if a constexpr function explicitly created by an STL (Standard Template Library) or a user exists, if a passed argument is not a variable or literal declared as constexpr, it is not calculated at the time of compilation.

以上の点に鑑み、本実施の形態においては、以下のような方法によってソースプログラムにconstexprを追加する。   In view of the above points, in the present embodiment, constexpr is added to the source program by the following method.

図4に、本実施の形態における情報処理装置1の機能ブロック図を示す。情報処理装置1は、ソースプログラム格納部101と、字句解析部102と、構文解析部103と、構文木格納部104と、配置表格納部105と、記号表格納部106と、リテラルチェッカー108を含む意味解析部107と、出力部109と、中間コード格納部110と、最適化部111と、生成部112と、オブジェクトプログラム格納部113とを含む。   FIG. 4 shows a functional block diagram of the information processing apparatus 1 in the present embodiment. The information processing apparatus 1 includes a source program storage unit 101, a lexical analysis unit 102, a syntax analysis unit 103, a syntax tree storage unit 104, a placement table storage unit 105, a symbol table storage unit 106, and a literal checker 108. A semantic analysis unit 107, an output unit 109, an intermediate code storage unit 110, an optimization unit 111, a generation unit 112, and an object program storage unit 113 are included.

ソースプログラム格納部101は、ユーザが作成したソースプログラムを格納する。字句解析部102は、ソースプログラム格納部101に格納されたソースプログラムをトークンに分割する処理等を実行し、処理結果を構文解析部103に出力する。構文解析部103は、字句解析部102から受け取った処理結果に基づき、構文木を生成する処理を実行し、処理結果である構文木のデータを構文木格納部104に格納する。また、構文解析部103は、字句解析部102から受け取った処理結果に基づき配置表及び記号表を生成する処理を実行し、配置表を配置表格納部105に格納し、記号表を記号表格納部106に格納する。リテラルチェッカー108は、構文木格納部104に格納されたデータに基づき処理を実行し、処理結果に基づき、配置表格納部105に格納された配置表及び記号表格納部106に格納された記号表を更新する。出力部109は、構文木格納部104に格納された構文木のデータ及び記号表格納部106に格納された記号表に基づきソースプログラムを修正し、修正後のソースプログラムを表示装置(例えばディスプレイ)に表示させる。意味解析部107は、構文木格納部104に格納された構文木のデータに基づきコンパイルエラーが有るか否か判断する処理等を実行し、中間言語のコード(すなわち中間コード)を生成して中間コード格納部110に格納する。最適化部111は、中間コード格納部110に格納された中間コードに対してコンパイラ最適化を実行し、実行結果であるコードを生成部112に出力する。生成部112は、最適化部111から受け取ったコードからオブジェクトプログラムを生成し、オブジェクトプログラム格納部113に格納する。   The source program storage unit 101 stores a source program created by a user. The lexical analysis unit 102 executes processing for dividing the source program stored in the source program storage unit 101 into tokens, and outputs the processing result to the syntax analysis unit 103. The syntax analysis unit 103 executes processing for generating a syntax tree based on the processing result received from the lexical analysis unit 102, and stores the syntax tree data as the processing result in the syntax tree storage unit 104. Further, the syntax analysis unit 103 executes processing for generating an allocation table and a symbol table based on the processing result received from the lexical analysis unit 102, stores the allocation table in the allocation table storage unit 105, and stores the symbol table in the symbol table. Stored in the unit 106. The literal checker 108 executes processing based on the data stored in the syntax tree storage unit 104, and based on the processing result, the arrangement table stored in the arrangement table storage unit 105 and the symbol table stored in the symbol table storage unit 106 Update. The output unit 109 corrects the source program based on the syntax tree data stored in the syntax tree storage unit 104 and the symbol table stored in the symbol table storage unit 106, and displays the corrected source program on a display device (for example, a display). To display. The semantic analysis unit 107 executes processing for determining whether there is a compile error based on the syntax tree data stored in the syntax tree storage unit 104, generates intermediate language code (ie, intermediate code), and performs intermediate processing. It is stored in the code storage unit 110. The optimization unit 111 performs compiler optimization on the intermediate code stored in the intermediate code storage unit 110, and outputs a code as an execution result to the generation unit 112. The generation unit 112 generates an object program from the code received from the optimization unit 111 and stores it in the object program storage unit 113.

本実施の形態においては、字句解析部102、構文解析部103、及び意味解析部107がフロントエンドに相当し、最適化部111がミドルエンドに相当し、生成部112がバックエンドに相当する。なお、意味解析部107、中間コード格納部110、最適化部111、生成部112、及びオブジェクトプログラム格納部113は、本実施の形態の主要な部分とは関係が無いので、詳細な説明を省略する。   In the present embodiment, the lexical analysis unit 102, the syntax analysis unit 103, and the semantic analysis unit 107 correspond to the front end, the optimization unit 111 corresponds to the middle end, and the generation unit 112 corresponds to the back end. The semantic analysis unit 107, the intermediate code storage unit 110, the optimization unit 111, the generation unit 112, and the object program storage unit 113 are not related to the main parts of the present embodiment, and thus detailed description thereof is omitted. To do.

次に、図5乃至図18を用いて、情報処理装置1が実行する処理について説明する。処理の開始時、構文木格納部104に格納された構文木のデータ、配置表格納部105に格納された配置表、及び記号表格納部106に格納された記号表は初期化される。   Next, processing executed by the information processing apparatus 1 will be described with reference to FIGS. At the start of processing, the syntax tree data stored in the syntax tree storage unit 104, the allocation table stored in the allocation table storage unit 105, and the symbol table stored in the symbol table storage unit 106 are initialized.

まず、情報処理装置1のソースプログラム格納部101にソースプログラムが格納されたとする。本実施の形態においては、図6に示すソースプログラムがソースプログラム格納部101に格納されたとする。そして、字句解析部102は、ソースプログラム格納部101に格納されたソースプログラムをトークンに分割する処理を実行し、処理結果を構文解析部103に出力する。   First, it is assumed that a source program is stored in the source program storage unit 101 of the information processing apparatus 1. In the present embodiment, it is assumed that the source program shown in FIG. 6 is stored in the source program storage unit 101. Then, the lexical analyzer 102 executes processing for dividing the source program stored in the source program storage unit 101 into tokens, and outputs the processing result to the syntax analyzer 103.

構文解析部103は、字句解析部102から受け取った処理結果から構文木を生成し(図5:ステップS1)、生成した構文木のデータを構文木格納部104に格納する。図7に、構文木の一例を示す。図7の例では、トークンに網掛けが付されている。構文木を生成する処理はよく知られているので、ここでは詳細な説明を省略する。   The syntax analysis unit 103 generates a syntax tree from the processing result received from the lexical analysis unit 102 (FIG. 5: step S1), and stores the generated syntax tree data in the syntax tree storage unit 104. FIG. 7 shows an example of the syntax tree. In the example of FIG. 7, the token is shaded. Since the process of generating a syntax tree is well known, detailed description thereof is omitted here.

構文解析部103は、生成した構文木に未処理のトークンが有るか判断する(ステップS3)。未処理のトークンが有る場合(ステップS3:Yesルート)、構文解析部103は、未処理のトークンを1つ特定する(ステップS5)。   The syntax analysis unit 103 determines whether there is an unprocessed token in the generated syntax tree (step S3). When there is an unprocessed token (step S3: Yes route), the syntax analysis unit 103 identifies one unprocessed token (step S5).

構文解析部103は、ステップS5において特定したトークンは変数であるか判定する(ステップS7)。本実施の形態においては、構文木において「Variable」と示されたトークンが変数である。図7の例では、a及びbが変数である。トークンが変数ではない場合(ステップS7:Noルート)、次のトークンについて処理するため、ステップS3の処理に戻る。   The syntax analysis unit 103 determines whether the token specified in step S5 is a variable (step S7). In the present embodiment, a token indicated as “Variable” in the syntax tree is a variable. In the example of FIG. 7, a and b are variables. If the token is not a variable (step S7: No route), the process returns to step S3 to process the next token.

一方、トークンが変数である場合(ステップS7:Yesルート)、構文解析部103は、トークンが式の左辺に含まれるか判断する(ステップS9)。図7の例では、トークンが、「Line2」における「Idx 0」のトークンである場合又は「Line4」における「Idx 0」又は「Line5」における「Idx 0」のトークンである場合、式の左辺に含まれると判断される。   On the other hand, when the token is a variable (step S7: Yes route), the syntax analysis unit 103 determines whether the token is included in the left side of the expression (step S9). In the example of FIG. 7, when the token is “Idx 0” token in “Line2”, or “Idx 0” token in “Line4” or “Idx 0” token in “Line5”, It is judged that it is included.

トークンが式の左辺に含まれる場合(ステップS9:Yesルート)、構文解析部103は、変数名及び左辺値を含む新規のエントリを配置表格納部105に格納された配置表に追加する(ステップS11)。そしてステップS3の処理に戻る。本実施の形態において、左辺値は(x)の形式で表され、右辺値は(x,y)の形式で表される。xは行番号であり、yはインデックス番号である。   When the token is included in the left side of the expression (step S9: Yes route), the syntax analysis unit 103 adds a new entry including the variable name and the left side value to the arrangement table stored in the arrangement table storage unit 105 (step S9). S11). Then, the process returns to step S3. In the present embodiment, the left side value is represented in the format (x), and the right side value is represented in the format (x, y). x is a row number, and y is an index number.

トークンが式の左辺に含まれない場合(ステップS9:Noルート)、構文解析部103は、配置表格納部105に格納された配置表の既存エントリに右辺値を追加する(ステップS13)。そしてステップS3の処理に戻る。   When the token is not included in the left side of the expression (step S9: No route), the syntax analysis unit 103 adds the right-side value to the existing entry of the arrangement table stored in the arrangement table storage unit 105 (step S13). Then, the process returns to step S3.

図8に、配置表格納部105に格納される配置表の一例を示す。図8の例では、変数名と、左辺値と、右辺値とが格納される。   FIG. 8 shows an example of an arrangement table stored in the arrangement table storage unit 105. In the example of FIG. 8, a variable name, a left side value, and a right side value are stored.

一方、未処理のトークンが無い場合(ステップS3:Noルート)、構文解析部103は、ソースプログラムについて記号表を生成して記号表格納部106に格納し、処理を終了する。   On the other hand, when there is no unprocessed token (step S3: No route), the syntax analysis unit 103 generates a symbol table for the source program, stores it in the symbol table storage unit 106, and ends the process.

図9に、記号表の一例を示す。図9の例では、変数の型と、変数名と、属性とが格納される。本処理の時点では、属性の欄にはデータが格納されない。   FIG. 9 shows an example of a symbol table. In the example of FIG. 9, the variable type, variable name, and attribute are stored. At the time of this processing, no data is stored in the attribute column.

次に、リテラルチェッカー108が実行する処理について説明する。配置表及び記号表の生成が完了すると、リテラルチェッカー108は、配置表格納部105に格納された配置表において未処理の変数を探索する(図10:ステップS21)。   Next, processing executed by the literal checker 108 will be described. When the generation of the arrangement table and the symbol table is completed, the literal checker 108 searches for an unprocessed variable in the arrangement table stored in the arrangement table storage unit 105 (FIG. 10: Step S21).

リテラルチェッカー108は、配置表格納部105において未処理の変数が有るか判断する(ステップS23)。未処理の変数が有る場合(ステップS23:Yesルート)、リテラルチェッカー108は、未処理の変数を配置表から1つ特定する(ステップS29)。   The literal checker 108 determines whether there is an unprocessed variable in the arrangement table storage unit 105 (step S23). When there is an unprocessed variable (step S23: Yes route), the literal checker 108 specifies one unprocessed variable from the arrangement table (step S29).

リテラルチェッカー108は、ステップS29において特定した変数の左辺値の行番号によって特定される式の右辺はコンパイル時定数であるか判断する(ステップS31)。本実施の形態においては、右辺が例えば「10」或いは「20」等の定数であればコンパイル時定数であると判断することとする。また、たとえ右辺が変数を含むとしても、その変数の属性がconstexprである場合には、コンパイル時定数であると判断することとする。すなわち、ステップS31においては、式の右辺がリテラルであるか否かがリテラルチェッカー108によって判断される。   The literal checker 108 determines whether the right side of the expression specified by the line number of the left-side value of the variable specified in step S29 is a compile time constant (step S31). In the present embodiment, if the right side is a constant such as “10” or “20”, it is determined that it is a compile time constant. Further, even if the right side includes a variable, if the attribute of the variable is constexpr, it is determined that it is a compile time constant. That is, in step S31, the literal checker 108 determines whether or not the right side of the expression is a literal.

右辺がコンパイル時定数ではない場合(ステップS31:Noルート)、ステップS21の処理に戻る。一方、右辺がコンパイル時定数である場合(ステップS31:Yesルート)、リテラルチェッカー108は、変数の属性は記号表において既に「constexpr」に設定されているか判断する(ステップS33)。   If the right side is not a compile time constant (step S31: No route), the process returns to step S21. On the other hand, when the right side is a compile time constant (step S31: Yes route), the literal checker 108 determines whether the variable attribute has already been set to “constexprpr” in the symbol table (step S33).

変数の属性は記号表において既に「constexpr」に設定されている場合(ステップS33:Yesルート)、ステップS21の処理に戻る。一方、変数の属性は記号表において未だ「constexpr」に設定されていない場合(ステップS33:Noルート)、リテラルチェッカー108は、ステップS29において特定した変数の属性を「constexpr」に設定する(ステップS35)。処理は端子Aを介して図12のステップS37の処理に移行する。   If the attribute of the variable is already set to “constexprpr” in the symbol table (step S33: Yes route), the process returns to step S21. On the other hand, if the variable attribute is not yet set to “constexpr” in the symbol table (step S33: No route), the literal checker 108 sets the attribute of the variable identified in step S29 to “constexpr” (step S35). ). The processing shifts to the processing in step S37 in FIG.

図11に、ステップS35の処理後に記号表に格納されるデータの一例を示す。図11の例では、変数aの属性が「constexpr」に設定されている。   FIG. 11 shows an example of data stored in the symbol table after the process of step S35. In the example of FIG. 11, the attribute of the variable a is set to “constexpr”.

図12の説明に移行し、リテラルチェッカー108は、ステップS29において特定した変数の変数名と同じ変数名のエントリが配置表に未だ存在するか判断する(図12:ステップS37)。同じ変数名のエントリが配置表に存在しない場合(ステップS37:Noルート)、処理は端子Bを介してステップS21の処理に戻る。   Shifting to the description of FIG. 12, the literal checker 108 determines whether an entry having the same variable name as the variable name identified in step S29 still exists in the arrangement table (FIG. 12: step S37). If no entry with the same variable name exists in the arrangement table (step S37: No route), the process returns to the process of step S21 via the terminal B.

一方、同じ変数名のエントリが配置表に未だ存在する場合(ステップS37:Yesルート)、リテラルチェッカー108は、同じ変数名を有する変数を1つ特定する(ステップS38)。そして、リテラルチェッカー108は、ステップS38において特定した変数の変数名を変更する(ステップS39)。ステップS39においては、例えばSSA形式(Static Single Assignment form)の新変数名が割り当てられる。   On the other hand, if an entry with the same variable name still exists in the allocation table (step S37: Yes route), the literal checker 108 identifies one variable having the same variable name (step S38). Then, the literal checker 108 changes the variable name of the variable identified in step S38 (step S39). In step S39, for example, a new variable name in the SSA format (Static Single Assignment form) is assigned.

リテラルチェッカー108は、新変数名を記号表に登録する(ステップS41)。図13に、ステップS41の処理後に記号表に格納されるデータの一例を示す。図13の例では、新変数名「a2」が新たに記号表に登録されている。   The literal checker 108 registers the new variable name in the symbol table (step S41). FIG. 13 shows an example of data stored in the symbol table after the process of step S41. In the example of FIG. 13, the new variable name “a2” is newly registered in the symbol table.

リテラルチェッカー108は、新変数名に変更された変数について、構文木における変数名及び配置表における変数名を更新する(ステップS43)。そしてステップS37の処理に戻る。   The literal checker 108 updates the variable name in the syntax tree and the variable name in the arrangement table for the variable changed to the new variable name (step S43). Then, the process returns to step S37.

図14に、ステップS43の処理後における構文木の一例を示す。図14の例では、黒色の矢印が付された、「Line5」における「Idx 0」のトークンの変数名と、「Line6」における「Idx 0」のトークンの変数名とが、「a」から「a2」に変更されている。   FIG. 14 shows an example of the syntax tree after the processing in step S43. In the example of FIG. 14, the variable name of the token “Idx 0” in “Line 5” and the variable name of the token “Idx 0” in “Line 6” with black arrows are added from “a” to “ a2 ".

図15に、ステップS43の処理後における配置表の一例を示す。図15の例では、3行目のエントリにおける変数名が「a」から「a2」に変更されている。   FIG. 15 shows an example of the arrangement table after the process of step S43. In the example of FIG. 15, the variable name in the entry on the third line is changed from “a” to “a2”.

図10の説明に戻り、未処理の変数が無い場合(ステップS23:Noルート)、リテラルチェッカー108は、出力部109に解析が完了したことを通知する。これに応じ、出力部109は、修正したソースプログラムを、構文木格納部104に格納された構文木のデータ及び記号表格納部106に格納された記号表に基づき生成する(ステップS25)。   Returning to the description of FIG. 10, when there is no unprocessed variable (step S23: No route), the literal checker 108 notifies the output unit 109 that the analysis is completed. In response to this, the output unit 109 generates a corrected source program based on the syntax tree data stored in the syntax tree storage unit 104 and the symbol table stored in the symbol table storage unit 106 (step S25).

図16に、ステップS25の処理時点において記号表に格納されるデータの一例を示す。図16の例では、変数a、変数b、及び変数a2のいずれに対しても、属性「constexpr」が設定されている。このような状態において、出力部109は、例えば図17に示すようにソースプログラムを修正する。すなわち、出力部109は、記号表において属性「constexpr」が設定されている変数の宣言文に、指定子「constexpr」を追加する。ここで、変数a2については、構文木のデータに基づき「a+=b;」というコードを「a2=a+b」というコードに書き換える。   FIG. 16 shows an example of data stored in the symbol table at the time of processing in step S25. In the example of FIG. 16, the attribute “constexprr” is set for any of the variable a, the variable b, and the variable a2. In such a state, the output unit 109 corrects the source program as shown in FIG. 17, for example. That is, the output unit 109 adds the specifier “constexpr” to the declaration statement of the variable for which the attribute “constexpr” is set in the symbol table. Here, for the variable a2, the code “a + = b;” is rewritten to the code “a2 = a + b” based on the data of the syntax tree.

出力部109は、修正されたソースプログラムを表示装置に表示させる(ステップS27)。そして処理を終了する。これにより、ユーザは、修正後のソースコードの内容を確認し、今後のプログラム開発の参考にすることができるようになる。   The output unit 109 displays the corrected source program on the display device (step S27). Then, the process ends. As a result, the user can confirm the contents of the modified source code and can be used as a reference for future program development.

以上のようにすれば、実行時ではなくコンパイル時に定数計算が実行されるようになるので、実行時間の短縮が可能になる。また、通常の最適化部111は中間コードに対して最適化を実行するため、ソースコード全容を把握できず、変数の有効範囲等がわからないため、実行できない最適化が生じることがある。しかし、本実施の形態においてはフロントエンドにおいても最適化を実行するので、最適化部111のみにおいて最適化を実行するよりも広範囲の最適化を行うことができるようになる。   In this way, the constant calculation is executed at the time of compilation instead of at the time of execution, so that the execution time can be shortened. In addition, since the normal optimization unit 111 performs optimization on the intermediate code, the entire source code cannot be grasped, and the effective range of the variable is not known. Therefore, optimization that cannot be performed may occur. However, in this embodiment, since optimization is performed also in the front end, a wider range of optimization can be performed than when optimization is performed only by the optimization unit 111.

また、constexprはソースコードに自動的に付加されるので、ユーザの知識や技術が不足している場合においても、ソースレベルの最適化が可能になる。   Further, since constexpr is automatically added to the source code, even when the user's knowledge and skills are insufficient, the source level can be optimized.

また、上で述べたような配置表を利用し、構文木内のトークンのうち変数名の変更の影響を受けるトークンのみを置換することで、高速な置換が可能になる。   Further, by using the arrangement table as described above and replacing only the tokens affected by the change of the variable name among the tokens in the syntax tree, high-speed replacement becomes possible.

また、既存のconstexpr関数或いはクラスに渡す引数がコンパイル時定数になる可能性が高くなるため、constexprの適用範囲を拡大することができるようになる。その結果として、さらに実行時間を短縮することが可能になる。   In addition, since there is a high possibility that an argument passed to an existing constexpr function or class becomes a compile time constant, the scope of application of constexpr can be expanded. As a result, the execution time can be further shortened.

また、フロントエンドにおいて計算可能な部分が計算されてから最適化部111において最適化を実行することになるため、最適化部111が実行すべき処理を少なくすることができるようになる。   In addition, optimization is performed in the optimization unit 111 after a part that can be calculated in the front end is calculated, so that the processing to be performed by the optimization unit 111 can be reduced.

また、言語規格に準拠するようにconstexprを付加するため、修正後のソースコードのコンパイルを他のコンパイラに実行させることも可能である。また、本実施の形態の方法はアーキテクチャに依存しない。   Further, since constexpr is added so as to comply with the language standard, it is possible to cause another compiler to compile the corrected source code. Further, the method of the present embodiment does not depend on the architecture.

図18を用いて、本実施の形態の方法(以下、本方法と呼ぶ)と他の方法との違いを説明する。ここでは、処理系への依存、コンパイル時間、実行時間、及び利便性という4つの観点から各方法を比較している。   The difference between the method of the present embodiment (hereinafter referred to as the present method) and another method will be described with reference to FIG. Here, each method is compared from four viewpoints of dependency on the processing system, compilation time, execution time, and convenience.

まず、本方法及び人手によってconstexprを付加する方法は、C++11をサポートするコンパイラであれば適用可能である。一方、定数伝播(すなわち、ミドルエンド或いはバックエンドによる最適化)は、コンパイラの最適化部111の作りこみを要するため、他のコンパイラではその最適化部111の機能を使用することができない。すなわち、定数伝播は処理系に依存する。   First, this method and the method of manually adding constexpr can be applied to any compiler that supports C ++ 11. On the other hand, constant propagation (that is, optimization by the middle end or back end) requires the creation of the optimization unit 111 of the compiler, so that other compilers cannot use the function of the optimization unit 111. That is, constant propagation depends on the processing system.

また、本方法及び人手によってconstexprを付加する方法によれば、定数計算を一括して実行できるため、コンパイル時間を短縮することができる。一方、定数伝播の場合、最適化部111において最適化機能を適用する度に定数伝播が行われるため、本方法と比較してコンパイル時間が長い。   In addition, according to the present method and the method of manually adding constexpr, constant calculation can be executed in a lump, so that the compilation time can be shortened. On the other hand, in the case of constant propagation, constant propagation is performed each time the optimization function is applied in the optimization unit 111, so that the compilation time is longer than that in the present method.

また、本方法においては機械的に漏れなくconstexprを付加するため、人手によってconstexprを付加する方法と比較すると、実行性能が向上し、実行時間の短縮につながる。   Further, in this method, constexpr is added without mechanical leakage, so that execution performance is improved and execution time is shortened as compared with a method of adding constexpr manually.

また、本方法においてはユーザがconstexprの使用方法を理解しなくてもよいため、利便性を向上させることができる。また、C++11の言語仕様に則っているため、他の処理系に修正後のソースプログラムをコンパイルさせることもできる。一方、人手によってconstexprを付加する方法は、ユーザがconstexprの使用方法を理解しなければならないため、本方法と比較して利便性は低い。   Moreover, in this method, since the user does not need to understand how to use constexpr, convenience can be improved. Moreover, since it complies with the language specification of C ++ 11, it is possible to compile the corrected source program in another processing system. On the other hand, the method of manually adding constexpr is less convenient than the present method because the user must understand how to use constexpr.

以上本発明の一実施の形態を説明したが、本発明はこれに限定されるものではない。例えば、上で説明した情報処理装置1の機能ブロック構成は実際のプログラムモジュール構成に一致しない場合もある。   Although one embodiment of the present invention has been described above, the present invention is not limited to this. For example, the functional block configuration of the information processing apparatus 1 described above may not match the actual program module configuration.

また、上で説明したデータ保持の構成は一例であって、上記のような構成でなければならないわけではない。さらに、処理フローにおいても、処理結果が変わらなければ処理の順番を入れ替えることも可能である。さらに、並列に実行させるようにしても良い。   Further, the configuration of data holding described above is an example, and the configuration as described above is not necessarily required. Further, in the processing flow, the processing order can be changed if the processing result does not change. Further, it may be executed in parallel.

また、修正後のソースコードと元のソースコードとを並べて表示するようにしてもよい。また、修正後のソースコードを表示装置に表示させる例を示したが、修正後のソースコードが記載された用紙をプリンタ等から印刷するようにしてもよい。また、   Further, the corrected source code and the original source code may be displayed side by side. In addition, although an example in which the corrected source code is displayed on the display device has been described, a sheet on which the corrected source code is described may be printed from a printer or the like. Also,

なお、上で述べた情報処理装置1は、コンピュータ装置であって、図19に示すように、メモリ2501とCPU(Central Processing Unit)2503とハードディスク・ドライブ(HDD:Hard Disk Drive)2505と表示装置2509に接続される表示制御部2507とリムーバブル・ディスク2511用のドライブ装置2513と入力装置2515とネットワークに接続するための通信制御部2517とがバス2519で接続されている。オペレーティング・システム(OS:Operating System)及び本実施例における処理を実施するためのアプリケーション・プログラムは、HDD2505に格納されており、CPU2503により実行される際にはHDD2505からメモリ2501に読み出される。CPU2503は、アプリケーション・プログラムの処理内容に応じて表示制御部2507、通信制御部2517、ドライブ装置2513を制御して、所定の動作を行わせる。また、処理途中のデータについては、主としてメモリ2501に格納されるが、HDD2505に格納されるようにしてもよい。本発明の実施例では、上で述べた処理を実施するためのアプリケーション・プログラムはコンピュータ読み取り可能なリムーバブル・ディスク2511に格納されて頒布され、ドライブ装置2513からHDD2505にインストールされる。インターネットなどのネットワーク及び通信制御部2517を経由して、HDD2505にインストールされる場合もある。このようなコンピュータ装置は、上で述べたCPU2503、メモリ2501などのハードウエアとOS及びアプリケーション・プログラムなどのプログラムとが有機的に協働することにより、上で述べたような各種機能を実現する。   The information processing apparatus 1 described above is a computer apparatus, and as shown in FIG. 19, a memory 2501, a CPU (Central Processing Unit) 2503, a hard disk drive (HDD: Hard Disk Drive) 2505, and a display device. A display control unit 2507 connected to 2509, a drive device 2513 for the removable disk 2511, an input device 2515, and a communication control unit 2517 for connecting to a network are connected by a bus 2519. An operating system (OS) and an application program for executing the processing in this embodiment are stored in the HDD 2505, and are read from the HDD 2505 to the memory 2501 when executed by the CPU 2503. The CPU 2503 controls the display control unit 2507, the communication control unit 2517, and the drive device 2513 according to the processing content of the application program, and performs a predetermined operation. Further, data in the middle of processing is mainly stored in the memory 2501, but may be stored in the HDD 2505. In the embodiment of the present invention, an application program for performing the above-described processing is stored in a computer-readable removable disk 2511 and distributed, and installed in the HDD 2505 from the drive device 2513. In some cases, the HDD 2505 may be installed via a network such as the Internet and the communication control unit 2517. Such a computer apparatus realizes various functions as described above by organically cooperating hardware such as the CPU 2503 and the memory 2501 described above and programs such as the OS and application programs. .

以上述べた本発明の実施の形態をまとめると、以下のようになる。   The embodiment of the present invention described above is summarized as follows.

本実施の形態の第1の態様に係る情報処理装置は、(A)ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定する特定部と、(B)特定された変数をコンパイル時に定数として取り扱うことを宣言する指定子を、ソースプログラムに追加する追加部と、(C)指定子が追加されたソースプログラムをオブジェクトプログラムに変換する変換部とを有する。   The information processing apparatus according to the first aspect of the present embodiment includes (A) a specifying unit that specifies a variable that can be handled as a constant at compile time among one or more variables included in a source program; B) An adder that adds to the source program a specifier that declares that the specified variable is handled as a constant at compile time, and (C) a conversion unit that converts the source program with the specifier added to an object program. Have.

このようにすれば、実行時に行われる計算をコンパイル時に行うことが可能になるので、実行に要する時間を短縮できるようになる。   In this way, it is possible to perform calculations performed at the time of compilation at the time of compilation, so that the time required for execution can be shortened.

また、上で述べた特定部は、(a1)ソースプログラムに含まれる1又は複数の変数の各々について、当該変数を左辺に含む式を特定し、(a2)ソースプログラムに含まれる1又は複数の変数のうち、特定された式の右辺が定数であるという条件を満たす変数を特定してもよい。このようにすれば、コンパイル時に定数として取り扱うことが可能な変数を適切に特定できるようになる。   The specifying unit described above specifies (a1) an expression including the variable on the left side for each of one or more variables included in the source program, and (a2) one or more variables included in the source program. Of the variables, a variable that satisfies the condition that the right side of the specified expression is a constant may be specified. This makes it possible to appropriately specify variables that can be handled as constants at the time of compilation.

また、本情報処理装置は、(D)ソースプログラムにおける式の左辺が複数の同じ変数を含む場合、当該複数の同じ変数の各々に異なる変数名を割り当て、当該変数名の割り当てに従いソースプログラムを修正する修正部をさらに有してもよい。このようにすれば、値が更新される変数が存在する場合にも対処できるようになる。   In addition, when the left side of the expression in the source program includes a plurality of the same variables, the information processing apparatus assigns a different variable name to each of the plurality of the same variables, and corrects the source program according to the assignment of the variable names. You may have further the correction part to do. In this way, it is possible to cope with a case where there is a variable whose value is updated.

また、本情報処理装置は、(E)指定子が追加されたソースプログラムを出力する出力部をさらに有してもよい。このようにすれば、ソースプログラムの作成者等が、実行時間の短縮に有効な記述方法を確認できるようになる。   The information processing apparatus may further include an output unit that outputs a source program to which (E) a specifier is added. In this way, a source program creator or the like can confirm a description method effective for shortening the execution time.

本実施の形態の第2の態様に係るコンパイル方法は、(F)ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定し、(G)特定された変数をコンパイル時に定数として取り扱うことを宣言する指定子を、ソースプログラムに追加し、(H)指定子が追加されたソースプログラムをオブジェクトプログラムに変換する処理を含む。   In the compiling method according to the second aspect of the present embodiment, (F) one or more variables included in the source program is specified as a constant that can be handled at compile time, and (G) is specified. A specifier for declaring that a variable is handled as a constant at compile time is added to the source program, and (H) includes processing for converting the source program to which the specifier has been added into an object program.

なお、上記方法による処理をコンピュータに行わせるためのプログラムを作成することができ、当該プログラムは、例えばフレキシブルディスク、CD−ROM、光磁気ディスク、半導体メモリ、ハードディスク等のコンピュータ読み取り可能な記憶媒体又は記憶装置に格納される。尚、中間的な処理結果はメインメモリ等の記憶装置に一時保管される。   A program for causing a computer to perform the processing according to the above method can be created. The program can be a computer-readable storage medium such as a flexible disk, a CD-ROM, a magneto-optical disk, a semiconductor memory, a hard disk, or the like. It is stored in a storage device. The intermediate processing result is temporarily stored in a storage device such as a main memory.

以上の実施例を含む実施形態に関し、さらに以下の付記を開示する。   The following supplementary notes are further disclosed with respect to the embodiments including the above examples.

(付記1)
ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定する特定部と、
特定された前記変数をコンパイル時に定数として取り扱うことを宣言する指定子を、前記ソースプログラムに追加する追加部と、
前記指定子が追加された前記ソースプログラムをオブジェクトプログラムに変換する変換部と、
を有する情報処理装置。
(Appendix 1)
A specifying unit for specifying a variable that can be handled as a constant during compilation from among one or more variables included in the source program;
An adder that adds to the source program a specifier that declares that the identified variable is treated as a constant at compile time;
A conversion unit that converts the source program to which the specifier is added into an object program;
An information processing apparatus.

(付記2)
前記特定部は、
前記ソースプログラムに含まれる1又は複数の変数の各々について、当該変数を左辺に含む式を特定し、
前記ソースプログラムに含まれる1又は複数の変数のうち、特定された前記式の右辺が定数であるという条件を満たす変数を特定する、
付記1記載の情報処理装置。
(Appendix 2)
The specific part is:
For each of one or more variables included in the source program, specify an expression that includes the variable on the left side,
Specifying a variable that satisfies a condition that the right side of the specified expression is a constant among one or more variables included in the source program,
The information processing apparatus according to attachment 1.

(付記3)
前記ソースプログラムにおける式の左辺が複数の同じ変数を含む場合、当該複数の同じ変数の各々に異なる変数名を割り当て、当該変数名の割り当てに従い前記ソースプログラムを修正する修正部
をさらに有する付記1又は2記載の情報処理装置。
(Appendix 3)
Appendix 1 or 2. The information processing apparatus according to 2.

(付記4)
前記指定子が追加された前記ソースプログラムを出力する出力部
をさらに有する付記1乃至3のいずれか1つ記載の情報処理装置。
(Appendix 4)
The information processing apparatus according to any one of supplementary notes 1 to 3, further comprising: an output unit that outputs the source program to which the specifier has been added.

(付記5)
ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定し、
特定された前記変数をコンパイル時に定数として取り扱うことを宣言する指定子を、前記ソースプログラムに追加し、
前記指定子が追加された前記ソースプログラムをオブジェクトプログラムに変換する、
処理をコンピュータが実行するコンパイル方法。
(Appendix 5)
Identify one or more variables included in the source program that can be handled as constants at compile time,
Add a specifier to the source program that declares the identified variable to be treated as a constant at compile time,
Converting the source program to which the specifier is added into an object program;
A compilation method in which processing is performed by a computer.

(付記6)
ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定し、
特定された前記変数をコンパイル時に定数として取り扱うことを宣言する指定子を、前記ソースプログラムに追加し、
前記指定子が追加された前記ソースプログラムをオブジェクトプログラムに変換する、
処理をコンピュータに実行させるためのコンパイラプログラム。
(Appendix 6)
Identify one or more variables included in the source program that can be handled as constants at compile time,
Add a specifier to the source program that declares the identified variable to be treated as a constant at compile time,
Converting the source program to which the specifier is added into an object program;
A compiler program that causes a computer to execute processing.

1 情報処理装置 101 ソースプログラム格納部
102 字句解析部 103 構文解析部
104 構文木格納部 105 配置表格納部
106 記号表格納部 107 意味解析部
108 リテラルチェッカー 109 出力部
110 中間コード格納部 111 最適化部
112 生成部 113 オブジェクトプログラム格納部
DESCRIPTION OF SYMBOLS 1 Information processing apparatus 101 Source program storage part 102 Lexical analysis part 103 Syntax analysis part 104 Syntax tree storage part 105 Arrangement table storage part 106 Symbol table storage part 107 Semantic analysis part 108 Literal checker 109 Output part 110 Intermediate code storage part 111 Optimization Unit 112 generation unit 113 object program storage unit

Claims (6)

ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定する特定部と、
特定された前記変数をコンパイル時に定数として取り扱うことを宣言する指定子を、前記ソースプログラムに追加する追加部と、
前記指定子が追加された前記ソースプログラムをオブジェクトプログラムに変換する変換部と、
を有する情報処理装置。
A specifying unit for specifying a variable that can be handled as a constant at the time of compiling among one or more variables included in the source program;
An adder that adds to the source program a specifier that declares that the identified variable is treated as a constant at compile time;
A conversion unit that converts the source program to which the specifier is added into an object program;
An information processing apparatus.
前記特定部は、
前記ソースプログラムに含まれる1又は複数の変数の各々について、当該変数を左辺に含む式を特定し、
前記ソースプログラムに含まれる1又は複数の変数のうち、特定された前記式の右辺が定数であるという条件を満たす変数を特定する、
請求項1記載の情報処理装置。
The specific part is:
For each of one or more variables included in the source program, specify an expression that includes the variable on the left side,
Specifying a variable that satisfies a condition that the right side of the specified expression is a constant among one or more variables included in the source program,
The information processing apparatus according to claim 1.
前記ソースプログラムにおける式の左辺が複数の同じ変数を含む場合、当該複数の同じ変数の各々に異なる変数名を割り当て、当該変数名の割り当てに従い前記ソースプログラムを修正する修正部
をさらに有する請求項1又は2記載の情報処理装置。
When the left side of the expression in the source program includes a plurality of the same variables, the modification unit further assigns a different variable name to each of the plurality of the same variables, and modifies the source program according to the assignment of the variable names. Or the information processing apparatus of 2.
前記指定子が追加された前記ソースプログラムを出力する出力部
をさらに有する請求項1乃至3のいずれか1つ記載の情報処理装置。
The information processing apparatus according to claim 1, further comprising: an output unit that outputs the source program to which the specifier is added.
ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定し、
特定された前記変数をコンパイル時に定数として取り扱うことを宣言する指定子を、前記ソースプログラムに追加し、
前記指定子が追加された前記ソースプログラムをオブジェクトプログラムに変換する、
処理をコンピュータが実行するコンパイル方法。
Identify one or more variables included in the source program that can be handled as constants at compile time,
Add a specifier to the source program that declares the identified variable to be treated as a constant at compile time,
Converting the source program to which the specifier is added into an object program;
A compilation method in which processing is performed by a computer.
ソースプログラムに含まれる1又は複数の変数のうち、コンパイル時に定数として取り扱うことが可能な変数を特定し、
特定された前記変数をコンパイル時に定数として取り扱うことを宣言する指定子を、前記ソースプログラムに追加し、
前記指定子が追加された前記ソースプログラムをオブジェクトプログラムに変換する、
処理をコンピュータに実行させるためのコンパイラプログラム。
Identify one or more variables included in the source program that can be handled as constants at compile time,
Add a specifier to the source program that declares the identified variable to be treated as a constant at compile time,
Converting the source program to which the specifier is added into an object program;
A compiler program that causes a computer to execute processing.
JP2015110680A 2015-05-29 2015-05-29 Information processing apparatus, compiling method, and compiler program Active JP6481515B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2015110680A JP6481515B2 (en) 2015-05-29 2015-05-29 Information processing apparatus, compiling method, and compiler program
US15/156,717 US10545741B2 (en) 2015-05-29 2016-05-17 Information processing apparatus, method of compiling, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015110680A JP6481515B2 (en) 2015-05-29 2015-05-29 Information processing apparatus, compiling method, and compiler program

Publications (2)

Publication Number Publication Date
JP2016224724A JP2016224724A (en) 2016-12-28
JP6481515B2 true JP6481515B2 (en) 2019-03-13

Family

ID=57398565

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015110680A Active JP6481515B2 (en) 2015-05-29 2015-05-29 Information processing apparatus, compiling method, and compiler program

Country Status (2)

Country Link
US (1) US10545741B2 (en)
JP (1) JP6481515B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
BR112017021873B1 (en) * 2015-04-17 2022-09-13 Ball Corporation APPARATUS FOR CONTROLLING THE INPUT AND OUTPUT SPEED OF A CONTINUOUS SHEET OF TONGUE MATERIAL, FIRST APPARATUS AND METHOD OF CONTROLLING AN INPUT RATE AND AN OUTPUT RATE ON A CONTINUOUS SHEET OF MATERIAL
US10421111B2 (en) 2015-04-17 2019-09-24 Ball Corporation Method and apparatus for controlling an operation performed on a continuous sheet of material
US20220318702A1 (en) * 2021-04-06 2022-10-06 International Business Machines Corporation Dynamically modifying a platform based on user feedback

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0526622A1 (en) 1991-02-27 1993-02-10 Digital Equipment Corporation Interface for representing effects in a multilanguage optimizing compiler
JP3650649B2 (en) * 1995-06-16 2005-05-25 松下電器産業株式会社 Optimization device
CA2175711A1 (en) 1996-05-01 1997-11-02 Lee Richard Nackman Incremental compilation of c++ programs
US5812855A (en) * 1996-06-03 1998-09-22 Silicon Graphics, Inc. System and method for constaint propagation cloning for unknown edges in IPA
CA2178898C (en) 1996-06-12 2000-02-01 David Joseph Streeter Sequencing and error detection of template instantiations during compilation of c++ programs
JP3788832B2 (en) * 1996-10-04 2006-06-21 株式会社東芝 Compound computer system
US6106571A (en) * 1998-01-29 2000-08-22 Applied Microsystems Corporation Relocatable instrumentation tags for testing and debugging a computer program
US7086046B2 (en) * 2001-07-30 2006-08-01 International Business Machines Corporation Method and apparatus for displaying compiler-optimizated code
US7389501B1 (en) * 2003-02-18 2008-06-17 Microsoft Corporation System and method for register allocation using SSA construction
US7917842B2 (en) * 2004-05-27 2011-03-29 Collegenet, Inc. System for describing the overlaying of electronic data onto an electronic image
JP4997749B2 (en) * 2005-12-07 2012-08-08 富士ゼロックス株式会社 Document processing method, program, and system
US20080244472A1 (en) * 2007-03-29 2008-10-02 Atrenta, Inc. Method for accelerating the generation of an optimized gate-level representation from a rtl representation
US8656377B2 (en) * 2010-06-10 2014-02-18 Microsoft Corporation Tracking variable information in optimized code
US8959479B2 (en) * 2011-05-06 2015-02-17 International Business Machines Corporation Presenting a custom view in an integrated development environment based on a variable selection
US8726255B2 (en) * 2012-05-01 2014-05-13 Concurix Corporation Recompiling with generic to specific replacement
CN104166822B (en) * 2013-05-20 2017-10-13 阿里巴巴集团控股有限公司 A kind of method and apparatus of data protection
JP6018022B2 (en) * 2013-06-14 2016-11-02 株式会社デンソー Parallel compilation method, parallel compiler, parallel compilation device, and in-vehicle device
US8990784B2 (en) * 2013-06-28 2015-03-24 International Business Machines Corporation Determining control flow divergence due to variable value difference

Also Published As

Publication number Publication date
US10545741B2 (en) 2020-01-28
US20160350090A1 (en) 2016-12-01
JP2016224724A (en) 2016-12-28

Similar Documents

Publication Publication Date Title
JP6637398B2 (en) Judgment device and judgment method
US8645932B2 (en) Control flow analysis methods and computing devices for converting COBOL-sourced programs to object-oriented program structures
US8453128B2 (en) Method and system for implementing a just-in-time compiler
US20130031531A1 (en) Method and system for performing backward-driven path-sensitive dataflow analysis
US10133560B2 (en) Link time program optimization in presence of a linker script
US7917899B2 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
US8863101B2 (en) Compiler generator
US20070226723A1 (en) Efficient generation of SIMD code in presence of multi-threading and other false sharing conditions and in machines having memory protection support
US9552195B2 (en) Enlarging control regions to optimize script code compilation
US20130159982A1 (en) Language Translation Using Preprocessor Macros
JP6003699B2 (en) Test data generation program, method and apparatus
JP2012038231A (en) Compile method for optimizing binary code, compiler system therefor, and computer program
JP2011065220A (en) Compiler program, compilation method and computer system
JP6481515B2 (en) Information processing apparatus, compiling method, and compiler program
US20200183658A1 (en) Identification and visualization of associations among code generated from a model and sources that affect code generation
US10013244B2 (en) Apparatus and method to compile a variadic template function
Moyen et al. Loop quasi-invariant chunk detection
JP6651974B2 (en) Information processing apparatus, compiling method and compiler program
US20090271766A1 (en) Methods, systems and computer program products for improving program performance by anti-refactoring
Moyen et al. Loop quasi-invariant chunk motion by peeling with statement composition
Macedo et al. Efficient Embedding of Strategic Attribute Grammars via Memoization
JPH09282173A (en) Static analysis method for program
US11615014B2 (en) Using relocatable debugging information entries to save compile time
Graf Compiler backend generation using the VADL processor description language
JP2011180814A (en) Compiler apparatus, compiling method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180306

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20181127

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20190115

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190128

R150 Certificate of patent or registration of utility model

Ref document number: 6481515

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150