KR0169909B1 - Method for designing assembly code generator for target processor - Google Patents

Method for designing assembly code generator for target processor Download PDF

Info

Publication number
KR0169909B1
KR0169909B1 KR1019960029721A KR19960029721A KR0169909B1 KR 0169909 B1 KR0169909 B1 KR 0169909B1 KR 1019960029721 A KR1019960029721 A KR 1019960029721A KR 19960029721 A KR19960029721 A KR 19960029721A KR 0169909 B1 KR0169909 B1 KR 0169909B1
Authority
KR
South Korea
Prior art keywords
code
target processor
assembly
program
rule
Prior art date
Application number
KR1019960029721A
Other languages
Korean (ko)
Other versions
KR980010760A (en
Inventor
정영식
이병선
Original Assignee
양승택
한국전자통신연구소
이준
한국전기통신공사
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 양승택, 한국전자통신연구소, 이준, 한국전기통신공사 filed Critical 양승택
Priority to KR1019960029721A priority Critical patent/KR0169909B1/en
Publication of KR980010760A publication Critical patent/KR980010760A/en
Application granted granted Critical
Publication of KR0169909B1 publication Critical patent/KR0169909B1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

본 발명은 코드 생성기의 작성법을 제공함으로써 컴파일러의 후위처리기를 보다 쉽게 구현하는 데에 그 목적이 있다.An object of the present invention is to more easily implement a postprocessor of a compiler by providing a method of writing a code generator.

본 발명은 코드변환 규칙 테이블을 작성하고, 코드변환 규칙 테이블을 이용하여 코드 생성기를 생성하는 생성기로 코드변환 규칙 프로그램을 만들고, 목표 프로세서에 대하여 종속적인 프로그램을 작성하고, 목표 프로세서에 대하여 독립적인 프로그램을 작성하고 코드변환 규칙 프로그램과 목표 프로세서에 대하여 독립적인 프로그램 및 목표 프로세서에 대하여 종속적인 프로그램을 함께 컴파일하여 목표 프로세서용 어셈블리 코드 생성기를 완성한다.The present invention creates a transcoding rule table, generates a transcoding rule program with a generator that generates a code generator using the transcoding rule table, writes a program dependent on the target processor, and a program independent of the target processor. We then write a code conversion rule program, a program independent of the target processor, and a program dependent on the target processor, to complete the assembly code generator for the target processor.

Description

목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법How to write an assembly code generator for a target processor

본 발명은 목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법에 관한 것으로서, 특히 중간코드를 입력으로 받아 목표 프로세서용 어셈블리 코드를 생성하는 생성기의 핵심 부분인 코드변환 규칙 테이블과 목표 프로세서에 관련된 부분을 작성하는 방법에 관한 것이다.The present invention relates to a method for writing an assembly code generator for a target processor, and more particularly, to create a code conversion rule table and a part related to a target processor, which are core parts of a generator that receives an intermediate code as input and generates assembly code for a target processor. It is about a method.

일반적으로, 컴파일러의 구조는 제공되는 각각의 고급 프로그래밍 언어에 대한 문법을 검사하고, 의미를 분석하여 어셈블리어 또는 기계어로 된 목적 파일을 생성하도록 되어 있다.In general, the compiler's structure is intended to examine the grammar for each high-level programming language provided, and to parse the semantics to produce object files in assembly or machine language.

이러한 구조는 N개의 프로그래밍 언어를 서로 다른 M개의 프로세서를 장착한 컴퓨터에서 실행시키기 위해서 (N×M)개의 컴파일러를 개발해야 하는 어려움이 있었다.This structure has a difficulty in developing (N × M) compilers in order to run N programming languages on a computer with different M processors.

상술한 어려움을 해결하기 위하여 컴파일러를 전위처리기(front-end)와 후위처리기(back-end)로 나두어 개발되었다.In order to solve the above problems, the compiler was developed by dividing the compiler into a front-end and a back-end.

전위 처리기는 C 및 CHILL과 같은 고급 프로그램밍 언어에 대한 문법과 의미를 검사하여 중간코드를 생성한다.The prefix handler examines the syntax and semantics of high-level programming languages such as C and CHILL to generate intermediate code.

후위 처리기는 중간코드를 입력으로 받아 프로세서에 관련된 부분을 처리하여 목표 프로세서에 대한 어셈블리 코드를 생성한다.The postprocessor takes the intermediate code as input and processes the part related to the processor to generate assembly code for the target processor.

코드 생성기는 후위 처리기의 중요한 부분으로서, 목표 프로세서의 종류에 관계없이 모든 코드 생성기에서 공통으로 처리할 수 있는 프로그램과 목표 프로세서에 관련된 어셈블리 명령어와 어셈블리 의사 명령어와 레지스터 정의와 함수의 호출/복귀 및 원시(source) 파일의 라인정보 등을 처리하는 프로그램으로 구성되어 있다.The code generator is an important part of the post-processor, and the assembly instructions, assembly pseudo-instructions, register definitions, and call / return and source functions associated with programs and target processors that can be commonly handled by all code generators, regardless of the target processor. (source) It consists of a program that processes line information of a file.

목표 프로세서에 관련된 내용은 레지스터, 주소지정 모드, 어셈블리 명령어 등에 관련된 내용을 처리하는 코드변환 규칙 테이블 및 어셈블리 의사 명령어, 함수의 호출/복귀, 원시 파일의 라인정보 등에 관련된 내용을 처리하는 C 프로그램 파일로 구성되어 있다.Content related to target processor is C program file which handles contents related to transcoding rule table and assembly pseudo-instruction, function call / return, line information of source file, etc. related to register, addressing mode, assembly instruction. Consists of.

따라서, 목표 프로세서에 대한 코드 생성기는 코드변환 규칙 테이블과 이 테이블에 기술하기 어려운 내용을 처리하는 C 프로그램 파일을 작성하면 된다.Thus, the code generator for the target processor only needs to create a transcoding rule table and a C program file that handles content that is difficult to describe in this table.

이렇게 개발된 컴파일러는 고급 프로그래밍 언어를 어셈블리 코드로 번역하는 데에 이식성(retargeting)이 매우 용이하게 된다.The compiler developed in this way becomes very easy to retarget for translating high-level programming languages into assembly code.

그러나, 종래에는 전위처리기의 전위처리 방법은 구체적으로 실현되었으나 목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법이 구체적으로 실현되지 못하였다는 문제점이 있었다.However, in the related art, the potential processing method of the potential processor has been specifically realized, but there has been a problem that the method of writing the assembly code generator for the target processor has not been specifically realized.

상기 문제점을 해결하기 위한 본 발명의 목적은 코드 생성기의 작성법을 제공함으로써 컴파일러의 후위처리기를 보다 쉽게 구현하는데에 있다.An object of the present invention for solving the above problems is to provide a method of writing a code generator to more easily implement a post-processor of the compiler.

제1도는 본 발명이 적용되는 하드웨어 구성도.1 is a hardware configuration to which the present invention is applied.

제2도는 본 발명을 적용하여 작성되는 컴 파일러 후위처리기의 구성을 도시한 도면.2 is a diagram showing the configuration of a compiler postprocessor created by applying the present invention.

제3도는 본 발명에 따른 목표 프로세서용 어셈블리 코드 생성기의 작성방법을 도시한 흐름도.3 is a flowchart illustrating a method of writing an assembly code generator for a target processor according to the present invention.

* 도면의 주요부분에 대한 부호의 설명* Explanation of symbols for main parts of the drawings

1 : 중앙처리 장치 2 : 메인 메모리1: central processing unit 2: main memory

3 : 보조기억 장치 4 : 입출력 장치3: auxiliary memory device 4: input / output device

11 : 중간코드 암호화기 12 : 중간코드 최적화기11: intermediate code encryptor 12: intermediate code optimizer

13 : 어셈블리 코드 생성기 14 : 최적화 규칙 테이블13: Assembly Code Generator 14: Optimization Rule Table

15 : 코드변환 규칙 테이블15: Transcoding Rule Table

상기 목적을 달성하기 위하여 본 발명의 특징은 코드변환 규칙 테이블을 작성하는 단계와, 코드변환 규칙 테이블을 이용하여 코드 생성기를 생성하는 생성기로 코드변환 규칙 프로그램을 만드는 단계와, 목표 프로세서에 대하여 독립적인 프로그램 및 목표 프로세서에 대하여 종속적인 프로그램을 작성하는 단계와, 목표 프로세서에 대하여 독립적인 프로그램을 작성하는 단계 및 코드변환 규칙 프로그램과 목표프로세서에 대하여 종속적인 프로그램을 함께 컴파일하여 목표 프로세서용 어셈블리 코드 생성기를 완성하는 단계로 이루어지는 데에 있다.In order to achieve the above object, a feature of the present invention is to create a transcoding rule table, to generate a transcoding rule program with a generator that generates a code generator using the transcoding rule table, and independent of the target processor. The assembly code generator for the target processor is generated by compiling a program dependent on the program and the target processor, a program independent of the target processor, and a code conversion rule program and a program dependent on the target processor. It consists of a stage of completion.

제1도는 본 발명이 적용되는 하드웨어 구성도이다.1 is a hardware block diagram to which the present invention is applied.

제1도를 참조하여, 본 발명이 적용되는 하드웨어의 구성을 간단히 설명한다.Referring to FIG. 1, the configuration of hardware to which the present invention is applied will be briefly described.

이는 중앙처리 장치(1)와 메인 메모리(2)와 보조 기억장치(3)와 입출력 장치(4)가 시스템 버스로 서로 연결 구성된 일반 범용 컴퓨터에 범용 운영체제를 띄운 시스템이다.This is a system in which the general-purpose operating system is mounted on a general-purpose computer in which the central processing unit 1, the main memory 2, the auxiliary memory unit 3, and the input / output unit 4 are connected to each other by a system bus.

컴 파일러의 후위 처리기의 코드 생성기 프로그램은 호스트 시스템의 메인 메모리(2)의 탑재되어 중앙처리 장치(1)에서 실행되고 입출력 장치(4)를 통하여 출력 및 오류 메시지가 입출력되며 각 장치간에 주고받는 메시지는 시스템 버스를 통하여 이루어진다.The code generator program of the postprocessor of the compiler is mounted in the main memory (2) of the host system and executed in the central processing unit (1). This is done via the system bus.

범용 운영체제는 프로그램들과 장치들을 제어한다.General-purpose operating systems control programs and devices.

그리고, 보조기억 장치(3)에는 목표 프로세서용 어셈블리 코드를 생성하기 위한 고급언어로 작성된 원시파일과 중간코드 파일 및 데이터 파일이 저장되며 메인 메모리(2)에 탑재되지 않은 파일과 도구들로 저장된다.In addition, the auxiliary memory device 3 stores source files, intermediate code files, and data files written in a high-level language for generating assembly code for a target processor, and are stored as files and tools that are not mounted in the main memory 2. .

제2도는 본 발명을 적용하여 작성되는 컴파일러 후위 처리기의 구성을 도시한 도면이다.2 is a diagram showing the configuration of a compiler postprocessor created by applying the present invention.

제2도를 참조하여 본 발명을 적용하여 작성되는 컴파일러 후위 처리기의 구성에 관하여 설명하면 다음과 같다.Referring to FIG. 2, the configuration of a compiler postprocessor created by applying the present invention will be described below.

컴파일러 전위 처리기가 EM 중간코드를 생성하면, 중간코드 암호화기(11)는 EM 중간코드를 입력받아 간결한(compact) 중간코드 형태로 변환하여 출력한다.When the compiler prefix processor generates the EM intermediate code, the intermediate code encoder 11 receives the EM intermediate code, converts the EM intermediate code into a compact intermediate code, and outputs the converted intermediate code.

이렇게 하면 후위처리 과정이 보다 단순화 되기 때문이다.This simplifies the postprocessing process.

중간코드 최적화기(12)는 이렇게 출력된 간결한 중간코드를 최적화 규칙 테이블(14)에 따라 최적화하여 최적화된 중간코드를 출력한다.The intermediate code optimizer 12 outputs the optimized intermediate code by optimizing the simple intermediate code thus output according to the optimization rule table 14.

최적화 규칙 테이블(14)에는 최적화 규칙이 기술되어 있다.The optimization rules table 14 describes the optimization rules.

어셈블리 코드 생성기(13)는 이렇게 출력된 최적화된 중간코드를 어셈블리 코드변환 규칙 테이블(15)에 따라 변환하여 최종적으로 어셈블리 코드를 생성한다.The assembly code generator 13 converts the optimized intermediate code thus output according to the assembly code conversion rule table 15 to finally generate the assembly code.

어셈블리 코드변환 규칙 테이블(15)에는 중간코드 어셈블리 코드로 변환하는 규칙이 기술되어 있다.The assembly code conversion rule table 15 describes rules for converting to intermediate code assembly code.

중간코드 암호화기(11)와 중간코드 최적화기(12)의 구성은 컴파일러의 입력인 고급 프로그래밍 언어와 생성할 해당 프로세서의 어셈블리 코드의 종류에 관계가 없다.The configuration of the intermediate code encryptor 11 and the intermediate code optimizer 12 is independent of the high-level programming language that is the input of the compiler and the type of assembly code of the corresponding processor to be generated.

그래서, 중간코드 암호화기(11)와 중간코드 최적화기(12)의 처리과정들은 모든 컴파일러에 공통적으로 적용되는 과정으로 이용하게 된다.Thus, the processes of the intermediate code encryptor 11 and the intermediate code optimizer 12 are used as processes commonly applied to all compilers.

따라서 EM 중간코드에서 해당 프로세서의 어셈블리 코드를 생성하는 후위 처리기는 어셈블리 코드 생성기(13)만 따로 작성하면 된다.Therefore, the postprocessor generating the assembly code of the processor from the EM intermediate code only needs to write the assembly code generator 13 separately.

이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 실시예들 중의 하나를 상세히 설명한다.Hereinafter, with reference to the accompanying drawings will be described in detail one of the preferred embodiments according to the present invention.

제3도는 본 발명에 따른 목표 프로세서용 어셈블리 코드 생성기 작성방법을 도시한 흐름도이다.3 is a flowchart illustrating a method of writing an assembly code generator for a target processor according to the present invention.

제3도를 참조하여 본 발명에 따른 목표 프로세서용 어셈블리 코드 생성기 작성방법에 관하여 설명한다.A method of writing an assembly code generator for a target processor according to the present invention will be described with reference to FIG.

목표 프로세서용 어셈블리 코드 생성기는 코드변환 규칙 프로그램과 목표 프로세서에 대하여 독립적인 프로그램 및 목표 프로세서에 대하여 종속적인 프로그램으로 구성되어 있다.The assembly code generator for the target processor is composed of a code conversion rule program, a program independent of the target processor, and a program dependent on the target processor.

코드변환 규칙 프로그램은 코드 생성기를 형성하는 생성기에 의해 코드변환 규칙이 기술된 테이블이 변환된 C 프로그램이다.The transcoding rule program is a C program in which a table describing transcoding rules is converted by a generator forming a code generator.

목표 프로세서에 대하여 종속적인 프로그램은 코드변환 규칙 테이블에서 기술하기 힘든 내용들이 기술된 프로그램이다.A program that is dependent on the target processor is a program whose contents are difficult to describe in the transcoding rule table.

목표 프로세서에 대하여 독립적인 프로그램은 목표 프로세서에 관계없이 모든 코드 생성기에서 공통적으로 처리할 수 있는 내용들이 기술되어 있다.A program that is independent of the target processor describes contents that can be handled by all code generators regardless of the target processor.

여기서는 코드변환 규칙 테이블과 목표 프로세서에 대하여 종속적인 프로그램으로부터 제공되는 정보를 이용한 수식의 계산과 중간코드 의사명령어 처리와 심벌처리와 중간코드의 패턴검사와 레지스터 관리와 입출력 파일처리 및 옵션처리 등을 수행한다.In this section, calculation of the formula using the code conversion rule table and the information provided from the program dependent on the target processor, intermediate code pseudo-instruction processing, symbol processing, pattern checking of intermediate code, register management, input / output file processing, and optional processing are performed. do.

이들 코드변환 규칙 프로그램과 목표 프로세서에 대하여 독립적인 프로그램 및 목표 프로세서에 대하여 종속적인 프로그램을 함께 컴파일하면 목표 프로세서용 어셈블리 코드 생성기가 만들어지게 되는 것이다.Compiling these code conversion rule programs and programs independent of the target processor and programs dependent on the target processor together creates an assembly code generator for the target processor.

먼저, 코드변환 규칙 테이블을 작성하고 나서 목표 프로세서에 대하여 종속적인 프로그램을 작성해야 한다.First, you need to create a transcoding rules table and then write a program that depends on the target processor.

S1부터 S4까지의 과정이 코드변환 규칙 테이블을 작성하는 과정이고, S6부터 S9까지의 과정이 목표 프로세서에 대하여 종속적인 프로그램을 작성하는 과정이다.Processes S1 through S4 create a code conversion rule table, and processes S6 through S9 create a program dependent on the target processor.

S1에서는 목표 프로세서의 어셈블리 언어에서 정의된 레지스터에 관련된 내용들을 테이블에 기술한다.In S1, the contents related to the registers defined in the assembly language of the target processor are described in a table.

S2에서는 목표 프로세서에 대한 어셈블리 명령어의 오퍼랜드 주소지정(addressing) 모드에 대한 정의를 기술한다.S2 describes the definition of the operand addressing mode of the assembly instructions for the target processor.

여기서, 레지스터 정의와 주소지정 모드는 코드변환시 가상스텍에 저장되어 입력 중간코드와 일치하는 코드생성 규칙이 있는지를 검사할 때 함께 이용되는 것이다.Here, register definition and addressing mode are used together to check whether there is a code generation rule that is stored in the virtual stack during code conversion and matches the input intermediate code.

S3에서는 레지스터 정의와 주소지정 모드정의를 이용하여 중간코드에서 목표 프로세서용 어셈블리 코드로 변환하기 위한 코드생성 규칙을 기술한다.S3 describes the code generation rules for converting intermediate code to assembly code for the target processor using register definitions and addressing mode definitions.

S4에서는 코드변환할 때에 중간코드와 가상스택에 저장된 레지스터 정의 또는 주소지정 모드 중에서 코드생성 규칙에 정의된 내용과 일치하는 규칙이 없을 때에 가상스택의 내용을 강제적으로 코드생성 규칙과 일치하는 패턴으로 변환하는 규칙을 정의하여 코드변환 규칙 테이블을 완성한다.S4 converts the contents of the virtual stack into a pattern that matches the code generation rule when there is no rule in the intermediate code and the register definition or addressing mode stored in the virtual stack that matches the content defined in the code generation rule. Complete the transcoding rules table by defining a rule that

S5에서는 S1부터 S4까지의 과정으로 완성된 코드변환 규칙 테이블을 이용하여 코드 생성기를 생성하는 생성기로 코드변환 규칙 프로그램을 만든다.In S5, a code conversion rule program is generated by a generator that generates a code generator using the code conversion rule table completed in the process of S1 to S4.

S6에서는 중간코드 의사명령어를 어셈블리 의상명령어로 변환하는 규칙을 작성한다.In S6, you write a rule that translates intermediate code pseudo-instructions into assembly cloth instructions.

S7에서는 함수를 호출할 때와 호출된 함수에서 복귀할 때에 처리하는 스택 프레임의 생성 및 소멸에 관한 내용을 작성한다.In S7, the contents of the generation and destruction of the stack frame to be processed when the function is called and when the function returns from the called function are written.

S8에서는 중간코드 데이터 타입을 어셈블리 언어에 정의된 데이터 타입으로 변환하는 규칙을 작성한다.In S8, you write rules to convert intermediate code data types to data types defined in assembly language.

S9에서는 생성되는 어셈블리 코드를 쉽게 읽을 수 있도록 원시파일의 해당라인의 정보를 해당 어셈블리 코드 앞에 기술하는 알고리듬을 작성하여 목표 프로세서에 대하여 종속적인 프로그램의 작성을 완성한다.In S9, the algorithm that describes the information of the corresponding line of the source file in front of the assembly code is written so that the generated assembly code can be easily read.

S10에서는 목표 프로세서에 대하여 독립적인 프로그램의 작성을 완성한다.In S10, the creation of a program independent of the target processor is completed.

S11에서는 코드변환 규칙 프로그램과 목표 프로세서에 대하여 독립적인 프로그램 및 목표 프로세서에 대하여 종속적인 프로그램을 함께 컴파일하여 목표 프로세서용 어셈블리 코드 생성기를 작성한다.In S11, an assembly code generator for the target processor is created by compiling a code conversion rule program, a program independent of the target processor, and a program dependent on the target processor.

그러므로, 상술한 바와 같은 본 발명은 코드변환 규칙 테이블과 목표 프로세서에 관련된 프로그램을 이용하여 코드 생성기를 작성하는 방법을 제시함으로써 컴파일러의 후위 처리기의 구현이 쉬워져서 컴파일러를 전위 처리기와 후위 처리기 2부분으로 나누어서 구현하는 데에 있어서 더 쉬워졌다는 데에 그 효과가 있다.Therefore, the present invention as described above provides a method of writing a code generator using a code conversion rule table and a program related to a target processor, thereby facilitating the implementation of the compiler postprocessor so that the compiler can be divided into two parts: the preprocessor and the postprocessor. The effect is that it is easier to implement separately.

Claims (4)

코드변환 규칙 테이블을 작성하는 단계, 코드변환 규칙 테이블을 이용하여 코드 생성기를 생성하는 생성기로 코드변환 규칙 프로그램을 만드는 단계; 목표 프로세서에 대하여 종속적인 프로그램을 작성하는 단계, 목표 프로세서에 대하여 독립적인 프로그램을 작성하는 단계; 및 코드변환 규칙 프로그램과 목표 프로세서에 대하여 독립적인 프로그램 및 목표 프로세서에 대하여 종속적인 프로그램을 함께 컴파일하여 목표 프로세서용 어셈블리 코드 생성기를 완성하는 단계로 이루어지는 것을 특징으로 하는 목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법.Creating a transcoding rule table; creating a transcoding rule program with a generator that generates a code generator using the transcoding rule table; Creating a program dependent on the target processor, creating a program independent of the target processor; And compiling the code conversion rule program and the program independent of the target processor and the program dependent on the target processor to complete the assembly code generator for the target processor. Way. 제1항에 있어서, 코드변환 규칙 테이블 작성단계가, 목표 프로세서의 어셈블리 언어에서 정의된 레지스터에 관련된 내용들을 테이블에 기술하는 단계; 목표 프로세서에 대한 어셈블리 명령어의 오퍼랜드 주소지정 모드에 대한 정의를 기술하는 단계; 레지스터 정의와 주소지정 모드정의를 이용하여 중간코드에서 목표 프로세서용 어셈블리 코드로 변환하기 위한 코드생성 규칙을 기술하는 단계; 및 코드를 변환할 때에 중간코드와 가상스택에 저장된 레지스터 정의 또는 주소지정 모드 중에서 코드생성 규칙에 정의된 내용과 일치하는 규칙이 없을 때에 가상스택의 내용을 강제적으로 코드생성 규칙과 일치하는 패턴으로 변환하는 규칙을 정의하여 코드변환 규칙 테이블을 완성하는 단계로 이루어지는 것을 특징으로 하는 목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법.2. The method of claim 1, wherein creating a transcoding rule table comprises: describing in a table contents relating to a register defined in an assembly language of a target processor; Describing a definition for the operand addressing mode of the assembly instruction for the target processor; Describing a code generation rule for converting intermediate code to assembly code for a target processor using register definitions and addressing mode definitions; When the code is converted, the contents of the virtual stack are forcibly converted into a pattern matching the code generation rule when there is no rule that matches the content defined in the code generation rule among the register definition or addressing mode stored in the intermediate code and the virtual stack. A method of writing an assembly code generator for a target processor, comprising: defining a rule to complete a transcoding rule table. 제2항에 있어서, 레시스터 정의와 주소지정 모드가 코드변환시 가상스텍에 저장되어, 입력되는 중간코드와 일치하느 코드생성 규칙이 있는지를 검사할 때에 함께 이용되는 것을 특징으로 하는 목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법.3. The assembly code of claim 2, wherein the register definition and the addressing mode are stored in the virtual stack at the time of code conversion and used together when checking whether there is a code generation rule that matches the input intermediate code. How to write a generator. 제1항에 있어서, 목표 프로세서에 대하여 종속적인 프로그램 작성단계가, 중간코드 의사 명령어를 어셈블리 의사명령어로 변환하는 규칙을 작성하는 단계, 함수를 호출할 때와 호출한 함수에서 복귀할 때에 처리하는 스택프레임의 생성 및 소멸에 관한 내용을 작성하는 단계; 중간코드의 데이터 타입을 어셈블리 언어에 정의된 데이터 타입으로 변환하는 규칙을 작성하는 단계; 및 생성되는 어셈블리 코드를 쉽게 읽을 수 있도록 해당 어셈블리 코드 앞에 원시파일의 해당 라인의 정보를 기술하는 알고리듬을 작성하여 목표 프로세서에 대하여 종속적인 프로그램의 작성을 완성하는 단계로 이루어지는 것을 특징으로 하는 목표 프로세서용 어셈블리 코드 생성기를 작성하는 방법.The stack of claim 1, wherein the programming step dependent on the target processor comprises: writing rules for converting intermediate code pseudo-instructions into assembly pseudo-instructions, stacking when calling a function and returning from the calling function. Writing content about creation and destruction of a frame; Writing a rule for converting the data type of the intermediate code to the data type defined in the assembly language; And writing an algorithm describing information of a corresponding line of a source file in front of the assembly code so that the generated assembly code can be easily read, and completing writing a program dependent on the target processor. How to write an assembly code generator.
KR1019960029721A 1996-07-23 1996-07-23 Method for designing assembly code generator for target processor KR0169909B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019960029721A KR0169909B1 (en) 1996-07-23 1996-07-23 Method for designing assembly code generator for target processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019960029721A KR0169909B1 (en) 1996-07-23 1996-07-23 Method for designing assembly code generator for target processor

Publications (2)

Publication Number Publication Date
KR980010760A KR980010760A (en) 1998-04-30
KR0169909B1 true KR0169909B1 (en) 1999-01-15

Family

ID=19467121

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019960029721A KR0169909B1 (en) 1996-07-23 1996-07-23 Method for designing assembly code generator for target processor

Country Status (1)

Country Link
KR (1) KR0169909B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111857678B (en) * 2019-04-25 2024-05-31 阿里巴巴(中国)有限公司 Code generation method, device, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
KR980010760A (en) 1998-04-30

Similar Documents

Publication Publication Date Title
USRE38104E1 (en) Method and apparatus for resolving data references in generated code
US5535391A (en) System and methods for optimizing object-oriented compilations
US6343373B1 (en) Retargetable information process system
US6748588B1 (en) One-pass greedy-pattern-matching finite-state-machine code generation
US7823139B2 (en) Method and system for translating programming languages
US20070226720A1 (en) System and Method for Efficiently Passing Information Between Compiler and Post-Compile-Time Software
US20060200796A1 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
KR960003138B1 (en) Analyzing inductive expressions in a multi-language optimizing compiler
KR0169909B1 (en) Method for designing assembly code generator for target processor
Sagonas et al. All you wanted to know about the HiPE compiler: (but might have been afraid to ask)
Tolmach Combining closure conversion with closure analysis using algebraic types
KR0169908B1 (en) Back-end of compiler using intermediate codes and tis method for generating assembly codes
Meyer et al. Image algebra preprocessor for the MasPar parallel computer
Logothetis et al. Compiling short‐circuit boolean expressions in one pass
Wendt Fast code generation using automatically-generated decision trees
von Ronne et al. Interpreting programs in static single assignment form
JP2000056981A (en) Program conversion device
Cilio et al. Efficient code generation for ASIPs with different word sizes
CN117971231A (en) Code processing method and device, electronic equipment and storage medium
Louden et al. Compilers and Interpreters.
JPH04120629A (en) Code generating method
Granicz et al. Phobos: A front-end approach to extensible compilers (long version)
von Ronne et al. A virtual machine for interpreting programs in static single assignment form
Daniel et al. Translation for intermediate code
JPH0373026A (en) Compile system

Legal Events

Date Code Title Description
A201 Request for examination
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20041001

Year of fee payment: 7

LAPS Lapse due to unpaid annual fee