JPH03177940A - Analyzing device for program contents - Google Patents

Analyzing device for program contents

Info

Publication number
JPH03177940A
JPH03177940A JP1319447A JP31944789A JPH03177940A JP H03177940 A JPH03177940 A JP H03177940A JP 1319447 A JP1319447 A JP 1319447A JP 31944789 A JP31944789 A JP 31944789A JP H03177940 A JPH03177940 A JP H03177940A
Authority
JP
Japan
Prior art keywords
instruction
branch
data
program
line number
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
JP1319447A
Other languages
Japanese (ja)
Inventor
Hisanori Yasuki
安木 寿教
Hirotoshi Tonou
宏敏 斗納
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.)
Denso Ten Ltd
Original Assignee
Denso Ten Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP1319447A priority Critical patent/JPH03177940A/en
Publication of JPH03177940A publication Critical patent/JPH03177940A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To prevent such an inconvenient case where an analysis route that could not exist as an actual execution route is analyzed by selecting one of plural execution routes of a program and tracing back each execution route. CONSTITUTION:A branch condition analysis part 13, a store contents analysis part 14, and a complete branch condition analysis part 15 perform each prescribed analysis processing. Then the data obtained from each analysis processing are stored in a branch condition file storage part 16 including a route data storage means and a position data storage means, an execution contents file storage part 17, and a complete branch condition file storage part 18 respectively. In a trace-back state, the route data and the branch data on each instruction are read out of a route data storage means and a branch data storage means. Then one of plural execution routes of a program is sequentially selected and each execution route is traced back in response to the same route data and based on the branch route prescribed by the branch data. Thus it is possible to prevent such an inconvenient case where an analysis route that could not exist as an actual execution route is analyzed.

Description

【発明の詳細な説明】 概  要 アセンブラ言語で記述されたプログラムの実行内容を当
該プログラムの基本的な仕様と照合する作業は、従来で
は当該プログラムのアセンブラ言語による出力リストを
手作業にて判別して行われていた。これでは膨大な労力
を有し、かつ過誤も生じやすい0本発明では、このよう
なプログラムによる基本的な入力/出力状態は、ロード
命令およびストア命令に依存し、かつ動作の流れは分岐
命令による分岐状態によって決定されることに着目した
ものである。この解析装置は、被解析プログラムの各命
令毎に前記分岐状態に関連する解析経路を識別するデー
タと、処理が分岐する際の分岐元および分岐先の命令の
配置位置に関するデータとを記憶するようにした。この
ようなデータに基づき、前記分岐命令やストア命令から
被解析プログラムを適正な解析経路に従って逆上って読
取り、解析経路毎に実行内容および分岐条件を論理式の
形式にて得るようにする。
[Detailed Description of the Invention] Overview The work of comparing the execution contents of a program written in assembler language with the basic specifications of the program has conventionally been performed by manually determining the output list of the program in assembler language. It was being held. This requires a huge amount of effort and is prone to errors. In the present invention, the basic input/output state of such a program depends on load and store instructions, and the flow of operation is based on branch instructions. This focuses on the fact that it is determined by the branch state. This analysis device stores data that identifies an analysis path related to the branch state for each instruction of the program to be analyzed, and data regarding the placement positions of branch source and branch destination instructions when processing branches. I made it. Based on such data, the program to be analyzed is read backwards from the branch instruction or store instruction along an appropriate analysis path, and the execution contents and branch conditions are obtained in the form of logical expressions for each analysis path.

産業上の利用分野 本発明は、マイクロプロセッサなどを動作させるために
用いられるプログラムの内容を解析する装置に関する。
INDUSTRIAL APPLICATION FIELD The present invention relates to an apparatus for analyzing the contents of a program used to operate a microprocessor or the like.

従来の技術 マイクロプロセッサが動作するにあたって実際に読取る
機械語に最も近い言語としてアセンブラ言語がプログラ
ムを記述するために用いられている。このアセンブラ言
語は高級言語と異なり、機械語の各命令とl対1対応を
なず言語であるたぬ、このプログラムに基づく各種入出
力装置の動作内容やプログラムの実行内容の概略などが
、アセンブラ言語にては把握しに<<、仕様上の記載内
容と照合するにあたり、人手によって命令毎に行う必要
がある。またシュミレーションやエミュレーションなど
を行ってプログラムの動作状態を確認する技術が採用さ
れているが、これらはプロゲラl、の中で要求される各
種入力命令に対応して数値やデータを設定しなければな
らない。
2. Description of the Related Art Assembler language is used to write programs as a language closest to the machine language that is actually read by microprocessors. Unlike high-level languages, this assembler language does not have a one-to-one correspondence with each machine language instruction. In language, it is difficult to understand <<, and when comparing it with the contents written in the specifications, it is necessary to manually perform each command. In addition, technology has been adopted to check the operating status of programs by performing simulations and emulations, but these require numerical values and data to be set in response to the various input commands required within Progera. .

したがってプログラムの各命令を読取ってプログラム全
体の処理や流れの構造を認識し、プログラムの実行内容
を概略的に記述したり、また入出力装置の動作として記
述するなど、プログラムの実行内容の把握が容易な形式
の出力を得ようとする技術が想定される。この場合、プ
ログラムに基づく入出力装置への最終的な出力は、マイ
クロプロセッサが或データをメモリの所定のアドレスに
書込むストア命令である6したがってストア命令に表れ
るオペランドの変数の内容が最終的に確定されるたとえ
ばロード命令まで、プログラムを逆上って命令を読取れ
ば、当該ロード命令でデータが入力されるものとして前
記変数の内容が確定することになる。このようにして前
記ロード命令に用いられたオペランドの変数でプログラ
ムの実行内容を概略的に記述できることなる。
Therefore, it is possible to understand the execution contents of the program by reading each command of the program, recognizing the structure of the overall program processing and flow, and describing the execution contents of the program roughly or as the operation of input/output devices. Techniques that attempt to obtain output in an easy format are envisioned. In this case, the final output to the input/output device based on the program is a store instruction in which the microprocessor writes some data to a predetermined address in memory.6 Therefore, the contents of the operand variables appearing in the store instruction are ultimately For example, if the program is read backwards until the load instruction is determined, the contents of the variables are determined as if data were input by the load instruction. In this way, the execution contents of the program can be roughly described using the operand variables used in the load instruction.

発明が解決しようとする課題 このような従来例において、解析する対象のプログラム
がたとえば第19図示の構造である場合について説明す
る。このプログラムは、ステップa1〜aloの命令か
ら成り、ステップa2.a4にサブルーチンプログラム
を呼出すコール命令rcALL A、およびrCALL
  Bノが配置されている。ここでステップa5からプ
ログラムを逆上る場合、逆上り経路としては、 a5→a8→a7→a6→・・・ および a 5−+ a 84 a 7−1 a 10−+ a
 9−* −−−の2種類想定されるが、実際のプログ
ラムの実行順を考慮すると後者は実際には実行され得な
い経路である8 すなわちプログラムの内容を解析するにあたって、プロ
グラムを命令の実行内容に基づいて逆上って順次的に読
取る技術のみでは、実際のプログラムの実行経路からは
あり得ない経路も解析の対象としてしまい、解析時間が
長くなってしまうとともに、実際のプログラム実行内容
と異なる解析結果を導出することになり極めて不具合で
ある。
Problems to be Solved by the Invention In such a conventional example, a case where the program to be analyzed has the structure shown in FIG. 19, for example, will be described. This program consists of instructions in steps a1 to alo, steps a2. Call instructions rcALL A and rCALL that call a subroutine program to a4
B is placed. Here, when the program is reversely ascended from step a5, the reverse ascending path is a5→a8→a7→a6→... and a 5-+ a 84 a 7-1 a 10-+ a
9-* --- Two types are assumed, but considering the actual program execution order, the latter is a path that cannot actually be executed.8 In other words, when analyzing the program contents, the program is If only the technology to read sequentially based on the contents is used, paths that are impossible from the actual program execution path will be analyzed, which increases the analysis time and makes it difficult to match the actual program execution contents. This is extremely problematic as it leads to different analysis results.

本発明の目的は、上述の技術的課題を解消し、プログラ
ムを逆上って命令を読取り、内容を解析するにあたって
実際の実行経路に対応した解析経路を選択して、実行経
路としては有り得ない解析経路を選択する不具合を解消
したプログラム内容解析装置を提供することである。
The purpose of the present invention is to solve the above-mentioned technical problems, to read instructions backwards from a program, and to analyze the contents by selecting an analysis path that corresponds to the actual execution path, and avoiding possible execution paths. It is an object of the present invention to provide a program content analysis device that eliminates the problem of selecting an analysis path.

課題を解決するための手段 本発明は、複数の命令から戒るプログラムの各命令を実
行順とは逆に逆上って読取り、その内容を解析する装置
において、 逆上り読取り時には、プログラム中の分岐命令の配置に
基づいて設定されるプログラムの複数の実行経路のいず
れか1つを順次的に選択して各実行経路に沿って逆上っ
て各命令を読取るようにしたことを特徴とするプログラ
ム内容解析装置である。
Means for Solving the Problems The present invention provides an apparatus that reads each instruction of a program that is to be read from a plurality of instructions backwards in the opposite order of execution, and analyzes the contents. The present invention is characterized in that any one of a plurality of execution paths of a program set based on the arrangement of branch instructions is sequentially selected, and each instruction is read backward along each execution path. This is a program content analysis device.

また本発明は、上記分岐命令はスタックのストア内容を
変更する命令を含むことを特徴とするプログラム内容解
析装置である。
Further, the present invention provides a program content analysis device, wherein the branch instruction includes an instruction to change the contents stored in the stack.

さらにまた本発明は、複数の命令から成るプログラムの
各命令を実行順とは逆に逆上って読取り、その内容を解
析する装置において、 各命令毎に、分岐命令に対応するプログラムの複数の実
行経路を識別する経路データと、分岐命令により規定さ
れる分岐先命令または分岐命令のいずれかである命令毎
に、対応する分岐命令または対応する分岐先命令のいず
れかの位置データとを含む分岐データを作成する分岐デ
ータ作成手段と、 経路データを記憶する経路データ記憶手段と、位置デー
タを記憶する位置データ記憶手段と、プログラムを逆上
って各命令を読取る逆上り読取手段であって、逆上り時
には各命令の経路データと分岐データとを、経路データ
記憶手段と分岐データ記憶手段とから読出し、連続する
同一経路データに対応し、かつ分岐データで規定される
分岐経路に従ってプログラムを逆上って読取る、そのよ
うな逆上り読取手段とを含むことを特徴とするプログラ
ム内容解析装置である。
Furthermore, the present invention provides an apparatus for reading each instruction of a program consisting of a plurality of instructions backwards in the order of execution and analyzing the contents, in which a plurality of instructions of a program corresponding to a branch instruction are read for each instruction. A branch that includes path data that identifies an execution path and, for each instruction that is either a branch destination instruction or a branch instruction specified by a branch instruction, position data of either the corresponding branch instruction or the corresponding branch destination instruction. A branch data creation means for creating data, a route data storage means for storing route data, a position data storage means for storing position data, and a reverse reading reading means for reading each instruction by reversing the program, When reversing, the route data and branch data of each instruction are read from the route data storage means and the branch data storage means, and the program is reversely reverted according to the branch path defined by the branch data, corresponding to the continuous same route data. This is a program content analysis device characterized in that it includes such reverse upstream reading means.

作  用 本発明に従い、複数の命令から成るプログラムの各命令
を実行順とは逆に逆上って読取るにあたり、プログラム
中の分岐命令に対応して設定されるプログラムの複数の
実行経路のいずれか1つを、順次的に選択して各実行経
路に沿って逆上るようにした。したがってプログラムの
各命令を実行順とは逆に逆上って読取り、その内容を解
析するにあたり、実際の実行経路としては有り得ない解
析経路に関して解析を行うという不具合を防ぐことがで
きる。これにより冗長な処理の発生を防ぐことができ、
処理速度が向上される。
According to the present invention, when each instruction of a program consisting of a plurality of instructions is read backwards in the opposite order of execution, one of the plurality of execution paths of the program that is set corresponding to a branch instruction in the program is read. One was selected sequentially and reversed along each execution path. Therefore, when each instruction of a program is read backwards from the order of execution and its contents are analyzed, it is possible to prevent the problem of performing analysis on an analysis path that is impossible as an actual execution path. This prevents redundant processing,
Processing speed is improved.

前記分岐命令はプログラムを実行するにあたってスタッ
クのストア内容を変更する命令を含むものとする。すな
わち分岐命令の配置位置からプログラムの実行順が変更
される分岐命令に限らず、スタックのストア内容を変化
させ、かつその命令自身では当該命令の配置位置におい
てはプログラムの実行順が変化しない命令もこれに含ま
れる。
It is assumed that the branch instruction includes an instruction that changes the contents stored in the stack when executing the program. In other words, this is not limited to branch instructions that change the program execution order from the location of the branch instruction, but also instructions that change the stack store contents and do not change the program execution order at the location of the instruction itself. This includes:

すなわちスタックのストア内容を変化することにより、
サブルーチンプログラムのリターン命令による分岐先が
変更される場合などである。このような場合であっても
上記作用を実現することができ、使用性が格段に向上さ
れる。
In other words, by changing the contents stored in the stack,
This is the case, for example, when the branch destination is changed by a return instruction in a subroutine program. Even in such a case, the above effect can be achieved, and usability is greatly improved.

上記作用はプログラムの命令毎に分岐命令に対応するプ
ログラムの複数の実行経路を識別する経路データと、分
岐命令により規定される分岐先命令または分岐命令のい
ずれかである命令毎に、対応する分岐命令または対応す
る分岐先命令のいずれかの位置データとを分岐データ作
成手段にて作成し、これらのデータを経路データ記憶手
段と位置データ記憶手段とに記憶する。逆上り読取手段
がプログラムを逆上ることによって各命令を読取る場合
、各命令の経路データと位置データとを前記経路データ
記憶手段と位置データ記憶手段とから続出し、連続する
同一経路データに対応し、がつ分岐データで規定される
分岐経路に従ってプログラムを逆上るようにしている。
The above operation is based on path data that identifies multiple execution paths of the program corresponding to the branch instruction for each program instruction, and for each instruction that is either the branch destination instruction specified by the branch instruction or the branch instruction, the corresponding branch Position data of either the instruction or the corresponding branch destination instruction is created by the branch data creation means, and these data are stored in the route data storage means and the position data storage means. When the reverse up reading means reads each instruction by reversing the program, the route data and position data of each command are sequentially read out from the route data storage means and the position data storage means, and the route data and position data of each command are sequentially read out from the route data storage means and the position data storage means so as to correspond to successive identical route data. , the program is run backwards according to the branch path defined by the branch data.

このような動作により前記本件発明に特有な作用効果を
実現できる。
By such an operation, the effects peculiar to the present invention can be realized.

実施例 第1図は本発明の一実施例のプログラム内容解析装置(
以下、解析装置と略す)1の構成例を示すブロック図で
ある。解析装置1には外部記憶装置2が接続され、解析
対象となる高級言語やアセンブラ言語で記述されたプロ
グラムが保存される。
Embodiment FIG. 1 shows a program content analysis device (
1 is a block diagram showing an example of the configuration of an analysis device (hereinafter abbreviated as an analysis device) 1. FIG. An external storage device 2 is connected to the analysis device 1 and stores a program written in a high-level language or assembler language to be analyzed.

解析装置1は外部記憶装置2からのプログラムを機械語
に変化するアセンブラ3を備え、アセンブラ3からのア
センブルリストがアセンブルリストファイル記憶部4に
記憶される。以下「記憶部」の名称は解析装置1に備え
られるたとえばRAM(ランダムアクセスメモリ)や固
定ディスク装置などの内部記憶装置の所定の領域を示す
The analysis device 1 includes an assembler 3 that converts a program from an external storage device 2 into machine language, and an assemble list from the assembler 3 is stored in an assemble list file storage section 4. Hereinafter, the term "storage unit" refers to a predetermined area of an internal storage device, such as a RAM (random access memory) or a fixed disk device, provided in the analysis device 1.

アセンブルリストファイル記憶手段4からの解析対象と
なるアセンブルプログラムは、解析準備処理子Fl 5
に与えられ、後述するプログラム解析に先立ち解析対象
となるプログラムのデータが内容別に分類される。解析
準備処理手段5には複数の記憶部が接続される。リスト
ファイル記憶部6には被解析プログラムの機械語とアセ
ンブラ言語の二一モニツクから成る命令列が記憶される
。RAMファイル記憶部7には被解析プログラムで用い
られる各種変数が記憶される。マツプデータ記憶部8に
は被解析プログラムで用いられるマツプ形式などでの固
定データが記憶される。またその他に記憶部9が接続さ
れ、被解析プログラノ、で用いられるたとえば割込みベ
クトルのベクトルアドレスや、前記リストファイル記憶
部6に記憶されている二一モニツクのプログラムに関す
るラベルなどが記憶される。また解析装置1には命令デ
ータファイル記憶部10が設けられ、被解析プログラム
で用いられる命令が予め記憶される。
The assemble program to be analyzed from the assemble list file storage means 4 is an analysis preparation processor Fl 5
The data of the program to be analyzed is classified by content prior to the program analysis described later. A plurality of storage units are connected to the analysis preparation processing means 5. The list file storage unit 6 stores an instruction sequence consisting of twenty-one monograms of machine language and assembler language of the program to be analyzed. The RAM file storage unit 7 stores various variables used in the program to be analyzed. The map data storage unit 8 stores fixed data in a map format used in the program to be analyzed. In addition, a storage section 9 is connected, and stores, for example, vector addresses of interrupt vectors used in the program to be analyzed, labels related to the twenty-one monitor programs stored in the list file storage section 6, and the like. The analysis device 1 is also provided with an instruction data file storage section 10 in which instructions used in the program to be analyzed are stored in advance.

前記リストファイル記憶部6からの二−モニツク形式で
のプログラムは分岐データ作成手段としての流れ構造解
析手段Y1に与えられ、被解析プログラムにおける処理
の流れの構造、すなわち分岐の有無、分岐命令が想定さ
れる場合の分岐先命令の位置の変動およびスタックのネ
スティングの程度などを解析するようにしている。ここ
ではこれ以降のすべての解析処理の基礎データとなる流
れ制御ファイルを作威し、流れ制御ファイル記憶部12
に記憶する。前記リストファイル記憶部6、命令ファイ
ル記憶部20および流れ制御ファイル記憶部12からの
各データに基づいて分岐条件解析部13、ストア内容解
析部14、完全分岐条件解析部15は後述するそれぞれ
の解析処理を行い得られた各データを経路データ記憶手
段および位置データ記憶手段を含む分岐条件ファイル記
憶部16、実行内容ファイル記憶部17、および完全分
岐条件ファイル記憶部18に記憶する。
The program in binary format from the list file storage unit 6 is given to the flow structure analysis unit Y1 as a branch data creation unit, and the process flow structure in the program to be analyzed, that is, the presence or absence of branches, and branch instructions are assumed. We are trying to analyze changes in the position of branch destination instructions and the degree of nesting of stacks when branch instructions are executed. Here, we will create a flow control file that will serve as the basic data for all subsequent analysis processing, and
to be memorized. Based on each data from the list file storage section 6, instruction file storage section 20, and flow control file storage section 12, the branch condition analysis section 13, store content analysis section 14, and complete branch condition analysis section 15 perform respective analyzes described later. Each data obtained through the processing is stored in a branch condition file storage section 16 including a route data storage means and a position data storage means, an execution content file storage section 17, and a complete branch condition file storage section 18.

流れ制御ファイル、分岐条件ファイルおよび実行内容フ
ァイルからフローチャート作成部19は、被解析プログ
ラムのフローチャートを作成して出力する。また実行内
容ファイルおよび完全分岐条件ファイルから実行内容解
析結果出力部20は被解析プログラムの実行内容をたと
えば印字出力する。
The flowchart creation unit 19 creates and outputs a flowchart of the program to be analyzed from the flow control file, branch condition file, and execution content file. Further, the execution content analysis result output unit 20 outputs, for example, the execution content of the analyzed program in print from the execution content file and the complete branch condition file.

第2図は解析準備処理手段5の動作を説明するフローチ
ャー1・である。ステップalにおいて解析装置1は外
部記f!装置2からソースプログラムを読込h、アセン
ブラ3にてアセンブル処理を行う。アセンブルリストフ
ァイル4に記憶されたアセンブルプログラムに対して、
解析準備処理手段5はステップa2にて各命令毎に一連
の番号(以下、行番号と称する)を付与する。このとき
各命令は後述するようにたとえばストア命令、入出力命
令、分岐命令あるいは演算命令などのようにその種類に
よって分類される。これは前記命令データファイル記憶
部10に記憶されている命令を参照して行われる。ステ
ップa3ではこのような命令の分類に基づいて、前述し
た各種データファイルの作成が行われる。
FIG. 2 is a flowchart 1 for explaining the operation of the analysis preparation processing means 5. In step al, the analysis device 1 writes the external record f! A source program is read from the device 2 and assembled by the assembler 3. For the assemble program stored in assemble list file 4,
The analysis preparation processing means 5 assigns a series of numbers (hereinafter referred to as line numbers) to each instruction in step a2. At this time, each instruction is classified according to its type, such as store instruction, input/output instruction, branch instruction, or arithmetic instruction, as will be described later. This is done by referring to the instructions stored in the instruction data file storage section 10. In step a3, the aforementioned various data files are created based on the classification of the instructions.

次に解析装置1は、流れ構造解析手段11によりリスト
ファイル記憶部6に記憶されている機械語と二一モニツ
クから成るプログラムファイルに関して流れ精造解析処
理を行う。この解析処理は被解析プログラムの流れ構造
(分岐の有無、分岐先の特定、スタックのネスティング
の程度など)を解析する処理であり、以後のすべての解
析プログラムの基礎データとなる前述した各種ファイル
を作成する。とりわけ分岐命令の存在に基づく分岐先命
令の行番号などの抽出の他、「逆上り(さかのぼり)」
概念と「属性」概念とを表すデータを作成する。
Next, in the analysis device 1, the flow structure analysis means 11 performs a flow refinement analysis process on the program file consisting of machine language and twenty-monics stored in the list file storage section 6. This analysis process analyzes the flow structure of the program being analyzed (presence or absence of branches, identification of branch destinations, degree of nesting of stacks, etc.), and the various files mentioned above are used as the basic data for all subsequent analysis programs. create. In particular, in addition to extracting the line number of the branch destination instruction based on the existence of a branch instruction, it is also possible to
Create data representing concepts and "attribute" concepts.

(1)逆上り概念 プログラムの実行内容を解析するためにプログラムをそ
の実行順に従って命令を読取って解析しようとする場合
、各種フラグなどのコンデイションコードの変化、複数
の命令の間の相関関係など、当該命令に関連して惣定さ
れるすべてのデータを蓄積しておく必要がある。このよ
うなデータの中には命令の種類によっては不必要なデー
タがある場合であっても、以後の解析処理で、どのデー
タが必要になるか判断できず、このためすべてのデータ
を収集する必要がある。
(1) Reverse upward concept When attempting to analyze the execution contents of a program by reading instructions from the program according to its execution order, changes in condition codes such as various flags, correlations between multiple instructions, etc. , it is necessary to store all the data determined in relation to the command. Even if some of this data is unnecessary depending on the type of instruction, it is not possible to determine which data will be needed in subsequent analysis processing, so all data must be collected. There is a need.

本発明に従う「逆上り」概念はこのような課題を解消す
るための方策である。
The "reverse upstream" concept according to the present invention is a measure to solve this problem.

本発明は機械語やアッセンブラプログラムで記述された
プログラムを、分岐命令およびストア命令の分岐条件や
ストア内容を合成することにより、把握容易な形式に論
理式により記述しようとするものである。このため前記
分岐命令またはストア命令を始点とし、当該分岐条件ま
たはストア命令の内容が確定する個所までプログラムを
逆上りつつ、必要な情報のみを収集するものである。
The present invention attempts to write a program written in machine language or an assembler program using a logical expression in an easy-to-understand format by synthesizing branch conditions and store contents of branch instructions and store instructions. For this reason, only the necessary information is collected by starting from the branch instruction or store instruction and working backward through the program to the point where the contents of the branch condition or store instruction are determined.

ここでプログラム例として下記第1表のプログラムに則
して説明する。
Here, as a program example, explanation will be given based on the program shown in Table 1 below.

〈以下余白) 第 表 上記プログラム例で、実行順序は行番号1−2→3→4
→5→6または行番号1→2−3→4−5−7である1
分岐命令はrBccJであり、その条件は行番号4の(
A−#8)が0以上か負であるかで決定される。そのた
めにはアキュムレータAの値が確定する必要がある。そ
のためには行番号3にてアキュムレータA、Hの双方の
値が確定する必要があり、行番号2,1を読取って初め
てその値が確定する。
(Left below) In the program example above, the execution order is line numbers 1-2 → 3 → 4.
→5→6 or line number 1→2-3→4-5-7 1
The branch instruction is rBccJ, and its condition is (
A-#8) is determined by whether it is 0 or more or negative. For this purpose, the value of accumulator A needs to be determined. To do this, it is necessary to determine the values of both accumulators A and H in row number 3, and the values are determined only after row numbers 2 and 1 are read.

流れ構造解析手段11では上記逆上り処理に必要な情報
、すなわち或命令とその前行とはプログラムの実行順に
従った連続した命令あるか否かの判断のためのデータや
、これらの命令が不連続の場き、どの行番号の命令へ連
続しているかに関するデータなどの後述する属性データ
を作成している。
The flow structure analysis means 11 collects information necessary for the reverse upstream processing, that is, data for determining whether a certain instruction and its preceding line are consecutive instructions according to the order of execution of the program, and data for determining whether these instructions are invalid. In the case of continuation, attribute data, which will be described later, is created, such as data regarding which line number the instruction is contiguous to.

(2)属性概念 プログラムにはメインルーチンと、メインルーチンの所
定の個所から処理が分岐されるサブルーチンとを含んで
構成される。同一のサブルーチンでも複数箇所から呼出
される場合があり、メインルーチンに処理を戻すリター
ン命令RETによる分岐先の位置は、メインルーチンの
呼出し命令に対応して変化する。したがって1つのサブ
ルーチンによっても複数の実行経路が設定されていると
考えられ、処理経路を区分する情報として属性概念を設
定する。以下、第2表で示されるプログラド例に沿って
説明する。
(2) Attribute concept The program includes a main routine and a subroutine whose processing branches off from a predetermined point in the main routine. The same subroutine may be called from multiple locations, and the branch destination position of a return instruction RET that returns processing to the main routine changes depending on the calling instruction of the main routine. Therefore, it is considered that a plurality of execution paths are set even for one subroutine, and an attribute concept is set as information for classifying processing paths. The following will explain the program example shown in Table 2.

(以下余白) 第 表 上記プログラム例のフローチャートは第3図に示される
(Left space below) Table A flowchart of the above program example is shown in FIG.

このプログラム例の実行順序は行番号1−2→3→9→
 10→ 1 l →4→5→6→8→9→ 10→1
1→7→・・・である、一方、行番号7からプログラム
を逆上る場合、第1の経路として行番号7→ 11 →
 10→9→8→6→5→4→ 1 l → 10−9
−3−2−1−・・・があるが、その他に行番号7→1
1→10→9→3→2→・・・などの逆上り経路が存在
していることになる。このような後者の逆上り経路は実
行順序からはあり得ない経路であり、前記属性概念を用
いてこのような不所望な経路の選択が防止される。
The execution order of this program example is line number 1-2 → 3 → 9 →
10→ 1 l →4→5→6→8→9→ 10→1
1 → 7 →... On the other hand, when going backwards through the program from line number 7, the first route is line number 7 → 11 →
10 → 9 → 8 → 6 → 5 → 4 → 1 l → 10-9
-3-2-1-...but also line number 7→1
This means that there are reverse upward routes such as 1→10→9→3→2→.... Such a latter reverse upward route is an impossible route based on the execution order, and the selection of such an undesirable route is prevented using the attribute concept.

第2表のプログラム例において、分岐先欄、分岐元欄、
流れフラグ欄および属性欄の内容が以下のようにして決
定される。
In the program example in Table 2, the branch destination column, branch source column,
The contents of the flow flag field and the attribute field are determined as follows.

(a)属性 行番号l〜7cよ行番号3.6のCALL命令によって
処理が分岐し、かつサブルーチンプログラムを含んでい
ないので、すべて同一の属性記号Mが与えられる0行番
号9〜11は行番号3のCALL命令により処理が移さ
れるサブルーチンプログラムであり、属性記号Aが与え
られる。また行番号8〜11は行番号6のCALL命令
により処理が移されるサブルーチンプログラムであり、
前記属性記号Aと異なる属性記号Bがそれぞれ与えられ
る。
(a) Processing branches from attribute line numbers 1 to 7c due to the CALL instruction at line number 3.6, and does not include a subroutine program, so lines 0 and 9 to 11 are all given the same attribute symbol M. This is a subroutine program whose processing is transferred by the CALL instruction number 3, and is given the attribute symbol A. Line numbers 8 to 11 are subroutine programs whose processing is transferred by the CALL command at line number 6.
An attribute symbol B different from the attribute symbol A is given.

(b)分岐先欄 上記プログラムの分岐命令は行番号3,6,7゜11に
配置されており、これらの処理が移る先は各命令の内容
に対応してそれぞれ行番号9.8゜1であり、分岐命令
RETでは対応するCALL命令の直後の行番号4また
は行番号7である。分岐先欄にはこのような分岐先の行
番号と当該行番号の命令が有する属性とが組になったデ
ータが設定される。
(b) Branch destination column The branch instructions in the above program are located at line numbers 3, 6, and 7°11, and the destinations to which these processes are transferred are located at line numbers 9.8°1 and 9.8°1, respectively, depending on the content of each instruction. In the branch instruction RET, this is line number 4 or line number 7 immediately after the corresponding CALL instruction. In the branch destination column, data is set in which the line number of the branch destination is paired with the attribute of the instruction of the line number.

(C)分岐元欄 前記各分岐命令により処理を移される分岐先の命令から
見て、処理が当該分岐先命令へ移る元となる分岐元命令
が対応付けられる。したがって分岐元欄には、各命令毎
に前記分岐元命令が対応付けられる場合にはその分岐元
命令の行番号と当該分岐命令の所属する属性記号とが組
となったデータが設定される。
(C) Branch source column A branch source instruction from which processing is transferred to the branch destination instruction is associated with the branch destination instruction to which processing is transferred by each branch instruction. Therefore, in the branch source column, when the branch source instruction is associated with each instruction, data in which the line number of the branch source instruction and the attribute symbol to which the branch instruction belongs is set is set.

(d)流れフラグ欄 流れフラグ「1」は当該命令が前行の命令から連続した
命令であることを示す。流れフラグ「○」は当該命令が
前行の命令以外の他の命令から処理が分岐してくる分岐
先命令であることを示す。すなわち行番号1〜3は一連
の命令であり、行番号4の命令は行番号3のCALL命
令によりサブルーチンプログラムAが実行されて行番号
11のRET命令により処理が分岐してきた命令である
(d) Flow flag column A flow flag "1" indicates that the instruction in question is a continuous instruction from the instruction in the previous line. The flow flag "○" indicates that the instruction is a branch destination instruction from which processing branches from another instruction other than the instruction in the previous line. That is, line numbers 1 to 3 are a series of instructions, and the instruction at line number 4 is an instruction in which the subroutine program A is executed by the CALL instruction at line number 3, and the processing is branched by the RET instruction at line number 11.

このため流れフラグ「O」が付される。同様にして行番
号5.6には流れフラグrlJが1寸され、行番号7に
は流れフラグ「0」が付される。
For this reason, a flow flag "O" is attached. Similarly, the flow flag rlJ is set by 1 inch at line number 5.6, and the flow flag "0" is set at line number 7.

行番号8が行番号6のCALL命令により処理が分岐し
てくる命令であり、fflれフラグ「0」が付される0
行番号9は行番号3のCALL命令により処理が分岐し
てくる命令であり、流れフラグ「0」が付される命令で
あるが、前記行番号3すCLLの後に行番号6のCAL
L命令が行われるので、行番号9は行番号8に連続する
命令となり、第2表のように流れフラグ「1」が与えら
れる。
Line number 8 is an instruction whose processing is branched by the CALL instruction of line number 6, and the ffl flag is set to 0.
Line number 9 is an instruction whose processing is branched by the CALL instruction of line number 3, and is an instruction with a flow flag of "0".
Since the L instruction is executed, line number 9 becomes an instruction following line number 8, and a flow flag "1" is given as shown in Table 2.

行番号10.11については流れフラグ「】」が与えら
れる。
For line number 10.11, a flow flag "]" is given.

上記第2表のプログラム例では、CALL命令などその
命令から処理が分岐し、またその命令へ処理が分岐して
くる命令に関して説明したが、般にマイクロコンピュー
タのプログラムの実行は、プログラムカウンタ(PC)
の出力するアドレスの命令を読取って実行し、その命令
の実行により次に実行すべき命令のアドレスがプログラ
ムカウンタに格納される。
In the example program shown in Table 2 above, we have explained instructions such as the CALL instruction where the processing branches from the instruction, and where the processing branches to that instruction. )
The instruction at the address output by is read and executed, and upon execution of that instruction, the address of the next instruction to be executed is stored in the program counter.

一方、プログラム中にサブルーチンプログラムが含まれ
ている場合、処理が分岐するが、このときスタックが用
いられる。スタックは周知のように、先入れ後出しくフ
ァーストインラストアウト。
On the other hand, if a subroutine program is included in the program, processing branches, and at this time a stack is used. As is well known, stacking is first in, last out.

FILO方式〉のメモリであり、サブルーチンを呼出す
ときサブルーチンから処理が戻るべきメインルーチンの
次のアドレスが格納される。サブルーチンの処理が終了
後、リターン命令RETによりスタックに格納されてい
るデータがプログラムカウンタに転送され、当該アドレ
スからプログラムが実行される。したがってスタックの
記憶内容を変更する命令が含まれていれば、サブルーチ
ンプログラムからの復帰先を変更することができる。
This is a FILO type memory, and when a subroutine is called, the next address of the main routine to which processing should return from the subroutine is stored. After the processing of the subroutine is completed, the data stored in the stack is transferred to the program counter by a return instruction RET, and the program is executed from the address. Therefore, if an instruction that changes the storage contents of the stack is included, the return destination from the subroutine program can be changed.

このようなプログラム例を下記第3表に示す。An example of such a program is shown in Table 3 below.

第  3  表 第3表のプログラム例は第2表のプログラム例の行番号
4〜8が変更されている。第3表のプログラム例で分岐
先欄、分岐元欄および流れフラグ欄のデータの決定方法
は第2表のプログラム例の場合と同様である。以下、属
性の決定方法について説明する。
Table 3 In the program example in Table 3, line numbers 4 to 8 of the program example in Table 2 have been changed. The method of determining data in the branch destination column, branch source column, and flow flag column in the program example in Table 3 is the same as in the case of the program example in Table 2. The method for determining attributes will be explained below.

行番号1〜3は一連の命令であり、属性データMを与え
る。行番号3のCALL命令により処理は行番号9に分
岐するので、行番号9〜11には他の属性記号Aを与え
る0行番号11のRET命令により処理は行番号4に復
帰する。この命令には属性記号Mを与える。
Line numbers 1 to 3 are a series of instructions and provide attribute data M. Since the process branches to line number 9 due to the CALL instruction at line number 3, the process returns to line number 4 due to the RET instruction at line number 11, which gives another attribute symbol A to line numbers 9 to 11. An attribute symbol M is given to this command.

行番号5のPSH命令により、前述したスタックの最新
のアドレスデータがXレジスタの内容に書換えられる。
The PSH instruction in line number 5 rewrites the latest address data on the stack to the contents of the X register.

この時点で属性データをBに変更し、以下行番号11ま
で同一の属性データBを与える。このようにして、前述
したスタックに格納されているデータを変更する命令を
含むプログラムに関する属性が決定される。
At this point, the attribute data is changed to B, and the same attribute data B is given to the following rows up to line number 11. In this way, attributes regarding the program including instructions that modify the data stored in the stack described above are determined.

上記第2表および第3表のプログラム例に関する流れ制
御データの属性データは、スタックの内容を変更する命
令を含む分岐命令に関してプログラムの実行経路毎に、
前述したように異なる記号を与えるようにしている。こ
のような方法の場合、被解析プログラムにおける属性の
数が増大すると、1憂述するようにプログラムを逆上っ
て解析を行う場合、命令毎にすべての属性欄の属性デー
タを検索して同一の属性に沿って逆上るような処理を行
うので、前記属性データの数を減小できればより高速な
処理が実現できる。
The attribute data of the flow control data regarding the program examples in Tables 2 and 3 above are as follows for each program execution path regarding branch instructions including instructions that change the contents of the stack:
As mentioned above, different symbols are given. In such a method, when the number of attributes in the program to be analyzed increases, if the program is to be analyzed backwards as mentioned above, attribute data in all attribute columns must be searched for each instruction to ensure the same attribute data. Since the processing is performed in a backward manner according to the attributes of , faster processing can be realized if the number of attribute data can be reduced.

下記第4表はプログラム内容は第3表のプログラム内容
と同一であるが、前記第2表および第3表とは異なる流
れ制御データを1分岐欄1,2および属性欄1,2.・
・・とじて設定している。
The program contents in Table 4 below are the same as those in Table 3, but flow control data different from those in Tables 2 and 3 are shown in branch columns 1, 2 and attribute columns 1, 2, .・
...is set to close.

以下、これらの決定方法について説明する。The method of determining these will be explained below.

(以下余白) (e)属性!i (i=1.2)= 属性部の行番号データNotま分岐命令毎に設定され、
分岐先命令の行番号が記述される。属性データtoは当
該分岐命令により、どの属性部に処理が分岐したかを表
す、また行上りフラグ欄においてフラグ=「O」は対応
する命令が分岐先命令であり、直前の行の命令とは処理
が連続しない命令であることを示し、フラグ= r j
ノ (j=1゜2、・・・)は属性部の番号を示す0行
番号1は行番号11を分岐命令とする分岐先命令の場合
があり、したがってフラグ=「0」が設定される。また
順下りフラグ欄においてフラグ−「0」は、対応する命
令が直後の命令と処理が連続しない命令であり、分岐命
令であることを示す。
(Left below) (e) Attribute! i (i = 1.2) = line number data in the attribute section Not set for each branch instruction,
The line number of the branch destination instruction is written. The attribute data to indicates which attribute part the process branches to by the branch instruction in question, and in the line-up flag column, flag = "O" indicates that the corresponding instruction is the branch destination instruction, and the instruction in the immediately previous line is Indicates that the processing is a non-consecutive instruction, flag = r j
ノ (j=1゜2,...) indicates the number of the attribute part 0 Line number 1 may be a branch destination instruction whose branch instruction is line number 11, so the flag = "0" is set. . Further, in the sequential descending flag column, a flag of "0" indicates that the corresponding instruction is an instruction whose processing is not consecutive to the immediately following instruction, and is a branch instruction.

行番号2ではまず設定された属性部1の番号がフラグ=
「1」として設定される。行番号3は分岐命令であり、
分岐先の行番号データN(1=r9Jが設定される。属
性データtoについてto=rIJが設定される。この
後、処理は行番号9へ分岐し、したがって逆上りフラグ
=「0」が設定される0行番号10には逆上りフラグ−
rl」が設定される0行番号「11」は分岐元命令であ
り、行番号データN0−r4Jが設定される。この行番
号4の命令は現時点では属性1I11の範囲にあり、し
たがって属性データto−rlJが設定される。
In line number 2, the number of attribute part 1 that is set first is flag =
Set as "1". Line number 3 is a branch instruction,
Branch destination line number data N (1=r9J is set. to=rIJ is set for attribute data to. After this, the process branches to line number 9, and therefore the reverse uplink flag is set to "0". Reverse uplink flag -
The zero line number "11" where "rl" is set is a branch source instruction, and line number data N0-r4J are set. The instruction at line number 4 is currently in the range of attribute 1I11, and therefore attribute data to-rlJ is set.

この後、処理は行番号4へ移る。このため逆上りフラグ
および順下りフラグはr□」、rl」となる、これ以降
、行番号5〜10には逆上りフラグ=「0」または「1
」のいずれかが設定される。
After this, the process moves to line number 4. Therefore, the reverse uplink flag and the forward downlink flag become r
” is set.

この後、処理は行番号11に到達する。分岐先は行番号
5のRS H命令により行番号1に変更されており、し
たがって属性部2が増設され、逆上りフラグ=「2」が
設定される。また行番号データN0=rlJと属性デー
タto=rl」が設定される。
After this, the process reaches line number 11. The branch destination has been changed to line number 1 by the RSH instruction at line number 5, so attribute section 2 is added and reverse upstream flag = "2" is set. Further, row number data N0=rlJ and attribute data to=rl are set.

(f)分岐元欄i (i=1.2.・・・〉この分岐元
欄のデータは分岐先命令とについて設定され、分岐先の
行番号データNoと、当該分岐命令の直前の命令が属す
る属性部番号frと、分岐先命令の属する属性部番号t
oとがそれぞれ設定される。
(f) Branch source column i (i = 1.2...> The data in this branch source column is set for the branch destination instruction, and the line number data No. of the branch destination and the instruction immediately before the branch instruction are The attribute part number fr to which the branch destination instruction belongs and the attribute part number t to which the branch destination instruction belongs.
o and are set respectively.

以下、分岐元欄のデータと属性部のデータとを用いて第
4表のプログラム例で逆上り解析可能であることを説明
する。逆上りフラグ=「l」について逆上ると、行番号
9で逆上りフラグ−「O」となるので分岐元欄を参照し
、行番号3の属性部1から分岐していることが理解され
る。さらに逆上り、行番号lですべての情報が確定する
。したがって逆上りフラグ=「1」に関する経路は行番
号10→9−3→2→lとなり、その処理内容は、[P
ORT1+o]+1つ[PORT1+O]    ・・
・(1〉となることが理解される。
Hereinafter, it will be explained that reverse upstream analysis is possible using the program example in Table 4 using the data in the branch source column and the data in the attribute section. When the reverse upstream flag = "l" is reversed, the reverse upstream flag becomes - "O" at line number 9, so refer to the branch source column and understand that it is branched from the attribute part 1 of line number 3. . Further, all the information is determined at line number l by going backwards. Therefore, the route related to reverse uplink flag = "1" is line number 10 → 9-3 → 2 → l, and the processing content is [P
ORT1+o]+1 [PORT1+O]...
・It is understood that (1>).

次に逆上りフラグ=「2」について逆上ると、まず属性
12が参照されるが、行番号9にて逆上リフラグ−rl
、に変更されるので、行番号8については属性部1が参
照される。これ以降、前述と同様に逆上って読取り、行
番号6にてすべての情報が確定する。これによれば処理
内容は、[PORT2+0]+1+1−[PORT2+
Oコ   =−(2)となることが理解される。
Next, when the reverse uplink flag = "2" is reversed, attribute 12 is first referenced, but at line number 9, the reverse uplink flag - rl
, so the attribute section 1 is referred to for line number 8. From this point on, the information is read backwards in the same manner as described above, and all information is determined at line number 6. According to this, the processing content is [PORT2+0]+1+1-[PORT2+
It is understood that Oko = - (2).

第4図は流れ構造解析手段11の動作を説明するフロー
チャートである。流れ構造解析手段11の動作の概略は
上記第2表〜第4表を参照して説明したが、以下にその
動作を詳述する3第4図ステップc1では解析を開始す
る行番号10を所定の値に設定し、また各種データを所
定の値に初期化する。ステップC2では処理が最給行ま
で到達したか否かを判断する。到達していなければ処理
はステップc3に移り、現在解析の対象となっている命
令の行番号Inに関して設定される属性部の個数を表す
配列CZ[in]がOであるか否かを判断する0個数配
列CZがOであれば、初めて解析する命令であることを
意味する。
FIG. 4 is a flowchart illustrating the operation of the flow structure analysis means 11. The outline of the operation of the flow structure analysis means 11 has been explained with reference to Tables 2 to 4 above, and the operation will be explained in detail below.3 In step c1 of FIG. and initialize various data to predetermined values. In step C2, it is determined whether the process has reached the highest pay line. If it has not been reached, the process moves to step c3, and it is determined whether the array CZ[in] representing the number of attribute parts set for the line number In of the instruction currently being analyzed is O. If the zero number array CZ is O, it means that this is the first instruction to be analyzed.

ステップc3の判断が否定であれば処理はステップC4
に移り、属性部の個数を1つ増加する。
If the judgment in step c3 is negative, the process proceeds to step C4.
, and increase the number of attribute parts by one.

ステップc5では第4表を参照して説明した属性データ
を設定する。ステップC6では行番号1nの命令が分岐
先行であるか否かを判断する。分岐先行であればステッ
プC7で第4表行番号4の命令における分岐元欄1など
の分岐元欄を設定し、ステップc8に移る。ステップc
6の判断が否定であればステップc9に移り、前記逆上
りフラグや順下りフラグを設定する。
In step c5, the attribute data explained with reference to Table 4 is set. In step C6, it is determined whether the instruction at line number 1n is a branch precedence. If the branch is precedence, a branch source column such as branch source column 1 for the instruction in row number 4 of the fourth table is set in step C7, and the process moves to step c8. step c
If the determination in step 6 is negative, the process moves to step c9, and the reverse uplink flag and forward downlink flag are set.

以下、上記逆上りフラグと順下りフラグとについて説明
する。第5図は流れ制御ファイル記憶部12の構造を説
明する図である。流れ制御ファイル記憶部12は、分岐
元ファイル部2■と属性ファイル部22とから構成され
る。第6図は分岐元ファイル部21の構造を説明する図
である6分岐元ファイル部21は行番号毎に設けられ、
当該行番号を分岐先とする分岐元命令の個数を記憶する
分岐元個数記憶部23と、第4表を参照して説明した分
岐光間に相当する分岐光間記憶部24がたとえば80領
域設定される。分岐光間記憶部24は行番号記憶部25
、分岐元属性記憶部26、分岐先属性記憶部27を含ん
で構成される。
The reverse uplink flag and forward downlink flag will be explained below. FIG. 5 is a diagram illustrating the structure of the flow control file storage section 12. As shown in FIG. The flow control file storage section 12 is composed of a branch source file section 22 and an attribute file section 22. FIG. 6 is a diagram explaining the structure of the branch source file section 21. The branch source file section 21 is provided for each line number,
A branch source number storage unit 23 that stores the number of branch source instructions whose branch destination is the line number, and a branch light inter-light storage unit 24 that corresponds to between the branch lights described with reference to Table 4 are set to, for example, 80 areas. be done. The branch light storage unit 24 is a line number storage unit 25.
, a branch source attribute storage section 26, and a branch destination attribute storage section 27.

第7[21は属性ファイル部22の構造を説明する図で
ある。属性ファイル部22は各行番号毎に設けられ、当
該行番号に設定された属性間の個数を記憶する属性個数
記憶部28、当該命令行の属性データが確定すれば「1
」、不定の場合は「0゜で表される不定フラグを記憶す
る不定フラグ記憶部2つ、第4表の属性間の属性データ
toに相当する属性値を記憶する属性値記憶部30、第
1図示の分岐条件ファイル記憶部16において当該行番
号の命令の分岐条件を記憶しているアドレスを記憶する
分岐条件記憶部31、第4表の属性間における行番号デ
ータNoと属性データtoとをそれぞれ記憶する分岐先
行番号記憶部32、分岐元属性記憶部33、第4表の属
性間のフラグに相当する逆上りフラグを記憶する逆上り
フラグ記憶部34、順下りフラグを記憶する順下りフラ
グ憶部35を含んで構成される。
7th [21] is a diagram illustrating the structure of the attribute file section 22. The attribute file section 22 is provided for each line number, and the attribute number storage section 28 stores the number of attributes set for the line number.
'', in the case of undefined, there are two undefined flag storage units that store an undefined flag represented by 0°, an attribute value storage unit 30 that stores an attribute value corresponding to the attribute data to between the attributes in Table 4, and an 1. In the illustrated branch condition file storage section 16, the branch condition storage section 31 stores the address storing the branch condition of the instruction with the corresponding line number, and stores the line number data No. and the attribute data to among the attributes in Table 4. A branch preceding number storage unit 32, a branch source attribute storage unit 33, a reverse uplink flag storage unit 34 that stores reverse uplink flags corresponding to the flags between the attributes in Table 4, and a forward downlink flag that stores forward downlink flags. It is configured to include a storage section 35.

前記順下りフラグは第4表のたとえば属性間1の順下り
フラグ欄に示すように設定される。すなわち、成行番号
の命令が直後の行番号の命令と連続した命令であれば「
1」、不連続な命令であれば「0」を与える。第4表の
行番号2は行番号3と連続する命令であり、前記データ
「1」が与えられる。ところが行番号3は行番号4の命
令とは連続せず、したがってデータrO」が与えられる
The forward descending flag is set as shown in the forward descending flag column of attribute 1 in Table 4, for example. In other words, if the command with the current line number is consecutive to the command with the immediately following line number,
If it is a discontinuous instruction, it is given "0". Line number 2 in Table 4 is an instruction that is continuous with line number 3, and the data "1" is given. However, line number 3 is not continuous with the instruction at line number 4, and therefore data rO'' is given.

第4図示ステップc7.c9では、上述したような内容
を有する逆上り属性、順下り属性および分岐光間が設定
される。
Fourth illustrated step c7. At c9, the reverse uplink attribute, forward downlink attribute, and branch light interval having the above-mentioned contents are set.

まずステップc8で当該命令が分岐命令であるか否かが
判断される0分岐命令であればステップcloに移り、
当該分岐命令が第4表行番号1YRET命令のような割
込み処理と終了させる命令であるか否かを判断する。こ
の判断が否定であればステップallに移り、分岐先行
番号を求める。
First, in step c8, it is determined whether or not the instruction is a branch instruction.If it is a 0 branch instruction, the process moves to step clo;
It is determined whether the branch instruction is an instruction to terminate interrupt processing, such as the YRET instruction in row number 1 of Table 4. If this judgment is negative, the process moves to step all, and the branch precedence number is determined.

これは第1図のリストファイル記憶部6を参照して求め
られる。ステップc12では、分岐の数を表す分岐数デ
ータbiを+1インクリメントし、ステップc13では
当該分岐数データbiと当該行番号を配列m、 m(bi)=1n             −<3)
で対応付ける。
This is determined by referring to the list file storage section 6 in FIG. In step c12, branch number data bi representing the number of branches is incremented by +1, and in step c13, the branch number data bi and the line number are arrayed m, m(bi)=1n -<3).
Match with .

ステップc14では、後述するようにスタックの変化が
チエツクされる。ステップc15では属性データが計算
されステップc16では次の行番号を変数Nnに設定し
、処理をステップc2に戻す、前記ステップc8の判断
が否定であれば処理はステップc14に移る。
At step c14, changes in the stack are checked as described below. At step c15, attribute data is calculated, and at step c16, the next row number is set in the variable Nn, and the process returns to step c2. If the determination at step c8 is negative, the process moves to step c14.

前記ステップc3の判断が肯定であれば当該命令は初め
て解析する命令行ではないことになり、ステップc17
で同一属性を有する属性間が存在するか否かが判断され
る。この判断が否定であればステップC4に移り、属性
間が増加される。ステップc17の判断が肯定であれば
ステップc18に移り、当該分岐命令が分岐先行である
か否かが判断される0分岐先行であればステップc19
で、第4表の分岐光間が設定され、ステップC20に移
る。ステップc18の判断が否定であればステップc2
1において前記ステップC9で説明した逆上りフラグお
よび順下りフラグが設定される。ここでステップc19
.c21の後、ステップc17の判断が肯定となってい
るので同−属性間がすでに存在していることになり、こ
の属性に関しては解析は終了しており、再び解析を行う
ことなく解析処理が終了され、ステップc20に処理を
移している。
If the judgment in step c3 is affirmative, it means that the command is not the first command line to be analyzed, and step c17
It is determined whether or not there are attributes having the same attribute. If this judgment is negative, the process moves to step C4, and the number of attributes is increased. If the judgment in step c17 is affirmative, the process moves to step c18, and it is determined whether or not the branch instruction is a branch precedence.If the branch instruction is 0 branch precedence, step c19
Then, the distance between the branched lights shown in Table 4 is set, and the process moves to step C20. If the judgment in step c18 is negative, step c2
1, the reverse uplink flag and the forward downlink flag described in step C9 are set. Here step c19
.. After c21, since the judgment in step c17 is affirmative, it means that the same attribute already exists, and the analysis has been completed for this attribute, and the analysis process ends without performing analysis again. Then, the process moves to step c20.

ステップc20では前記分岐数データbiが(であるか
否かが判断される。肯定であれば処理に終了する。否定
であれば解析処理が終了していくいことになり、ステッ
プC20に前記ステップ(13で記憶した分岐命令の行
番号inを前記配夕1m(bi)にて読出し、またステ
ップc23に【分岐数データbiを−lデクリメントし
、処理(こステップc2に戻る。すなわちステップc2
2て続出された行番号1nがら再び解析処理を行う。
In step c20, it is determined whether or not the branch number data bi is (.If affirmative, the process ends.If negative, the analysis process ends, and step C20 returns to the step (). The line number in of the branch instruction stored in step 13 is read out in the data 1m(bi), and in step c23, the branch number data bi is decremented by -l, and the process (returns to step c2. That is, step c2
2, the analysis process is performed again using the row numbers 1n that are successively generated.

第8図4、分岐条件解析手段13の動作を説すするフロ
ーチャートである。上記第4表に示したプログラム内容
に即して分岐条件解析処理にっtて説明する。第8図ス
テップd1では行番号s1nをOに設定し、ステップd
2では行番号si’nを+lインクリメントする。ステ
ップd3では止該行番号Inがプログラムの最終行番号
、ずな4二ち第4表のプログラム例では行番号11を超
えたか否かを判断する。超えていれば処理は終了し、超
えていなければステップd4に移る。ステップd4では
行番号Inの命令が分岐命令であるが否かを判断する。
FIG. 8 is a flowchart illustrating the operation of the branch condition analysis means 13. The branch condition analysis process will be explained based on the program contents shown in Table 4 above. In step d1 of FIG. 8, line number s1n is set to O, and step d
In step 2, the line number si'n is incremented by +l. In step d3, it is determined whether or not the line number In exceeds the last line number of the program, ie, line number 11 in the program example shown in Table 4. If it exceeds the limit, the process ends, and if it does not exceed the limit, the process moves to step d4. In step d4, it is determined whether the instruction at line number In is a branch instruction or not.

上記プログラム例では、行番号1は分岐命令ではなく処
理はステップb2へ戻り、次の行番号の命令へ進む。行
番号3で分岐命令であることが判断され、ステップd5
へ進む。
In the above program example, line number 1 is not a branch instruction, and the process returns to step b2 and proceeds to the instruction at the next line number. It is determined that line number 3 is a branch instruction, and step d5
Proceed to.

ステップd5では、属性間番号を表す変数kをOに設定
し、ステップd6では変数kを+1インクリメントする
。ステップd7では、当該行番号inの命令に関する属
性間の個数を表す配列C2(Nn)に関して、 k≦CZ C1n)             −(4
)の判断を行う。この判断が否定であれば、第4図に示
した流れ11造解析処理の際の命令毎の属性間の個数を
超過したことになり、すなわち当該分岐命令におけるす
べての属性について分岐条件解析が終了したことになり
、処理はステップd2へ移り、次の行番号の命令へ進む
In step d5, the variable k representing the inter-attribute number is set to O, and in step d6, the variable k is incremented by +1. In step d7, regarding the array C2 (Nn) representing the number of attributes related to the instruction at the line number in, k≦CZ C1n) −(4
). If this judgment is negative, it means that the number of attributes for each instruction during the flow 11 structure analysis process shown in Figure 4 has been exceeded, that is, branch condition analysis has been completed for all attributes in the branch instruction. Therefore, the process moves to step d2 and proceeds to the instruction of the next line number.

ステップd7の判断が肯定であればステップd8へ移り
、当該行番号Inの前記命令における属性間番号kに沿
って後述する逆上り処理を開始して逆上り経路を求める
。前述したように分岐命令の分岐条件を確定するに必要
な命令には、後述する関与フラグを設定する。ステップ
d9では、後述するように逆上って読取った命令毎の実
行内容を分岐条件としてfIII或する。ステップdl
Oではこのようにして得られた分岐条件を第1図示の分
岐条件ファイル記憶部16に記憶する。
If the determination in step d7 is affirmative, the process moves to step d8, and a reverse upstream process, which will be described later, is started along the inter-attribute number k in the instruction of the line number In to find a reverse upstream path. As described above, a participation flag, which will be described later, is set for the instruction necessary to determine the branch condition of the branch instruction. In step d9, as will be described later, the execution content of each instruction read backward is set as a branch condition. step dl
At O, the branch condition obtained in this manner is stored in the branch condition file storage section 16 shown in the first diagram.

第9図は、第8図のステップd8の逆上り処理の詳細を
説明するフローチャートである。第9図ステップe1で
は、後述する制御変数swが0に初期化される。ステッ
プe2では、上記制御変数SWがOであるか否かを判断
し、肯定であればステップe3に移り、第4表の属性間
に示される逆上りフラグをチエツクして、逆上りフラグ
が0のとき制御[数sw=2とし、逆上りフラグが0以
内のときs w = iと設定する。この後、処理はス
テップe2に戻る。
FIG. 9 is a flowchart illustrating details of the reverse upstream process in step d8 of FIG. At step e1 in FIG. 9, a control variable sw, which will be described later, is initialized to zero. In step e2, it is determined whether or not the control variable SW is O. If it is affirmative, the process moves to step e3, where the reverse uplink flag shown between the attributes in Table 4 is checked, and the reverse uplink flag is set to 0. When the control [number sw=2 is set, and when the reverse uplink flag is within 0, sw=i is set. After this, the process returns to step e2.

第10図は、前記ステップe3の逆上り判断処理の詳細
を説明するフローチャートである。第10図ステップf
1では、第4表行番号3の属性間1の属性データtoで
示される属性n番号を読出す、上記例ではt o = 
r I Jであり、属性間1が読出される。ステップf
2では、属性間1の逆上りフラグの値を前記属性データ
toの値に設定する。ステップf3では、属性データt
oがOであるか否かを判断する。0であれば前行の命令
とは実行順に関する連続性が失われていることになり、
ステップf4で前記制御変数sw=2に設定して処理は
終了する。
FIG. 10 is a flowchart illustrating details of the reverse upstream determination process in step e3. Figure 10 Step f
1 reads the attribute n number indicated by the attribute data to between attributes 1 in row number 3 of the fourth table. In the above example, to =
r I J, and 1 between attributes is read. step f
In step 2, the value of the reverse uplink flag of attribute 1 is set to the value of the attribute data to. At step f3, attribute data t
Determine whether o is O. If it is 0, it means that continuity with respect to the execution order with the previous instruction has been lost.
In step f4, the control variable sw is set to 2, and the process ends.

前記ステップf3で判断が否定であれば、前行の命令と
は処理が連続していることになり、ステップf5にて制
御変数SW= 1に設定する。ステップf6では、行番
号を表す変数/nを−lデクリメントして処理を終了す
る。第4表のプログラムと例の行番号3では属性データ
to=rl」であり、この場合、制御変数S W −1
となる。
If the determination at step f3 is negative, it means that the processing is continuous with the previous command, and the control variable SW=1 is set at step f5. In step f6, the variable /n representing the line number is decremented by -1 and the process is terminated. In line number 3 of the program and example in Table 4, the attribute data to=rl, and in this case, the control variable SW −1
becomes.

再び第9図を参照して、前記ステップe2の判断が否定
であればステップe4へ移り、制御変数sw=1である
が否かを判断する。肯定であればステップe5へ移り、
上記分岐命令の分岐条件を確定するに必要な情報が全て
得られているとき、対応する逆上りフラグをクリアし、
新たに必要な情報を対応するフラグをセラ)・する。全
てのフラグがクリアされたとき、制御変数sw=4と設
定され、これ以外のときには制御変数5W=Oに設定さ
れる。この後、処理はステップe2に戻る。
Referring again to FIG. 9, if the determination at step e2 is negative, the process moves to step e4, and it is determined whether the control variable sw=1 or not. If affirmative, move to step e5,
When all the information necessary to determine the branch condition of the above branch instruction is obtained, clear the corresponding reverse up flag,
Set the flag corresponding to the newly required information. When all the flags are cleared, the control variable sw is set to 4; otherwise, the control variable 5W is set to O. After this, the process returns to step e2.

第11図は、前記ステップe5の逆上り情報設定処理の
詳細を説明するフローチャートである。
FIG. 11 is a flowchart illustrating details of the reverse upstream information setting process in step e5.

第1112]ステツプg1では、被解析プログラムを1
行ずつ逆上る毎に+1インクリメントされる逆上り行カ
ウンタrcを+1インクリメントする。
1112] In step g1, the program to be analyzed is
A reverse up row counter rc, which is incremented by +1 each time a row is reversed, is incremented by +1.

ステップg2では、逆上り用カウンタCrlを変数とし
、行番号In、属性データto、分岐欄番号ndおよび
分岐命令またはストア命令の分岐条件、またはストア条
件を確定するに必要な命令の行番号rnQを一時的に記
憶するワークメモリmに、先ず逆上った行番号Inを記
憶する。
In step g2, the reverse up counter Crl is used as a variable, and the line number In, attribute data to, branch field number nd, branch condition of a branch instruction or store instruction, or line number rnQ of an instruction necessary to determine the store condition are set. First, the backward row number In is stored in the temporarily stored work memory m.

ステップg3では同じくワークメモリmに逆上った命令
の属性データtoを記憶する。ステップg4では、逆上
った行番号に対応する第6図示の分岐元ファイル部21
の分岐光間21において、当該命令の属性データtoと
同一属性へ分岐している分岐元命令の個数を計数し、記
憶する。また、前記ワークメモリmに記憶された分岐元
命令毎に分岐光間番号ntをワークメモリmに記憶する
At step g3, the attribute data to of the instruction that has been uploaded is also stored in the work memory m. In step g4, the branch source file section 21 shown in FIG.
In the branch light interval 21, the number of branch source instructions branching to the same attribute as the attribute data to of the instruction is counted and stored. Further, a branch light number nt is stored in the work memory m for each branch source instruction stored in the work memory m.

ステップg5では、前記ステップg2〜g4で得られた
各種データが必要であるか否かを判断する。第4表の行
番号3のCALL命令は、無条件分岐命令であり、した
がって行番号2の上記各種データは不・e・要であり、
判断は否定となる。一方、第4表行番号3が前記第1表
行番号5のBBC命令のように条件付き分岐命令であっ
て、行番号2がその分岐条件に関与するならばステップ
g7へ移り、そのような命令毎に与えられる番号を前記
ワークメモリに記憶する。ステップg8では、前記ワー
クメモリ以外の情報フラグをクリアし、ステップg9に
移る。
In step g5, it is determined whether the various data obtained in steps g2 to g4 are necessary. The CALL instruction at line number 3 in Table 4 is an unconditional branch instruction, so the various data listed above at line number 2 are unnecessary, e, and necessary.
The judgment is negative. On the other hand, if line number 3 of the fourth table is a conditional branch instruction like the BBC instruction of line number 5 of the first table, and line number 2 is involved in the branch condition, the process moves to step g7, and such A number given to each command is stored in the work memory. In step g8, the information flag other than the work memory is cleared, and the process moves to step g9.

ステップg9では、新たな必要情報があるか否かが判断
され、あればステップgloで新たな情報フラグを設定
し、ステップgllに移る。前記ステップg5の判断が
否定の場合、前記ワークメモリm (rcrno>には
データ「0」が設定され、ステップgllに移る。ステ
ップg9の判断が否定の場合も同様である。
In step g9, it is determined whether or not new necessary information exists, and if so, a new information flag is set in step glo, and the process moves to step gll. If the determination in step g5 is negative, data "0" is set in the work memory m (rcrno>, and the process moves to step gll. The same applies if the determination in step g9 is negative.

ステップgllでは、分岐条件やストア命令の内容を確
定するためにさらに新たな情報が必要が否かを表す必要
情報フラグが「0」であるか否がを判断する。すなわち
、必要情報フラグがrl。
In step gll, it is determined whether a necessary information flag indicating whether new information is required to determine the branch condition or the contents of the store instruction is "0". That is, the necessary information flag is rl.

のとき、逆上り解析処理が出発した前記分岐命令やスI
・ア命令の実行内容が確定したことになり、処理はステ
ップg12へ移り、前記制御変数SW−「4」とする、
これは後述するように、前記ワークメモリmに記憶され
たデータを第1図の分岐条件ファイル記憶部16に書込
む処理を行うためである。また、前記ステップgllの
判断が否定であれば、処理はステップg13に移り、制
御変数5W=rOJに設定される。これは後述するよう
に、処理が第9図ステップ62 /\戻ったとき、ステ
ップe3へ移って逆上り処理を続行するためて′ある。
, the branch instruction or step I from which the reverse upward analysis process started
- The execution content of the instruction A has been determined, and the process moves to step g12, where the control variable SW- is set to "4".
This is to write the data stored in the work memory m into the branch condition file storage section 16 of FIG. 1, as will be described later. If the determination at step gll is negative, the process moves to step g13, where the control variable 5W is set to rOJ. This is because, as will be described later, when the process returns to step 62/\ in FIG. 9, it moves to step e3 to continue the reverse upstream process.

このようにして第1図ステップe5が実行され、処理は
ステップe2に戻る。前記ステップe4の判断が否定で
あればステップe6へ移り、制御変数SW=「2」であ
るか否かが判断される。この場合は、ステップe3で説
明したように、逆上りフラグ=「○」であって、行番号
が直前の命令とは処理の順序が連続していない命令であ
る場合を示している。このような場合には、逆上り解析
処理を分岐させる必要があるため、ステップe7に移る
。ステップe7では、後述するように逆上り解析処理の
分岐先の行番号を求め、制御変数SW=「1」として処
理をステップe2に戻す。
In this way, step e5 in FIG. 1 is executed, and the process returns to step e2. If the determination at step e4 is negative, the process moves to step e6, where it is determined whether the control variable SW=2. In this case, as explained in step e3, the reverse uplink flag is set to "○", indicating that the line number is an instruction whose processing order is not consecutive with the immediately preceding instruction. In such a case, it is necessary to branch the reverse upstream analysis process, so the process moves to step e7. In step e7, as will be described later, the line number of the branch destination of the reverse upward analysis process is determined, and the control variable SW is set to "1" and the process returns to step e2.

第12図は、第1図ステップeフの逆上り分岐処理の詳
細を示すフローチャートである。第11図ステップh1
では、第11図ステップg4で分岐光間番号が記憶され
たワークメモリm[rc。
FIG. 12 is a flowchart showing details of the reverse upstream branch processing in step e of FIG. 1. Figure 11 Step h1
Then, in step g4 of FIG. 11, the work memory m[rc] stores the branch light number.

nd (cn)]から分岐元欄番号を読出し、第4表に
示されるような分岐光間1などにおいて、対応する分岐
元行番号データNoや、分岐元の属性データすなわち分
岐元属性欄番号frを求め、行番号Inに前記分岐元行
番号データNOを設定しステップh2では属性データt
oに分岐元属性データを設定する。
nd (cn)], and read the branch source column number from the branch light interval 1 as shown in Table 4, and read the corresponding branch source row number data No. and the attribute data of the branch source, that is, the branch source attribute column number fr. , set the branching source line number data NO in the line number In, and set the attribute data t in step h2.
Set branch source attribute data to o.

ステップh3では、第11図ステップg4で設定された
分岐個数データm[rc]、cnを〜1デクリメントす
る。この後、ステップh4で前記制御変数5W−r I
 Jとし、処理は終了する。
In step h3, the branch count data m[rc] and cn set in step g4 in FIG. 11 are decremented by ~1. After this, in step h4, the control variable 5W-r I
J, and the process ends.

このように第1図ステップeフの処理が終了してステッ
プe2に戻る。ステップe6の判断が否定であればステ
ップe8に移り、制御変数S W =「3」であるか否
かを判断する。この判断が肯定であればステップe9に
移り、逆上り解析を保留している解析経路の開始行番号
を求め、制御変数5W=r2」として処理をステップe
2へ戻す。
In this way, the process of step e in FIG. 1 is completed and the process returns to step e2. If the determination in step e6 is negative, the process moves to step e8, and it is determined whether the control variable S W = "3". If this judgment is affirmative, the process moves to step e9, where the starting line number of the analysis route for which reverse upstream analysis is pending is determined, and the process is performed at step e, setting the control variable 5W=r2.
Return to 2.

第13図は第1図ステップe9の未解析データ処理の詳
細を示すフローチャートである。第13図ステラプル1
では、逆上り経路カウンタreが「O」であるか否かを
判断する。すなわち、未解析の逆上り解析経路が残って
いるかどうかを判断する。このような未解析逆上りルー
トが存在しなければステップp2に移り、制御変数SW
−’5Jとして処理を終了する。ステップp1の判断が
否定であればステップp3に移り、逆上り経路カウンタ
rcを〜1デクリメントし、ステップp4にて第11図
ステップg4で説明した分岐個数ワークデータm(rc
)、cnがOであるか否かを判断する。Oであれば処理
はステップpiに戻り、他の未解析経路に関して同様な
処理を行う。
FIG. 13 is a flowchart showing details of the unanalyzed data processing at step e9 in FIG. Figure 13 Stellar pull 1
Then, it is determined whether the reverse up route counter re is "O" or not. In other words, it is determined whether there are any unanalyzed reverse upward analysis routes remaining. If such an unanalyzed reverse upward route does not exist, the process moves to step p2, and the control variable SW
−'5J and ends the process. If the judgment in step p1 is negative, the process moves to step p3, where the backward up route counter rc is decremented by ~1, and in step p4, the branch number work data m(rc
), it is determined whether cn is O or not. If it is O, the process returns to step pi, and similar processes are performed for other unanalyzed routes.

ステップp4の判断が否定であればステップp5に移り
、制御変数5W=r2Jに設定して処理を終了する。
If the determination in step p4 is negative, the process moves to step p5, sets the control variable 5W=r2J, and ends the process.

再び第9図を参照して、このようにしてステップe9の
未解析ルート解析処理が終了して処理はステラ7e2に
戻る。ステップe8の判断が否定であればステップel
oに移り、制9j変数SW=「4」であるか否かを判断
する。肯定であれば、逆上り解析処理は想定される全て
の逆上り解析経路に関して終了していることになり、ス
テップe、11にて得られた解析経路、すなわち逆上り
解析経路を構成する各命令の行番号データを第1図の分
岐条件ファイル16に書込む。未解析経路が残っている
場合には、制御変数5W=r3.と設定される。
Referring again to FIG. 9, the unanalyzed route analysis process of step e9 is thus completed and the process returns to Stella 7e2. If the judgment in step e8 is negative, step el
Moving to step o, it is determined whether or not variable SW=4. If affirmative, it means that the reverse upstream analysis process has been completed for all assumed reverse upstream analysis routes, and the analysis route obtained in steps e and 11, that is, each instruction constituting the reverse upstream analysis route The line number data of is written to the branch condition file 16 in FIG. If unanalyzed routes remain, control variable 5W=r3. is set.

第14図は、第9図ステップellの処理を詳述するフ
ローチャートである。第11図ステップq1で前記逆上
り経路カウンタrcがOであるか否かが判断される。O
であれば、前逆上り経路に亘って解析が終了したことに
なり、前述した経路データの記憶処理を行い、処理は終
了する。ステップqlの判断が否定であれば、ステップ
q3に移り、制御変数5W=r3’Jに設定して処理を
終了する。
FIG. 14 is a flowchart illustrating the process of step ell in FIG. 9 in detail. At step q1 in FIG. 11, it is determined whether the reverse upward route counter rc is O or not. O
If so, it means that the analysis of the previous and reverse uphill routes has been completed, and the above-mentioned route data storage process is performed and the process ends. If the determination in step ql is negative, the process moves to step q3, sets the control variable 5W=r3'J, and ends the process.

再び第9図を参照して、このようにしてステップell
でデータの書込み処理が終了して処理はステップe2に
戻る。ステップe10の判断が否定の場合、第13図ス
テラプル2で説明したように、全解析経路に亘って解析
が終了していることになり、第1図ステップd8で説明
したプロゲラ11を逆上る経路を求める処理が終了する
Referring again to FIG. 9, in this way step ell
The data writing process ends and the process returns to step e2. If the judgment in step e10 is negative, it means that the analysis has been completed for all analysis paths as explained in FIG. The process for determining the value ends.

第1図ステップd9では、ステップd8で得られた逆上
り解析経路毎に分岐条件を合成する処理を行う。上記第
2表〜第3表における分岐命令は、無条件分岐命令であ
り、第1表のプログラム例に関して説明する。このプロ
ゲラ1.、例の分岐命令は、行番号5のBCC命令であ
り、前述した逆上る経路を求める処理に従えば行番号5
から出発する逆上り解析経路として行番号5−4−’ 
3−2−’ 1が得られる。
At step d9 in FIG. 1, processing is performed to synthesize branch conditions for each reverse upstream analysis route obtained at step d8. The branch instructions in Tables 2 and 3 above are unconditional branch instructions, and will be explained with reference to the program example in Table 1. This progera 1. , the branch instruction in the example is a BCC instruction with line number 5, and if you follow the process of finding the backward path described above, line number 5
Line number 5-4-' as a reverse upward analysis route starting from
3-2-' 1 is obtained.

すなわち、行番号5の分岐命令の分岐条件は行番号4で
得られる、 A−#8≧0            ・・・〈5〉で
あり、変数Aが未確定である。行番号3で変数Aについ
て、 A←(A−B)             ・・・(6
)の演算が行われ、未確定変数はA、Bとなる。行番号
2〜1の命令にて A=#3              ・・〈7)B=
#5               ・(8)が得られ
、変数A、Bは確定する。したがって、これらを合成す
ると、分岐条件として 3*5−8 ≧8                ・
・・(9〉が得られる。
That is, the branch condition of the branch instruction at line number 5 is obtained at line number 4, A-#8≧0...<5>, and variable A is undefined. Regarding variable A in line number 3, A←(A-B)...(6
) is performed, and the undefined variables become A and B. A=#3 with the commands in line numbers 2 to 1...<7) B=
#5 ・(8) is obtained, and variables A and B are determined. Therefore, when these are combined, the branching condition is 3*5-8 ≧8 ・
...(9> is obtained.

第8図のステップdloでは、このようにしてステップ
d9で得られた分岐条件を第1図分岐条件ファイル記憶
部16に記憶する。このようにして、被解析プログラム
を分岐命令がち逆上り、分岐条件を求める処理は終了す
る。
In step dlo of FIG. 8, the branch condition thus obtained in step d9 is stored in the branch condition file storage section 16 of FIG. In this way, the program to be analyzed is redirected to a branch instruction, and the process of determining the branch condition is completed.

また、第4表のプログラム例において、実行内容を求め
る処理は、第8図ステップd8で得られた逆上り解析経
路を、たとえば行番号10のST命令から開始すること
によって得られる。得られた第1の解析経路は、前述し
たように 行番号lO→3−2→l である、この経路に沿って前記分岐束f↑を合成した手
法と同様な技術により、実行内容を合成すると、 [PORT1+0] +1− [PORT1+O]  
・(IO>[PORT1]は、アドレスPORTに格納
されたデータを示す。
Further, in the program example shown in Table 4, the process for determining the execution details can be obtained by starting the reverse upward analysis path obtained in step d8 in FIG. 8 from, for example, the ST instruction at line number 10. The obtained first analysis path is line number lO→3-2→l as described above, and the execution contents are synthesized using the same technique as the method of synthesizing the branch bundle f↑ along this path. Then, [PORT1+0] +1- [PORT1+O]
-(IO>[PORT1] indicates data stored at address PORT.

が得られる。すなわちアドレスPORTIにプリセット
データOを加えたアドレスの内容にデータ1を加えたも
のを同一アドレスに再び格納する処理、すなわちアドレ
スPORTIのデータを+lインクリメントする処理を
示している。
is obtained. In other words, it shows the process of storing again the contents of the address PORTI plus the preset data O plus data 1 at the same address, that is, the process of incrementing the data at the address PORTI by +1.

他の解析経路は、 行番号10−9−8→6−5→4 となる、この経路に沿って実行内容を合成すると、[P
ORT2+O]   +  1   +   1  →
  [POr(T2.+0’1・・・(11) となり、アドレスPORT2のデータを2ずつインクリ
メントする処理であることが判る。このような実行内容
のデータは、第ttgの実行内容ファイル記憶部17に
記憶される。
The other analysis path is line number 10-9-8 → 6-5 → 4. If the execution contents are synthesized along this path, [P
ORT2+O] + 1 + 1 →
[POr(T2.+0'1...(11)), and it can be seen that the process increments the data at address PORT2 by 2. Such execution content data is stored in the ttg execution content file storage unit 17. is memorized.

以上のようにして本実施例に従えば、上記第2表〜第4
表や第5図〜第7図に示した分岐光間の各データや属性
欄を構成する各データを、逆上り解析処理に先立って設
定するようにしたので、逆上り解析時においてプログラ
ムの実行順序に矛盾する不所望な逆上り解析経路が選択
されて、無駄な処理が行われる事態を防ぐことができる
If this embodiment is followed as described above, the above Tables 2 to 4
Since each data between the branched lights and the data composing the attribute column shown in the table and Figures 5 to 7 are set prior to reverse upstream analysis processing, the program can be executed during reverse upstream analysis. It is possible to prevent unnecessary processing from being performed due to selection of an undesired reverse upward analysis path that contradicts the order.

また本実施例では、前記第2表に示したプログラム例の
行番号9〜1.1のサブルーチンプログラムAのように
、行番号3のCALL命令で呼出されるとともに、行番
号6のCALL命令で呼出されたサブルーチンプログラ
ムBが呼出されることにより再び実行されるような命令
列において、複数の分岐命令毎に解析経路を識別する属
性データを設定するようにしている。
Furthermore, in this embodiment, like the subroutine program A in line numbers 9 to 1.1 of the program example shown in Table 2, it is called by the CALL instruction in line number 3, and it is called by the CALL instruction in line number 6. In an instruction sequence that is executed again when the called subroutine program B is called, attribute data for identifying an analysis path is set for each of a plurality of branch instructions.

したがって、このようなサブルーチンプログラムの中か
ら逆上り解析処理を行うに際して、CALL命令などの
呼出し箇所に応じた解析経路を設定することができ、誤
った解析経路が設定される事態を防ぐことができる。
Therefore, when performing reverse upstream analysis processing from such a subroutine program, it is possible to set an analysis path according to the call location such as a CALL command, and it is possible to prevent a situation in which an incorrect analysis path is set. .

以下、第4表の属性欄における順下がりフラグについて
説明する。
The descending order flag in the attribute column of Table 4 will be explained below.

第15図はこの順下がりフラグを用いる理由を説明する
プログラム例を示すフローチャートであり、第16図は
第15図示の10グラム実行時に用いられるスタック3
6の記憶内容を説明する図である。メイ〉′ルーチンプ
ログラムの実行時にサブルーチンプログラムが呼出され
ると、第16121(1)に示すようにスタック36に
は戻りアドレスが格納されてスタックポインタは+1イ
ンクリメントされ、処理はたとえば第15図示のサブル
ーチンプログラムに移る。
FIG. 15 is a flowchart showing a program example explaining the reason for using this descending order flag, and FIG.
6 is a diagram illustrating the stored contents of No. 6. FIG. When the subroutine program is called during the execution of the routine program, the return address is stored in the stack 36 as shown in 16121 (1), the stack pointer is incremented by +1, and the processing is performed, for example, in the subroutine shown in Fig. 15. Move on to the program.

第15図のサブルーチンプログラムにおいて、ステップ
r1でスタック36に新たなアドレスデータを書込むブ
ツシュ命令PSHが実行されると、スタック36には第
16図(2)図示のようにアドレスデータが書込まれ、
スタックポインタは+1インクリメントされる。これ以
降、処理がステップr2.r3.r4.r5と進行した
場合、スタック36から最新に書込まれたアドレスデー
タを読出してスタックポインタを一1デクリメントする
プル命令PULLによりスタック36では、第16図(
3)に示すように前記アドレスデータが消去され、戻り
アドレスのみが残る状態となる。
In the subroutine program of FIG. 15, when the bush command PSH for writing new address data into the stack 36 is executed in step r1, the address data is written into the stack 36 as shown in FIG. 16 (2). ,
The stack pointer is incremented by +1. From this point on, the process proceeds to step r2. r3. r4. r5, the stack 36 reads the most recently written address data from the stack 36 and decrements the stack pointer by one (1).
As shown in 3), the address data is erased, leaving only the return address.

第15図示のようなサブルーチンプログラムにおいて、
前記スタック操作命令PSHとスタック操作命令PUL
Lとが単一のサブルーチンプログラム内で1個ずつ組と
なっているか否かを検査しようとする場合を惣定する。
In a subroutine program as shown in Figure 15,
The stack operation instruction PSH and the stack operation instruction PUL
A case is determined in which it is to be checked whether or not L and L are paired one by one within a single subroutine program.

このとき逆上り処理では、下記の3種類の経路が存在す
る。
At this time, in the reverse upstream process, there are the following three types of routes.

行番号R7,R6・・・〈12) 行番号R7,R6,R2,R1’    、・、(13
)行番号R7,R5,R4,R3,R2,R1・・・(
14)である、したがって、前記検査を行う場合、第1
2式の経路についても検査することになり、スタック操
作命令に全く関係を有さない無駄な検査を行ってしまう
ことになる。したがって、前記のような検査を行う場合
、プログラムの実行順に命令を読取って検査を行う手法
が無駄な処理を省く点で有利である。
Line numbers R7, R6...<12) Line numbers R7, R6, R2, R1',... (13
) Line numbers R7, R5, R4, R3, R2, R1...(
14) Therefore, when performing the above inspection, the first
This means that the paths of the two formulas will also be inspected, resulting in unnecessary inspections that are completely unrelated to the stack manipulation instruction. Therefore, when performing the above-mentioned inspection, a method of reading instructions in the order of program execution and performing the inspection is advantageous in that it eliminates unnecessary processing.

このため本実施例では、第4表の属性欄に才3ける順下
がりフラグを設定するようにした。この順下がりフラグ
は、前述したように、ある命令が次の行番号の命令と実
行順序に関して連続した命令であるか否かを識別するフ
ラグである。この順下がりフラグを前述の実施例におい
て説明した逆上りフラグと同様な手法にて用いることに
より、被解析プログラムを順下がりの経路にて読取って
解析を行うことができる。これにより無駄な処理は省か
れ、処理の高速化と高効率化とを図ることができる。
For this reason, in this embodiment, a flag for lower rank by 3 is set in the attribute column of Table 4. As described above, this descending order flag is a flag for identifying whether or not a certain instruction is a consecutive instruction with respect to the instruction of the next line number in terms of execution order. By using this descending order flag in the same manner as the reverse ascending flag explained in the above embodiment, it is possible to read and analyze the program to be analyzed along the descending route. This eliminates unnecessary processing, making it possible to increase processing speed and efficiency.

前述の第4表のプログラム例において、サブルーチンプ
ログラムAに対し、複数のCALL命令が配置される場
合、同表の分岐入間および属性欄は、CA L L命令
の数だけ設定されることになる。
In the program example shown in Table 4 above, if a plurality of CALL instructions are placed in subroutine program A, the branch entry and attribute columns in the table will be set for the number of CALL instructions.

このようなサブルーチンプログラムがその中でスタック
の内容を変化させないならば、異なるCALL命令によ
って呼出された場合でも実行内容は同一であり、このよ
うな場合には後述するように分岐入間および属性欄に割
りあてられるメモリの容量を削減することができる。
If such a subroutine program does not change the contents of the stack, the execution content will be the same even if it is called by a different CALL instruction, and in such a case, the branch entry and attribute column will be The amount of memory allocated can be reduced.

このような本実施例の動作例を、下記第5表のプログラ
ム例に沿って説明する。
An example of the operation of this embodiment will be explained along with the example program shown in Table 5 below.

(以下余白) 上記の第5表の分岐入間および属性桐のデータは、上記
第4表を参照して説明したデータの設定方法に基づいて
設定されている。ここで前述したように、分岐入間およ
び属性欄に割りあてられるメモリの容量を削減するため
に、第5表のプログラム例に基づいて下記第6表のよう
な分岐入間および属性欄を作成する。
(The following is a blank space) The data for the branched entrance hall and the attribute paulownia in Table 5 above are set based on the data setting method explained with reference to Table 4 above. As described above, in order to reduce the memory capacity allocated to the branch entries and attribute columns, branch entries and attribute columns as shown in Table 6 below are created based on the program example in Table 5.

第  6  表 上記第5表と第6表とでは、 下線を付したデー 夕が変更されている。すなわち、行番号3のCAL L
命令とこれより分岐した行番号8〜10の命令列、およ
びリターン命令RETによりさらに分岐した行番号4に
関する分岐光間や属性部の決定に関しては、上記第5艮
と同様に設定される。引続き行番号6を読取ったとき、
行番号8に分岐する。
Table 6 The underlined data has been changed between Tables 5 and 6 above. That is, CAL L of line number 3
The determination of the branch light intervals and attribute parts regarding the instruction, the instruction string of line numbers 8 to 10 branched from this, and the line number 4 further branched by the return instruction RET are set in the same manner as in the fifth case. When I continue reading line number 6,
Branches to line number 8.

第4表の例では新たな分岐元n2および属性部2が設定
されるが、本実施例は同一のザブルーチンプログラムを
解析するため、このような分岐元(資)および属性部の
増加を行わず、分岐元n1の行番号8において、行番号
データN0=rO,と設定し、また行番号4の属性デー
タf r= rO」と設定する。さらに、行番号8の属
性1jIIt o−r O。
In the example in Table 4, a new branch source n2 and attribute section 2 are set, but in this embodiment, since the same subroutine program is analyzed, such an increase in the branch source (source) and attribute section is performed. First, in line number 8 of branch source n1, line number data N0=rO is set, and attribute data of line number 4 is set as f r=rO. Furthermore, the attribute 1jIIt or O of line number 8.

と設定する。このようなデータ「O」を用いて、行番号
6のCALL命令に基づく行番号8〜10のサブルーチ
ンプログラムの解析を終了したことを表示する。
and set. Such data "O" is used to indicate that the analysis of the subroutine program at line numbers 8 to 10 based on the CALL instruction at line number 6 has been completed.

このとき、属性部も同様に、行番号l→2→3−8→9
−1. O→4→5までの解析が終了した段階では、第
5表の属性Ia1のようなデータが設定されるが、行番
号6以降の前述のような処理によって属性部2を増設せ
ず、第6表の属性n1のようなデータが設定される。
At this time, the attribute part is also line number l → 2 → 3-8 → 9.
-1. At the stage when the analysis from O → 4 → 5 is completed, data such as attribute Ia1 in Table 5 is set, but attribute part 2 is not added by the above-mentioned processing from line number 6 onwards, and the Data such as attribute n1 in Table 6 is set.

逆上り処理にあたって、行番号8の分岐光間1の行番号
データNOが参照されるとこれは「0」であるため、分
岐元行番号が不明となる。したがって、前述した分岐光
間および属性部を作成す−る処理において、行番号8に
分岐する分岐元命令の行番号の次の行番号、すなわち第
5表の例では行番号5.7をファーストインラストアウ
ト(FILO)形のメモリに記憶する。したがって、逆
上り解析時において、分岐光間で行番号データrQJの
データが参照された場合には、前記行番号を記憶したF
 I LO形メモリからデータを読出して逆上り処理に
おける分岐先行番号とする。
In the reverse upstream process, when the row number data NO of branch light interval 1 of row number 8 is referred to, it is "0", so the branch source row number becomes unknown. Therefore, in the process of creating the branch light interval and attribute part described above, the line number next to the line number of the branch source instruction that branches to line number 8, that is, line number 5.7 in the example in Table 5, is set first. Stored in in-last-out (FILO) type memory. Therefore, when the row number data rQJ is referenced between branched lights during reverse upstream analysis, the F
Data is read from the ILO type memory and used as a branch precedence number in reverse upstream processing.

このようにすることによって、流れ制御ファイル記憶部
12において、分岐光間および属性部に割当てられるメ
モリの容量を削減することができる。
By doing so, in the flow control file storage section 12, it is possible to reduce the memory capacity allocated between the branched lights and the attribute section.

前記第4表のプログラム例における実行内容は、行番号
3,5.11などの分岐命令やスタックの内容をti作
する命令などによって変化するスタックの記憶内容に大
きく作用されることが知られている。このようなスタッ
クの内容を予め属性部のデータとしてまとめておくと、
プログラムの解析上便利である。とりわけ前記第4表の
行番号5のPSH命令や、これと対を戒すPULL命令
などのようにスタックの内容を変化させる命令が含まれ
る場合には、プログラムの実行状態の変化が明瞭になり
、プログラム解析経路の特定が容易になる。
It is known that the execution contents of the program example in Table 4 above are greatly influenced by the storage contents of the stack, which change due to branch instructions such as line numbers 3 and 5.11, and instructions that create the contents of the stack. There is. If the contents of such a stack are compiled in advance as attribute data,
This is useful for program analysis. In particular, when an instruction that changes the contents of the stack is included, such as the PSH instruction in line number 5 of Table 4, or the PULL instruction that pairs with it, the change in the program execution state becomes clear. , it becomes easier to specify the program analysis path.

上記第4表と同一のプログラム例において、当該プロゲ
ラ11の各命令毎に下記第7表のようなアドレスが設定
される場合を想定して説明する。
The following description assumes that in the same program example as in Table 4 above, addresses as shown in Table 7 below are set for each instruction of the progera 11.

(以下余白) 本実施例では、分岐元部および属性欄のデータは第4表
のデータを用いるが、これに加えスタックの内容が変化
する命令がある場合には、その命令により変化したスタ
ックの内容をデータとするスタックデータVALの欄を
設ける。これによれば、行番号3で行番号9へ分岐する
が、このときスタックにはデータ#FOO7が格納され
る。したがって、行番号9〜11のVALlliには、
当該アドレス#FOO7の上位バイトおよび下位バイト
を転換したデータVAL= r07FO」がそれぞれ設
定される。
(Left below) In this example, the data in Table 4 is used for the branch source and attribute columns, but if there is an instruction that changes the contents of the stack in addition to this, the stack contents changed by that instruction. A stack data VAL column whose contents are data is provided. According to this, the process branches to line number 9 at line number 3, and at this time, data #FOO7 is stored in the stack. Therefore, for VALlli in line numbers 9-11,
Data VAL=r07FO'' obtained by converting the upper byte and lower byte of the address #FOO7 are respectively set.

行番号1■から行番号4へ処理が戻り、次に行番号5に
おいてスタックの記憶内容が行番号1のアドレス#F’
OOOに変更される。したがって、これ以降の行番号4
〜8の属性欄1においては、スタックデータVAL−r
oOFO」が設定される。行番号8にて、新たな属性欄
2が設定され、引続きスタックデータVAL= roO
FOJが設定される。
Processing returns from line number 1■ to line number 4, and then at line number 5, the memory contents of the stack are changed to the address #F' of line number 1.
Changed to OOO. Therefore, line number 4 after this
In attribute column 1 of ~8, stack data VAL-r
"oOFO" is set. At line number 8, a new attribute column 2 is set, and the stack data VAL=roO
FOJ is set.

以上のようにして本実施例によれば、属性欄にスタック
のデータを設定するようにしたので、たとえばサブルー
チン命令のメインルーチンへの復帰命令RETから逆上
り処理を行う場合、前記メインルーチンへの復帰先は、
スタックデータVALを参照すれば判明し、各命令を逆
上って順次的に解析して検知する必要が解消される。こ
れにより処理の高速化が図られる。また、前記スタック
データVALを用いれば、各命令毎に設定される属性の
種類および処理経路等の属性の識別が格段に容易となる
As described above, according to this embodiment, the stack data is set in the attribute column, so that, for example, when performing reverse upward processing from the subroutine instruction RET, which returns to the main routine, the stack data is set in the attribute column. The return destination is
This can be determined by referring to the stack data VAL, eliminating the need to go backwards through each instruction and sequentially analyze and detect them. This speeds up the processing. Further, by using the stack data VAL, it becomes much easier to identify attributes such as the type of attribute and the processing path set for each instruction.

第8図ステップd9において、分岐条件を脅威して第1
図に示すフローチャート作成手段19や実行内容解析結
果出力手段20などから、当該得られた結果を論理式の
結合した形式としてフローチャートやPAD図の形式で
出力したり、または実行内容を印字出力したりする場合
、被解析プログラムが長くなるほどその出力量が膨大と
なる。
In step d9 of Fig. 8, the first
From the flowchart creation means 19 and execution content analysis result output means 20 shown in the figure, the obtained results can be output as a combination of logical expressions in the form of a flowchart or PAD diagram, or the execution contents can be printed out. In this case, the longer the program to be analyzed, the larger the amount of output.

したがって、これらの論理式で記述される出力をプール
代数を用いて簡易な形に整理する技術が必要となる。
Therefore, a technique is needed to organize the outputs described by these logical formulas into a simple form using pooling algebra.

第14[21は、このような実施例を説明するフローチ
ャートである。フローチャート作成手段19や実行内容
解析結果出力手段20からの出力がたとえば下式、 ・・・(15) のような論理記号の結合した論理式として与えられてい
る場合、これを簡約1ヒするには以下の処理を行う、こ
の簡約化処理の基本方針は下記の第16式と第17式と
である。
The 14th [21] is a flowchart explaining such an embodiment. For example, when the output from the flowchart creation means 19 or the execution content analysis result output means 20 is given as a logical expression in which logical symbols are combined, such as the following expression, ... (15), to simplify this, The following processing is performed. The basic policy of this simplification processing is the following equations 16 and 17.

A+A=U             ・・・(16)
A + A−g = A + g          
・・・(17)U;全体集合 A、Uの部分集合 A、Aの補集合 g;単項 論理積演算 +、論理和演算 第15121は、上記第16式と第17式の内容を説明
するペン図である。上記第16式は、全体集合Uにおい
て、部分集合Aとその補集合Aとの和集合が常に全体集
合となる意味である。また、上記第17式は部分集合A
と単項gとが互いに素であるならば、補集合Aと単項g
との補集合と集合Aとは集合Aと単項gとの和集合にな
る意味である。
A+A=U...(16)
A + A-g = A + g
...(17) U; entire set A, subset A of U, complement g of A; unary logical product operation +, logical sum operation No. 15121 explains the contents of the above equations 16 and 17. It is a pen diagram. Equation 16 above means that in the entire set U, the union of the subset A and its complement A is always the entire set. Also, the above formula 17 is the subset A
If and unary g are disjoint, then the complement A and unary g
The complementary set of and set A means that it is the union of set A and unary g.

このような上記第16式および第17式の基本方式に基
づいて、上記第15式を簡約化する手順について第17
図のフローチャートを参照して説明する。第17図ステ
ツ7slにおいて、各項を分解する。これにより上記第
1式は下記第18式に変化される。
Based on the basic method of the above equations 16 and 17, the 17th equation describes the procedure for simplifying the above equation 15.
This will be explained with reference to the flowchart shown in the figure. In step 7sl of FIG. 17, each term is decomposed. As a result, the above first equation is changed to the following equation 18.

F = C−A +C・A−B + C−A + C−
A−13+A−B・・・(18〉 次にステップS2にて共通項があるか否かが判断される
。先ず第18式の第1項および第2項について、共通項
Cがあることが判断され、ステップs3でく)でくくら
れ、下記第18式が得られる。
F = C-A + C・A-B + C-A + C-
A-13+A-B...(18> Next, in step S2, it is determined whether or not there is a common term. First, it is determined that there is a common term C for the first term and the second term of Equation 18. This is determined, and the result is combined in step s3) to obtain the following Equation 18.

C・(A+A−B)            ・・(1
9)次にステップs4では、前記第16式および第17
式に基づく合成パターンがあるか否かが判断される。第
19式の0内では、第17式に基づく合成が可能であり
、判断が肯定となり、ステップS5に移り、下記第20
式のように合成される。
C・(A+A-B)...(1
9) Next, in step s4, the 16th equation and the 17th equation are
It is determined whether there is a composite pattern based on the expression. Within 0 of the 19th equation, synthesis based on the 17th equation is possible, and the judgment is affirmative, moving to step S5 and proceeding to the following 20th equation.
It is synthesized as shown in Eq.

前記ステップs4で合成パターンがないことが判断され
ると、ステップs6に移り、他に(〉でくくれる同−項
があるか否かが判断され、なければステップs3に移る
。下記第20式の例では、0内でこれ以上の合成パター
ンがなく、処理はステップs1に戻され、0が分解され
、下記第21式が得られる。
If it is determined in step s4 that there is no composite pattern, the process moves to step s6, and it is judged whether there is another same-term that can be bracketed by (>).If not, the process moves to step s3.Equation 20 below. In the example, there are no more combination patterns within 0, and the process returns to step s1, where 0 is decomposed and the following equation 21 is obtained.

0°(A+B)              ・・・(
20〉c−Al + CB             
・・・(21)次に第21式第1項と第18式第3項と
に関して、前記ステップs2.ステップs3の処理が適
用され、下記第22式が得られる。
0°(A+B)...(
20〉c-Al + CB
(21) Next, regarding the first term of Equation 21 and the third term of Equation 18, step s2. The process in step s3 is applied, and the following equation 22 is obtained.

CA十C−A−A・(C+C)      ・・(22
)次のステップs4.s5にて上記第16式の基本方針
が適用され、下記第23式が得られる。
CA10C-A-A・(C+C)...(22
) next step s4. At s5, the basic principle of Equation 16 above is applied, and Equation 23 below is obtained.

A・ (C+C)= A              
   ・・・(23)次に第21式第2項と第18式第
4項とに関して、同様な処理が行われ、下記第24式の
結果が得られる。
A・(C+C)=A
(23) Next, similar processing is performed on the second term of Equation 21 and the fourth term of Equation 18, and the result of Equation 24 below is obtained.

C−B + CA−B = B・(C+C−A)= B
c十BA・(24) 次に第21式第1辺の第2項と、第18式第5項との間
で同様な処理が行われ、下記第25式が得られる。
C-B + CA-B = B・(C+C-A) = B
c10BA·(24) Next, similar processing is performed between the second term of the first side of Equation 21 and the fifth term of Equation 18, and the following Equation 25 is obtained.

B−A +A−B = A・(B+B)=A    ・
・(25〉したがって第23式、第21式第1辺第1項
および第25式より下記第26式が得られる。
B-A +A-B = A・(B+B)=A・
-(25> Therefore, the following Equation 26 is obtained from Equation 23, the first term on the first side of Equation 21, and Equation 25.

A+B・C十A=B・C+U=U    ・・・(26
)このようにして上記第16式および第17式に示す基
本方針の元で、第17図に示す処理手順に基づいて上記
第15式に示す論理式が全体集合Uに簡約化されること
が確認された。このようにして第8図ステップd9で分
岐条件を合成する処理を行うにあたって、前述したよう
にプール代数を用いて論理式を論理演算にて簡略化して
表現する。
A+B・C10A=B・C+U=U...(26
) In this way, based on the basic policy shown in Equations 16 and 17 above, the logical expression shown in Equation 15 above can be simplified to the entire set U based on the processing procedure shown in FIG. confirmed. In this way, when performing the process of synthesizing branch conditions in step d9 of FIG. 8, the logical expression is simplified and expressed by logical operations using pool algebra, as described above.

これによりフローチャート作成手段1つでフローチャー
トを作成して出力したり、または実行内容解析結果出力
手段20にて実行内容を論理式にて印字出力する場合に
あたって、実行内容をより内容の把握が容易な形式にて
表現することができ、本件プログラム内容解析装置をプ
ログラムのデバッグなどに用いる場合にきわめて効率的
である。
This makes it easier to understand the execution contents when creating and outputting a flowchart with a single flowchart creation means, or when printing out the execution contents as a logical formula using the execution contents analysis result output means 20. It can be expressed in a format, and is extremely efficient when using the program content analysis device of the present invention for program debugging, etc.

発明の効果 以上のように本発明に従えば、プログラム中の分岐命令
に対応して設定されるプロゲラ11の複数の実行経路の
いずれか1つを、順次的に選択して各実行経路に沿って
逆上るようにした。したがってプログラムの各命令を実
行順とは逆に逆上って読取り、その内容を解析するにあ
たり、実際の実行経路としては有り得ない解析経路に関
して解析を行うという不具合を防ぐことかて′きる。こ
れにより冗長な処理の発生を防ぐことができ、処理速度
が向上される。
Effects of the Invention As described above, according to the present invention, any one of a plurality of execution paths of the pro gamer 11 set corresponding to a branch instruction in a program is sequentially selected and each execution path is followed. It made me lash out. Therefore, when each instruction of a program is read backwards from the execution order and its contents are analyzed, it is possible to prevent the problem of performing analysis on an analysis path that is impossible as an actual execution path. This prevents redundant processing from occurring and improves processing speed.

またスタックのストア内容を変化する命令により、サブ
ルーチンプログラムのリターン命令による分岐先が変更
される場合であっても、上記作用を実現することができ
、使用性が格段に向上される。
Further, even if the branch destination of a return instruction of a subroutine program is changed by an instruction that changes the contents stored in the stack, the above effect can be achieved, and usability is greatly improved.

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

第1図は解析装置1の構成を示すブロック図、第2図は
解析準備処理手段5の動作を説明するフローチャート、
第3図は被解析プログラム例の動作の流れを示すフロー
チャート、第4図は流れ構造解析手段11の動作を説明
するフローチャート、第5I2Iは流れ制御ファイル記
憶部12の構成を示す図、第6図は分岐元ファイル記憶
部21の構成を示す図、第7図は属性ファイル記憶部2
2の構成を示す図、第8図は分岐条件解析手段13の動
作を説明するフローチャート、第9図は本実施例の逆上
りフラグを説明するフローチャート、第10図逆上り処
理における逆上り判断を説明するフローチャー1− 、
第1■図は逆上り処理におけるデータ設定処理を説明す
るフローチャート、第12図は逆上り処理の逆上り分岐
処理を説明するフロ−チャート、第13I21は逆上り
処理の未解析ルート処理の動作を説明するフローチャー
ト、第14図はデータ書込み処理を説明するフローチャ
ート、第15図は被解析プログラム例の動作の流れを説
明するフローチャー1・、第16図はスタックの状態を
説明する図、第17図は論理式のプール代数を用いる簡
約化処理を説明するフローチャート、第18図は本実施
例を説明するペン図、第1911はプログラム例の流れ
を示すフローチャートである。 l・・・解析装置、3・・・アセンブラ、4・・アセン
ブルリストファイル記憶部、5・・・解析準備処理手段
、6・・・リストファイル記憶部、10・・・命令デー
タファイル記憶部、11・・・流れ構造解析手段、12
・・流れ制御ファイル記憶部、13・・・分岐条件解析
手段、16・・・分岐条件ファイル記憶部、21・・分
岐元ファイル部、22・・・属性ファイル部、23・・
・属性個数記憶部、24・・・分岐元部記憶部、25・
・行番号記憶部、26・・・分岐元属性記憶部、27・
・分岐先属性記憶部、28・・・属性個数記憶部、29
・・・不定フラグ記憶部、 属性値記憶部
FIG. 1 is a block diagram showing the configuration of the analysis device 1, and FIG. 2 is a flowchart explaining the operation of the analysis preparation processing means 5.
3 is a flowchart showing the flow of the operation of the example program to be analyzed, FIG. 4 is a flowchart explaining the operation of the flow structure analysis means 11, 5I2I is a diagram showing the configuration of the flow control file storage unit 12, and FIG. 7 shows the configuration of the branch source file storage unit 21, and FIG. 7 shows the configuration of the attribute file storage unit 2.
8 is a flowchart explaining the operation of the branch condition analysis means 13, FIG. 9 is a flowchart explaining the reverse uplink flag of this embodiment, and FIG. 10 is a flowchart explaining the reverse upstream flag in the reverse upstream processing. Flowchart 1 to be explained,
Fig. 1 is a flowchart explaining data setting processing in reverse upstream processing, Fig. 12 is a flowchart explaining reverse upstream branching process in reverse upstream processing, and Figure 13I21 is a flowchart explaining the operation of unanalyzed route processing in reverse upstream processing. FIG. 14 is a flowchart explaining the data writing process, FIG. 15 is a flowchart 1 explaining the operation flow of the example program to be analyzed, FIG. 16 is a diagram explaining the state of the stack, and FIG. 19 is a flowchart illustrating a simplification process using a pool algebra of a logical formula, FIG. 18 is a pen diagram illustrating this embodiment, and 1911 is a flowchart illustrating the flow of an example program. l...Analysis device, 3...Assembler, 4...Assemble list file storage unit, 5...Analysis preparation processing means, 6...List file storage unit, 10...Instruction data file storage unit, 11...Flow structure analysis means, 12
...Flow control file storage unit, 13...Branch condition analysis means, 16...Branch condition file storage unit, 21...Branch source file part, 22...Attribute file part, 23...
・Attribute number storage unit, 24...Branch source unit storage unit, 25・
・Line number storage unit, 26...Branch source attribute storage unit, 27・
- Branch destination attribute storage unit, 28... Attribute number storage unit, 29
...Undefined flag storage section, attribute value storage section

Claims (3)

【特許請求の範囲】[Claims] (1)複数の命令から成るプログラムの各命令を実行順
とは逆に逆上つて読取り、その内容を解析する装置にお
いて、 逆上り読取り時には、プログラム中の分岐命令の配置に
基づいて設定されるプログラムの複数の実行経路のいず
れか1つを順次的に選択して各実行経路に沿つて逆上つ
て各命令を読取るようにしたことを特徴とするプログラ
ム内容解析装置。
(1) In a device that reads each instruction of a program consisting of multiple instructions backwards in the opposite order of execution and analyzes its contents, when reading backwards, the settings are set based on the placement of branch instructions in the program. A program content analysis device characterized in that any one of a plurality of execution paths of a program is sequentially selected and each instruction is read backward along each execution path.
(2)上記分岐命令はスタックのストア内容を変更する
命令を含むことを特徴とする特許請求の範囲第1項記載
のプログラム内容解析装置。
(2) The program content analysis device according to claim 1, wherein the branch instruction includes an instruction to change the contents stored in the stack.
(3)複数の命令から成るプログラムの各命令を実行順
とは逆に逆上つて読取り、その内容を解析する装置にお
いて、 各命令毎に、分岐命令に対応するプログラムの複数の実
行経路を識別する経路データと、分岐命令により規定さ
れる分岐先命令または分岐命令のいずれかである命令毎
に、対応する分岐命令または対応する分岐先命令のいず
れかの位置データとを含む分岐データを作成する分岐デ
ータ作成手段と、 経路データを記憶する経路データ記憶手段と、位置デー
タを記憶する位置データ記憶手段と、プログラムを逆上
つて各命令を読取る逆上り読取手段であつて、逆上り時
には各命令の経路データと分岐データとを、経路データ
記憶手段と分岐データ記憶手段とから読出し、連続する
同一経路データに対応し、かつ分岐データで規定される
分岐経路に従つてプログラムを逆上つて読取る、そのよ
うな逆上り読取手段とを含むことを特徴とするプログラ
ム内容解析装置。
(3) A device that reads each instruction of a program consisting of multiple instructions backwards in the opposite order of execution and analyzes the contents, identifying, for each instruction, multiple execution paths of the program corresponding to the branch instruction. For each instruction that is either a branch destination instruction or a branch instruction specified by a branch instruction, branch data is created that includes path data for the corresponding branch instruction or position data of the corresponding branch destination instruction. A branch data creation means, a route data storage means for storing route data, a position data storage means for storing position data, and a reverse reading reading means for reading each instruction by reversing the program. reading the route data and branch data from the route data storage means and the branch data storage means, and reading the program backwards according to the branch route corresponding to the continuous same route data and defined by the branch data; A program content analysis device comprising such reverse upstream reading means.
JP1319447A 1989-12-07 1989-12-07 Analyzing device for program contents Pending JPH03177940A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1319447A JPH03177940A (en) 1989-12-07 1989-12-07 Analyzing device for program contents

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1319447A JPH03177940A (en) 1989-12-07 1989-12-07 Analyzing device for program contents

Publications (1)

Publication Number Publication Date
JPH03177940A true JPH03177940A (en) 1991-08-01

Family

ID=18110305

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1319447A Pending JPH03177940A (en) 1989-12-07 1989-12-07 Analyzing device for program contents

Country Status (1)

Country Link
JP (1) JPH03177940A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63317853A (en) * 1987-06-20 1988-12-26 Fujitsu Ten Ltd Analyzing device for program contents
JPS63317844A (en) * 1987-06-20 1988-12-26 Fujitsu Ten Ltd Analyzing device for program contents
JPS63317848A (en) * 1987-06-20 1988-12-26 Fujitsu Ten Ltd Analyzing device for program contents

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63317853A (en) * 1987-06-20 1988-12-26 Fujitsu Ten Ltd Analyzing device for program contents
JPS63317844A (en) * 1987-06-20 1988-12-26 Fujitsu Ten Ltd Analyzing device for program contents
JPS63317848A (en) * 1987-06-20 1988-12-26 Fujitsu Ten Ltd Analyzing device for program contents

Similar Documents

Publication Publication Date Title
JP2765423B2 (en) Programmable controller and control method thereof
JP2755154B2 (en) Program conversion processing device and program conversion processing method
US4309756A (en) Method of automatically evaluating source language logic condition sets and of compiling machine executable instructions directly therefrom
US5367468A (en) Design aid method and design aid apparatus for integrated circuits
JPH1173325A (en) Program converting device and recording medium
JPH11232117A (en) Program transformation method, program transformer and storage medium having stored program transformation program
CN102289362A (en) Segmented symbolic execution device and working method thereof
US6611956B1 (en) Instruction string optimization with estimation of basic block dependence relations where the first step is to remove self-dependent branching
US5721924A (en) Method and device for obtaining a value of a referred to variable defined in a source program having a specific variable name
US6968544B1 (en) Method for transformation of interface definitions and intermediate format tables thereof
JPH03177940A (en) Analyzing device for program contents
JPH03177942A (en) Analyzing device for program contents
EP0638862B1 (en) Method and system for processing language
JPH03179536A (en) Program contents analyzing device
JPH03177941A (en) Analyzing device for program contents
JPH0775003B2 (en) Program content analyzer
JP2982490B2 (en) SFC programming method
JP3771682B2 (en) Vector processing equipment
JPS6015772A (en) Processing system for inter-loop array processing vector
JPH0391035A (en) Instruction train scheduling processing method
JP5169322B2 (en) Variable optimization apparatus, variable optimization program, compiler, variable optimization method, and compilation method
JPS62106542A (en) Production system for control flow
JPS63156238A (en) System for selecting and outputting update id to source list
JPH06222913A (en) Program analyzer
JPH01184539A (en) Parallel description system for assembly language