KR20120062970A - Apparatus and method for analyzing assembly language code - Google Patents
Apparatus and method for analyzing assembly language code Download PDFInfo
- Publication number
- KR20120062970A KR20120062970A KR1020100123925A KR20100123925A KR20120062970A KR 20120062970 A KR20120062970 A KR 20120062970A KR 1020100123925 A KR1020100123925 A KR 1020100123925A KR 20100123925 A KR20100123925 A KR 20100123925A KR 20120062970 A KR20120062970 A KR 20120062970A
- Authority
- KR
- South Korea
- Prior art keywords
- assembly language
- language code
- dependency
- instruction
- input
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
Abstract
Description
실시예들은 어셈블리(assembly) 언어 코드의 분석 장치 및 방법에 관한 것이다. Embodiments relate to an apparatus and method for analyzing assembly language code.
어셈블리(assembly) 언어 프로그래밍은, 시스템에 밀접하거나 또는 성능에 민감한 프로그램을 작성하기 위하여 사용되고 있다. 예를 들어, 운영체제(Operating System; OS) 프로그램의 경우 캐쉬(cache) 및 가상 메모리 주소의 설정 등을 필요로 하나, 이는 C 또는 C++ 와 같은 상위 수준의 언어로는 표현할 수 없고 중앙 처리 장치(Central Processing Unit; CPU)가 제공하는 어셈블리 명령어를 통해서만 제어할 수 있다. 따라서, 이들 기능은 해당 CPU가 제공하는 어셈블리 언어를 이용하여 프로그래밍 되고 있다. 또한, 곱셈 또는 나눗셈과 같이 연산량이 많은 연산을 CPU가 명령어로 제공하지 않는 경우, 관련된 프로그램을 작성하기 위해서는 이들 연산을 제공하는 라이브러리(library) 함수를 만들어서 사용하게 된다. 이러한 라이브러리 함수를 프로그래밍할 때, 보다 나은 성능을 위해 해당 CPU에 최적화된 어셈블리 언어로 개발자들이 직접 프로그래밍을 하고 있다. Assembly language programming is used to write programs that are system-sensitive or performance sensitive. For example, operating system (OS) programs require the setting of caches and virtual memory addresses, which cannot be expressed in higher-level languages such as C or C ++ and are not centralized. Controllable only through assembly instructions provided by the Processing Unit (CPU). Therefore, these functions are programmed using the assembly language provided by the CPU. In addition, when the CPU does not provide a large amount of operations such as multiplication or division as an instruction, a library function that provides these operations is used to create a related program. When programming these library functions, developers are programming in assembly language optimized for the CPU for better performance.
그러나, 기존의 어셈블리 언어 프로그래밍 도구들은, 작성된 어셈블리 언어 코드의 문법적인 부분을 검사하는 기능만을 제공하고 있다. 이 때문에 위에서 기술한 것과 같이 어셈블리 언어로 프로그래밍을 할 경우 개발자가 해당 CPU의 명령어 및 아키텍처(architecture)에 숙련되지 않았다면, 해당 CPU에 최적화된 어셈블리 프로그램을 작성하는 일은 오류가 발생하기 쉽고 시간이 많이 소요되는 어려운 작업이 되는 것이 현실이다. However, existing assembly language programming tools only provide the ability to examine the grammatical parts of written assembly language code. Because of this, if you are programming in assembly language as described above, writing a program optimized for that CPU is error-prone and time-consuming unless you are skilled at the instructions and architecture of that CPU. It is a difficult task to become a reality.
본 발명의 일 측면에 따르면, 어셈블리(assembly) 언어로 프로그램을 작성할 경우 작성된 어셈블리 언어 코드가 가지고 있는 성능에 저해될 수 있는 문제점들을 분석하여 개발자에게 제공함으로써 보다 나은 성능을 위한 어셈블리 프로그래밍을 가능하게 하는 어셈블리 언어 코드의 분석 장치 및 방법을 제공할 수 있다. According to an aspect of the present invention, when writing a program in an assembly language (assembly) to analyze the problems that may be impaired the performance of the assembly language code written to provide a developer to enable assembly programming for better performance An apparatus and method for analyzing assembly language code can be provided.
일 실시예에 따른 어셈블리(assembly) 언어 코드의 분석 장치는, 어셈블리 언어의 처리 수단에 대한 의존도(dependency) 규약 정보를 저장하는 저장 모듈; 하나 이상의 명령어를 포함하는 어셈블리 언어 코드가 입력되는 입력 모듈; 및 입력된 상기 어셈블리 언어 코드를 상기 의존도 규약 정보에 따라 분석하여, 상기 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 결정하는 분석 모듈을 포함할 수 있다.According to an embodiment, an apparatus for analyzing assembly language code may include: a storage module configured to store dependency protocol information on a processing means of assembly language; An input module to which assembly language code including one or more instructions is input; And an analysis module for analyzing the input assembly language code according to the dependency agreement information to determine a portion corresponding to an error or a performance degradation factor in the assembly language code.
일 실시예에 따른 어셈블리 언어 코드의 분석 방법은, 하나 이상의 명령어를 포함하는 어셈블리 언어 코드를 수신하는 단계; 수신된 상기 어셈블리 언어 코드를 미리 저장된 어셈블리 언어의 처리 수단에 대한 의존도 규약 정보에 따라 분석하는 단계; 및 상기 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 결정하는 단계를 포함할 수 있다.According to an embodiment, a method of analyzing assembly language code may include: receiving assembly language code including one or more instructions; Analyzing the received assembly language code according to dependency agreement information on a processing means of pre-stored assembly language; And determining a part corresponding to an error or a performance degradation factor in the assembly language code.
본 발명의 일 측면에 따른 어셈블리(assembly) 언어 코드의 분석 장치 및 방법을 이용하면, 입력된 어셈블리 언어 코드를 초기에 입력된 중앙 처리 장치(Central Processing Unit; CPU)의 의존도(dependency) 규약 정보에 기초하여 분석하고, 분석 결과를 기반으로 오류 또는 성능 저하 요인들을 찾아내어 개발자에게 보고할 수 있다. 따라서, 개발자는 해당 CPU에 최적화된 고성능의 어셈블리 언어 코드를 용이하게 작성할 수 있게 된다. Using an apparatus and method for analyzing assembly language codes according to an aspect of the present invention, inputted assembly language codes may be added to dependency protocol information of a central processing unit (CPU) initially input. Based on the analysis results, errors or performance degradation factors can be identified and reported to the developer. Therefore, the developer can easily write high performance assembly language code optimized for the CPU.
도 1은 일 실시예에 따른 어셈블리(assembly) 언어 코드의 분석 장치의 블록도이다.
도 2는 일 실시예에 따른 어셈블리 언어 코드의 분석 장치의 출력 화면을 나타내는 개략도이다.
도 3은 일 실시예에 따른 어셈블리 언어 코드의 분석 방법을 나타내는 순서도이다.
도 4는 일 실시예에 따른 어셈블리 언어 코드의 분석 과정에서 생성되는 그래프를 나타내는 개략도이다. 1 is a block diagram of an apparatus for analyzing assembly language code, according to an exemplary embodiment.
2 is a schematic diagram illustrating an output screen of an apparatus for analyzing assembly language code, according to an exemplary embodiment.
3 is a flowchart illustrating a method of analyzing assembly language code, according to an exemplary embodiment.
4 is a schematic diagram illustrating a graph generated during an analysis of assembly language code, according to an exemplary embodiment.
이하에서는, 도면을 참조하여 본 발명의 실시예에 대해 구체적으로 설명한다. 그러나, 본 발명이 하기 실시예에 의하여 제한되는 것은 아니다.Hereinafter, with reference to the drawings will be described in detail an embodiment of the present invention. However, the present invention is not limited by the following examples.
본 명세서에 기술된 실시예는 전적으로 하드웨어이거나, 부분적으로 하드웨어이고 부분적으로 소프트웨어이거나, 또는 전적으로 소프트웨어인 측면을 가질 수 있다. 본 명세서에서 "부(unit)", "모듈(module)", "장치" 또는 "시스템" 등은 하드웨어, 하드웨어와 소프트웨어의 조합, 또는 소프트웨어 등 컴퓨터 관련 엔티티(entity)를 지칭한다. 예를 들어, 본 명세서에서 부, 모듈, 장치 또는 시스템 등은 실행중인 프로세스, 프로세서, 객체(object), 실행 파일(executable), 실행 스레드(thread of execution), 프로그램(program), 및/또는 컴퓨터(computer)일 수 있으나, 이에 제한되는 것은 아니다. 예를 들어, 컴퓨터에서 실행중인 애플리케이션(application) 및 컴퓨터의 양쪽이 모두 본 명세서의 부, 모듈, 장치 또는 시스템 등에 해당할 수 있다. Embodiments described herein may have aspects that are wholly hardware, partly hardware and partly software, or wholly software. As used herein, "unit", "module", "device" or "system" and the like refer to hardware, a combination of hardware and software, or a computer related entity such as software. For example, parts, modules, devices, or systems herein refer to running processes, processors, objects, executables, threads of execution, programs, and / or computers. computer, but is not limited thereto. For example, both an application running on a computer and a computer may correspond to a part, module, device, system, or the like herein.
도 1은 일 실시예에 따른 어셈블리(assembly) 언어 코드의 분석 장치의 블록도이다. 1 is a block diagram of an apparatus for analyzing assembly language code, according to an exemplary embodiment.
도 1을 참조하면, 어셈블리 언어 코드의 분석 장치는 입력 모듈(10), 저장 모듈(20) 및 분석 모듈(30)을 포함할 수 있다. 또한, 일 실시예에서, 어셈블리 언어 코드의 분석 장치는 출력 모듈(40)을 더 포함할 수도 있다. 이상의 모듈(10, 20, 30, 40) 각각은 유선 및/또는 무선으로 상호간에 통신 가능하게 연결될 수 있다. Referring to FIG. 1, an apparatus for analyzing assembly language code may include an
입력 모듈(10)은 개발자가 작성하는 어셈블리 언어 코드가 입력되는 부분이다. 예를 들어, 입력 모듈(10)은 어셈블리 언어 코드를 입력할 수 있는 키보드(keyboard) 또는 다른 적당한 입력 장치를 포함할 수 있다. 또한, 후술하는 것과 같이 입력 모듈(10)을 통해 해당 어셈블리 언어의 처리 수단에 대한 의존도(dependency) 규약 정보가 입력될 수도 있다.The
저장 모듈(20)은 입력 모듈(10)에 입력된 어셈블리 언어 코드의 분석을 위해 해당 어셈블리 언어의 처리 수단에 대한 의존도 규약 정보가 저장되는 부분이다. 처리 수단이란, 컴퓨터의 중앙 처리 장치(Central Processing Unit; CPU) 또는 다른 적당한 프로세서를 지칭할 수 있다. 의존도 규약 정보는 레지스터(register)의 종류, 오류 또는 성능 저하가 발생할 수 있는 요인들에 대한 정보 등이 기록된 파일의 형태로 저장될 수 있다. 의존도 규약 정보는 사전에 생성되어 저장 모듈(20)에 저장되거나, 또는/또한 입력 모듈(10)을 통해 입력되어 저장 모듈(20)에 저장될 수 있다. The
분석 모듈(30)은, 저장 모듈(20)에 저장되어 있는 의존도 규약 정보를 이용하여, 입력 모듈(10)에 입력된 어셈블리 언어 코드를 분석하기 위한 부분이다. 이러한 분석을 통하여, 입력된 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 알아낼 수 있다. 일 실시예에서, 분석 모듈(30)은 그래프 생성부(31) 및 그래프 분석부(32)를 포함할 수 있다. The
그래프 생성부(31)는 입력 모듈(10)에 입력된 어셈블리 언어 코드에 대응되는 그래프를 생성하는 부분이다. 그래프 생성부(31)는, 어셈블리 언어 코드의 각 줄에 기재된 명령어를, 명령어의 동작을 의미하는 연산자(opcode) 및 그 동작에 사용되는 피연산자인 주소부(operand)로 구분하여 기록할 수 있다. 또한, 그래프 생성부(31)는 분석된 각각의 명령어를 그래프상의 노드(node)로 변환할 수 있으며, 어셈블리 언어 코드의 한 줄이 입력될 때마다 그래프에 노드가 추가될 수 있다. 상기 그래프에 대해서는 상세히 후술한다. The
그래프 분석부(32)는, 그래프 생성부(31)에 의해 생성된 그래프를 분석하여 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 결정할 수 있다. 즉, 그래프 분석부(32)는, 상기 그래프를 이용하여 이전에 입력된 어셈블리 언어 코드들과 현재 입력된 어셈블리 언어 코드 사이의 의존도를 분석함으로써, 오류 또는 성능 저하 요인에 해당하는 명령어를 알아낼 수 있다. The
출력 모듈(40)은, 어셈블리 언어 코드 중 분석 모듈(30)에 의하여 오류 또는 성능 저하 요인에 해당하는 부분으로 결정된 명령어를 출력할 수 있다. 예컨대, 분석 모듈(30)에 의한 분석 결과 입력된 어셈블리 언어 코드에서 오류 또는 성능 저하가 예상될 경우, 출력 모듈(40)은 오류 또는 성능 저하에 관련된 명령어의 정보를 화면에 출력할 수 있다. 개발자는 작성중인 어셈블리 언어 코드에서 오류 또는 성능 저하 요인이 되는 부분을 출력 모듈(40)을 통해 즉각적으로 확인하고 문제가 되는 부분을 개선할 수 있다. The
도 2는 일 실시예에 따른 어셈블리 언어 코드의 분석 장치의 출력 화면을 나타내는 개략도이다. 도 2를 참조하면, 어셈블리 언어 코드의 분석 장치의 출력 화면은 제1 화면(210) 및 제2 화면(220)으로 구성될 수 있다. 제1 화면(210)에는 개발자가 입력하는 어셈블리 언어 코드가 표시될 수 있다. 제2 화면(220)에는, 현재까지 작성된 어셈블리 언어 코드를 분석하여 얻어지는, 오류 또는 성능 저하를 일으킬 수 있는 원인 및 그 원인에 관련된 어셈블리 언어 코드가 표시될 수 있다. 2 is a schematic diagram illustrating an output screen of an apparatus for analyzing assembly language code, according to an exemplary embodiment. Referring to FIG. 2, the output screen of the apparatus for analyzing the assembly language code may include a
일 예로, 제2 화면(220)을 통해 다음과 같은 메시지가 표시될 수 있다: "warning: line 20 -> expected pipeline stall". 이상의 메시지는 현재까지 작성된 어셈블리 언어 코드 중 20번째 줄에 기재된 명령어로 인해 파이프라인 스톨(pipeline stall)이 발생할 수 있음을 표시한다. 그러나, 이상의 출력 화면 및 메시지는 단지 예시적인 것으로서, 어셈블리 언어 코드의 분석 장치에서 분석 결과의 출력 형태는 전술한 것으로 한정되지 않으며 개발자가 분석 결과를 용이하게 확인할 수 있는 다른 다양한 형태로 출력될 수 있다. For example, the following message may be displayed on the second screen 220: "warning: line 20-> expected pipeline stall". The above message indicates that a pipeline stall may occur due to the instruction written on
도 3은 일 실시예에 따른 어셈블리 언어 코드의 분석 방법의 각 단계를 나타내는 순서도이다. 3 is a flowchart illustrating each step of a method of analyzing assembly language code, according to an exemplary embodiment.
도 3을 참조하면, 먼저 작성하고자 하는 어셈블리 언어의 처리 수단(예컨대, CPU)에 대한 의존도 규약 정보가 입력될 수 있다(S1). 예컨대, 의존도 규약 정보는 키보드 등의 입력 수단을 통해 입력되어 별도의 저장 수단에 저장될 수 있다. 그러나, 다른 실시예에서, 의존도 규약 정보는 입력되는 대신 사전에 미리 저장되어 있을 수도 있으며, 이 경우 전술한 의존도 규약 정보의 입력 단계(S1)는 생략될 수도 있다. Referring to FIG. 3, dependency agreement information on a processing means (eg, a CPU) of an assembly language to be written first may be input (S1). For example, the dependency agreement information may be input through an input means such as a keyboard and stored in a separate storage means. However, in another embodiment, the dependency agreement information may be stored in advance instead of being input, in which case the above-described step of inputting the dependency agreement information S1 may be omitted.
의존도 규약 정보에는 어셈블리 언어 코드의 각 명령어의 특성이 기술될 수 있다. 예를 들어, 정수 관련 산술 연산 명령어, 소수 관련 산술 연산 명령어, 비트 연산 명령어, 메모리 접근 명령어 또는 브랜치(branch) 관련 명령어 등 각 명령어의 속성이 의존도 규약 정보에 포함될 수 있다. 의존도 규약 정보에는 각 명령어가 수행되는 데 걸리는 시간(예컨대, CPU의 싸이클(cycle) 단위)이 포함될 수도 있다. 또한, 의존도 규약 정보에는 각 명령어의 속성 관련 의존도 정보가 포함될 수 있으며, 예컨대 메모리 접근 명령어 뒤에 브랜치 명령어가 올 경우 몇 싸이클을 기다려야 하는지에 대한 정보 등이 이에 해당된다. 또한, 의존도 규약 정보에는 CPU 레지스터 세트(set)가 포함될 수 있다.The dependency protocol information may describe the characteristics of each instruction in assembly language code. For example, the dependency protocol information may include attributes of each instruction such as an integer arithmetic instruction, a decimal arithmetic instruction, a bit arithmetic instruction, a memory access instruction, or a branch related instruction. The dependency protocol information may include the time taken for each instruction to be executed (for example, a cycle of a CPU). In addition, the dependency protocol information may include dependency information related to attributes of each instruction. For example, information about how many cycles to wait when a branch instruction comes after a memory access instruction is included. In addition, the dependency agreement information may include a CPU register set.
이상에서 기재한 의존도 규약 정보는 단지 예시적인 것으로서, 의존도 규약 정보에 포함되는 정보는 전술한 것에 한정되지 않는다. 또한, 의존도 규약 정보 중 일부의 정보는 모든 종류의 CPU에 공통적일 수 있는 반면, 다른 일부의 정보는 특정 종류의 CPU에만 해당하는 것일 수도 있다.The dependency agreement information described above is merely exemplary, and the information included in the dependency agreement information is not limited to the above. In addition, some of the dependency protocol information may be common to all kinds of CPU, while some other information may be specific to the specific type of CPU.
다음으로, 분석하고자 하는 어셈블리 언어 코드가 입력될 수 있다(S2). 예컨대, 개발자는 키보드 또는 다른 적당한 입력 수단을 통하여 어셈블리 언어 코드를 작성할 수 있다. 입력되는 어셈블리 언어 코드는 하나 이상의 명령어를 포함하며, 어셈블리 언어 코드의 각 줄이 하나의 명령어에 대응된다. 어셈블리 언어 코드는 C 또는 C++와 같은 상위 수준 언어와 달리 각 줄, 즉, 각 명령어마다 해당하는 동작을 명시하므로, 후술하는 것과 같이 어셈블리 언어 코드를 한 줄 단위로 분석할 수 있다.Next, the assembly language code to be analyzed may be input (S2). For example, a developer can write assembly language code via a keyboard or other suitable input means. The input assembly language code includes one or more instructions, and each line of assembly language code corresponds to one instruction. Unlike high-level languages such as C or C ++, assembly language code specifies a corresponding action for each line, that is, each instruction, so that assembly language code can be analyzed on a line-by-line basis as described below.
다음으로, 입력된 어셈블리 언어 코드의 각 명령어를 명령어의 동작을 의미하는 연산자(opcode) 및 그 동작에 사용되는 피연산자인 주소부(operand)로 분석하고(S3), 분석된 각 명령어를 그래프상의 노드로 변환할 수 있다(S4). 이상의 과정(S3, S4)은 어셈블리 언어 코드에서 각 명령어 단위, 즉, 어셈블리 언어 코드의 각 줄 단위로 수행될 수 있다. 따라서, 어셈블리 언어 코드의 한 줄이 입력될 때마다 그래프에 해당 줄에 대응되는 노드가 추가될 수 있다. Next, each instruction of the input assembly language code is analyzed into an operator (opcode) representing the operation of the instruction and an operand which is an operand used in the operation (S3), and each analyzed instruction is a node on the graph. Can be converted to (S4). The above processes S3 and S4 may be performed in units of instructions in the assembly language code, that is, in units of lines of the assembly language code. Therefore, whenever a line of assembly language code is input, a node corresponding to the line may be added to the graph.
구체적으로는, 먼저 명령어를 연산자 및 주소부로 분리한 후, 분리된 각 명령어가 어떤 속성을 가지고 있는지를 전술한 의존도 규약 정보를 통하여 알아낼 수 있다. 다음으로, 기존에 입력된 명령어들의 그래프에 현재 단계에서 분리된 명령어를 특성별로 추가할 수 있다. 이때, 추가되는 명령어는 명령어들이 실행되는 순서에 대응되는 제어 흐름(control flow) 및 피연산자들의 의존도 및 명령어 속성들간의 의존도에 대응되는 데이터 흐름(data flow)을 고려하여 그래프상에 적절히 배치될 수 있다.Specifically, first, after dividing an instruction into an operator and an address unit, it is possible to find out what attribute each separated instruction has through the above-described dependency protocol information. Next, a command separated in the current step may be added to the graph of previously input commands by characteristics. In this case, the added instruction may be appropriately disposed on the graph in consideration of the control flow corresponding to the order in which the instructions are executed, the data flow corresponding to the dependence of the operands, and the dependency between the instruction attributes. .
도 4는 일 실시예에 따른 어셈블리 언어 코드의 분석 과정에서 생성되는 그래프를 나타내는 개략도이다. 도 4는 하기 표 1과 같은 어셈블리 언어 코드가 입력되었을 경우 이에 대응되어 생성되는 그래프를 나타낸 것이다. 4 is a schematic diagram illustrating a graph generated during an analysis of assembly language code, according to an exemplary embodiment. 4 illustrates a graph generated corresponding to the assembly language code as shown in Table 1 below.
도 4를 참조하면, 그래프는 표 1에 기재된 어셈블리 언어 코드의 각 줄(즉, 각 명령어)에 대응되는 노드(401, 402, 403, 404, 405)를 포함한다. 각각의 노드 사이에 표시된 에지(edge)(411~414, 421~422)는 전술한 단계(S1)에서 입력된 의존도 규약에 따라 각 명령어 사이의 의존도를 나타낸 것이다. 실선으로 표시된 에지(411, 412, 413, 414)는 제어 흐름 의존도를 나타내며, 점선으로 표시된 에지(421, 422)는 데이터 흐름 의존도를 나타낸다. Referring to FIG. 4, the graph includes
다음으로, 이상의 과정에 의해 생성된 그래프를 분석하여 오류 또는 성능 저하 요인을 분석할 수 있다(S5). 즉, 전술한 단계(S3, S4)에서 생성된 그래프의 각 노드 사이의 의존도를 이용하여, 이전에 작성된 어셈블리 언어 코드들과 현재 입력된 어셈블리 언어 코드 사이의 의존도를 분석하여 오류 또는 성능 저하 요인에 해당하는 명령어를 검출할 수 있다. 어셈블리 언어 코드로부터 의존도를 이용하여 오류 또는 성능 저하 요인을 검출하는 과정의 일 예를 설명하면 다음과 같다.Next, by analyzing the graph generated by the above process can analyze the error or performance degradation factor (S5). That is, by using the dependencies between the nodes of the graph generated in the above-described steps (S3, S4), the dependency between previously written assembly language codes and the currently input assembly language code is analyzed to determine errors or performance degradation factors. The corresponding command can be detected. An example of a process of detecting errors or performance degradation factors using dependencies from assembly language code is as follows.
ARM CPU의 경우, 메모리 주소로부터 레지스터로 값을 읽어오는 명령어인 ldr 명령어의 수행이 완료되는데 드는 시간이 의존도 규약에 포함될 수 있다. 예컨대, 의존도 규약에 상기 시간이 4 싸이클(cycle)이라고 정의되어 있을 경우, ldr 명령어의 결과를 담고 있는 레지스터를 피연산자로 사용하는 명령어들은 4 싸이클 뒤에 ldr 명령어의 결과를 사용하여야 파이프라인의 스톨을 막을 수 있게 된다. 이때, 다음 표 2와 같은 어셈블리 언어 코드가 입력되었을 경우를 가정한다.For ARM CPUs, the dependency protocol may include the time it takes to complete the execution of the ldr instruction, which reads a value from a memory address into a register. For example, if the dependency protocol defines that the time is four cycles, instructions that use the register containing the result of the ldr instruction as an operand must use the result of the ldr instruction after four cycles to prevent stalling of the pipeline. It becomes possible. In this case, it is assumed that the assembly language code shown in Table 2 below is input.
표 2에 기재된 어셈블리 언어 코드의 첫 번째 줄은 label 메모리 주소에 있는 내용을 r0 레지스터로 읽어오는 명령어이며, 두 번째 줄은 r0 및 r2 레지스터의 내용을 더하여 r1 레지스터에 입력하는 명령어이다. 각 명령어의 실행은 1 싸이클을 단위로 순차적으로 이루어진다. 표 2와 같이 ldr 명령어의 결과인 r0를 다음 명령어인 add에서 바로 사용하도록 어셈블리 언어 코드를 작성하게 되면, 어셈블리 언어 코드가 실제 CPU에 의해 실행될 때 ldr 명령어의 결과인 r0를 add 명령어가 실행될 때 사용할 수 없게 되므로, r0를 add 명령어가 사용할 수 있을 때까지 CPU 내의 파이프라인이 스톨, 즉, 멈춰있게 된다.The first line of the assembly language code shown in Table 2 reads the contents of the label memory address into the r0 register. The second line adds the contents of the r0 and r2 registers to the r1 register. Each instruction is executed sequentially in units of one cycle. If you write assembly language code to use r0, the result of the ldr instruction, directly in the next instruction, add, as shown in Table 2, r0, the result of the ldr instruction, is used when the add instruction is executed when the assembly language code is executed by the real CPU. This prevents the pipeline from stalling, or stalling, in the CPU until r0 is available to the add instruction.
이를 방지하기 위하여, 그래프의 각 노드 사이의 의존도를 이용하여 오류 또는 성능 저하 요인에 해당하는 명령어를 검출할 수 있다(S5). 예컨대, ldr 명령어 다음에 오는 명령어가 ldr 명령어의 결과를 사용하도록 하는 어셈블리 언어 코드가 입력되었을 경우, 의존도 규약 정보에서 ldr 명령어의 수행이 완료되는데 드는 시간을 참조하여 성능 저하 요인을 결정할 수 있다. 즉, 표 2에 기재된 어셈블리 언어 코드의 경우, 두 번째 줄에 기재된 add 명령어가 성능 저하 요인에 해당된다.In order to prevent this, a command corresponding to an error or a performance deterioration factor may be detected using the dependency between each node of the graph (S5). For example, when assembly language code is inputted so that the instruction following the ldr instruction uses the result of the ldr instruction, the performance degradation factor may be determined by referring to the time taken to complete the execution of the ldr instruction in the dependency agreement information. That is, in the case of the assembly language code shown in Table 2, the add instruction described in the second line corresponds to the performance degradation factor.
다음으로, 오류 또는 성능 저하 요인이 있는 것으로 판단될 경우 오류 또는 성능 저하 요인에 관련된 명령어의 정보를 출력할 수 있다(S6). 예컨대, 오류 또는 성능 저하를 일으킬 수 있는 원인과 그 원인이 위치하는 어셈블리 언어 코드의 정보를 개발자가 알 수 있도록 화면 등에 표시할 수 있다. 개발자에 의해 어셈블리 언어 코드의 다음 줄이 입력되면, 다시 단계(S2)로 돌아가 새로 입력된 어셈블리 언어 코드에 대해 전술한 과정(S2 내지 S6)을 반복할 수 있다. Next, when it is determined that there is an error or performance deterioration factor, information of an instruction related to the error or performance deterioration factor may be output (S6). For example, information on the cause of error or performance degradation and the assembly language code in which the cause is located may be displayed on a screen so that a developer may know. When the next line of assembly language code is input by the developer, the process returns to step S2, and the above-described processes S2 to S6 may be repeated for the newly input assembly language code.
개발자에 의해 어셈블리 언어 코드가 작성되는 동안 이상의 과정을 수행함으로써, 작성된 어셈블리 언어 코드에서 오류 또는 성능 저하가 예상되는 경우 이를 즉각적으로 개발자에게 보고할 수 있다. 따라서, 개발자는 해당 CPU에 최적화된 고성능의 어셈블리 언어 코드를 용이하게 작성할 수 있게 된다. 또한, 각 명령어의 특성들(예컨대, 제어 흐름 및 데이터 흐름)을 고려하여 생성된 그래프를 이용하여 각 명령어 사이의 의존도를 분석하므로, 특정 명령어가 오류 또는 성능 저하 요인에 해당하는지를 알기 위해 모든 명령어를 분석할 필요 없이 각 특성별로 연관된 명령어들만을 분석할 수 있어 분석에 필요한 시간이 감소되는 이점이 있다.By doing the above while the assembly language code is being written by the developer, you can immediately report any errors or performance degradations to the developer when the assembly language code is written. Therefore, the developer can easily write high performance assembly language code optimized for the CPU. In addition, the dependencies between each instruction are analyzed using graphs generated by considering the characteristics of each instruction (for example, control flow and data flow), so that all instructions are checked to see whether a specific instruction corresponds to an error or a performance degradation factor. It is possible to analyze only the commands associated with each characteristic without having to analyze it, thereby reducing the time required for analysis.
본 명세서에 기술된 어셈블리 언어 코드의 분석 장치 및 방법, 또는 이들의 어떤 측면이나 부분은, 플로피 디스켓, CD-ROM, DVD, 하드 디스크 드라이브, 또는 기타 임의의 컴퓨터로 판독 가능한 기록 매체와 같은 유형 매체에 포함된 프로그램 코드(즉, 명령어)의 형태로 구현될 수도 있다. 상기 프로그램 코드는 컴퓨터와 같은 장치에 로드되어 실행되며, 이때 상기 장치가 본 발명을 실시하기 위한 장치에 해당된다. Apparatus and method of analyzing assembly language code described herein, or any aspect or portion thereof, may be any tangible medium, such as a floppy diskette, CD-ROM, DVD, hard disk drive, or any other computer readable recording medium. It may be implemented in the form of program code (ie, instructions) included in. The program code is loaded and executed in a device such as a computer, wherein the device corresponds to a device for practicing the present invention.
이상에서 살펴본 본 발명은 도면에 도시된 실시예들을 참고로 하여 설명하였으나 이는 예시적인 것에 불과하며 당해 분야에서 통상의 지식을 가진 자라면 이로부터 다양한 변형 및 실시예의 변형이 가능하다는 점을 이해할 것이다. 그러나, 이와 같은 변형은 본 발명의 기술적 보호범위 내에 있다고 보아야 한다. 따라서, 본 발명의 진정한 기술적 보호범위는 첨부된 특허청구범위의 기술적 사상에 의해서 정해져야 할 것이다.Although the present invention described above has been described with reference to the embodiments illustrated in the drawings, this is merely exemplary, and it will be understood by those skilled in the art that various modifications and variations may be made therefrom. However, such modifications should be considered to be within the technical protection scope of the present invention. Therefore, the true technical protection scope of the present invention will be defined by the technical spirit of the appended claims.
Claims (12)
하나 이상의 명령어를 포함하는 어셈블리 언어 코드가 입력되는 입력 모듈; 및
입력된 상기 어셈블리 언어 코드를 상기 의존도 규약 정보에 따라 분석하여, 상기 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 결정하는 분석 모듈을 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 장치.
A storage module for storing dependency protocol information on the processing means of the assembly language;
An input module to which assembly language code including one or more instructions is input; And
And an analysis module for analyzing the input assembly language code according to the dependency agreement information to determine a portion corresponding to an error or a performance degradation factor in the assembly language code.
상기 분석 모듈은,
상기 의존도 규약 정보를 이용하여, 상기 하나 이상의 명령어 각각에 대응되는 하나 이상의 노드를 갖는 그래프를 생성하는 그래프 생성부; 및
상기 각 노드 사이의 의존도를 분석하여 오류 또는 성능 저하 요인에 해당하는 명령어를 결정하는 그래프 분석부를 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 장치.
The method of claim 1,
The analysis module,
A graph generator configured to generate a graph having at least one node corresponding to each of the at least one command by using the dependency protocol information; And
And a graph analyzer configured to analyze the dependencies between the nodes to determine a command corresponding to an error or a performance deterioration factor.
상기 그래프 생성부는, 상기 하나 이상의 명령어 각각을 연산자 및 주소부로 구분하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 장치.
The method of claim 2,
And the graph generator divides each of the one or more instructions into an operator and an address unit.
상기 의존도 규약 정보는 상기 입력 모듈에 입력되어 상기 저장 모듈에 저장되는 것을 특징으로 하는 어셈블리 언어 코드의 분석 장치.
The method of claim 1,
And the dependency protocol information is input to the input module and stored in the storage module.
상기 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당되는 부분을 표시하는 출력 모듈을 더 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 장치.
The method of claim 1,
And an output module for displaying a portion corresponding to an error or a performance degradation factor in the assembly language code.
상기 의존도 규약 정보는, 어셈블리 언어의 각 명령어의 속성, 각 명령어가 수행되는데 걸리는 시간, 각 명령어의 속성 관련 의존도 정보 및 처리 수단의 레지스터 세트 정보 중 하나 이상을 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 장치.
The method of claim 1,
The dependency protocol information may include at least one of an attribute of each instruction of an assembly language, a time taken for each instruction to be executed, dependency information related to an attribute of each instruction, and register set information of a processing means. Analysis device.
수신된 상기 어셈블리 언어 코드를 미리 저장된 어셈블리 언어의 처리 수단에 대한 의존도 규약 정보에 따라 분석하는 단계; 및
상기 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 결정하는 단계를 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 방법.
Receiving an assembly language code comprising one or more instructions;
Analyzing the received assembly language code according to dependency agreement information on a processing means of pre-stored assembly language; And
And determining a part corresponding to an error or a performance degradation factor in the assembly language code.
상기 의존도 규약 정보에 따라 분석하는 단계는,
상기 의존도 규약 정보를 이용하여, 상기 하나 이상의 명령어 각각에 대응되는 하나 이상의 노드를 갖는 그래프를 생성하는 단계; 및
상기 각 노드 사이의 의존도를 분석하여 오류 또는 성능 저하 요인에 해당하는 명령어를 결정하는 단계를 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 방법.
The method of claim 7, wherein
Analyzing according to the dependency protocol information,
Generating a graph having one or more nodes corresponding to each of the one or more instructions using the dependency protocol information; And
Analyzing the dependencies between the nodes to determine an instruction corresponding to an error or a performance deterioration factor.
상기 그래프를 생성하는 단계는, 상기 하나 이상의 명령어 각각을 연산자 및 주소부로 구분하는 단계를 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 방법.
The method of claim 8,
The generating of the graph may include dividing each of the one or more instructions into an operator and an address unit.
상기 어셈블리 언어 코드를 수신하는 단계 전에, 상기 의존도 규약 정보를 수신하는 단계를 더 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 방법.
The method of claim 7, wherein
And before receiving the assembly language code, receiving the dependency protocol information.
상기 어셈블리 언어 코드에서 오류 또는 성능 저하 요인에 해당하는 부분을 출력하는 단계를 더 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 방법.
The method of claim 7, wherein
And outputting a portion corresponding to an error or a performance deterioration factor in the assembly language code.
상기 의존도 규약 정보는, 어셈블리 언어의 각 명령어의 속성, 각 명령어가 수행되는데 걸리는 시간, 각 명령어의 속성 관련 의존도 정보 및 처리 수단의 레지스터 세트 정보 중 하나 이상을 포함하는 것을 특징으로 하는 어셈블리 언어 코드의 분석 방법.The method of claim 7, wherein
The dependency protocol information may include at least one of an attribute of each instruction of an assembly language, a time taken for each instruction to be executed, dependency information related to an attribute of each instruction, and register set information of a processing means. Analytical Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020100123925A KR101225577B1 (en) | 2010-12-07 | 2010-12-07 | Apparatus and method for analyzing assembly language code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020100123925A KR101225577B1 (en) | 2010-12-07 | 2010-12-07 | Apparatus and method for analyzing assembly language code |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20120062970A true KR20120062970A (en) | 2012-06-15 |
KR101225577B1 KR101225577B1 (en) | 2013-01-24 |
Family
ID=46683580
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020100123925A KR101225577B1 (en) | 2010-12-07 | 2010-12-07 | Apparatus and method for analyzing assembly language code |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR101225577B1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102523329B1 (en) * | 2020-11-17 | 2023-04-19 | 홍익대학교세종캠퍼스산학협력단 | Method for visualizing performance improvement element and changing software code for power improvement |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20000032119A (en) * | 1998-11-12 | 2000-06-05 | 이계철 | Method for managing error of branch range of conditional branch code in assembler |
KR100597414B1 (en) * | 2004-10-21 | 2006-07-05 | 삼성전자주식회사 | Data processing device and register allocation method using data processing device |
KR100946417B1 (en) * | 2007-09-14 | 2010-03-09 | 주식회사 신한은행 | Method for Testing Program Source Code |
KR101051600B1 (en) * | 2010-03-29 | 2011-07-22 | 주식회사 소프트 포 소프트 | Systems for performing code inspection on abap source code |
-
2010
- 2010-12-07 KR KR1020100123925A patent/KR101225577B1/en not_active IP Right Cessation
Also Published As
Publication number | Publication date |
---|---|
KR101225577B1 (en) | 2013-01-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110096338B (en) | Intelligent contract execution method, device, equipment and medium | |
US8516444B2 (en) | Debugging a high performance computing program | |
US9898387B2 (en) | Development tools for logging and analyzing software bugs | |
US7836430B2 (en) | Reversing execution of instructions in a debugger | |
US7530056B1 (en) | Method and system for detecting runtime defects in a program by comparing correct and incorrect runs | |
US8418149B2 (en) | Differential comparison system and method | |
US9946628B2 (en) | Embedding and executing trace functions in code to gather trace data | |
US20090119649A1 (en) | Static analysis defect detection in the presence of virtual function calls | |
US9626170B2 (en) | Method and computer program product for disassembling a mixed machine code | |
US20120131559A1 (en) | Automatic Program Partition For Targeted Replay | |
JP2009540464A (en) | Iterative static and dynamic software analysis | |
US8418148B2 (en) | Thread execution analyzer | |
JP2006185211A (en) | Program analysis system, test execution device, and analysis method and program thereof | |
US20110047531A1 (en) | Methods and apparatuses for selective code coverage | |
US9459986B2 (en) | Automatic generation of analysis-equivalent application constructs | |
US20060277371A1 (en) | System and method to instrument references to shared memory | |
US9122791B2 (en) | Identifying a storage location for a storage address requested during debugging | |
WO2014185165A1 (en) | Information processing device, and information processing method | |
US20110231178A1 (en) | Modeling and generating computer software product line variants | |
US8769498B2 (en) | Warning of register and storage area assignment errors | |
CN113778838A (en) | Binary program dynamic taint analysis method and device | |
JP2009075965A (en) | Software development method and software development device | |
KR101225577B1 (en) | Apparatus and method for analyzing assembly language code | |
US20130111431A1 (en) | Validation of a system model including an activity diagram | |
JP4870956B2 (en) | Embedded program generation method, embedded program development system, and information table section |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant | ||
FPAY | Annual fee payment |
Payment date: 20151229 Year of fee payment: 4 |
|
FPAY | Annual fee payment |
Payment date: 20161226 Year of fee payment: 5 |
|
LAPS | Lapse due to unpaid annual fee |