JPH03233727A - System for optimizing unconditional branching text - Google Patents

System for optimizing unconditional branching text

Info

Publication number
JPH03233727A
JPH03233727A JP3076690A JP3076690A JPH03233727A JP H03233727 A JPH03233727 A JP H03233727A JP 3076690 A JP3076690 A JP 3076690A JP 3076690 A JP3076690 A JP 3076690A JP H03233727 A JPH03233727 A JP H03233727A
Authority
JP
Japan
Prior art keywords
text
internally generated
output
generated label
unconditional
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
JP3076690A
Other languages
Japanese (ja)
Inventor
Yukie Matsuda
松田 幸恵
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP3076690A priority Critical patent/JPH03233727A/en
Publication of JPH03233727A publication Critical patent/JPH03233727A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To optimize an unconditional branching text just with the signal execution of a branching instruction by outputting an internally generated label to the jumping destination of an unconditional branching instruction not to a position right before an unconditional branching text when this text is outputted right after an internally generated label text. CONSTITUTION:It is decided whether an intermediate text 110 is unconditionally a branching text or not. If so, an unconditional text producing means 107 is called out. If not, an intermediate text output means 108 is called out via an output text deciding means 106. When the output right before an unconditional text to be outputted is not an internally generated label, a new internally generated label name is set as a branching destination by the means 107. If the output right before the unconditional text to be outputted is an internally generated label, the name of this label is set as a branching destination and an internally generated label holding area 109 becomes idle. Thus, an unconditional branching text is optimized just with the single execution of a branching instruction.

Description

【発明の詳細な説明】 〔産業上の利用分野、〕 本発明は無条件分岐テキストの最適化方式に関し、特に
言語処理に関するコンパイラの無条件分岐テキストの最
適化方式に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an optimization method for unconditional branch text, and more particularly to an optimization method for unconditional branch text in a compiler related to language processing.

〔従来の技術〕[Conventional technology]

従来、コンパイラの中間テキストでは内部生成ラベルの
直後の場合でも、そのまま無条件分岐テキストを出力し
ていた。
Conventionally, compiler intermediate text outputs unconditional branch text as is, even if it immediately follows an internally generated label.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

上述した従来の無条件分岐テキスト出力方式では、内部
生成ラベルの直後に無条件分岐命令のオブジェクトプロ
グラムが生成され、実行時に内部生成ラベルへの分岐命
令の直後にもう一度無条件分岐を行わなければならない
という欠点がある。
In the conventional unconditional branch text output method described above, an object program with an unconditional branch instruction is generated immediately after an internally generated label, and an unconditional branch must be performed again immediately after the branch instruction to the internally generated label at runtime. There is a drawback.

〔課題を解決するための手段〕[Means to solve the problem]

本発明の無条件分岐テキストの最適化方式は、コンパイ
ラにおいて出力する中間テキストが無条件で分岐テキス
トであるか否かを判定し、無条件分岐テキストであった
場合は無条件分岐テキスト作成手段を呼び出し、無条件
分岐テキストでない場合は中間テキスト出力手段を呼び
出す出力テキスト判定手段と、 出力する無条件テキストの直前の出力が内部生成ラベル
でない場合は新しく内部生成ラベル名を分岐先として設
定し、出力する無条件テキストの直前の出力が内部生成
ラベルである場合はその内部生成ラベル名を分岐先とし
て設定し、内部生成ラベル保留領域を空にする無条件分
岐テキスト作成手段と、 内部生成ラベル保留領域が空でない場合は内部生成ラベ
ルテキストを中間テキストファイルへ出力し内部生成ラ
ベル保留領域を空にすると共に、出力するテキストが内
部生成ラベルでない場合は中間テキストファイルへ出力
し、出力するテキストが内部生成ラベルである場合内部
生成ラベル保留領域へ出力する中間テキスト出力手段と
を備えて構成される。
The unconditional branch text optimization method of the present invention unconditionally determines whether or not the intermediate text output by the compiler is a branch text, and if it is an unconditional branch text, an unconditional branch text creation means is executed. If the output is not an unconditional branch text, the output text judgment means calls the intermediate text output means, and if the output immediately before the unconditional text to be output is not an internally generated label, it sets a new internally generated label name as the branch destination and outputs it. If the output immediately before the unconditional text to be output is an internally generated label, the internally generated label name is set as the branch destination, and the internally generated label reservation area is emptied. If is not empty, output the internally generated label text to the intermediate text file and empty the internally generated label reservation area, and if the text to be output is not an internally generated label, output to the intermediate text file, and if the text to be output is internally generated. If it is a label, the intermediate text output means outputs it to the internally generated label storage area.

〔実施例〕〔Example〕

次に、本発明について図面を参照して説明する。 Next, the present invention will be explained with reference to the drawings.

第1図は本発明の一実施例の構成を示すブロック図であ
る。第1図に示す本実施例は、ソースプログラム101
.オブジェクトプログラム102、コンパイラ103.
解析処理部104.オブジェクトプログラム生成処理部
105.出力テキスト判定手段106.無条件分岐テキ
スト作成手段107.中間テキスト出力手段108.内
部生成ラベル保留領域109及び中間テキスト110か
ら構成されている。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention. In this embodiment shown in FIG. 1, a source program 101
.. Object program 102, compiler 103.
Analysis processing unit 104. Object program generation processing unit 105. Output text determining means 106. Unconditional branch text creation means 107. Intermediate text output means 108. It consists of an internally generated label reservation area 109 and intermediate text 110.

第2図を参照すると第1図中の無条件分岐テキスト作成
手段107は、無条件分岐テキストの直前の出力が内部
生成ラベルであるかを判定するステップ201.保留し
である内部生成ラベル名を分岐先に設定するステップ2
02.内部生成ラベル保留領域を空にするステップ20
3.新しい内部生成ラベル名を分岐先に設定するステッ
プ204から構成されている。
Referring to FIG. 2, the unconditional branch text creation means 107 in FIG. 1 determines whether the output immediately before the unconditional branch text is an internally generated label (step 201). Step 2: Setting the pending internally generated label name as the branch destination
02. Step 20 of emptying the internally generated label reservation area
3. It consists of step 204 of setting a new internally generated label name to the branch destination.

第3図を参照すると第1図中の中間テキスト出力手段1
08は、内部生成ラベル保留領域が空であるかを判定す
るステップ301.内部生成ラベルテキストを中間テキ
ストファイルへ出力するステップ302.内部生成ラベ
ル保留領域を空にするステップ303.出力テキストが
ラベルであるかを判定するステップ304.出力テキス
トを内部生成ラベル保留領域へ出力するステップ305
、及び出力テキストを中間テキストファイルへ出力する
ステップ306から構成されている。
Referring to FIG. 3, intermediate text output means 1 in FIG.
Step 301.08 determines whether the internally generated label reservation area is empty. Step 302 of outputting internally generated label text to an intermediate text file. Empty the internally generated label reservation area 303. Step 304 of determining whether the output text is a label. Step 305 of outputting the output text to the internally generated label reservation area
, and step 306 of outputting the output text to an intermediate text file.

次に、本実施例の動作について説明する。Next, the operation of this embodiment will be explained.

コンパイラ103の解析処理部104で中間テキストを
出力するとき、出力テキスト判定手段106が、出力す
るテキストが無条件分岐テキストか判定し、無条件分岐
テキストでない場合は中間テキスト出力手段108へ制
御を移す。
When the analysis processing unit 104 of the compiler 103 outputs intermediate text, the output text determining means 106 determines whether the text to be output is an unconditional branch text, and if it is not an unconditional branch text, transfers control to the intermediate text output means 108. .

出力するテキストが無条件分岐テキストの場合は無条件
分岐テキスト作成手段107に制御が移り、出力する無
条件分岐テキストの直前が内部生成ラベルであるかを判
定するステップ201が内部生成ラベル領域109が空
か否かによって出力する無条件分岐テキストの直前か内
部生成ラベルか否かを判定し、その結果が内部生成ラベ
ルでない場合は新しい内部生成ラベル名を分岐先に設定
するステップ204が新しい内部生成ラベル名を無条件
分岐テキストの分岐先として設定して処理を終了し、中
間テキスト出力手段108へ制御を移す。出力する無条
件分岐テキストの直前が内部生成ラベルであった場合は
保留しである内部生成ラベル名を分岐先に設定するステ
ップ202が内部生成ラベル保留領域109に保留しで
ある内部生成ラベル名を無条件分岐テキストの分岐先と
して設定し、内部生成ラベル保留領域を空にするステッ
プ203が内部生成ラベル保留領域109を空にして処
理を終了し、中間テキスト出力手段108へ制御を移す
If the text to be output is an unconditional branch text, control is transferred to the unconditional branch text creation means 107, and step 201 of determining whether the immediately preceding unconditional branch text to be output is an internally generated label is performed when the internally generated label area 109 is Step 204 determines whether it is an internally generated label immediately before the unconditional branch text to be output based on whether it is empty or not, and if the result is not an internally generated label, sets a new internally generated label name as the branch destination. The label name is set as the branch destination of the unconditional branch text, the process is terminated, and control is transferred to the intermediate text output means 108. If the immediately preceding unconditional branch text to be output is an internally generated label, step 202 of setting the pending internally generated label name as the branch destination sets the pending internally generated label name in the internally generated label reservation area 109. A step 203 of setting the branch destination of the unconditional branch text and emptying the internally generated label reservation area empties the internally generated label reservation area 109, ends the process, and transfers control to the intermediate text output means 108.

中間テキスト出力手段108は内部生成ラベル保留領域
が空であるが否かを判定するステップ301で内部生成
ラベル保留領域109が空が否かを判定し、空でない場
合は内部生成ラベルテキストを中間テキストファイルへ
出力するステップ302で内部生成ラベルテキストを中
間テキスト110へ出力し、内部生成ラベル保留領域を
空とするステップ303で内部生成ラベル保留領域10
9を空にする。出力テキストがラベルが否がを判定する
ステップ304が出力する中間テキストが内部生成ラベ
ルか否かを判定し、内部生成ラベルである場合、内部生
成ラベル保留領域109へ出力しくステップ305) 
、内部生成ラベルでない場合、中間テキストを中間テキ
ストファイル110へ出力しくステップ306〉処理を
終了する。
In step 301, the intermediate text output means 108 determines whether the internally generated label reservation area 109 is empty or not, and if it is not empty, the internally generated label text is converted into intermediate text. In step 302 of outputting to a file, the internally generated label text is output to the intermediate text 110, and in step 303, the internally generated label reservation area is emptied.
Empty 9. Determine whether the output text is a label Step 304 determines whether the output intermediate text is an internally generated label, and if it is an internally generated label, output it to the internally generated label reservation area 109 (Step 305)
, if the label is not an internally generated label, the intermediate text is output to the intermediate text file 110 and the process ends in step 306.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明は、内部生成ラベルテキスト
の直後に無条件分岐テキストを出力する様な場合、内部
生成ラベルをその無条件分岐テキストの直前ではなく無
条件分岐命令の飛び先に出力することにより、実行時に
内部生成ラベルへの分岐命令の直後にもう一度無条件分
岐を行うのではなく一回の分岐命令の実行ですむという
効果がある。
As explained above, when an unconditional branch text is output immediately after an internally generated label text, the present invention outputs the internally generated label at the destination of the unconditional branch instruction instead of immediately before the unconditional branch text. This has the effect that the branch instruction only needs to be executed once, instead of having to take another unconditional branch immediately after the branch instruction to the internally generated label at the time of execution.

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

第1図は本発明の一実施例の構成を示すブロック図、第
2図は第1図中に示した無条件分岐テキスト作成手段1
07の処理を示す流れ図、第3図は第1図中に示した中
間テキスト出力手段108の処理を示す流れ図である。 101・・・ソースプログラム、102・・・オブジェ
クトプログラム、103・・・コンパイラ、104・・
・解析処理部、105・・・オブジェクトプログラム生
成処理部、106・・・出力テキストプログラム判定手
段、107・・・無条件分岐テキスト作成手段、108
・・・中間テキスト出力手段、109・・・内部生成ラ
ベル保留領域、 ■ O・・・中間テキスト。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention, and FIG. 2 is an unconditional branch text creation means 1 shown in FIG.
FIG. 3 is a flowchart showing the processing of the intermediate text output means 108 shown in FIG. 101...Source program, 102...Object program, 103...Compiler, 104...
-Analysis processing unit, 105...Object program generation processing unit, 106...Output text program determination means, 107...Unconditional branch text creation means, 108
... Intermediate text output means, 109... Internally generated label reservation area, ■ O... Intermediate text.

Claims (1)

【特許請求の範囲】 コンパイラにおいて出力する中間テキストが無条件で分
岐テキストであるか否かを判定し、無条件分岐テキスト
であった場合は無条件分岐テキスト作成手段を呼び出し
、無条件分岐テキストでない場合は中間テキスト出力手
段を呼び出す出力テキスト判定手段と、 出力する無条件テキストの直前の出力が内部生成ラベル
でない場合は新しく内部生成ラベル名を分岐先として設
定し、出力する無条件テキストの直前の出力が内部生成
ラベルである場合はその内部生成ラベル名を分岐先とし
て設定し、内部生成ラベル保留領域を空にする無条件分
岐テキスト作成手段と、 内部生成ラベル保留領域が空でない場合は内部生成ラベ
ルテキストを中間テキストフアイルへ出力し内部生成ラ
ベル保留領域を空にすると共に、出力するテキストが内
部生成ラベルでない場合は中間テキストファイルへ出力
し、出力するテキストが内部生成ラベルである場合内部
生成ラベル保留領域へ出力する中間テキスト出力手段と
を備えて成ることを特徴とする無条件分岐テキストの最
適化方式。
[Claims] The compiler unconditionally determines whether or not the output intermediate text is a branch text, and if it is an unconditional branch text, calls an unconditional branch text creation means, and if the intermediate text is not an unconditional branch text. If the output immediately before the unconditional text to be output is not an internally generated label, the output text judgment means calls the intermediate text output means, and if the output immediately before the unconditional text to be output is not an internally generated label, it sets a new internally generated label name as the branch destination, If the output is an internally generated label, the internally generated label name is set as the branch destination, and the internally generated label reservation area is empty. Output the label text to the intermediate text file and empty the internally generated label reservation area, and if the text to be output is not an internally generated label, output it to the intermediate text file, and if the text to be output is an internally generated label, the internally generated label An optimization method for unconditional branch text, comprising intermediate text output means for outputting to a reservation area.
JP3076690A 1990-02-09 1990-02-09 System for optimizing unconditional branching text Pending JPH03233727A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3076690A JPH03233727A (en) 1990-02-09 1990-02-09 System for optimizing unconditional branching text

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3076690A JPH03233727A (en) 1990-02-09 1990-02-09 System for optimizing unconditional branching text

Publications (1)

Publication Number Publication Date
JPH03233727A true JPH03233727A (en) 1991-10-17

Family

ID=12312808

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3076690A Pending JPH03233727A (en) 1990-02-09 1990-02-09 System for optimizing unconditional branching text

Country Status (1)

Country Link
JP (1) JPH03233727A (en)

Similar Documents

Publication Publication Date Title
JP2692609B2 (en) Multitask program debugging method and apparatus
US7228527B1 (en) Method and system for structuring a procedure
JP2001184218A (en) Optimization method in compile of mpi program
JPH03233727A (en) System for optimizing unconditional branching text
JPS6378231A (en) Partial program combining system
US5765148A (en) Database processing apparatus and database processing method for variable length objects, and computer-readable memory medium for storing database processing program
JP2001255912A (en) Method for executing motion program
JPH103382A (en) Device and method for generating operating system
JPH0254368A (en) Translation control system for mechanical translation
JP3179076B2 (en) Automatic source program generation from flowchart
JPH03144830A (en) Parallel processing system
JPS63228341A (en) Program syntax checking system
JPH09160762A (en) Program conversion system
JPH0358232A (en) Preprocessor calling system
JPH09325892A (en) Job parallel execution control method
JPH02280228A (en) System for converting input data
JPH04107650A (en) Shift system for data base reference structure
JPH05313910A (en) Machine word instruction generating system
JPH0488426A (en) Program coverage measuring instrument
JPH08263272A (en) Library registration method and device for common routine
JPH0683635A (en) Compiling/linking system
JPH0327444A (en) Deletion system for exception check object of substitution sentence
JPH05143352A (en) Microprocessor
JPH03175532A (en) System definition changing system
JPH04178862A (en) Program execution system for terminal computer