JP2006163854A - Compile method, compile processor, program, and recording medium - Google Patents
Compile method, compile processor, program, and recording medium Download PDFInfo
- Publication number
- JP2006163854A JP2006163854A JP2004354835A JP2004354835A JP2006163854A JP 2006163854 A JP2006163854 A JP 2006163854A JP 2004354835 A JP2004354835 A JP 2004354835A JP 2004354835 A JP2004354835 A JP 2004354835A JP 2006163854 A JP2006163854 A JP 2006163854A
- Authority
- JP
- Japan
- Prior art keywords
- function
- compile
- exclusion
- compilation
- return value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、ソースプログラムのコンパイル方法および処理装置、プログラムおよび記録媒体に関する。 The present invention relates to a source program compiling method and processing apparatus, a program, and a recording medium.
標準ソースプログラムを使用して複数の製品機種毎の実行モジュールを作成する場合、
前記標準ソースプログラムには各製品機種で使用する全ての関数とその関数呼び出しを含めておき、製品機種毎の仕様に応じて、不要な関数の関数呼び出しと関数本体を除外する必要がある。
従来のコンパイラでは、関数単位での除外指定の機能がなく、標準ソースプログラムを使用して製品機種毎の実行モジュールを作成する場合には、図5に示すように、製品機種毎に不要な関数の関数呼び出しと関数本体を除外するために、標準ソースモジュールを製品機種毎に編集し、製品機種毎のソースモジュールからコンパイラおよびリンカにより実行モジュールを作成する方法が一般的であった(例えば、特許文献1参照)。
また、従来の他のプログラム翻訳装置は、使用されていない関数をリンク時に実行モジュールから除外するものであり、標準ソースプログラムで使用されている関数を除外することが出来ないため、製品機種毎の仕様に応じて標準ソースプログラムから不要な関数を除外するためには、標準ソースプログラムを編集する必要があった(例えば、特許文献2参照)。
It is necessary to include all functions used in each product model and the function calls in the standard source program, and to exclude unnecessary function calls and function bodies according to the specifications for each product model.
In conventional compilers, there is no function for specifying exclusion in units of functions. When creating an execution module for each product model using a standard source program, as shown in FIG. In order to exclude the function call and function body of, the standard source module was edited for each product model, and an execution module was created from the source module for each product model by a compiler and linker (for example, patents) Reference 1).
In addition, other conventional program translation devices exclude unused functions from the execution module at the time of linking, and functions used in standard source programs cannot be excluded. In order to exclude unnecessary functions from the standard source program according to the specification, it is necessary to edit the standard source program (see, for example, Patent Document 2).
標準ソースプログラムを使用して複数の製品機種毎の実行モジュールを作成する場合、従来のコンパイラでは、製品機種毎に標準ソースプログラムの編集と製品機種毎のソースプログラムの管理が必要であり、多くの労力を要するという問題があった。
本発明はこのような問題点に鑑みてなされたものであり、標準ソースプログラムから、簡単に製品機種毎の実行モジュールを作成する方法を提供することを目的とする。
When creating execution modules for multiple product models using a standard source program, the conventional compiler requires editing the standard source program for each product model and managing the source program for each product model. There was a problem of requiring labor.
The present invention has been made in view of such problems, and an object thereof is to provide a method for easily creating an execution module for each product model from a standard source program.
上記問題を解決するため、本発明は、次のように構成したのである。
請求項1に記載の発明は、ソースプログラムがコンパイルされてオブジェクトプログラムを作成するコンパイル方法において、関数のコンパイル要否を指定するコンパイル除外関数テーブルに基づいて、関数のコンパイル要否を判断することを特徴とするものである。
また、請求項2に記載の発明は、前記コンパイル除外関数テーブルにおいて、コンパイル除外関数と、前記関数のコンパイル除外時の関数戻り値と、を指定することを特徴とするものである。
また、請求項3に記載の発明は、ソースプログラムがコンパイルされてオブジェクトプログラムを作成するコンパイル方法において、コンパイル除外関数と前記関数のコンパイル除外時の関数戻り値とが指定されるコンパイル除外関数テーブルを備え、前記指定されたコンパイル除外関数の呼び出しが戻り値を使用しない呼び出しの場合はオブジェクトプログラムを作成せず、前記指定されたコンパイル除外関数の呼び出しが戻り値を使用する呼び出しの場合は関数呼び出し部のオブジェクトプログラムに代えて前記コンパイル除外時の関数戻り値を関数の戻り値用レジスタに設定するオブジェクトプログラムを作成することを特徴とするものである。
また、請求項4に記載の発明は、ソースプログラムをコンパイルしてオブジェクトプログラムを作成するコンパイル処理装置において、関数のコンパイル要否を指定するコンパイル除外関数テーブルを備え、前記コンパイル除外関数テーブルに基づいて、関数のコンパイル要否を判断することを特徴とするものである。
また、請求項5に記載の発明は、前記コンパイル除外関数テーブルにおいて、コンパイル除外関数と、前記関数のコンパイル除外時の関数戻り値と、が指定されることを特徴とするものである。
また、請求項6に記載の発明は、ソースプログラムをコンパイルしてオブジェクトプログラムを作成するコンパイル処理装置において、コンパイル除外関数と前記関数のコンパイル除外時の関数戻り値とが指定されるコンパイル除外関数テーブルを備え、前記指定されたコンパイル除外関数の呼び出しが戻り値を使用しない呼び出しの場合はオブジェクトプログラムを作成せず、前記指定されたコンパイル除外関数の呼び出しが戻り値を使用する呼び出しの場合は関数呼び出し部のオブジェクトプログラムに代えて前記コンパイル除外時の関数戻り値を関数の戻り値用レジスタに設定するオブジェクトプログラムを作成することを特徴とするものである。
また、請求項7に記載の発明は、ソースプログラムをコンパイルしてオブジェクトプログラムを作成するコンピュータ読み取り可能なプログラムであって、
関数のコンパイル要否を指定するコンパイル除外関数テーブルに基づいて、関数のコンパイル要否を判断する手順をコンピュータに実行させるものである。
また、請求項8に記載の発明は、前記コンパイル除外関数テーブルにおいて、コンパイル除外関数と、前記関数のコンパイル除外時の関数戻り値と、が指定されることを特徴とするものである。
また、請求項9に記載の発明は、ソースプログラムをコンパイルしてオブジェクトプログラムを作成するコンピュータ読み取り可能なプログラムであって、コンパイル除外関数と前記関数のコンパイル除外時の関数戻り値とが指定されるコンパイル除外関数テーブルに基づいて、前記指定されたコンパイル除外関数の呼び出しが戻り値を使用しない呼び出しの場合はオブジェクトプログラムを作成せず、前記指定されたコンパイル除外関数の呼び出しが戻り値を使用する呼び出しの場合は関数呼び出し部のオブジェクトプログラムに代えて前記コンパイル除外時の関数戻り値を関数の戻り値用レジスタに設定するオブジェクトプログラムを作成する手順をコンピュータに実行させるものである。
また、請求項10に記載の発明は、請求項7乃至10いずれかに記載のコンパイル処理プログラムを記録したものである。
In order to solve the above problem, the present invention is configured as follows.
According to the first aspect of the present invention, in the compiling method for creating an object program by compiling a source program, it is determined whether or not a function is required to be compiled based on a compilation exclusion function table that specifies whether or not a function is to be compiled. It is a feature.
The invention described in
According to a third aspect of the present invention, there is provided a compile exclusion function table in which a compile exclusion function and a function return value at the time of compile exclusion of the function are specified in a compilation method in which a source program is compiled to create an object program. An object program is not created if the call to the specified compilation exclusion function is a call that does not use a return value, and a function call part if the call to the specified compilation exclusion function is a call that uses a return value Instead of the object program, an object program for setting the function return value when the compilation is excluded to the function return value register is created.
According to a fourth aspect of the present invention, there is provided a compile processing apparatus for compiling a source program to create an object program, comprising a compile exclusion function table for designating whether or not a function is to be compiled, based on the compile exclusion function table. , Determining whether or not the function needs to be compiled.
The invention described in
According to a sixth aspect of the present invention, in a compile processing apparatus for compiling a source program to create an object program, a compile-excluded function table in which a compile-excluded function and a function return value when the function is excluded from compilation are specified If the specified compilation exclusion function call is a call that does not use a return value, an object program is not created, and if the specified compilation exclusion function call is a call that uses a return value, a function call Instead of the object program, the object program for setting the function return value when the compilation is excluded to the function return value register is created.
The invention according to
The computer is caused to execute a procedure for determining whether or not to compile a function based on a compile exclusion function table that specifies whether or not to compile a function.
The invention described in claim 8 is characterized in that, in the compilation exclusion function table, a compilation exclusion function and a function return value when the function is excluded from compilation are specified.
The invention according to claim 9 is a computer-readable program for compiling a source program to create an object program, and a compile exclusion function and a function return value when the function is excluded from compilation are designated. Based on the compilation exclusion function table, if the call to the specified compilation exclusion function is a call that does not use a return value, an object program is not created, and the call to the specified compilation exclusion function uses a return value In this case, instead of the object program of the function calling unit, the computer is caused to execute a procedure for creating an object program for setting the function return value when the compilation is excluded in the function return value register.
The invention according to claim 10 records the compile processing program according to any one of
本発明によると、関数単位でのコンパイル除外指定と除外時の関数戻り値の指定のみで、標準ソースプログラムから製品機種毎に不要な関数を除外した製品機種毎の実行モジュールを作成することができ、製品機種毎の標準ソースプログラムの編集と製品機種毎のソースプログラムの管理が不要となる。 According to the present invention, it is possible to create an execution module for each product model by excluding unnecessary functions for each product model from the standard source program simply by specifying the compile exclusion in function units and the function return value at the time of exclusion. The editing of the standard source program for each product model and the management of the source program for each product model become unnecessary.
以下、本発明の実施の形態について図を参照して説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
一般に、複数の関数からなるソースプログラムは、図1のような構成となっている。すなわち、図において、関数A内に記述された関数B呼び出し部により関数Bが呼び出され、関数C呼び出し部により関数Cが呼び出される。なお、ソースプログラムの構成は、図1で示されるものに限定されるものではなく、ある関数から他の関数を呼び出すものであれば、任意でよい。
図2は、本発明による実行モジュール作成フローを示したものである。図において、3はコンパイラであり、ソースモジュール1とコンパイル除外関数指定テーブル2を読み込み、後述するコンパイル方法により、図2のオブジェクトモジュール4を生成する。ここで、コンパイル除外関数とは、コンパイル不要な関数を示す。5はリンカであり、前記オブジェクトモジュールを読み込み、従来と同じリンク処理手段により、実行モジュールを生成する。
図3は、コンパイル除外関数指定テーブルである。コンパイル除外関数指定テーブルでは、コンパイル除外関数とコンパイル除外時の関数戻り値が指定される。また、コンパイル除外関数とコンパイル除外時の関数戻り値は、行単位にて、関数名と戻り値が任意の個数指定される。
In general, a source program composed of a plurality of functions has a configuration as shown in FIG. That is, in the figure, the function B is called by the function B calling unit described in the function A, and the function C is called by the function C calling unit. The configuration of the source program is not limited to that shown in FIG. 1, and may be arbitrary as long as another function is called from a certain function.
FIG. 2 shows an execution module creation flow according to the present invention. In the figure,
FIG. 3 is a compilation exclusion function designation table. In the compilation exclusion function specification table, a compilation exclusion function and a function return value when compilation is excluded are designated. The compile exclusion function and the function return value at the time of compile exclusion specify an arbitrary number of function names and return values in units of lines.
図4は、本発明のコンパイル処理フローを示したものである。図において、コンパイル処理はソースプログラムから順次ソースステートメントを読み込み、そのソースステートメントに対するオブジェクトプログラムを作成することにより行われ、ソースプログラムの終了まで同様の処理が繰り返し実行される。
7はオブジェクトプログラム作成の分岐処理部であり、最初にソースステートメントを解析し関数の先頭であるかどうかを判定する。ソースステートメントが関数の先頭の場合はコンパイル除外関数であるか否かを図3に示したコンパイル除外関数指定テーブルを検索することにより判定する。コンパイル除外関数の場合は、後述するコンパイル除外関数の関数本体オブジェクトプログラム作成処理部10に分岐する。コンパイル除外関数でない場合は、後述する従来のオブジェクトプログラム作成処理部9に分岐する。次にソースステートメントが関数呼び出しであるかどうかを判定し、ソースステートメントが関数呼び出し以外の場合は、従来のオブジェクトプログラム作成処理部9に分岐する。ソースステートメントが関数呼び出しの場合は、コンパイル除外関数であるか否かを図3に示すコンパイル除外関数指定テーブルを検索することにより判定する。コンパイル除外関数の場合は、後述するコンパイル除外関数の関数呼び出しオブジェクトプログラム作成処理部8に分岐する。コンパイル除外関数でない場合は、従来のオブジェクトプログラム作成処理部9に分岐する。
FIG. 4 shows the compile processing flow of the present invention. In the figure, compilation processing is performed by sequentially reading source statements from a source program and creating an object program for the source statements, and the same processing is repeatedly executed until the end of the source program.
8は除外関数の関数呼び出しオブジェクトプログラム作成処理部であり、戻り値を使用する関数呼び出しかどうかを判断し、戻り値を使用しない関数呼び出しの場合はオブジェクトプログラムを作成せずに次のソースプログラムステートメント読込処理に戻る。戻り値を使用する関数呼び出しの場合は、図3に示すコンパイル除外関数指定テーブルで指定された除外時の戻り値を関数の戻り値用レジスタに設定することで、関数呼び出しの代わりとするオブジェクトプログラムを作成した後、次のソースプログラムステートメント読込処理に戻る。
9は従来のオブジェクトプログラム作成処理部であり、従来と同じ方法でオブジェクトプログラムを作成した後、次のソースプログラムステートメント読込処理に戻る。
10はコンパイル除外関数の関数本体オブジェクトプログラム作成処理部であり、関数本体のオブジェクトプログラムは作成せずに、関数終了までのソースステートメントを破棄した後、次のソースプログラムステートメント読込処理に戻る。
このように、本発明によれば、コンパイル除外関数の指定と除外時の戻り値の指定のみで、標準ソースプログラムから不要な関数を除外したオブジェクトプログラムの作成が可能であり、一つの標準ソースプログラムから製品機種毎の実行モジュールを簡単に作成することが可能となる。
Reference numeral 8 denotes a function call object program creation processing unit for an exclusion function, which determines whether the function call uses a return value. If the function call does not use a return value, the next source program statement is created without creating an object program. Return to reading process. In the case of a function call that uses a return value, an object program that replaces the function call by setting the return value at the time of exclusion specified in the compilation exclusion function specification table shown in FIG. 3 in the function return value register After creating, return to the next source program statement reading process.
Reference numeral 9 denotes a conventional object program creation processing unit, which creates an object program by the same method as before, and then returns to the next source program statement reading process.
As described above, according to the present invention, it is possible to create an object program that excludes unnecessary functions from a standard source program only by specifying a compile exclusion function and specifying a return value at the time of exclusion. It is possible to easily create an execution module for each product model.
各種ソースプログラムから不要な関数を除外したオブジェクトプログラムが容易に作成できるので、コンパイラ全般に適用できる。 An object program that excludes unnecessary functions from various source programs can be easily created, so that it can be applied to all compilers.
1 ソースモジュール
2 コンパイル除外関数と除外時関数戻り値指定テーブル
3 コンパイラ
4 オブジェクトモジュール
5 リンカ
6 実行モジュール
7 オブジェクトプログラム作成の分岐処理部
8 コンパイル除外関数の関数呼び出しオブジェクトプログラム作成処理部
9 従来のオブジェクトプログラム作成処理部
10 コンパイル除定関数の関数本体オブジェクトプログラム作成処理部
1
Claims (10)
関数のコンパイル要否を指定するコンパイル除外関数テーブルに基づいて、関数のコンパイル要否を判断することを特徴とするコンパイル方法。 In a compiling method for compiling a source program to create an object program,
A compiling method characterized by determining whether or not a function needs to be compiled based on a compilation exclusion function table that specifies whether or not the function needs to be compiled.
コンパイル除外関数と前記関数のコンパイル除外時の関数戻り値とが指定されるコンパイル除外関数テーブルを備え、
前記指定されたコンパイル除外関数の呼び出しが戻り値を使用しない呼び出しの場合はオブジェクトプログラムを作成せず、
前記指定されたコンパイル除外関数の呼び出しが戻り値を使用する呼び出しの場合は関数呼び出し部のオブジェクトプログラムに代えて前記コンパイル除外時の関数戻り値を関数の戻り値用レジスタに設定するオブジェクトプログラムを作成することを特徴とするコンパイル方法。 In a compiling method for compiling a source program to create an object program,
A compilation exclusion function table in which a compilation exclusion function and a function return value at the time of compilation exclusion of the function are specified;
If the call to the specified compile exclusion function is a call that does not use a return value, no object program is created,
If the call to the specified compilation exclusion function is a call that uses a return value, create an object program that sets the function return value when the compilation is excluded in the function return value register instead of the object program of the function call section A compiling method characterized by:
関数のコンパイル要否を指定するコンパイル除外関数テーブルを備え、
前記コンパイル除外関数テーブルに基づいて、関数のコンパイル要否を判断することを特徴とするコンパイル処理装置。 In a compile processing apparatus that compiles a source program and creates an object program,
Compile exclusion function table that specifies whether to compile functions,
A compile processing apparatus that determines whether or not a function needs to be compiled based on the compile exclusion function table.
コンパイル除外関数と前記関数のコンパイル除外時の関数戻り値とが指定されるコンパイル除外関数テーブルを備え、
前記指定されたコンパイル除外関数の呼び出しが戻り値を使用しない呼び出しの場合はオブジェクトプログラムを作成せず、
前記指定されたコンパイル除外関数の呼び出しが戻り値を使用する呼び出しの場合は関数呼び出し部のオブジェクトプログラムに代えて前記コンパイル除外時の関数戻り値を関数の戻り値用レジスタに設定するオブジェクトプログラムを作成することを特徴とするコンパイル処理装置。 In a compile processing apparatus that compiles a source program and creates an object program,
A compilation exclusion function table in which a compilation exclusion function and a function return value at the time of compilation exclusion of the function are specified;
If the call to the specified compile exclusion function is a call that does not use a return value, no object program is created,
If the call to the specified compilation exclusion function is a call that uses a return value, create an object program that sets the function return value when the compilation is excluded in the function return value register instead of the object program of the function call section A compile processing apparatus characterized by:
関数のコンパイル要否を指定するコンパイル除外関数テーブルに基づいて、関数のコンパイル要否を判断する手順をコンピュータに実行させるためのコンパイル処理プログラム。 A computer-readable program for compiling a source program to create an object program,
A compile processing program for causing a computer to execute a procedure for determining whether or not to compile a function based on a compile exclusion function table that specifies whether or not to compile a function.
コンパイル除外関数と前記関数のコンパイル除外時の関数戻り値とが指定されるコンパイル除外関数テーブルに基づいて、
前記指定されたコンパイル除外関数の呼び出しが戻り値を使用しない呼び出しの場合はオブジェクトプログラムを作成せず、
前記指定されたコンパイル除外関数の呼び出しが戻り値を使用する呼び出しの場合は関数呼び出し部のオブジェクトプログラムに代えて前記コンパイル除外時の関数戻り値を関数の戻り値用レジスタに設定するオブジェクトプログラムを作成する手順をコンピュータに実行させるためのコンパイル処理プログラム。 A computer-readable program for compiling a source program to create an object program,
Based on the compilation exclusion function table that specifies the compilation exclusion function and the function return value when the function is excluded from compilation,
If the call to the specified compile exclusion function is a call that does not use a return value, no object program is created,
If the call to the specified compilation exclusion function is a call that uses a return value, create an object program that sets the function return value when the compilation is excluded in the function return value register instead of the object program of the function call section A compilation processing program for causing a computer to execute the procedure to be performed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004354835A JP2006163854A (en) | 2004-12-08 | 2004-12-08 | Compile method, compile processor, program, and recording medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004354835A JP2006163854A (en) | 2004-12-08 | 2004-12-08 | Compile method, compile processor, program, and recording medium |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2006163854A true JP2006163854A (en) | 2006-06-22 |
Family
ID=36665801
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004354835A Pending JP2006163854A (en) | 2004-12-08 | 2004-12-08 | Compile method, compile processor, program, and recording medium |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2006163854A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015158911A (en) * | 2014-02-21 | 2015-09-03 | ダッソー システムズ アメリカズ コーポレーション | Methods and systems for filtering components in hierarchically-referenced data |
-
2004
- 2004-12-08 JP JP2004354835A patent/JP2006163854A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015158911A (en) * | 2014-02-21 | 2015-09-03 | ダッソー システムズ アメリカズ コーポレーション | Methods and systems for filtering components in hierarchically-referenced data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5599535B2 (en) | Sequence program debugging support device | |
JP2005503680A5 (en) | ||
JP2006163854A (en) | Compile method, compile processor, program, and recording medium | |
JP5038760B2 (en) | Source code conversion apparatus and source code conversion method | |
EP1202171A3 (en) | Compile method and program recording medium | |
JPH08263299A (en) | Method for converting program | |
JP6812861B2 (en) | Program creator and program | |
JP2007265098A (en) | Macro definition information acquisition device | |
JP2009258796A (en) | Program development device and program development method | |
CN1476200A (en) | Automatic maintenance system and method of its automatic maintenance communication equipment | |
JP2008071065A (en) | Compile device, method, program and storage medium for performing in-line expansion | |
JP2005326909A (en) | Plant engineering system | |
JP2009515243A (en) | Method for generating a simulation program executable on a host computer | |
JP2009064207A (en) | Compiler | |
KR960024908A (en) | How to create base station software package for mobile communication system | |
JP2011113148A (en) | Macro development method and preprocessor | |
JP2007080207A (en) | Program development support system and linker | |
JP2006146731A (en) | Program, storage medium, assembler device, compiler device, simulator device and emulator device | |
JP2013210920A (en) | Compilation device, compilation method, and compiler | |
JP3323147B2 (en) | Compiling device, compiling method, and recording medium recording compiler program | |
JP2011034419A (en) | Modeling apparatus using model, and system construction method for software system | |
JP3367438B2 (en) | Conditional execution processing device | |
JPH08194624A (en) | Executing form program preparing method | |
JPH04209029A (en) | Parallel process program translation processor | |
CN116629172A (en) | Method, device, equipment and medium for automatically generating and integrating modules in chip design |