JP2013127703A - Method and program for generating load module - Google Patents

Method and program for generating load module Download PDF

Info

Publication number
JP2013127703A
JP2013127703A JP2011277038A JP2011277038A JP2013127703A JP 2013127703 A JP2013127703 A JP 2013127703A JP 2011277038 A JP2011277038 A JP 2011277038A JP 2011277038 A JP2011277038 A JP 2011277038A JP 2013127703 A JP2013127703 A JP 2013127703A
Authority
JP
Japan
Prior art keywords
address
cpu
local
symbol
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2011277038A
Other languages
Japanese (ja)
Inventor
Makoto Sato
真琴 佐藤
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.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2011277038A priority Critical patent/JP2013127703A/en
Publication of JP2013127703A publication Critical patent/JP2013127703A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To suppress a memory usage for storing an object code without sacrifice of the high processing speed using a local address.SOLUTION: When generating a load module for multi-CPU core system capable of using a global address and a local address for referring to a local memory in a CPU core, instruction information for identifying in which local memory in the CPU core the data of a function are arranged and in which CPU the function is executed is made to follow a source program. An object code is generated on the basis of the instruction information, the object code for referring to at least one of a local address symbol and a global address symbol according to whether using the global address or the local address for a reference of a variable for every object. The global address and the local address are allocated based on the generated object code to generate a load module in common with a plurality of CPU cores.

Description

本発明は、ローカルアドレスとグローバルアドレスによって参照可能なローカルメモリをそれぞれが有する複数のCPUコアを用いたマルチCPUコアシステムによって実行されるプログラムのロードモジュールを生成する方法及びその方法を制御するためのコンピュータプログラムに関する。   The present invention relates to a method for generating a load module for a program executed by a multi-CPU core system using a plurality of CPU cores each having a local memory and a local memory that can be referred to by a global address, and to control the method. It relates to a computer program.

マルチCPUコアシステムによって実行されるプログラムのロードモジュールを生成する方法について記載された文献の例として特許文献1、2がある。これらには、CPU毎にメモリ空間は異なるが、特別なアドレスを使うことにより他CPUコア内のローカルメモリを参照可能なマルチコアシステムによって実行されるプログラムのロードモジュールを生成する方法が記載される。この記載の要点は以下の通りである。即ち、第2のCPUコアで実行される関数から第2のCPUコア内のローカルメモリ上にあるデータYへの参照に対しては、第2のCPUの「メモリ空間内リンカ」によりアドレスが解決されてアドレスyを割り当てる。一方、第1のCPUコアで実行される関数から第2のCPUコア内のローカルメモリ上にあるデータYへの参照に対しては、上記アドレスyを用いて、「メモリ空間間リンカ」により、「y+offset」によってアドレスを解決する。offsetは第1のCPUコア内のローカルメモリの先頭ローカルアドレスに対する第2のCPUコア内のローカルメモリの先頭グローバルアドレスのオフセットを意味するものとする。   Patent Documents 1 and 2 are examples of documents describing a method for generating a load module for a program executed by a multi-CPU core system. These describe a method of generating a load module of a program executed by a multi-core system that can refer to a local memory in another CPU core by using a special address, although the memory space is different for each CPU. The main points of this description are as follows. That is, for a reference from the function executed in the second CPU core to the data Y in the local memory in the second CPU core, the address is resolved by the “in-memory space linker” of the second CPU. And assign address y. On the other hand, for the reference from the function executed in the first CPU core to the data Y in the local memory in the second CPU core, using the above address y, the “inter-memory space linker” The address is resolved by “y + offset”. “offset” means an offset of the leading global address of the local memory in the second CPU core with respect to the leading local address of the local memory in the first CPU core.

特許第4133107号公報Japanese Patent No. 4133107 特開2004−78600号公報JP 2004-78600 A

本発明者は異なるCPUコア上で実行される同じ関数から同じ変数を参照する場合における変数のアドレス解決方法について検討した。図6には本発明者によるその検討結果が例示される。第1のCPUコア内のローカルメモリLM1に付与されたローカルアドレスと第2のCPUコア内のローカルメモリLM2に付与されたローカルアドレスとをそれぞれ0x000〜0x0ffとする。第1のCPUコア内のローカルメモリLM1に付与されたグローバルアドレスを0x100〜0x1ff、第2のCPUコア内のローカルメモリLM2に付与されたグローバルアドレスを0x200〜0x2ffとする。第1のCPUコア内のローカルメモリLM1の先頭ローカルアドレスに対する第2のCPUコア内のローカルメモリLM2の先頭グローバルアドレスのオフセットは、offset=0x200となる。   The present inventor has studied a variable address resolution method in the case where the same variable is referenced from the same function executed on different CPU cores. FIG. 6 illustrates the result of the study by the present inventor. The local address given to the local memory LM1 in the first CPU core and the local address given to the local memory LM2 in the second CPU core are set to 0x000 to 0x0ff, respectively. Assume that the global address assigned to the local memory LM1 in the first CPU core is 0x100 to 0x1ff, and the global address assigned to the local memory LM2 in the second CPU core is 0x200 to 0x2ff. The offset of the leading global address of the local memory LM2 in the second CPU core relative to the leading local address of the local memory LM1 in the first CPU core is offset = 0x200.

図6において、関数F、Gはその記述の一部に含まれる変数Yを参照し、変数Yのデータは第2のCPUコア内のローカルメモリLM2上に配置されている。第2のCPUコア内のローカルメモリLM2上に配置された関数Fの中から第2のCPUコア内のローカルメモリLM2上の変数Yのデータを参照するもの、または、その関数Fの中から第2のCPUコア内のローカルメモリLM2上に配置された関数Gを呼び出すもの、に対しては、第2のCPUに対する「メモリ空間内リンカ」によって上記F,YおよびGのアドレスが解決される。アドレス解決された夫々の関数アドレスをf,g、解決された変数アドレスをy(=0x0aa)とする。ここで、仮に上記関数Fを第1のCPUコアから呼び出した場合、関数Fはアドレスf+offsetによって正しくコールされる。しかし、すでにオブジェクトコードとなった関数F内のアドレスy及びgはそのままの値のため、第1のCPUコアがコールした関数Fを実行すると第1のCPUコア内のローカルメモリLM1上の不正なアドレスを参照して、誤動作を生ずることになる。   In FIG. 6, functions F and G refer to a variable Y included in a part of the description, and data of the variable Y is arranged on the local memory LM2 in the second CPU core. Reference is made to the data of the variable Y on the local memory LM2 in the second CPU core from among the functions F arranged on the local memory LM2 in the second CPU core, or For those calling the function G arranged on the local memory LM2 in the second CPU core, the addresses of F, Y and G are resolved by the “linker in memory space” for the second CPU. It is assumed that the function addresses whose addresses are resolved are f and g, and the resolved variable addresses are y (= 0x0aa). Here, if the function F is called from the first CPU core, the function F is correctly called by the address f + offset. However, since the addresses y and g in the function F that has already become the object code are the same values, if the function F called by the first CPU core is executed, an illegal on the local memory LM1 in the first CPU core is executed. By referring to the address, a malfunction occurs.

これを防止するには、第1CPUコアについてメモリ空間内リンカは、第2CPUコア内のローカルメモリLM2上の関数アドレスfの関数の変数Yに対してアドレス解決を行わず、メモリ空間間リンカによって、fの関数の変数Yに対してグローバルアドレスを用いたアドレス解決を行う。これにより、関数F内で変数Yを参照するアドレスが第1CPUコアの場合にはグローバルアドレス「0x2aa」、第2CPUコアの場合はローカルアドレス「0x0aa」となって、相違される。そのため、関数Fの実体が第1CPUコアと第2CPUコアの両方で別々に必要になる。すなわち、上記のような関数Fを複数のCPUから呼び出す場合には、各CPUコアに関数Fに関するオブジェクトコードが別々に必要になり、システム全体から見れば、メモリ使用量が増加するという課題がある。   In order to prevent this, the in-memory space linker for the first CPU core does not perform address resolution for the function variable f of the function address f on the local memory LM2 in the second CPU core, but by the inter-memory space linker, Address resolution using a global address is performed on the variable Y of the function f. As a result, when the address referring to the variable Y in the function F is the first CPU core, the global address is “0x2aa”, and when the address is the second CPU core, the local address is “0x0aa”. For this reason, the entity of the function F is required separately for both the first CPU core and the second CPU core. That is, when the function F as described above is called from a plurality of CPUs, each CPU core requires a separate object code related to the function F, and there is a problem that the amount of memory used increases when viewed from the entire system. .

この点に関し、本発明者はさらに、グローバルアドレスで変数のアドレス解決を行ってオブジェクトコードを生成し、CPUコア内のローカルメモリ上のデータをそのデータのローカルアドレスで参照したいときはそのデータのグローバルアドレスを実行時にローカルアドレスに変換して参照させることによってメモリ使用量を減らすことについても検討した。しかしながら、実行時にアドレスの変換処理を追加すると、参照を高速化するためのローカルアドレスを使えるにもかかわらず、その高速性を十分に生かすことができない。   In this regard, the present inventor further generates an object code by resolving the address of the variable with the global address, and when it is desired to refer to the data on the local memory in the CPU core with the local address of the data, We also considered reducing the amount of memory used by converting addresses to local addresses during execution. However, if an address translation process is added at the time of execution, the high speed cannot be fully utilized even though a local address for speeding up the reference can be used.

本発明の目的は、ローカルアドレスを用いることによる処理の高速性を犠牲にすることなく、オブジェクトコードを格納するためのメモリ使用量の増大を抑えることができるロードモジュール生成技術を提供することにある。   An object of the present invention is to provide a load module generation technique capable of suppressing an increase in the amount of memory used for storing an object code without sacrificing the high speed of processing by using a local address. .

本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。   The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。   The following is a brief description of an outline of typical inventions disclosed in the present application.

すなわち、CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内のローカルメモリを参照するのにグローバルアドレスとローカルアドレスとを用いることができるマルチCPUコアシステムによって実行されるプログラムのロードモジュールを生成する。この場合に、関数のデータがどのCPUコア内のローカルメモリ上に配置されるか、及び、その関数がどのCPUで実行されるかを指定する指示情報をソースプログラムに付随させる。この指示情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成する。生成したオブジェクトコードに対してグローバルアドレス用シンボルにはグローバルアドレスを割り当て、ローカルアドレス用シンボルにはローカルアドレスを割り当てて、複数のCPUコアに共通なロードモジュールを生成する。   That is, a load module for a program executed by a multi-CPU core system that can use a global address and a local address to refer to a local memory among a plurality of CPU cores each having a CPU and a local memory is generated. To do. In this case, instruction information for specifying in which CPU core the function data is allocated and in which CPU the function is executed is attached to the source program. Based on this instruction information, it is determined for each function whether the global address or the local address is used for referring to the variable, and at least one of the local address symbol and the global address symbol is determined according to the determination result. Generate object code that references one. For the generated object code, a global address is assigned to a global address symbol and a local address is assigned to a local address symbol to generate a load module common to a plurality of CPU cores.

これによれば、関数内の変数に対するアドレス解決処理を複数CPU間にまたがるリンク時にまで遅らせることによって、複数のCPUから呼び出される関数に対しては、その中から参照するデータや関数に対するアドレスとしてグローバルアドレス用シンボルに対するアドレスを参照するコードが出力される。出力された単一のコードは複数のCPUで正しく実行されるので、CPU毎に関数のコピーは不要となり、メモリ使用量増加は発生しない。さらに、本来ローカルアドレスを用いた参照が可能な場合にはアドレス変換を行うことを要しないから、ローカルアドレスを用いることによる処理の高速性も犠牲にならない。   According to this, by delaying the address resolution processing for variables in a function until the time of linking across multiple CPUs, for functions called from multiple CPUs, global addresses are used as addresses for the data and functions to be referred to from among them. A code referring to the address for the address symbol is output. Since the output single code is correctly executed by a plurality of CPUs, there is no need to copy a function for each CPU, and the memory usage does not increase. Further, since it is not necessary to perform address conversion when the reference using the local address is possible, the high-speed processing by using the local address is not sacrificed.

本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記のとおりである。   The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.

すなわち、ローカルアドレスを用いることによる処理の高速性を犠牲にすることなく、オブジェクトコードを格納するためのメモリ使用量の増大を抑えることができるロードモジュールを生成することができる。   That is, it is possible to generate a load module that can suppress an increase in memory usage for storing object code without sacrificing high-speed processing by using a local address.

図1はマルチCPUコアシステムとしてのマイクロコンピュータによって実行されるプログラムのロードモジュールを生成する開発システムの概略ブロック図である。FIG. 1 is a schematic block diagram of a development system that generates a load module for a program executed by a microcomputer as a multi-CPU core system. 図2はローカルアドレスとグローバルアドレスによるローカルメモリのアドレスマップを例示する説明図である。FIG. 2 is an explanatory view exemplifying an address map of a local memory by a local address and a global address. 図3はローカルアドレスとグローバルアドレスによるローカルメモリのアクセス経路を例示する説明図である。FIG. 3 is an explanatory diagram illustrating an access path of a local memory using a local address and a global address. 図4はロードモジュールを生成する処理フローを例示するフローチャートである。FIG. 4 is a flowchart illustrating a processing flow for generating a load module. 図5はロードモジュールを生成する別の処理フローを例示するフローチャートである。FIG. 5 is a flowchart illustrating another processing flow for generating a load module. 図6は同じ関数の同じ変数を異なるCPUコアが参照する場合における変数のアドレス解決方法について本発明者が先に検討した結果を例示する説明図である。FIG. 6 is an explanatory diagram exemplifying the result of the inventor's first examination of a variable address resolution method when different CPU cores refer to the same variable of the same function.

1.実施の形態の概要
先ず、本願において開示される発明の代表的な実施の形態について概要を説明する。代表的な実施の形態についての概要説明で括弧を付して参照する図面中の参照符号はそれが付された構成要素の概念に含まれるものを例示するに過ぎない。
1. First, an outline of a typical embodiment of the invention disclosed in the present application will be described. Reference numerals in the drawings referred to in parentheses in the outline description of the representative embodiments merely exemplify what are included in the concept of the components to which the reference numerals are attached.

〔1〕<複数CPUコアに共通なロードモジュールの生成>
本発明の代表的な実施の形態に係るロードモジュール生成方法は、CPU(211,221)とローカルメモリ(212,222)をそれぞれが有する複数個のCPUコア(201,202)の内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステム(2)によって実行されるプログラムのロードモジュール(151,151A)をコンピュータ(1)のデータ処理によって生成するロードモジュール生成方法である。この方法はコンパイル処理(120,120A)及びリンク処理(130)を含む。コンパイル処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、及び、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラム(140)を入力し、入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル(LY)及びグローバルアドレス用シンボル(GY)の内の少なくとも一つを参照するオブジェクトコード(141,141A)を生成する処理である。リンク処理は、前記オブジェクトコードに対してグローバルアドレス用シンボルにはグローバルアドレスを割り当て、ローカルアドレス用シンボルにはローカルアドレスを割り当てて、複数のCPUコアに共通なロードモジュール(151,151A)を生成する処理である。
[1] <Generation of load module common to multiple CPU cores>
The load module generation method according to the representative embodiment of the present invention is one of a plurality of CPU cores (201, 202) each having a CPU (211, 221) and a local memory (212, 222). A multi-CPU core system (2) using a global address for a CPU of a CPU core to reference a local memory in another CPU core and a local address for a CPU to reference a local memory in its own CPU core Is a load module generation method for generating the load module (151, 151A) of the program executed by the computer (1) by data processing of the computer (1). This method includes a compilation process (120, 120A) and a link process (130). The compile processing is performed by inputting a source program (140) having instruction information specifying which CPU is to allocate certain data on which local memory and which CPU executes a certain function. Based on the information, it is determined for each function whether the global address or the local address is used to refer to the variable, and the local address symbol (LY) and the global address symbol (GY) are determined according to the determination result. It is a process which produces | generates the object code (141, 141A) which refers at least one of these. In the link process, a global address is assigned to a symbol for global address and a local address is assigned to a symbol for local address to generate a load module (151, 151A) common to a plurality of CPU cores. It is processing.

上記によれば、関数内の変数に対するアドレス解決処理を複数CPU間にまたがるリンク時にまで遅らせることによって、複数のCPUから呼び出される関数に対しては、その中から参照するデータや関数に対するアドレスとして、グローバルアドレス用シンボルに対するアドレスを参照するコードが出力され、その単一のコードは複数のCPUで正しく実行されるので、CPU毎に関数のコピーは不要となり、メモリ使用量増加は発生しない。さらに、ローカルアドレス用シンボルに対するアドレスを参照するコードに対しては、その中から参照するデータや関数に対するアドレスとして、ローカルアドレス用シンボルに対するローカルアドレスを参照するコードがロードモジュール内に生成されるから、本来ローカルアドレスを用いた参照が可能な関数についてロードモジュールを実行するときアドレス変換を行うことを要さず、ローカルアドレスを用いることによる処理の高速性も犠牲にならない。   According to the above, by delaying the address resolution processing for the variables in the function until the time of linking across multiple CPUs, for functions called from multiple CPUs, as addresses for the data and functions to be referenced from among them, A code that refers to the address for the global address symbol is output, and the single code is correctly executed by a plurality of CPUs. Therefore, there is no need to copy a function for each CPU, and the memory usage does not increase. Furthermore, for the code that refers to the address for the symbol for the local address, the code that refers to the local address for the symbol for the local address is generated in the load module as the address for the data or function to be referenced from within the code. When a load module is originally executed for a function that can be referred to using a local address, it is not necessary to perform address conversion, and the processing speed by using the local address is not sacrificed.

〔2〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数CPUによる同一実行関数からの変数の参照にはグローバルアドレス用シンボルを付与>
項1のロードモジュール生成方法における前記コンパイル処理(120)において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照するコード(g;=LY)を生成し、複数のCPUで実行される関数の場合にはその変数を参照するためにグローバルアドレス用シンボルを参照するコード(f;=GY)を生成する。
[2] <Local address symbol is assigned to a variable in its own local memory by a single CPU, and global address symbol is assigned to a variable from the same execution function by a plurality of CPUs>
In the compile processing (120) in the load module generation method according to Item 1, in a function executed only by a single CPU, when a variable on a local memory in the CPU core is referred to, a code that refers to a symbol for a local address (G; = LY) is generated, and in the case of a function executed by a plurality of CPUs, a code (f; = GY) for referring to a global address symbol is generated to refer to the variable.

上記によれば、単一のCPUでのみ実行される関数による変数の参照にはローカルアドレスを用いて当該CPUコア内部で高速に参照を行うことができる。複数のCPUで実行される関数による変数の参照にはグローバルアドレスを用いるから、自らのCPUコア内部の参照の場合には当該CPUコアから出力されたグローバルアドレス信号が当該CPUコアの内部にルーティングされて参照が行われる。自らのCPUコア外部の参照の場合には当該CPUコアから出力されたグローバルアドレス信号が別のCPUコアの内部にルーティングされて参照が行われる。   According to the above, it is possible to refer to a variable by a function executed only by a single CPU using the local address at high speed within the CPU core. Since a global address is used for referring to a variable by a function executed by a plurality of CPUs, a global address signal output from the CPU core is routed inside the CPU core in the case of referring to its own CPU core. Is referred to. In the case of reference outside its own CPU core, the global address signal output from the CPU core is routed inside another CPU core for reference.

〔3〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数のCPUで実行される関数の場合には実行するCPUに応じて変数の参照シンボルを指示>
項1のロードモジュール生成方法における前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコード(図5のg;=LY)を生成し、複数のCPUで実行される可能性のある関数の場合には関数を実行するCPUと参照する変数の所在に応じてローカルアドレス用シンボルとグローバルアドレス用シンボルとの参照を選択する第2のコード(図5のf;if(cpu==2)=0x0aa,else=GY)を生成する。
[3] <Local address symbol for referring to a variable in its own local memory by a single CPU, and variable reference symbol in accordance with the CPU to be executed in the case of a function executed by a plurality of CPUs>
In the compile processing in the load module generation method according to Item 1, in a function executed only by a single CPU, when referring to a variable on a local memory in the CPU core, first code that refers to a symbol for a local address (G in FIG. 5; = LY), in the case of a function that can be executed by a plurality of CPUs, a local address symbol and a global address depending on the location of the CPU that executes the function and the variable to be referred to A second code (f in FIG. 5; if (cpu == 2) = 0x0aa, else = GY) is generated to select a reference to the symbol for use.

これによれば、複数のCPUで実行される可能性のある関数に関しても一つのコード内でローカルアドレスを用いる変数参照かグローバルアドレスを用いた変数参照かを選択することができるから、参照主体になるCPUの種別判定処理に要する時間が、CPUコアから出力されたグローバルアドレス信号が当該CPUコアの内部にルーティングされるまでの時間に比べて短ければ、複数のCPUで実行される可能性のある関数による変数の参照をさらに高速化することができる。   According to this, since a variable reference using a local address or a variable reference using a global address can be selected in one code even for a function that may be executed by a plurality of CPUs, If the time required for the CPU type determination process is shorter than the time required for the global address signal output from the CPU core to be routed inside the CPU core, it may be executed by a plurality of CPUs. It is possible to further speed up the reference of variables by functions.

〔4〕<ローカルアドレス用シンボルを用いた参照を行うコード、グローバルアドレス用シンボルを用いた参照を行うコード、及び何れのコードを用いるかの判定文を含む第2のコード>
項3のロードモジュール生成方法において、前記第2のコードは、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む。
[4] <Second code including a reference code using a local address symbol, a reference code using a global address symbol, and a determination statement indicating which code to use>
In the load module generation method according to Item 3, when the second code refers to data on a local memory in a specific CPU core in a function that may be executed by a plurality of CPUs, the function is A statement for determining whether or not to be executed by a specific CPU, a code for performing a reference using a local address symbol corresponding to a local address when the function is executed by the specific CPU, and the function When executed by another CPU, a code for performing a reference using a global address symbol corresponding to the global address is included.

これによれば、簡単なコード記述に基づいて項3の作用効果を得ることができる。   According to this, the effect of item 3 can be obtained based on simple code description.

〔5〕<pragma文による指示情報>
項1乃至4の何れかのロードモジュール生成方法において、前記指示情報は、C言語におけるpragma文で指定される情報である。
[5] <Instruction information by pragma statement>
In the load module generation method according to any one of Items 1 to 4, the instruction information is information specified by a pragma statement in C language.

これによれば、C言語によるソースプログラムに前記指示情報を容易に付随させることができる。   According to this, the instruction information can be easily attached to the source program in C language.

〔6〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数CPUによる同一実行関数からの変数の参照にはグローバルアドレス用シンボルを付与して、複数CPUコアに共通なロードモジュールを生成>
本発明の別の形態に係るロードモジュール生成方法は、項1と同様に、CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成する方法である。特にこの方法は、入力処理、コード生成処理、アドレス解決処理、及びアドレス生成処理を含む。入力処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力する処理である。コード生成処理は、前記入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成する処理である。アドレス解決処理は、前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決する処理である。アドレス生成処理は、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルに対応するアドレスを用いるコード(図4のg;=0x0aa)を生成し、複数のCPUで実行される可能性のある関数において変数を参照する場合はグローバルアドレス用シンボルに対応するアドレスを用いるコード(図4のf;=0x2aa)を生成する処理である。
[6] <Common address is assigned to multiple CPU cores by assigning a local address symbol to a reference to a variable in its own local memory by a single CPU and a global address symbol to refer to a variable from the same execution function by a plurality of CPUs. A simple load module>
In the load module generation method according to another aspect of the present invention, as in item 1, the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory is local to another CPU core. Data processing of a computer generates a load module for a program executed by a multi-CPU core system using a global address for referring to a memory and a local address for a CPU to refer to a local memory in its own CPU core It is a method to do. In particular, the method includes input processing, code generation processing, address resolution processing, and address generation processing. The input process is a process of inputting a source program having instruction information specifying which CPU allocates certain data on a local memory in which CPU core and which CPU executes a certain function. The code generation process determines whether to use a global address or a local address for referring to the variable for each function based on the input information, and depending on the determination result, the local address symbol and the global address This is a process for generating an object code that refers to at least one of the symbols. The address resolution process is a process of resolving an address for the global address symbol generated by the code generation process, and resolving the address of the local address symbol based on the resolved address. In the address generation process, when referring to a variable on a local memory in a CPU core in a function executed only by a single CPU, a code using an address corresponding to the symbol for the local address (g in FIG. 4; = 0x0aa) ) And a code that uses an address corresponding to the symbol for global address (f in FIG. 4; = 0x2aa) is generated when a variable is referred to in a function that may be executed by a plurality of CPUs. .

これによれば、項1及び項2と同様の作用効果を得る。   According to this, the same effects as those of the items 1 and 2 are obtained.

〔7〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数のCPUで実行される関数の場合には実行するCPUに応じて変数の参照シンボルを指示して、複数CPUコアに共通なロードモジュールを生成>
本発明の更に別の実施の形態に係るロードモジュール生成方法は、項1と同様に、CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成する方法である。特にこの方法は、入力処理、コード生成処理、アドレス解決処理、及びアドレス生成処理を含む。入力処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力する処理である。コード生成処理は、前記入力した情報に基づいて、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコード(図5のg;=LY)を生成し、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む第2のコード(図5のf;if(cpu==2)=LY,else=GY)を生成する処理である。アドレス解決処理は、前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決する処理である。アドレス生成処理は、前記オブジェクトコードに対してグローバルアドレス用シンボルには対応するグローバルアドレスを用いるコードを生成し、ローカルアドレス用シンボルには対応するローカルアドレスを用いるコードを生成する処理である。
[7] <Local address symbol for referring to a variable in its own local memory by a single CPU, and in the case of a function executed by a plurality of CPUs, a variable reference symbol is indicated according to the CPU to be executed, Generating a load module common to multiple CPU cores>
In the load module generation method according to still another embodiment of the present invention, the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory is another CPU core as in item 1. The load module of the program executed by the multi-CPU core system using a global address for referring to the local memory in the memory and a local address for referring to the local memory in the CPU core of the CPU is stored in the computer data. It is a method of generating by processing. In particular, the method includes input processing, code generation processing, address resolution processing, and address generation processing. The input process is a process of inputting a source program having instruction information specifying which CPU allocates certain data on a local memory in which CPU core and which CPU executes a certain function. Based on the input information, the code generation process refers to a first code that refers to a local address symbol when referring to a variable in a local memory in the CPU core in a function executed only by a single CPU. (G in FIG. 5; LY) is generated, and when the function refers to data on a local memory in a specific CPU core in a function that may be executed by a plurality of CPUs, the function is the specific CPU. A statement for determining whether or not the function is executed, a code for performing a reference using a symbol for a local address corresponding to a local address when the function is executed by the specific CPU, and the function for other CPUs Is executed by the second code (see FIG. 5) including a code for performing a reference using a global address symbol corresponding to the global address. ; If (cpu == 2) = LY, a process of generating an else = GY). The address resolution process is a process of resolving an address for the global address symbol generated by the code generation process, and resolving the address of the local address symbol based on the resolved address. The address generation process is a process of generating a code using a global address corresponding to a global address symbol for the object code and generating a code using a corresponding local address for a local address symbol.

これによれば、項1、項3及び項4と同様の作用効果を得る。   According to this, the same effects as the items 1, 3 and 4 are obtained.

〔8〕<複数CPUコアに共通なロードモジュールの生成プログラム>
本発明の更に別の実施の形態に係るロードモジュール生成プログラムは、CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュール(151,151A)を生成するための、コンピュータにより実行可能なロードモジュール生成プログラムである。このプログラムはコンパイル処理(120,120A)とリンク処理(130)を制御する。コンパイル処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、及び、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力し、入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコード(141,141A)を生成する処理である。リンク処理は、前記オブジェクトコードに対してグローバルアドレス用シンボルにはグローバルアドレスを割り当て、ローカルアドレス用シンボルにはローカルアドレスを割り当てて、複数のCPUコアに共通なロードモジュール(151,151A)を生成する処理である。
[8] <Load module generation program common to multiple CPU cores>
In a load module generation program according to still another embodiment of the present invention, a CPU of one CPU core among a plurality of CPU cores each having a CPU and a local memory refers to a local memory in another CPU core. For generating a load module (151, 151A) for a program executed by a multi-CPU core system using a global address for the CPU and a local address for the CPU to refer to a local memory in its own CPU core A load module generation program executable by a computer. This program controls compile processing (120, 120A) and link processing (130). Compile processing inputs a source program having instruction information specifying which CPU allocates certain data on which local memory in which CPU core and which CPU executes a certain function, and based on the input information For each function, determine whether to use the global address or local address for the reference of the variable for each function, and refer to at least one of the local address symbol and the global address symbol according to the determination result This is a process for generating the code (141, 141A). In the link process, a global address is assigned to a symbol for global address and a local address is assigned to a symbol for local address to generate a load module (151, 151A) common to a plurality of CPU cores. It is processing.

このロードモジュール生成プログラムを用いることにより、項1の方法を容易に実現することができる。   By using this load module generation program, the method of item 1 can be easily realized.

〔9〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数CPUによる同一実行関数からの変数の参照にはグローバルアドレス用シンボルを付与>
項8のロードモジュール生成プログラムが制御する前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照するコード(図4のg;=LY)を生成し、複数のCPUで実行される関数の場合にはその変数を参照するためにグローバルアドレス用シンボルを参照するコード(図4のf;=GY)を生成する制御を行う。
[9] <Local address symbol is given to reference to variable in own local memory by single CPU, and global address symbol is given to variable reference from same execution function by multiple CPUs>
In the compile process controlled by the load module generation program according to Item 8, in a function executed only by a single CPU, when a variable on a local memory in the CPU core is referred to, a code that refers to a symbol for a local address ( (G; = LY) in FIG. 4 is generated, and in the case of a function executed by a plurality of CPUs, a code (f; = GY in FIG. 4) that references a symbol for a global address is generated to refer to the variable. Control.

このロードモジュール生成プログラムを用いることにより、項2の方法を容易に実現することができる。   By using this load module generation program, the method of item 2 can be easily realized.

〔10〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数のCPUで実行される関数の場合には実行するCPUに応じて変数の参照シンボルを指示>
項8のロードモジュール生成プログラムが制御する前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコード(図5のg;=LY)を生成し、複数のCPUで実行される可能性のある関数の場合には関数を実行するCPUと参照する変数の所在に応じてローカルアドレス用シンボルとグローバルアドレス用シンボルとの参照を選択する第2のコード(図5のf;if(cpu==2)=LY,else=GY)を生成する制御を行う。
[10] <Local address symbol is designated for reference to a variable in its own local memory by a single CPU, and a variable reference symbol is designated according to the CPU to be executed in the case of a function executed by a plurality of CPUs>
In the compile process controlled by the load module generation program according to Item 8, when a variable on a local memory in the CPU core is referred to in a function executed only by a single CPU, a first reference is made to a local address symbol. In the case of a function that is likely to be executed by a plurality of CPUs, a local address symbol is generated according to the location of the CPU that executes the function and the variable to be referred to. Control is performed to generate a second code (f in FIG. 5; if (cpu == 2) = LY, else = GY) for selecting a reference to the global address symbol.

このロードモジュール生成プログラムを用いることにより、項3の方法を容易に実現することができる。   By using this load module generation program, the method of Item 3 can be easily realized.

〔11〕<ローカルアドレス用シンボルを用いた参照を行うコード、グローバルアドレス用シンボルを用いた参照を行うコード、及び何れのコードを用いるかの判定文を含む第2のオブジェクトコード>
項10のロードモジュール生成プログラムにおいて、前記第2のコードは、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む。
[11] <Second object code including a code that performs a reference using a symbol for local address, a code that performs a reference using a symbol for global address, and a determination statement indicating which code to use>
In the load module generation program according to item 10, when the second code refers to data on a local memory in a specific CPU core in a function that may be executed by a plurality of CPUs, the function is A statement for determining whether or not to be executed by a specific CPU, a code for performing a reference using a local address symbol corresponding to a local address when the function is executed by the specific CPU, and the function When executed by another CPU, a code for performing a reference using a global address symbol corresponding to the global address is included.

これによれば、簡単なコード記述に基づいて項10の作用効果を得ることができる。   According to this, the effect of item 10 can be obtained based on simple code description.

〔12〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数CPUによる同一実行関数からの変数の参照にはグローバルアドレス用シンボルを付与して、複数CPUコアに共通なロードモジュールの生成を制御するプログラム>
本発明の別の形態に係るロードモジュール生成プログラムは、項8と同様に、CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステム(2)によって実行されるプログラムのロードモジュール(151)をコンピュータ(1)のデータ処理によって生成するための、コンピュータにより実行可能なプログラムである。このプログラムは入力処理(121)、コード生成処理(122、123)、アドレス解決処理(131)、及びアドレス生成処理(132)を制御する。入力処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラム(140)を入力する処理である。コード生成処理は、前記入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコード(141)を生成する処理である。アドレス解決処理は、前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決する処理である。アドレス生成処理は、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルに対応するアドレスを用いるコード(図4のg;=0x0aa)を生成し、複数のCPUで実行される可能性のある関数において変数を参照する場合はグローバルアドレス用シンボルに対応するアドレスを用いるコード(図4のf;=0x2aa)を生成する処理である。
[12] <Common address shared by multiple CPU cores by assigning local address symbols to refer to variables in its own local memory by a single CPU, and global address symbols to refer to variables from the same execution function by multiple CPUs Program that controls the generation of load modules>
In the load module generation program according to another aspect of the present invention, as in item 8, the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory is local to another CPU core. A load module (151) of a program executed by a multi-CPU core system (2) using a global address for referring to a memory and a local address for a CPU to refer to a local memory in its own CPU core A computer-executable program generated by data processing of the computer (1). This program controls input processing (121), code generation processing (122, 123), address resolution processing (131), and address generation processing (132). The input process is a process of inputting a source program (140) having instruction information specifying which CPU is to allocate certain data on which local memory and which CPU is to execute a certain function. . The code generation process determines whether to use a global address or a local address for referring to the variable for each function based on the input information, and depending on the determination result, the local address symbol and the global address This is a process for generating an object code (141) referring to at least one of the symbols. The address resolution process is a process of resolving an address for the global address symbol generated by the code generation process, and resolving the address of the local address symbol based on the resolved address. In the address generation process, when referring to a variable on a local memory in a CPU core in a function executed only by a single CPU, a code using an address corresponding to the symbol for the local address (g in FIG. 4; = 0x0aa) ) And a code that uses an address corresponding to the symbol for global address (f in FIG. 4; = 0x2aa) is generated when a variable is referred to in a function that may be executed by a plurality of CPUs. .

これによれば、項8及び項9と同様の作用効果を得る。   According to this, the same effects as the items 8 and 9 are obtained.

〔13〕<単一CPUによる自ローカルメモリ上変数の参照にはローカルアドレス用シンボルを、複数のCPUで実行される関数の場合には実行するCPUに応じて変数の参照シンボルを指示して、複数CPUコアに共通なロードモジュールの生成を制御するプログラム>
本発明の別の形態に係るロードモジュール生成プログラムは、項8と同様に、CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステム(2)によって実行されるプログラムのロードモジュール(151A)をコンピュータ(1)のデータ処理によって生成するための、コンピュータにより実行可能なプログラムである。このプログラムは入力処理(121)、コード生成処理、アドレス解決処理(131)、及びアドレス生成処理(132)を制御する。入力処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラム(140)を入力する処理である。コード生成処理は、前記入力した情報に基づいて、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコード(図5のg;=LY)を生成し、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む第2のコード(図5のf;if(cpu==2)=LY,else=GY)を生成する処理である。アドレス解決処理は、前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決する処理である。アドレス生成処理は、前記オブジェクトコードに対してグローバルアドレス用シンボルには対応するグローバルアドレスを用いるコードを生成し、ローカルアドレス用シンボルには対応するローカルアドレスを用いるコードを生成する処理である。
[13] <Indicating a local address symbol for referring to a variable in its own local memory by a single CPU, and in the case of a function executed by a plurality of CPUs, indicating a variable reference symbol according to the CPU to be executed, Program for controlling generation of load module common to multiple CPU cores>
In the load module generation program according to another aspect of the present invention, as in item 8, the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory is local to another CPU core. A load module (151A) of a program executed by the multi-CPU core system (2) using a global address for referring to a memory and a local address for a CPU to refer to a local memory in its own CPU core A computer-executable program generated by data processing of the computer (1). This program controls input processing (121), code generation processing, address resolution processing (131), and address generation processing (132). The input process is a process of inputting a source program (140) having instruction information specifying which CPU is to allocate certain data on which local memory and which CPU is to execute a certain function. . Based on the input information, the code generation process refers to a first code that refers to a local address symbol when referring to a variable in a local memory in the CPU core in a function executed only by a single CPU. (G in FIG. 5; LY) is generated, and when the function refers to data on a local memory in a specific CPU core in a function that may be executed by a plurality of CPUs, the function is the specific CPU. A statement for determining whether or not the function is executed, a code for performing a reference using a symbol for a local address corresponding to a local address when the function is executed by the specific CPU, and the function for other CPUs Is executed by the second code (see FIG. 5) including a code for performing a reference using a global address symbol corresponding to the global address. ; If (cpu == 2) = LY, a process of generating an else = GY). The address resolution process is a process of resolving an address for the global address symbol generated by the code generation process, and resolving the address of the local address symbol based on the resolved address. The address generation process is a process of generating a code using a global address corresponding to a global address symbol for the object code and generating a code using a corresponding local address for a local address symbol.

これによれば、項8、項10及び項11と同様の作用効果を得る。   According to this, the same effects as those of the items 8, 10, and 11 are obtained.

2.実施の形態の詳細
実施の形態について更に詳述する。
2. Details of Embodiments Embodiments will be further described in detail.

〔実施の形態1〕
《ロードモジュールの開発システム》
図1にはマルチCPU(中央処理装置)コアシステムとしてのマイクロコンピュータによって実行されるプログラムのロードモジュールを生成する開発システムの概略が例示される。
[Embodiment 1]
《Load module development system》
FIG. 1 illustrates an outline of a development system that generates a load module of a program executed by a microcomputer as a multi-CPU (central processing unit) core system.

1はロードモジュールの生成に用いるコンピュータシステムとしてのパーソナルコンピュータ(PC)システム、2はPCシステム1で生成されたロードモジュールを実行するマイクロコンピュータ、3はロードモジュールをマイクロコンピュータ2に書込むPROMライタである。ロードモジュールの書込みはPROMライタ3を用いる構成に限定されず、例えばマイクロコンピュータ2が図示を省略するネットワークを介してPCシステム1からロードモジュールをダウンロードし、ダウンロードしたロードモジュールを自らの書込み制御プログラムを用いて自立的に書き込むことも可能である。PCシステム1に変えてエンジニアリングワークステーションなどを採用することも可能である。   1 is a personal computer (PC) system as a computer system used for generating a load module, 2 is a microcomputer for executing the load module generated by the PC system 1, and 3 is a PROM writer for writing the load module into the microcomputer 2. is there. The writing of the load module is not limited to the configuration using the PROM writer 3. For example, the microcomputer 2 downloads the load module from the PC system 1 via a network (not shown), and loads the downloaded load module with its own write control program. It is also possible to write it independently. An engineering workstation or the like can be employed instead of the PC system 1.

PCシステム1には、例えば表示装置として代表的に示されたディスプレイ100、入力装置として代表的に示されたキーボード101、及びPC本体102が設けられる。PC本体102は、プロセッサ、アクセラレータ及びキャッシュメモリなどを搭載したCPUモジュール(CPUM)110、補助記憶装置として代表的に示されたハードディスクドライブ(HDD)111、RAM112、並びに図示を省略する外部入出力回路などの回路ユニットがバス113を介してインタフェース可能に構成される。   The PC system 1 includes, for example, a display 100 typically shown as a display device, a keyboard 101 typically shown as an input device, and a PC main body 102. The PC main body 102 includes a CPU module (CPUM) 110 on which a processor, an accelerator, a cache memory, and the like are mounted, a hard disk drive (HDD) 111 typically shown as an auxiliary storage device, a RAM 112, and an external input / output circuit (not shown) Such circuit units are configured to be interfaceable via the bus 113.

RAM112にはソースプログラムからマイクロコンピュータ2のロードモジュール206を生成するためのプログラムなどが格納される。CPUモジュールはキーボードなどから入力される指示にしたがって、RAMのプログラムを実行する。その詳細は後述する。   The RAM 112 stores a program for generating the load module 206 of the microcomputer 2 from the source program. The CPU module executes a RAM program in accordance with an instruction input from a keyboard or the like. Details thereof will be described later.

《マイクロコンピュータ》
図1に示されるマイクロコンピュータ2は、複数個のCPUコアとして、例えば2個の第1CPUコア201と第2CPUコア202とを有し、それらはバス203に接続される。バス203には例えばRAM204及びROM205などが更に接続される。例えばROM205にはロードモジュール206が書き込まれる。第1CPUコア201はCPU(CPU_1)211とローカルメモリ(LM_1)212を有し、第2CPUコア202はCPU(CPU_2)221とローカルメモリ(LM_2)222を有する。CPU211,221は、ROM204が保有するオペレーティングシステムにしたがって、タスクスケジューリング、メモリ管理及び割込み制御などのシステム制御を行う。更に、CPU211,221はROM204が保有するロードモジュール206に含まれる命令コードを夫々の命令実行順にフェッチして実行する。
<Microcomputer>
The microcomputer 2 shown in FIG. 1 has, for example, two first CPU cores 201 and second CPU cores 202 as a plurality of CPU cores, and these are connected to a bus 203. For example, a RAM 204 and a ROM 205 are further connected to the bus 203. For example, the load module 206 is written in the ROM 205. The first CPU core 201 has a CPU (CPU_1) 211 and a local memory (LM_1) 212, and the second CPU core 202 has a CPU (CPU_2) 221 and a local memory (LM_2) 222. The CPUs 211 and 221 perform system control such as task scheduling, memory management, and interrupt control according to the operating system possessed by the ROM 204. Further, the CPUs 211 and 221 fetch and execute the instruction codes included in the load module 206 held by the ROM 204 in the respective instruction execution order.

夫々のCPU211,221は自らのCPUコア201,202内のローカルメモリ212,222を参照するのにグローバルアドレスとローカルアドレスとを用いることができる。当然、夫々のCPU211,221は自らのCPUコア201,202の外部にあるローカルメモリ212,222を参照するにはグローバルアドレスを用いる。   Each of the CPUs 211 and 221 can use a global address and a local address to refer to the local memories 212 and 222 in its own CPU cores 201 and 202. Naturally, each of the CPUs 211 and 221 uses a global address to refer to the local memories 212 and 222 outside the CPU cores 201 and 202 thereof.

図2にはローカルメモリ212,222に対するそのようなアドレスマップが例示される。双方のローカルメモリ(LM_1,LM_2)212,222に共通なローカルアドレスLAは0x000≦LA<0x100に割り当てられ、ローカルメモリ(LM_1)212のグローバルアドレスGA_1は0x100≦GA_1<0x200に割り当てられ、ローカルメモリ(LM_2)222のグローバルアドレスGA_2は0x200≦GA_2<0x300に割り当てられる。   FIG. 2 illustrates such an address map for the local memories 212 and 222. The local address LA common to both local memories (LM_1, LM_2) 212, 222 is assigned to 0x000 ≦ LA <0x100, and the global address GA_1 of the local memory (LM_1) 212 is assigned to 0x100 ≦ GA_1 <0x200, and the local memory The global address GA_2 of (LM_2) 222 is assigned to 0x200 ≦ GA_2 <0x300.

図2のアドレスマップから明らかなように、CPU(CPU_1)211からローカルメモリ(LM_1)212をアクセスするとき、及び、CPU(CPU_2)221からローカルメモリ(LM_2)222をアクセスするときに、それぞれがローカルアドレスを用いる。即ち、ローカルアドレスはローカルメモリに対するアクセスが夫々のCPUコア内に閉じている場合に用いられる。したがって、CPU(CPU_1)211からローカルメモリ(LM_1)212をアクセスするとき、ローカルメモリ(LM_1)212の先頭アドレスは0x000となり、同様に、CPU(CPU_2)221からローカルメモリ(LM_2)222をアクセスするとき、ローカルメモリ(LM_2)222の先頭アドレスも0x000となる。   As is apparent from the address map of FIG. 2, when accessing the local memory (LM_1) 212 from the CPU (CPU_1) 211 and when accessing the local memory (LM_2) 222 from the CPU (CPU_2) 221, respectively. Use local addresses. That is, the local address is used when access to the local memory is closed in each CPU core. Therefore, when the local memory (LM_1) 212 is accessed from the CPU (CPU_1) 211, the top address of the local memory (LM_1) 212 is 0x000. Similarly, the local memory (LM_2) 222 is accessed from the CPU (CPU_2) 221. At this time, the top address of the local memory (LM_2) 222 is also 0x000.

CPU211,221はグローバルアドレスを用いたアクセスを行う場合にはそのアドレス信号をバス203に出力する。出力されたアドレス信号はバス203のルータによって、それが示すアドレスの回路モジュールに向けてルーティングされる。例えば、第1CPU211がローカルメモリ(LM_1)211をアクセスするとき、そのグローバルアドレスを用いると、そのローカルアドレスを用いる場合に比べてアクセスに時間がかかる。これは、CPUがグローバルアドレスを用いて他のCPUコア内のローカルメモリをアクセスする場合と同様である。   The CPUs 211 and 221 output the address signal to the bus 203 when accessing using a global address. The output address signal is routed by the router of the bus 203 toward the circuit module having the address indicated by the bus 203. For example, when the first CPU 211 accesses the local memory (LM_1) 211, if the global address is used, it takes longer time to access than when the local address is used. This is the same as when the CPU accesses a local memory in another CPU core using a global address.

図3にはローカルアドレスとグローバルアドレスによるローカルメモリのアクセス経路が例示される。第1CPUコア210及び第2CPUコア202の内部にそれぞれ示される経路(a)はローカルアドレスによるアクセス経路を示す。CPU211,221はローカルアドレスを用いたアクセスであることを例えば、アドレス信号0x000の最初の桁が0であることから判別する。   FIG. 3 illustrates an access path of a local memory using a local address and a global address. A path (a) shown in each of the first CPU core 210 and the second CPU core 202 indicates an access path based on a local address. The CPUs 211 and 221 determine that the access is performed using a local address, for example, because the first digit of the address signal 0x000 is 0.

経路(b)はCPU(CPU_1)211がグローバルアドレスを使ってローカルメモリ(LM_1)212をアクセスするときの経路を示す。CPU(CPU_1)211は例えばアクセスアドレス0x100の最初の桁が0でないことから外部のバス203に対してアクセス要求を出力する。バス203のルータはそのアドレスの最初の桁が1であることから、当該アクセス要求を第1CPUコア201内のローカルメモリ(LM_1)212に向けてルーティングし、これをCPU(CPU_1)211が受け付けて自らのローカルメモリ(LM_1)212をアクセスする。この場合は経路(a)に比べてアクセス経路が長くなるので、アクセスに時間がかかる。   A path (b) indicates a path when the CPU (CPU_1) 211 accesses the local memory (LM_1) 212 using a global address. For example, since the first digit of the access address 0x100 is not 0, the CPU (CPU_1) 211 outputs an access request to the external bus 203. Since the first digit of the address of the router of the bus 203 is 1, the access request is routed to the local memory (LM_1) 212 in the first CPU core 201, and this is received by the CPU (CPU_1) 211. Access its own local memory (LM_1) 212. In this case, since the access route becomes longer than the route (a), access takes time.

経路(c)はCPU(CPU_1)211がグローバルアドレスを使って第2CPUコア202内のローカルメモリ(LM_2)222をアクセスするときの経路を示す。CPU(CPU_1)211は例えばアクセスアドレス0x200の最初の桁が0でないことから外部のバス203に対してアクセス要求を出力する。バス203のルータはそのアドレスの最初の桁が2であることから、当該アクセス要求を第2のCPUコア201内のローカルメモリ(LM_2)222に向けてルーティングし、これをCPU(CPU_2)221が受け付けて自らのローカルメモリ(LM_2)222をアクセスする。この場合も経路(a)に比べてアクセス経路が長くなるので、アクセスに時間がかかるが、これはCPU(CPU_1)211が別の第2のCPUコア内のローカルメモリ(LM_2)222をアクセスするために必ず必要とされる時間である。   A path (c) indicates a path when the CPU (CPU_1) 211 accesses the local memory (LM_2) 222 in the second CPU core 202 using the global address. The CPU (CPU_1) 211 outputs an access request to the external bus 203 because the first digit of the access address 0x200 is not 0, for example. Since the first digit of the address of the router of the bus 203 is 2, the access request is routed to the local memory (LM_2) 222 in the second CPU core 201, and this is routed by the CPU (CPU_2) 221. Accept and access its own local memory (LM_2) 222. In this case as well, the access path becomes longer than the path (a), so it takes time to access, but this is because the CPU (CPU_1) 211 accesses the local memory (LM_2) 222 in another second CPU core. This is the time that is absolutely necessary.

《ロードモジュール生成処理》
ロードモジュールを生成するプログラムとして例えば図1のRAM112はコンパイラ120とリンカ130を格納する。図1の表記では便宜上コンパイラ120やリンカ130が必要な情報を読み込んでコードを生成するかのように記載されているが、実際にはCPUモジュール110がコンパイラ120及びリンカ130を実行しながら、必要な情報を読み込んでコードを生成するものと理解されたい。
<< Load module generation process >>
For example, the RAM 112 in FIG. 1 stores a compiler 120 and a linker 130 as a program for generating a load module. In the notation of FIG. 1, it is described as if the compiler 120 and the linker 130 read necessary information and generate code for convenience, but actually, the CPU module 110 needs to execute the compiler 120 and the linker 130 while executing them. It should be understood that the code is generated by reading various information.

夫々の処理の詳細は後述するものとして、CPUモジュール110は前記コンパイラ120を実行することにより、データ・関数情報入力処理121、MAS出力処理122、及びMAS参照コード生成処理123などを制御して、データ・関数情報付きソースプログラム140からMAS及びMAS参照コード入りオブジェクトコード141を生成する。MASは多重アドレス付けシンボル(Multiply Addressed Symbol)を表す。また、CPUモジュール110は前記リンカ130を実行することにより、アドレスマップ情報150などを参照しながらローカルアドレス解決処理131及びMASアドレス生成処理132などを制御して、MAS及びMAS参照コード入りオブジェクトコード141からロードモジュール151を生成する。生成されたロードモジュール151はROM書込みツール152の制御に従ってROMライタ3でマイクロコンピュータ2のROM204に書き込まれる。   The details of each process will be described later. By executing the compiler 120, the CPU module 110 controls the data / function information input process 121, the MAS output process 122, the MAS reference code generation process 123, etc. An object code 141 containing a MAS and a MAS reference code is generated from the source program 140 with data / function information. MAS stands for Multiply Addressed Symbol. The CPU module 110 executes the linker 130 to control the local address resolution processing 131 and the MAS address generation processing 132 while referring to the address map information 150 and the like, and the object code 141 including the MAS and MAS reference codes. The load module 151 is generated from the above. The generated load module 151 is written into the ROM 204 of the microcomputer 2 by the ROM writer 3 under the control of the ROM writing tool 152.

図4にはロードモジュールを生成する処理フローが例示される。   FIG. 4 illustrates a processing flow for generating a load module.

コンパイルの対象にされるソースプログラムには、あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報が付随される。この指示情報をここではデータ・関数情報と称し、コンパイラ120はデータ・関数情報付きソースプログラム140を入力する。図4の例では、データ・関数情報付きソースプログラム140は、2つのpragma文と2つの関数F,Gから構成される。pragma文とはコンパイラに付加情報を与えるためのC言語に備わる文である。   The source program to be compiled is accompanied by instruction information specifying which CPU is to allocate certain data on which local memory and which CPU is to execute a certain function. This instruction information is referred to herein as data / function information, and the compiler 120 inputs a source program 140 with data / function information. In the example of FIG. 4, the source program 140 with data / function information includes two pragma statements and two functions F and G. The pragma statement is a statement provided in the C language for giving additional information to the compiler.

ここで、図4に示された「#pragma Y in LM2」は、変数Yがローカルメモリ(LM_2)222に配置されることを表す。   Here, “#pragma Y in LM2” shown in FIG. 4 indicates that the variable Y is arranged in the local memory (LM_2) 222.

また、「pragma G exec on CPU2」は、関数GがCPU(CPU_2)202で実行されることを表す。   “Pragma G exec on CPU2” indicates that the function G is executed by the CPU (CPU_2) 202.

pragma文の下に示される2つの図形は各々、関数FとGを模式的に表現したものである。2つの矩形から構成される図形は、図4の凡例に示されるように、左側が関数名を、右側が関数本体に書かれたコードの一部を表す。関数FとGにおいて「=Y」の記述は、関数FとGの中に変数Yを参照する文が含まれることを表す。   Each of the two figures shown below the pragma statement is a schematic representation of functions F and G. As shown in the legend of FIG. 4, the graphic composed of two rectangles represents the function name on the left side and a part of the code written in the function body on the right side. In the functions F and G, the description “= Y” indicates that the functions F and G include a statement that refers to the variable Y.

コンパイラ120を用いたデータ・関数情報入力処理121では、データ・関数情報付きのソースプログラムにおける2つのpragma文を入力して解釈し、「変数Yがローカルメモリ(LM_2)222に配置されること」及び「関数Gが第2CPU(CPU_2)202で実行されること」を示す情報を取り込む。   In the data / function information input processing 121 using the compiler 120, two pragma statements in the source program with data / function information are input and interpreted, and “the variable Y is arranged in the local memory (LM_2) 222”. And information indicating that the function G is executed by the second CPU (CPU_2) 202 is fetched.

MAS出力処理122では、変数Yに対する2つのシンボル情報「GY」と「LY」をオブジェクトコードに出力する。ここで、GYはグローバルアドレスに対応するシンボルであり、LYはローカルアドレスに対応するシンボルを表す。   In the MAS output process 122, two pieces of symbol information “GY” and “LY” for the variable Y are output to the object code. Here, GY is a symbol corresponding to the global address, and LY represents a symbol corresponding to the local address.

MAS参照コード生成処理123では関数Fにおける変数Yの参照に対して、Yがローカルメモリ(LM_2)222上に配置される情報はあるが、関数がどのCPUで実行されるかという情報がないことから、関数Fについてはグローバルアドレスに対応するシンボルGYを用いた参照を行うと判断し、グローバルアドレス用シンボルGYを用いたコードfをオブジェクトコード141中に出力する。コードfは関数Fについてコンパイラ120でコンパイルされたコードを意味する。   In the MAS reference code generation process 123, for the reference of the variable Y in the function F, there is information that Y is arranged on the local memory (LM_2) 222, but there is no information on which CPU the function is executed on. Therefore, the function F is determined to be referred to using the symbol GY corresponding to the global address, and the code f using the global address symbol GY is output in the object code 141. The code f means a code compiled by the compiler 120 for the function F.

また、MAS参照コード生成処理では、関数Gにおける変数Yの参照に対して、変数Yがローカルメモリ(LM_2)222に配置される情報と関数Gが第2CPUY(CPU_2)221で実行されるという情報から、関数Gについてはローカルアドレスに対応するローカルアドレス用シンボルLYを用いた参照を行うと判断し、ローカルアドレス用シンボルLYを用いたコードgをオブジェクトコード141中に出力する。コードgは関数Gについてコンパイラ120でコンパイルされたコードを意味する。   Further, in the MAS reference code generation process, with respect to the reference of the variable Y in the function G, information that the variable Y is arranged in the local memory (LM_2) 222 and information that the function G is executed by the second CPUY (CPU_2) 221 Therefore, the function G is determined to be referred to using the local address symbol LY corresponding to the local address, and the code g using the local address symbol LY is output in the object code 141. The code g means a code compiled by the compiler 120 for the function G.

その結果として、図4のMAS及びMAS参照コード入りオブジェクトコードには、変数Yのグローバルアドレス用シンボルGY及び変数Yのローカルアドレス用真吾ルLYを含むシンボル情報テーブルと、関数F,Gに対するオブジェクトコードf、gが示されている。   As a result, the object code including the MAS and MAS reference code in FIG. 4 includes a symbol information table including the global address symbol GY of the variable Y and the local address true LY of the variable Y, and object codes for the functions F and G. f and g are shown.

リンカ130による処理では、前記MAS及びSAM参照コード入りオブジェクトコード141とアドレスマップ情報150を入力して、まず、リンカ130の既存技術によってグローバルアドレス変数に対するアドレスを解決する。アドレスマップ情報は図2に例示した情報に従って、例えば、ローカルメモリの番号(ローカルメモリLM_1の番号は「1」、ローカルメモリLM_2の番号は「2」)からグローバルアドレスの最初の桁番号(ローカルメモリLM_1におけるグローバルアドレスの最初の桁番号は「1」、ローカルメモリLM_2におけるグローバルアドレスの最初の桁番号は「2」)を得るための方法を特定する情報、即ち、LM_nに対してアドレスの最初の桁番号がnであるという情報と、グローバルアドレスからローカルアドレスを得るための方法を特定するための情報、即ち、アドレスの最初の桁番号と「0x0」の論理積を取るという情報とを含む。   In the processing by the linker 130, the object code 141 including the MAS and SAM reference code and the address map information 150 are input, and first, the address for the global address variable is resolved by the existing technology of the linker 130. The address map information is in accordance with the information illustrated in FIG. 2, for example, from the number of the local memory (the number of the local memory LM_1 is “1” and the number of the local memory LM_2 is “2”) to the first digit number of the global address (local memory The first digit number of the global address in LM_1 is “1” and the first digit number of the global address in the local memory LM_2 is “2”), that is, how to obtain the first address of the address for LM_n It includes information that the digit number is n and information for specifying a method for obtaining a local address from the global address, that is, information that performs a logical product of the first digit number of the address and “0x0”.

例えば、先ず、変数Yがローカルメモリ(LM_2)222に配置されることからYのグローバルアドレス用シンボルGYのアドレスは「0x2aa」と決定することによって、グローバルアドレス用シンボルGYに対応するグローバルアドレス変数に対するアドレスを解決する。   For example, since the variable Y is first arranged in the local memory (LM_2) 222, the address of the global address symbol GY of Y is determined to be “0x2aa”, so that the global address variable corresponding to the global address symbol GY Resolve the address.

次に、ローカルアドレス解決処理131ではグローバルアドレス用シンボルGYのアドレス「0x2aa]と上記アドレスマップ情報150から、Yのローカルアドレス用シンボルLYのアドレスを、「0x0aa」と決定する。   Next, the local address resolution processing 131 determines the address of the Y local address symbol LY as “0x0aa” from the address “0x2aa” of the global address symbol GY and the address map information 150.

MAS用アドレス生成処理132では、ローカルアドレス用シンボルに対してはローカルアドレスを用い、グローバルアドレス用シンボルに対してはグローバルアドレスを用いるコードを出力する。これにより、例えば、オブジェクトコード141中のグローバルアドレス用シンボルGYに対する参照に対してアドレス「0x2aa」を、ローカルアドレス用シンボルLYに対する参照に対してアドレス「0x0aa」を用いるコードを出力する。   The MAS address generation process 132 outputs a code that uses a local address for a local address symbol and uses a global address for a global address symbol. Accordingly, for example, a code using the address “0x2aa” for the reference to the global address symbol GY in the object code 141 and the address “0x0aa” for the reference to the local address symbol LY is output.

この結果、図4に例示されるコア1及びコア2共用ロードモジュール151を得る。コア1及びコア2共用ロードモジュール151は、アドレス解決された後の2つの関数fとgから構成される。fとgは、実際には、各々、関数FとGのアドレスを表すことになる。関数fと関数g本体の中に現れるアドレス「0x2aa」と「0x0aa」は各々、変数Yに対するグローバルアドレスとローカルアドレスを表す。変数Yはローカルメモリ(LM_2)222に配置されるので、第2CPU(CPU_2)221で実行される関数gからはローカルアドレス参照になり(最初の桁が0になる)、関数fは第1CPU(CPU_1)211と第2CPU(CPU_2)221のどちらのCPUで実行されるか不明なため、ローカルメモリ(LM_2)222上のYに対するアドレスはグローバルアドレス(最初の桁が2)で指定されている。   As a result, the core 1 and core 2 shared load module 151 illustrated in FIG. 4 is obtained. The core 1 and core 2 shared load module 151 is composed of two functions f and g after address resolution. f and g actually represent the addresses of functions F and G, respectively. Addresses “0x2aa” and “0x0aa” appearing in the body of the function f and function g represent a global address and a local address for the variable Y, respectively. Since the variable Y is arranged in the local memory (LM_2) 222, the function g executed by the second CPU (CPU_2) 221 makes a local address reference (the first digit is 0), and the function f is the first CPU ( Since it is unknown which of the CPU_1) 211 and the second CPU (CPU_2) 221 is executed, the address for Y on the local memory (LM_2) 222 is designated by a global address (first digit is 2).

実施の形態1によるロードモジュールの生成方法によれば、全てのCPUコアで実行するソースプログラムにおいて、関数で参照するデータ即ち変数がどのCPUコア内のローカルメモリに配置されるか、及び、ある関数が一つのCPU上でのみ実行される場合はそれがどのCPU上で実行されるかを示す情報(データ・関数情報)をソースプログラムに追加した。コンパイラ120はこの情報を入力し、関数毎にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、同じ変数のデータに対してリンカが上記互いに関連する2種類の異なるアドレスを出力することが可能となるように、2種類のシンボル情報GY,LYと各々を参照するオブジェクトコード(MAS及びMAS参照コード入りオブジェクトコード)141を生成するようにした。リンカ130は既存の技術によって、グローバルアドレスを持つシンボルに対するアドレスを解決し、上記2種類の互いに異なるアドレス間の関係をアドレスマップ情報150から読み取ることによって、ローカルアドレスを持つシンボルLYに対するアドレスを解決するようにした。更に、グローバルアドレスを持つシンボルGYとローカルアドレスを持つシンボルLYに対して、各々、ローカルアドレス、グローバルアドレスを出力することによって、第1のCPUコア202と第2のCPUコア201に共通なロードモジュール151を生成するようにした。   According to the load module generation method according to the first embodiment, in a source program executed by all CPU cores, data that is referred to by a function, that is, a variable is allocated in a local memory in which CPU core, and a certain function Is executed on only one CPU, information (data / function information) indicating on which CPU it is executed is added to the source program. The compiler 120 inputs this information, determines whether to use a global address or a local address for each function, and the linker can output two different addresses related to the same variable data. In order to make it possible, two types of symbol information GY and LY and an object code (an object code including a MAS and a MAS reference code) 141 that refers to each of them are generated. The linker 130 resolves an address for a symbol having a global address using existing technology, and resolves an address for the symbol LY having a local address by reading the relationship between the two types of different addresses from the address map information 150. I did it. Further, a load module common to the first CPU core 202 and the second CPU core 201 is output by outputting a local address and a global address to the symbol GY having the global address and the symbol LY having the local address, respectively. 151 is generated.

これらによって、あるCPUがそのCPUコア内のローカルメモリ上のあるデータを参照する場合が判定できるので、ローカルアドレスを使った最適コードを出力することができる。先に本発明者が検討したように、アドレス解決を全てグローバルアドレスで行っておき、ローカルメモリ上のあるデータを参照する場合には命令実行時にグローバルアドレスをローカルアドレスに変換する方法に比べて、参照の高速化を実現することができる。要するに、ローカルアドレスを用いることによる処理の高速性が犠牲にならない。   As a result, it is possible to determine when a certain CPU refers to certain data on the local memory in the CPU core, so that an optimum code using a local address can be output. As previously discussed by the present inventor, all address resolution is performed with a global address, and when referring to certain data on the local memory, compared to a method of converting a global address to a local address at the time of instruction execution, Speeding up of reference can be realized. In short, the high speed of processing by using a local address is not sacrificed.

また、ある関数が複数のCPUコア上で実行されることが判定できるので、第1CPU(CPU_1)211上でも第2CPU(CPU_2)222上でも実行できるようなグローバルアドレスを用いたコードを出力することができ、従来技術のように同じ関数に対してCPU毎に関数のコピーを作成する必要が無くなるので、使用メモリ量を削減することができる。   Since it can be determined that a certain function is executed on a plurality of CPU cores, a code using a global address that can be executed on the first CPU (CPU_1) 211 and the second CPU (CPU_2) 222 is output. This eliminates the need to make a copy of the function for each CPU for the same function as in the prior art, so that the amount of memory used can be reduced.

《ロードモジュール生成プログラム》
上記ロードモジュールの生成方法はPCシステム1のようなコンピュータにロードモジュール生成プログラムを実行させることによって実現される。そのようなプログラムは、前記コンパイラ120によるコンパイル処理とリンカ130によるリンク処理を制御する。コンパイル処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、及び、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力し、入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成する処理を行えばよく、例えば前記データ・関数情報入力処理121、MAS出力処理122、及びMAS参照コード生成処理123によって構成すればよい。リンク処理は、前記オブジェクトコードに対してグローバルアドレス用シンボルにはグローバルアドレスを割り当て、ローカルアドレス用シンボルにはローカルアドレスを割り当てて、複数のCPUコアに共通なロードモジュールを生成する処理を行えばよく、例えば既存のグローバルアドレス解決処理、ローカルアドレス解決処理131、及びMAS用アドレス生成処理によって構成すればよい。
<< Load module generation program >>
The load module generation method is realized by causing a computer such as the PC system 1 to execute a load module generation program. Such a program controls compile processing by the compiler 120 and link processing by the linker 130. Compile processing inputs a source program having instruction information specifying which CPU allocates certain data on which local memory in which CPU core and which CPU executes a certain function, and based on the input information For each function, determine whether to use the global address or local address for the reference of the variable for each function, and refer to at least one of the local address symbol and the global address symbol according to the determination result What is necessary is just to perform the process which produces | generates a code | cord | chord, for example, may comprise by the said data and function information input process 121, the MAS output process 122, and the MAS reference code production | generation process 123. FIG. The link processing may be performed by assigning a global address to the global address symbol and assigning a local address to the local address symbol to generate a load module common to a plurality of CPU cores. For example, it may be configured by existing global address resolution processing, local address resolution processing 131, and MAS address generation processing.

このロードモジュール生成プログラムを用いることにより、実施の形態1に係るロードモジュール生成方法を容易に実現することができる。   By using this load module generation program, the load module generation method according to the first embodiment can be easily realized.

〔実施の形態2〕
図5にはロードモジュールを生成する別の処理フローが例示される。ここでは特に図示はしないが図1のPCシステム1と類似のコンピュータを用いてマイクロコンピュータ2のロードモジュールを生成する処理について説明する。図1及び図4との相違点はコンパイラ120Aによる一部の処理である。その結果として、リンカ130による処理結果が相違される。以下では、図1及び図4との相違点を中心に処理の詳細を説明する。
[Embodiment 2]
FIG. 5 illustrates another processing flow for generating a load module. Here, although not particularly illustrated, a process of generating a load module of the microcomputer 2 using a computer similar to the PC system 1 of FIG. 1 will be described. A difference from FIGS. 1 and 4 is a part of processing by the compiler 120A. As a result, the processing result by the linker 130 is different. Hereinafter, details of the processing will be described focusing on the differences from FIGS.

コンパイラ120Aは実施の形態1と同様のデータ・関数情報入力処理及びMAS出力処理を行うが、MAS参照コード生成処理では、関数Fにおける変数Yの参照に対して、変数Yがローカルメモリ(LM_2)222上に配置される情報ではあるが、関数Fが第1CPU(CPU_1)211と第2CPU(CPU_2)221のどのCPUで実行されるかという情報がないことから、関数Fが第2CPU(CPU_2)221で実行される場合と他のCPUで実行される場合に分けたコードを出力する。即ち、関数Fが第2CPU(CPU_2)221で実行されるか否かを判定する文(if(cpu==2)、関数Fが第2CPU(CPU_2)221で実行される場合にはローカルアドレスに対応するシンボルLYを用いた参照を行うコード(=LY)、関数Fがその他のCPUで実行される場合にはグローバルアドレスに対応するシンボルGYを用いた参照を行うコード(=GY)、を含むコードfをオブジェクトコード141A中に出力する。一方、MAS参照コード出力部は関数Gにおける変数Yの参照に対して、変数Yがローカルメモリ(LM_2)222上に配置される情報と関数Gが第2CPU(CPU_2)221で実行されるという情報から、ローカルアドレスに対応するシンボルLYを用いた参照を行うと判断し、シンボルLYを用いた参照コード(=LY)を含むコードgをオブジェクトコード141A中に出力する。   The compiler 120A performs the same data / function information input processing and MAS output processing as in the first embodiment. In the MAS reference code generation processing, the variable Y is a local memory (LM_2) with respect to the reference of the variable Y in the function F. Although there is no information on which CPU of the first CPU (CPU_1) 211 and the second CPU (CPU_2) 221 is the function F, the function F is the second CPU (CPU_2). Codes divided into the case of being executed at 221 and the case of being executed by another CPU are output. That is, a statement for determining whether or not the function F is executed by the second CPU (CPU_2) 221 (if (cpu == 2)). When the function F is executed by the second CPU (CPU_2) 221, the local address is set. A code (= LY) for performing a reference using the corresponding symbol LY, and a code (= GY) for performing a reference using the symbol GY corresponding to the global address when the function F is executed by another CPU. The code f is output in the object code 141 A. On the other hand, the MAS reference code output unit receives information about the variable Y being placed on the local memory (LM_2) 222 and the function G in response to the reference of the variable Y in the function G. It is determined from the information that it is executed by the 2CPU (CPU_2) 221 that the reference using the symbol LY corresponding to the local address is performed. And it outputs the code g containing a reference code (= LY) using Le LY into object code 141A.

リンカ130による処理は、実施の形態1と同様であるが、入力として図5の前記MAS及びSAM参照コード入りオブジェクトコード141Aと前述のアドレスマップ情報150を入力して、まず、リンカ130の既存技術によってグローバルアドレス変数に対するアドレスを解決する。アドレスマップ情報150の内容は実施の形態1と同じである。このとき、前記MAS及びSAM参照コード入りオブジェクトコード141Aに対するMAS用アドレス生成処理では、例えば、先ず、変数Yがローカルメモリ(LM_2)222に配置されることからYのグローバルアドレス用シンボルGYのアドレスは「0x2aa」と決定することによって、グローバルアドレス用シンボルGYに対応するグローバルアドレス変数に対するアドレスを解決する。次に、ローカルアドレス解決処理ではグローバルアドレス用シンボルGYのアドレス「0x2aa]と上記アドレスマップ情報150から、Yのローカルアドレス用シンボルLYのアドレスを、「0x0aa」と決定する。MAS用アドレス生成処理132では、ローカルアドレス用シンボルに対してはローカルアドレスを用い、グローバルアドレス用シンボルに対してはグローバルアドレスを用いるコードを出力する。これにより、例えば、オブジェクトコード141中のグローバルアドレス用シンボルGYに対する参照に対してアドレス「0x2aa」を、ローカルアドレス用シンボルLYに対する参照に対してアドレス「0x0aa」を用いるコードを出力する。   The processing performed by the linker 130 is the same as that of the first embodiment, but the MAS and SAM reference code-containing object code 141A shown in FIG. 5 and the address map information 150 described above are input as input. To resolve the address for the global address variable. The contents of the address map information 150 are the same as those in the first embodiment. At this time, in the MAS address generation process for the object code 141A including the MAS and the SAM reference code, for example, since the variable Y is first arranged in the local memory (LM_2) 222, the address of the Y global address symbol GY is By determining “0x2aa”, the address for the global address variable corresponding to the global address symbol GY is resolved. Next, in the local address resolution processing, from the address “0x2aa” of the global address symbol GY and the address map information 150, the address of the Y local address symbol LY is determined as “0x0aa”. The MAS address generation process 132 outputs a code that uses a local address for a local address symbol and uses a global address for a global address symbol. Accordingly, for example, a code using the address “0x2aa” for the reference to the global address symbol GY in the object code 141 and the address “0x0aa” for the reference to the local address symbol LY is output.

この結果、MAS及びMAS参照コード入りオブジェクトコード141Aの記述にしたがって、図5に例示されるコア1及びコア2共用ロードモジュール151Aを得る。コア1及びコア2共用ロードモジュール151Aは、アドレス解決された後の2つの関数fとgから構成される。fとgは、実際には、各々、関数FとGのアドレスを表すことになる。関数fと関数g本体の中に現れるアドレス「0x2aa」と「0x0aa」は各々、変数Yに対するグローバルアドレスとローカルアドレスを表す。変数Yはローカルメモリ(LM_2)222に配置されるので、第2CPU(CPU_2)221で実行される関数gからはローカルアドレス「0x0aa」の参照になる。さらに、関数fを実行するCPUが第2CPU(CPU_2)221か否かを判するコード、第2CPU(CPU_2)221の場合にはローカルアドレス「0x0aa」の参照、それ以外のCPUの場合にはグローバルアドレス「0x2aa」の参照を示すコードが生成される。   As a result, the core 1 and core 2 shared load module 151A illustrated in FIG. 5 is obtained according to the description of the object code 141A including the MAS and the MAS reference code. The core 1 and core 2 shared load module 151A is composed of two functions f and g after address resolution. f and g actually represent the addresses of functions F and G, respectively. Addresses “0x2aa” and “0x0aa” appearing in the body of the function f and function g represent a global address and a local address for the variable Y, respectively. Since the variable Y is arranged in the local memory (LM_2) 222, the function g executed by the second CPU (CPU_2) 221 is referred to the local address “0x0aa”. Further, a code for determining whether or not the CPU executing the function f is the second CPU (CPU_2) 221; in the case of the second CPU (CPU_2) 221, the local address “0x0aa” is referenced; A code indicating the reference of the address “0x2aa” is generated.

実施の形態2では、MAS参照コード生成処理により、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するシンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するシンボルを用いた参照を行うコードを、オブジェクトコードに出力するコンパイラ120Aを採用した。したがって、MAS参照コード生成処理において関数Fを実行するCPUの番号に応じてローカルメモリアクセスが自CPUコア内のアクセスか否かに応じた条件文にてMAS及びMAS参照コード入りオブジェクトコード141Aを生成するから、関数Fを実行するCPUの番号をプログラム実行中に判定し、CPU番号が2の場合には自CPUコア内のローカルメモリを高速に参照できる。これにより、判定処理と自CPUコア内ローカルメモリの参照にかかる合計時間が他CPUコア内のローカルメモリを参照する時間よりも少なければ、プログラムの実行を実施の形態1よりも更に高速化することができる。   In the second embodiment, when the MAS reference code generation process refers to data on a local memory in a specific CPU core in a function that may be executed by a plurality of CPUs, the function is the specific CPU. A statement for determining whether or not the above function is executed, if the above function is executed by the specific CPU, a code for performing a reference using a symbol corresponding to a local address, and the above function is executed by another CPU. In this case, a compiler 120A is employed that outputs a code for performing a reference using a symbol corresponding to a global address to an object code. Therefore, the MAS and MAS reference code-containing object code 141A is generated with a conditional statement according to whether or not the local memory access is an access within the own CPU core according to the CPU number that executes the function F in the MAS reference code generation processing. Therefore, the CPU number for executing the function F is determined during the program execution. When the CPU number is 2, the local memory in the CPU core can be referred to at high speed. As a result, if the total time required for the determination process and the reference to the local memory in the own CPU core is less than the time for referring to the local memory in the other CPU core, the execution of the program is further accelerated than in the first embodiment. Can do.

《ロードモジュール生成プログラム》
図5に基づいて説明した上記ロードモジュールの生成方法はPCシステム1のようなコンピュータにロードモジュール生成プログラムを実行させることによって実現されることは言うまでもない。そのようなプログラムは、前記コンパイラ120Aによるコンパイル処理とリンカ130によるリンク処理を制御する。コンパイル処理は、あるデータをどのCPUコア内のローカルメモリ上に配置するか、及び、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力し、入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定する。コンパイル処理は、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成する処理を行えばよい。例えば実施の形態1と同様の前記データ・関数情報入力処理121及びMAS出力処理122、並びに実施の形態2特有のMAS参照コード生成処理によって構成すればよい。このMAS参照コード生成処理では、前述のとおり、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合にその関数が上記特定のCPUで実行されるか否かを判定するコード、当該関数が特定のCPUで実行される場合にはローカルアドレスに対応するシンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するシンボルを用いた参照を行うコード、をオブジェクトコードとして生成すればよい。リンク処理は上述のとおり、例えば既存のグローバルアドレス解決処理、ローカルアドレス解決処理、及びMAS用アドレス生成処理によって構成すればよい。
<< Load module generation program >>
Needless to say, the load module generation method described with reference to FIG. 5 is implemented by causing a computer such as the PC system 1 to execute a load module generation program. Such a program controls the compiling process by the compiler 120A and the linking process by the linker 130. Compile processing inputs a source program having instruction information specifying which CPU allocates certain data on which local memory in which CPU core and which CPU executes a certain function, and based on the input information Each function determines whether to use the global address or local address to refer to the variable. Compile processing may be performed by generating object code that refers to at least one of the local address symbol and the global address symbol in accordance with the determination result. For example, the data / function information input processing 121 and MAS output processing 122 similar to those in the first embodiment and the MAS reference code generation processing unique to the second embodiment may be used. In this MAS reference code generation process, as described above, when a function that can be executed by a plurality of CPUs refers to data on a local memory in a specific CPU core, the function is executed by the specific CPU. Code for determining whether or not the function is executed, code for performing a reference using a symbol corresponding to the local address when the function is executed by a specific CPU, and when the function is executed by another CPU May be generated as an object code that performs a reference using a symbol corresponding to a global address. As described above, the link processing may be configured by, for example, existing global address resolution processing, local address resolution processing, and MAS address generation processing.

このロードモジュール生成プログラムを用いることにより、実施の形態2に係るロードモジュール生成方法を容易に実現することができる。   By using this load module generation program, the load module generation method according to the second embodiment can be easily realized.

以上本発明者によってなされた発明を実施形態に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。   Although the invention made by the present inventor has been specifically described based on the embodiments, it is needless to say that the present invention is not limited thereto and can be variously modified without departing from the gist thereof.

例えば、ロードモジュールが適用されるマルチCPUコアシステムはCPUコアの数が2個に限定されず、3個以上であってよいことは言うまでもない。マイクロコンピュータ2に代表されるマルチCPUコアシステム、及びロードモジュールの生成を制御するためのPC本体1に代表されるコンピュータの内部構成は図1の説明に制限されず適宜変更可能である。   For example, in a multi-CPU core system to which a load module is applied, the number of CPU cores is not limited to two, and may be three or more. The internal configuration of the computer represented by the multi-CPU core system represented by the microcomputer 2 and the PC main body 1 for controlling the generation of the load module is not limited to the description of FIG.

1 PCシステム
2 マイクロコンピュータ
102 PC本体
110 CPUモジュール(CPUM)
111 ハードディスクドライブ(HDD)
112 RAM
201 第1CPUコア
202 第2CPUコア
203 バス
204 RAM
205 ROM
211 CPU(CPU_1)
212 ローカルメモリ(LM_1)
221 CPU(CPU_2)
222 ローカルメモリ(LM_2)
120 コンパイラ
130 リンカ
121 データ・関数情報入力処理
122 MAS出力処理
123 MAS参照コード生成処理
140 データ・関数情報付きソースプログラム
141 MAS参照コード入りオブジェクトコード
150 アドレスマップ情報
131 ローカルアドレス解決処理
132 MASアドレス生成処理
151 ロードモジュール
1 PC system 2 Microcomputer 102 PC body 110 CPU module (CPUM)
111 Hard disk drive (HDD)
112 RAM
201 First CPU core 202 Second CPU core 203 Bus 204 RAM
205 ROM
211 CPU (CPU_1)
212 Local memory (LM_1)
221 CPU (CPU_2)
222 Local memory (LM_2)
120 Compiler 130 Linker 121 Data / Function Information Input Processing 122 MAS Output Processing 123 MAS Reference Code Generation Processing 140 Source Program with Data / Function Information 141 Object Code with MAS Reference Code 150 Address Map Information 131 Local Address Resolution Processing 132 MAS Address Generation Processing 151 Load module

Claims (13)

CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成するロードモジュール生成方法であって、
あるデータをどのCPUコア内のローカルメモリ上に配置するか、及び、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力し、入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成するコンパイル処理と、
前記オブジェクトコードに対してグローバルアドレス用シンボルにはグローバルアドレスを割り当て、ローカルアドレス用シンボルにはローカルアドレスを割り当てて、複数のCPUコアに共通なロードモジュールを生成するリンク処理と、
を含むロードモジュール生成方法。
A global address for the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory to refer to a local memory in another CPU core, and a local memory in the CPU core of the CPU itself A load module generating method for generating a load module of a program executed by a multi-CPU core system using a local address for referring to a computer by data processing,
A source program having instruction information designating which CPU core a certain data is arranged on which local memory and which CPU executes a certain function is input, and each function is based on the input information. Determine whether to use the global address or local address to refer to the variable, and generate object code that references at least one of the local address symbol and the global address symbol according to the determination result Compilation process,
A link process that assigns a global address to a global address symbol and assigns a local address to a local address symbol for the object code, and generates a load module common to a plurality of CPU cores,
A load module generation method including:
前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照するコードを生成し、複数のCPUで実行される関数の場合にはその変数を参照するためにグローバルアドレス用シンボルを参照するコードを生成する、請求項1記載のロードモジュール生成方法。   In the compile process, when a function that is executed only on a single CPU refers to a variable on a local memory in the CPU core, a code that refers to a symbol for a local address is generated and executed on a plurality of CPUs. 2. The load module generation method according to claim 1, wherein in the case of a function, a code for referring to a global address symbol is generated to refer to the variable. 前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコードを生成し、複数のCPUで実行される可能性のある関数の場合には関数を実行するCPUと参照する変数の所在に応じてローカルアドレス用シンボルとグローバルアドレス用シンボルとの参照を選択する第2のコードを生成する、請求項1記載のロードモジュール生成方法。   In the compile process, when a function executed only on a single CPU refers to a variable on a local memory in the CPU core, a first code that refers to a symbol for a local address is generated. In the case of a function that can be executed, a second code that selects a reference between the symbol for the local address and the symbol for the global address is generated according to the location of the CPU that executes the function and the variable to be referenced. Item 2. A load module generation method according to Item 1. 前記第2のコードは、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む、請求項3記載のロードモジュール生成方法。   When the second code refers to data on a local memory in a specific CPU core in a function that can be executed by a plurality of CPUs, whether or not the function is executed by the specific CPU. A statement for determining whether or not the above function is executed by the specific CPU, a code for performing a reference using a local address symbol corresponding to the local address, and when the above function is executed by another CPU. 4. The load module generation method according to claim 3, further comprising: a code for performing a reference using a global address symbol corresponding to the global address. 前記指示情報は、C言語におけるpragma文で指定される情報である、請求項1記載のロードモジュール生成方法。   The load module generation method according to claim 1, wherein the instruction information is information specified by a pragma statement in C language. CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成するロードモジュール生成方法であって、
あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力する入力処理と、
前記入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成するコード生成処理と、
前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決するアドレス解決処理と、
単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルに対応するアドレスを用いるコードを生成し、複数のCPUで実行される可能性のある関数において変数を参照する場合はグローバルアドレス用シンボルに対応するアドレスを用いるコードを生成するアドレス生成処理と、
を含むロードモジュール生成方法。
A global address for the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory to refer to a local memory in another CPU core, and a local memory in the CPU core of the CPU itself A load module generating method for generating a load module of a program executed by a multi-CPU core system using a local address for referring to a computer by data processing,
An input process for inputting a source program having instruction information designating which CPU allocates certain data on a local memory in which CPU core and which CPU executes a certain function;
Based on the input information, it is determined whether a global address or a local address is used for referring to the variable for each function, and at least one of the local address symbol and the global address symbol is determined according to the determination result. Code generation processing to generate object code that references one;
Address resolution processing for resolving an address for the global address symbol generated by the code generation processing, and resolving the address of the symbol for local address based on the resolved address;
When a function that is executed only on a single CPU refers to a variable on the local memory in the CPU core, a code that uses an address corresponding to the symbol for the local address may be generated and executed on multiple CPUs. When referring to a variable in a certain function, address generation processing for generating code that uses an address corresponding to the symbol for global address,
A load module generation method including:
CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成するロードモジュール生成方法であって、
あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力する入力処理と、
前記入力した情報に基づいて、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコードを生成し、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む第2のコードを生成するコード生成処理と、
前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決するアドレス解決処理と、
前記オブジェクトコードに対してグローバルアドレス用シンボルには対応するグローバルアドレスを用いるコードを生成し、ローカルアドレス用シンボルには対応するローカルアドレスを用いるコードを生成するアドレス生成処理と、
を含むロードモジュール生成方法。
A global address for the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory to refer to a local memory in another CPU core, and a local memory in the CPU core of the CPU itself A load module generating method for generating a load module of a program executed by a multi-CPU core system using a local address for referring to a computer by data processing,
An input process for inputting a source program having instruction information designating which CPU allocates certain data on a local memory in which CPU core and which CPU executes a certain function;
Based on the input information, when referring to a variable on a local memory in a CPU core in a function executed only by a single CPU, a first code that references a local address symbol is generated, A statement for determining whether or not the function is executed by the specific CPU when referring to data on a local memory in the specific CPU core in a function that may be executed by the CPU; Is executed by the specific CPU, a code for making a reference using a local address symbol corresponding to the local address, and a global address corresponding to the global address when the function is executed by another CPU. A code generation process for generating a second code including a code for performing a reference using a symbol for use;
Address resolution processing for resolving an address for the global address symbol generated by the code generation processing, and resolving the address of the symbol for local address based on the resolved address;
An address generation process for generating a code using a global address corresponding to a symbol for a global address with respect to the object code, and generating a code using a corresponding local address for a symbol for a local address;
A load module generation method including:
CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールを生成するための、コンピュータにより実行可能なロードモジュール生成プログラムであって、
あるデータをどのCPUコア内のローカルメモリ上に配置するか、及び、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力し、入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成するコンパイル処理と、
前記オブジェクトコードに対してグローバルアドレス用シンボルにはグローバルアドレスを割り当て、ローカルアドレス用シンボルにはローカルアドレスを割り当てて、複数のCPUコアに共通なロードモジュールを生成するリンク処理と、
を制御するロードモジュール生成プログラム。
A global address for the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory to refer to a local memory in another CPU core, and a local memory in the CPU core of the CPU itself A computer-executable load module generation program for generating a load module of a program executed by a multi-CPU core system using a local address for referring to
A source program having instruction information designating which CPU core a certain data is arranged on which local memory and which CPU executes a certain function is input, and each function is based on the input information. Determine whether to use the global address or local address to refer to the variable, and generate object code that references at least one of the local address symbol and the global address symbol according to the determination result Compilation process,
A link process that assigns a global address to a global address symbol and assigns a local address to a local address symbol for the object code, and generates a load module common to a plurality of CPU cores,
Load module generation program to control
前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照するコードを生成し、複数のCPUで実行される関数の場合にはその変数を参照するためにグローバルアドレス用シンボルを参照するコードを生成する制御を行う、請求項8記載のロードモジュール生成プログラム。   In the compile process, when a function that is executed only on a single CPU refers to a variable on a local memory in the CPU core, a code that refers to a symbol for a local address is generated and executed on a plurality of CPUs. 9. The load module generation program according to claim 8, wherein in the case of a function, control is performed to generate a code for referring to a global address symbol to refer to the variable. 前記コンパイル処理において、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコードを生成し、複数のCPUで実行される可能性のある関数の場合には関数を実行するCPUと参照する変数の所在に応じてローカルアドレス用シンボルとグローバルアドレス用シンボルとの参照を選択する第2のコードを生成する制御を行う、請求項8記載のロードモジュール生成プログラム。   In the compile process, when a function executed only on a single CPU refers to a variable on a local memory in the CPU core, a first code that refers to a symbol for a local address is generated. In the case of a function that may be executed, control is performed to generate a second code that selects a reference to the symbol for the local address and the symbol for the global address according to the location of the CPU that executes the function and the variable to be referenced. The load module generation program according to claim 8, which is executed. 前記第2のコードは、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む、請求項10記載のロードモジュール生成プログラム。   When the second code refers to data on a local memory in a specific CPU core in a function that can be executed by a plurality of CPUs, whether or not the function is executed by the specific CPU. A statement for determining whether or not the above function is executed by the specific CPU, a code for performing a reference using a local address symbol corresponding to the local address, and when the above function is executed by another CPU. 11. The load module generation program according to claim 10, comprising a code for performing a reference using a global address symbol corresponding to the global address. CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成するための、コンピュータにより実行可能なロードモジュール生成プログラムであって、
あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力する入力処理と、
前記入力した情報に基づいて、関数毎にその変数の参照にグローバルアドレスを使うか、ローカルアドレスを使うかを判定し、その判定結果に応じてローカルアドレス用シンボル及びグローバルアドレス用シンボルの内の少なくとも一つを参照するオブジェクトコードを生成するコード生成処理と、
前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決するアドレス解決処理と、
単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルに対応するアドレスを用いるコードを生成し、複数のCPUで実行される可能性のある関数において変数を参照する場合はグローバルアドレス用シンボルに対応するアドレスを用いるコードを生成するアドレス生成処理と、
を制御するロードモジュール生成プログラム。
A global address for the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory to refer to a local memory in another CPU core, and a local memory in the CPU core of the CPU itself A computer-executable load module generation program for generating a load module of a program executed by a multi-CPU core system using a local address for referring to the computer by data processing,
An input process for inputting a source program having instruction information designating which CPU allocates certain data on a local memory in which CPU core and which CPU executes a certain function;
Based on the input information, it is determined whether a global address or a local address is used for referring to the variable for each function, and at least one of the local address symbol and the global address symbol is determined according to the determination result. Code generation processing to generate object code that references one;
Address resolution processing for resolving an address for the global address symbol generated by the code generation processing, and resolving the address of the symbol for local address based on the resolved address;
When a function that is executed only on a single CPU refers to a variable on the local memory in the CPU core, a code that uses an address corresponding to the symbol for the local address may be generated and executed on a plurality of CPUs. When referring to a variable in a certain function, address generation processing for generating code that uses an address corresponding to the symbol for global address,
Load module generation program to control
CPUとローカルメモリをそれぞれが有する複数個のCPUコアの内の一のCPUコアのCPUが他のCPUコア内のローカルメモリを参照するためのグローバルアドレスと、CPUが自らのCPUコア内のローカルメモリを参照するためのローカルアドレスと、を用いるマルチCPUコアシステムによって実行されるプログラムのロードモジュールをコンピュータのデータ処理によって生成するための、コンピュータにより実行可能なロードモジュール生成プログラムであって、
あるデータをどのCPUコア内のローカルメモリ上に配置するか、および、ある関数がどのCPUで実行されるかを指定した指示情報を有するソースプログラムを入力する入力処理と、
前記入力した情報に基づいて、単一のCPUでのみ実行される関数においてそのCPUコア内のローカルメモリ上の変数を参照する場合はローカルアドレス用シンボルを参照する第1のコードを生成し、複数のCPUで実行される可能性のある関数において特定のCPUコア内のローカルメモリ上のデータを参照する場合に、上記関数が上記特定のCPUで実行されるか否かを判定する文、上記関数が上記特定のCPUで実行される場合にはローカルアドレスに対応するローカルアドレス用シンボルを用いた参照を行うコード、及び上記関数がその他のCPUで実行される場合にはグローバルアドレスに対応するグローバルアドレス用シンボルを用いた参照を行うコードを含む第2のコードを生成するコード生成処理と、
前記コード生成処理で生成された前記グローバルアドレス用シンボルに対してアドレスを解決し、この解決されたアドレスに基づいてローカルアドレス用シンボルのアドレスを解決するアドレス解決処理と、
前記オブジェクトコードに対してグローバルアドレス用シンボルには対応するグローバルアドレスを用いるコードを生成し、ローカルアドレス用シンボルには対応するローカルアドレスを用いるコードを生成するアドレス生成処理と、
を制御するロードモジュール生成プログラム。
A global address for the CPU of one CPU core among the plurality of CPU cores each having a CPU and a local memory to refer to a local memory in another CPU core, and a local memory in the CPU core of the CPU itself A computer-executable load module generation program for generating a load module of a program executed by a multi-CPU core system using a local address for referring to the computer by data processing,
An input process for inputting a source program having instruction information designating which CPU allocates certain data on a local memory in which CPU core and which CPU executes a certain function;
Based on the input information, when referring to a variable on a local memory in a CPU core in a function executed only by a single CPU, a first code that references a local address symbol is generated, A statement for determining whether or not the function is executed by the specific CPU when referring to data on a local memory in the specific CPU core in a function that may be executed by the CPU; Is executed by the specific CPU, a code for making a reference using a local address symbol corresponding to the local address, and a global address corresponding to the global address when the function is executed by another CPU. A code generation process for generating a second code including a code for performing a reference using a symbol for use;
Address resolution processing for resolving an address for the global address symbol generated by the code generation processing, and resolving the address of the symbol for local address based on the resolved address;
An address generation process for generating a code using a global address corresponding to a symbol for a global address with respect to the object code, and generating a code using a corresponding local address for a symbol for a local address;
Load module generation program to control
JP2011277038A 2011-12-19 2011-12-19 Method and program for generating load module Pending JP2013127703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011277038A JP2013127703A (en) 2011-12-19 2011-12-19 Method and program for generating load module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011277038A JP2013127703A (en) 2011-12-19 2011-12-19 Method and program for generating load module

Publications (1)

Publication Number Publication Date
JP2013127703A true JP2013127703A (en) 2013-06-27

Family

ID=48778203

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011277038A Pending JP2013127703A (en) 2011-12-19 2011-12-19 Method and program for generating load module

Country Status (1)

Country Link
JP (1) JP2013127703A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598724A (en) * 2015-10-14 2017-04-26 三星电子株式会社 Computing system memory management method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598724A (en) * 2015-10-14 2017-04-26 三星电子株式会社 Computing system memory management method
CN106598724B (en) * 2015-10-14 2022-01-14 三星电子株式会社 Method for managing memory in a computing system

Similar Documents

Publication Publication Date Title
US7143388B1 (en) Method of transforming software language constructs to functional hardware equivalents
US8683468B2 (en) Automatic kernel migration for heterogeneous cores
US9495136B2 (en) Using aliasing information for dynamic binary optimization
US20120066668A1 (en) C/c++ language extensions for general-purpose graphics processing unit
US20120198427A1 (en) Ensuring Register Availability for Dynamic Binary Optimization
US20150193234A1 (en) Register allocation for vectors
US20150261511A1 (en) Handling Pointers in Program Code in a System that Supports Multiple Address Spaces
JP2016508640A (en) Solutions for branch branches in the SIMD core using hardware pointers
JP6236093B2 (en) Hardware and software solutions for branching in parallel pipelines
US8266416B2 (en) Dynamic reconfiguration supporting method, dynamic reconfiguration supporting apparatus, and dynamic reconfiguration system
Kandemir et al. A linear algebra framework for automatic determination of optimal data layouts
US11656880B2 (en) Function evaluation using multiple values loaded into registers by a single instruction
US9921838B2 (en) System and method for managing static divergence in a SIMD computing architecture
US6301652B1 (en) Instruction cache alignment mechanism for branch targets based on predicted execution frequencies
US20190187964A1 (en) Method and Apparatus for Compiler Driven Bank Conflict Avoidance
Filipovic et al. OpenCL kernel fusion for GPU, Xeon Phi and CPU
Su et al. An efficient GPU implementation of inclusion-based pointer analysis
US8990741B2 (en) Circuit design support device, circuit design support method and program
US20090133022A1 (en) Multiprocessing apparatus, system and method
Janik et al. An overview of altera sdk for opencl: A user perspective
JP2013127703A (en) Method and program for generating load module
JP5360506B2 (en) Multi-core programming system, method and program
US20030135535A1 (en) Transferring data between threads in a multiprocessing computer system
JP4133107B2 (en) Load module generation method, load module generation program, and load module generation apparatus
Yang et al. Support OpenCL 2.0 Compiler on LLVM for PTX Simulators