JP4157016B2 - コンパイラ装置及びコンパイル方法 - Google Patents
コンパイラ装置及びコンパイル方法 Download PDFInfo
- Publication number
- JP4157016B2 JP4157016B2 JP2003376093A JP2003376093A JP4157016B2 JP 4157016 B2 JP4157016 B2 JP 4157016B2 JP 2003376093 A JP2003376093 A JP 2003376093A JP 2003376093 A JP2003376093 A JP 2003376093A JP 4157016 B2 JP4157016 B2 JP 4157016B2
- Authority
- JP
- Japan
- Prior art keywords
- fixed
- variable
- point
- data
- data type
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims description 54
- 238000003860 storage Methods 0.000 claims description 47
- 238000004458 analytical method Methods 0.000 claims description 26
- 230000006870 function Effects 0.000 claims description 24
- 230000010365 information processing Effects 0.000 claims description 15
- 230000014509 gene expression Effects 0.000 claims description 11
- 238000004587 chromatography analysis Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 description 37
- 238000012545 processing Methods 0.000 description 16
- 238000006243 chemical reaction Methods 0.000 description 13
- 238000004364 calculation method Methods 0.000 description 10
- 238000005457 optimization Methods 0.000 description 9
- 230000008859 change Effects 0.000 description 3
- 230000007423 decrease Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000007689 inspection Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 101150071111 FADD gene Proteins 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Description
ユーザーズ・マニュアル「CC77016 μPD77016 ファミリ用Cコンパイラ装置」、NEC Electric Corp、2003年1月発行、第48頁−51頁
本発明の実施の形態に係るコンパイラ装置100は、図2に示すように、記憶装置2及びCPU(セントラルプロセッシングユニット)3と、両者を接続するシステムバス4等から構成される。
本発明の実施の形態に係るコンパイラ装置は、図1の処理の矢印に沿った手順でソースプログラムを機械語のオブジェクトコード(オブジェクトプログラム)に変換する。
#pragma fx_format short:1,10 long:2,20
を読み込み、宣言された固定小数点のデータ型を取得する。
short _Accum x,y,z;
を読み込む。
x=y+z
という演算式記述がある場合、x,y,zのいずれかが固定小数点のデータ型であるか否かについて判断する。固定小数点のデータ型の変数を含む演算の場合は、ステップS302へ進み、コード生成手段15は、ステップS302にて、変数記憶部27から変数の型番号を得る。固定小数点のデータ型の変数を含む演算でない場合は、ステップS310へ進み、他のコード生成処理に転送する。
固定小数点変数の処理不可能である場合、ステップS313へ進みエラーメッセージを出力する。
fadd R0,R1,N1,N2
(N1は、整数部のビット数、N2は、小数部のビット数)のように固定小数点のデータを構成するビット数を命令のオペランドに記述する機械命令の場合は、整数部が1ビットで小数部が10ビットであれば、
fadd R0,R1,1,10
と表記する機械命令のオブジェクトコードを生成する。
.debug fx,l,2,20
(sは“short”を指し、lは“long”を指す)
一例として、デバッグ中に固定小数点型の変数xの値を参照する場合を考えてみる。参照するときの変数xのビットパターンが“0x20000000”のとき、その変数xの固定小数点型のビット数がデフォルトの場合は変数xは16384.0になり、ユーザに整数部1ビット、小数部10ビットと定義されていた場合は0.5になる。このように同じビットパターンであっても整数部と小数部のビット数により小数の値は変わるが、オブジェクトコードのファイルには、ユーザが定義した固定小数点のデータ型情報を参照することにより、デバッガは固定小数点のビット数を正確に知ることができる。
上述したように本発明の実施の形態によると、固定小数点データにデータ型情報及び変数情報を付することにより、ユーザが定義する固定小数点のデータ型の変数をプログラム中で他のデータ型の変数と同様に扱って記述できる。これにより、プログラムの読み取りが容易となり、プログラムの開発効率や保守性を向上させ、再利用を容易とさせる。更に、アプリケーションに適した固定小数点のデータ型のデータで処理するため、実行性能が良く、オブジェクトサイズが小さなプログラムを生成することが可能となる。
(変更例1)
字句解析手段11は、固定小数点のデータ型を宣言された図6のソースプログラムをコンパイラする時、図6の1行目に示される、コンパイラ指示子によって宣言された固定小数点のデータ型を取得するとされているが、これはコンパイラ識別子によって宣言されるものに限られない。例えば、ユーザに、固定小数点のデータ型の変数を用いてソースプログラムを記述させる際、コンパイラ起動コマンドを、
cc −Xfx short:1,10 −Xfx long:2,20
のように入力させることによっても、コンパイルオプションで固定小数点のデータ型を定義することが可能である。
変更例1のコンパイルオプションで定義する代わりに、固定小数点のデータ型を定義してユーザにソースプログラムを記述させる際、変数宣言時の固定小数点のデータ型を、
short _Accum(1,10)x;
long _Accum(2,20)y;
のよう入力させることによっても固定小数点のデータ型を定義することが可能である。
一般的にコンパイラは、演算を構成するオペランドの精度が違う場合は、より大きい精度に合わせる仕様となっている。例えば、浮動小数点演算の場合、一方のオペランドが単精度(float)、他方が倍精度(double)の場合は、演算前に単精度のオペランドを倍精度に変換する機械命令を生成するよう言語仕様で定められている。
3…CPU
4…システムバス
11…字句解析手段
12…構文解析手段
12a…データ型情報処理手段
12b…変数情報処理手段
15,15a…コード生成手段
16…コード最適化手段
17…コード出力手段
20…小数部
21…作業領域
22…機械語プログラム格納部
23…ソースプログラム格納部
24…コンパイラ格納部
25…オブジェクトコード格納部
26…型情報記憶部
27…変数記憶部
31…演算実行部
32…レジスタ
33…命令デコーダ部
34…制御部
35…条件コードレジスタ部
100…コンパイラ装置
Claims (4)
- ユーザにより定義された固定小数点のデータ型の定義文を解析して、解析の結果ユーザにより定義された前記固定小数点のデータ型の型番号、データ種類、符号、データサイズ、整数部のビット数、小数部のビット数を含むデータ型情報を取得するデータ型情報処理手段と、
前記データ型情報を格納する型情報記憶部と、
前記固定小数点のデータ型の変数宣言文を解析して、解析の結果得られた変数名と前記型番号を含む変数情報を得る変数情報処理手段と、
前記変数情報を格納する変数記憶部と、
前記ソースプログラム中に記載された前記変数を含む演算式データを読み込むと、前記変数記憶部から前記変数に対応する前記型番号を取得し、前記型番号に対応する前記データ型情報を前記型情報記憶部から取得し、取得した前記データ型情報を伴う前記演算式データを予めプロセッサに組み込まれた関数呼び出し命令若しくは固定小数点演算命令の機械語へ変換するコード生成手段とを備え、
前記固定小数点のデータ型の定義文は、コンパイルオプションの指定によって定義されることを特徴とするコンパイラ装置。 - 前記コード生成手段は、前記固定小数点データ型の演算式を機械語に変換する前に、前記演算式に含まれる第1の固定小数点データと第2の固定小数点データの両者のオペランドの型を比較し、整数部は前記第1の固定小数点データのビット数が多く小数部は前記第2の固定小数点データのビット数が多い場合若しくは整数部は前記第2の固定小数点データのビット数が多く小数部は前記第1の固定小数点データのビット数が多い場合に、いずれかビット数が多い方の前記整数部及び前記小数部の精度に合わせた新たな固定小数点データのオペランド型を生成し、前記両者のオペランド型を前記新たな固定小数点データのオペランド型に変換することを特徴とする請求項1に記載のコンパイラ装置。
- 前記固定小数点のデータ型の定義文の情報は、コンパイルされたオブジェクトコードにデバッグの際に使用可能な情報として付加されることを特徴とする請求項1又は請求項2に記載のコンパイラ装置。
- コンパイルオプションの指定によってユーザにより定義された固定小数点のデータ型の定義文を解析して、解析の結果ユーザにより定義された前記固定小数点のデータ型の型番号、データ種類、符号、データサイズ、整数部のビット数、小数部のビット数を含むデータ型情報を取得して前記データ型情報を型情報記憶部に格納し、
前記固定小数点のデータ型の変数宣言文を解析して、解析の結果得られた変数名と前記
型番号を含む変数情報を取得して前記変数情報を変数記憶部に格納し、
前記ソースプログラム中に記載された前記変数を含む演算式データを読み込むと、前記変数記憶部から前記変数に対応する前記型番号を取得し、前記型番号に対応する前記データ型情報を前記型情報記憶部から取得し、取得した前記データ型情報を伴う前記演算式データを予めプロセッサに組み込まれた関数呼び出し命令若しくは固定小数点演算命令の機械語へ変換する
ことを特徴とするコンパイル方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003376093A JP4157016B2 (ja) | 2003-11-05 | 2003-11-05 | コンパイラ装置及びコンパイル方法 |
US10/747,210 US7325230B2 (en) | 2003-11-05 | 2003-12-30 | System for compiling source programs into machine language programs, a computer implemented method for the compiling and a computer program product for the compiling within the computer system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003376093A JP4157016B2 (ja) | 2003-11-05 | 2003-11-05 | コンパイラ装置及びコンパイル方法 |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2005141410A JP2005141410A (ja) | 2005-06-02 |
JP4157016B2 true JP4157016B2 (ja) | 2008-09-24 |
Family
ID=34544311
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003376093A Expired - Fee Related JP4157016B2 (ja) | 2003-11-05 | 2003-11-05 | コンパイラ装置及びコンパイル方法 |
Country Status (2)
Country | Link |
---|---|
US (1) | US7325230B2 (ja) |
JP (1) | JP4157016B2 (ja) |
Families Citing this family (23)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3847672B2 (ja) * | 2002-07-03 | 2006-11-22 | 松下電器産業株式会社 | コンパイラ装置及びコンパイル方法 |
US7299225B2 (en) * | 2002-11-26 | 2007-11-20 | International Business Machines Corporation | High performance predicate push-down for non-matching predicate operands |
JP4157016B2 (ja) | 2003-11-05 | 2008-09-24 | 株式会社東芝 | コンパイラ装置及びコンパイル方法 |
US8559605B2 (en) * | 2005-02-07 | 2013-10-15 | Avaya Inc. | Extensible diagnostic tool |
JP2006260096A (ja) * | 2005-03-16 | 2006-09-28 | Matsushita Electric Ind Co Ltd | プログラム変換方法およびプログラム変換装置 |
JP4413804B2 (ja) | 2005-03-24 | 2010-02-10 | 株式会社東芝 | 磁気冷凍材料及びその製造方法 |
JP4786268B2 (ja) * | 2005-09-13 | 2011-10-05 | 株式会社東芝 | コンパイル装置 |
WO2008061557A1 (en) * | 2006-11-20 | 2008-05-29 | Freescale Semiconductor, Inc. | System, apparatus and method for translating data |
US8601452B2 (en) * | 2007-03-02 | 2013-12-03 | Oracle International Corporation | Compiler for JAVA and .NET |
WO2008116106A2 (en) * | 2007-03-20 | 2008-09-25 | Viasat, Inc. | Circuit card assembly including individually testable layers |
KR101418969B1 (ko) * | 2008-02-27 | 2014-08-13 | 삼성전자주식회사 | 프로세서 및 컴파일 방법 |
JP2009237762A (ja) * | 2008-03-26 | 2009-10-15 | Toshiba Corp | プログラム解析装置、プログラム解析方法および解析プログラム |
US8407681B2 (en) * | 2008-05-23 | 2013-03-26 | International Business Machines Corporation | System and method for changing variables at runtime |
CN101650648A (zh) * | 2008-08-14 | 2010-02-17 | 鸿富锦精密工业(深圳)有限公司 | 动态调用功能模块的系统及方法 |
US8392895B2 (en) * | 2009-01-13 | 2013-03-05 | Mediatek Inc. | Firmware extension method and firmware builder |
JP2011028648A (ja) * | 2009-07-28 | 2011-02-10 | Renesas Electronics Corp | オブジェクトコード生成システム、及びオブジェクトコード生成方法 |
CN103164220B (zh) * | 2013-02-21 | 2016-03-02 | 北京控制工程研究所 | 一种星载计算机在轨维护所用浮点立即数的自主处理方法 |
US10055207B2 (en) * | 2013-03-13 | 2018-08-21 | Vmware, Inc. | Persistent variables in programming languages |
JP6137962B2 (ja) * | 2013-06-24 | 2017-05-31 | キヤノン株式会社 | 情報処理装置、情報処理方法及びプログラム |
US9223921B1 (en) * | 2014-11-13 | 2015-12-29 | Xilinx, Inc. | Compilation of HLL code with hardware accelerated functions |
JP2017016503A (ja) * | 2015-07-03 | 2017-01-19 | 富士通株式会社 | コンパイラ、コンパイル装置及びコンパイル方法 |
US10592213B2 (en) * | 2016-10-19 | 2020-03-17 | Intel Corporation | Preprocessing tensor operations for optimal compilation |
CN110333870B (zh) * | 2019-06-28 | 2023-04-18 | 潍柴动力股份有限公司 | Simulink模型变量分配的处理方法、装置及设备 |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07134645A (ja) | 1993-11-10 | 1995-05-23 | Kofu Nippon Denki Kk | 情報処理用条件コード生成装置 |
JPH103390A (ja) | 1996-06-17 | 1998-01-06 | Hitachi Ltd | テーブル管理システムとその作成方法 |
JP4319706B2 (ja) | 1998-04-10 | 2009-08-26 | 株式会社日立製作所 | プログラム開発支援ツール |
US7039906B1 (en) * | 2000-09-29 | 2006-05-02 | International Business Machines Corporation | Compiler for enabling multiple signed independent data elements per register |
WO2003032157A1 (en) | 2001-09-18 | 2003-04-17 | Asahi Kasei Kabushiki Kaisha | Compiler |
JP3801545B2 (ja) * | 2002-08-02 | 2006-07-26 | 松下電器産業株式会社 | コンパイラ用プログラム、コンパイラ装置及びコンパイル方法 |
JP4157016B2 (ja) | 2003-11-05 | 2008-09-24 | 株式会社東芝 | コンパイラ装置及びコンパイル方法 |
-
2003
- 2003-11-05 JP JP2003376093A patent/JP4157016B2/ja not_active Expired - Fee Related
- 2003-12-30 US US10/747,210 patent/US7325230B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
US7325230B2 (en) | 2008-01-29 |
US20050097523A1 (en) | 2005-05-05 |
JP2005141410A (ja) | 2005-06-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4157016B2 (ja) | コンパイラ装置及びコンパイル方法 | |
US6247174B1 (en) | Optimization of source code with embedded machine instructions | |
US7657878B2 (en) | Compiler, method of compiling and program development tool | |
KR101150003B1 (ko) | 소프트웨어 개발 툴 생성 방법 | |
US7530061B2 (en) | Programmatic access to the widest mode floating-point arithmetic supported by a processor | |
JP5893038B2 (ja) | ユーザ定義型のコンパイル時境界検査 | |
US7917899B2 (en) | Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus | |
US9081586B2 (en) | Systems and methods for customizing optimization/transformation/ processing strategies | |
US20030140338A1 (en) | Method, apparatus and article for generation of debugging information | |
JP2007079844A (ja) | コンパイル装置 | |
CN107003885B (zh) | 用于低级别可组合高性能计算库的技术 | |
JPH0769832B2 (ja) | プログラミング演算の効果と従属性とを表現する方法及び装置 | |
Larsen et al. | Tensorflow graph optimizations | |
Husár et al. | Automatic C compiler generation from architecture description language ISAC | |
JP2008276735A (ja) | プログラムコード変換装置及びプログラムコード変換方法 | |
CN112416313B (zh) | 支持大整数数据类型和运算符的编译方法 | |
JP2011129102A (ja) | エンディアン変換のための方法および装置 | |
Leupers | LANCE: AC compiler platform for embedded processors | |
JP7295469B2 (ja) | 関数生成プログラム、関数生成方法、及び情報処理装置 | |
Cardoso et al. | Enriching MATLAB with aspect-oriented features for developing embedded systems | |
Dillig et al. | SAIL: Static analysis intermediate language with a two-level representation | |
Jinturkar et al. | Programming the Sandbridge Multithreaded Processor | |
JP2004013190A (ja) | ソフトウエア開発環境、シミュレータ及び記録媒体 | |
Nobre et al. | Hardware/Software Compilation | |
Helm | Annotating Deeply Embedded Languages |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070109 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070301 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070918 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20071024 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20071211 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080206 |
|
A911 | Transfer to examiner for re-examination before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20080215 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20080311 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080507 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20080701 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20080710 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110718 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110718 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120718 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130718 Year of fee payment: 5 |
|
LAPS | Cancellation because of no payment of annual fees |