WO2000003322A1 - Procede et appareil de compilation - Google Patents

Procede et appareil de compilation Download PDF

Info

Publication number
WO2000003322A1
WO2000003322A1 PCT/JP1999/003710 JP9903710W WO0003322A1 WO 2000003322 A1 WO2000003322 A1 WO 2000003322A1 JP 9903710 W JP9903710 W JP 9903710W WO 0003322 A1 WO0003322 A1 WO 0003322A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
compile
information
executable
instruction information
Prior art date
Application number
PCT/JP1999/003710
Other languages
English (en)
Japanese (ja)
Inventor
Yuji Fukuzawa
Tetsuya Okada
Original Assignee
Sony Corporation
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 Sony Corporation filed Critical Sony Corporation
Publication of WO2000003322A1 publication Critical patent/WO2000003322A1/fr

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring

Definitions

  • the present invention provides, for example, a serial system, a parallel system, or a VLIW document.
  • the present invention relates to a compilation processing device that generates an executable program from a program described in a programming language on a computer such as the (VeryLonInstrstructOnWora) method.
  • an executable program Generates a program in a format that can be executed on the target computer (hereinafter referred to as an executable program) from a source program written in a programming language, or generates an optimized executable program
  • a compile processing device is used.
  • a source program created by a programmer and described in a programming language stored in a source program storage unit 1 is input to a compile processing device 2.
  • the compile processor 2 performs lexical analysis, syntax analysis, By performing a taste analysis or the like, an executable program that can be executed by the target computer is generated from the source program, and is stored in the executable program storage unit 3.
  • the profile information of the executable program is obtained, and the profile information is stored in the profile information storage unit 4. Is stored.
  • the profile information contains various information about the program operation obtained by executing the program, such as which part of the executed program has been executed how many times and how long the execution time has been. Contains.
  • a compile processing device 2 stores a source program described in a programming language stored in a software program storage unit 1 and a program stored in a profile information storage unit 4. By inputting the profile information and executing the compiling process again, the program is optimized, and an optimized and accelerated executable program is generated, which is stored in the executable program. Stored in part 3.
  • a source program is input to a compiling processor, and a target computer executable program is generated.
  • the profile information is obtained from the information obtained by executing this executable program.
  • lexical analysis, syntactic analysis, and semantic analysis of the source program are performed in the first compile process for generating an executable program to obtain profile information and in the second compile process for obtaining an optimized program.
  • analysis processing such as duplication is performed redundantly, and it takes time to generate an optimized executable program.
  • an object of the present invention is to provide a compilation processing device and a compilation processing method capable of shortening a processing time and quickly generating an executable program.
  • a compile processing device includes: an analysis information generation unit that generates analysis information of a source program from a source program; and a first execution format that generates a first execution format program based on the analysis information.
  • a program generation unit, a profile information generation unit that generates profile information based on the first execution format program, and a second execution format program based on the analysis information and the profile information And a second executable program generation unit.
  • the compile processing method includes an analysis information generating step of generating analysis information of the source program from the source program, and a first execution form program for generating a first executable program based on the analysis information.
  • FIG. 1 is a diagram for explaining a procedure for generating an optimized executable program using a conventional compilation processing device.
  • FIG. 2 is a diagram for explaining an embodiment of the compile processing device according to the present invention.
  • FIG. 3 is a diagram for explaining an execution format generation unit in the compilation processing device shown in FIG.
  • FIG. 4 is a diagram illustrating an example of a source program.
  • FIG. 5 is a diagram for explaining an example of an intermediate code as analysis information generated by a source program analysis unit.
  • FIG. 6 is a diagram for explaining an example of an assembly code as analysis information generated by the source program analysis unit.
  • FIG. 7 is a diagram for explaining an example of profile information generated by the profile information generation unit.
  • FIG. 8 is a diagram for explaining an example of the probability information generated by the probability information generation unit of the execution format generation unit.
  • FIG. 9 is a diagram for explaining an example of a program optimized using probability information generated from profile information.
  • FIG. 10 is a diagram for explaining another example of the execution format generation unit of the compilation processing device.
  • FIG. 11 is a diagram for explaining another example of the embodiment of the compilation processing device according to the present invention.
  • FIG. 12 is a diagram for explaining another example of the embodiment of the compile processing device according to the present invention.
  • FIG. 13 is a diagram for explaining the instruction information receiving unit and the execution format generating unit of the compile processing device shown in FIG.
  • FIG. 14 is a diagram for explaining an example of a graphical user interface as a program for assisting compilation.
  • FIG. 15 is a diagram for explaining an example of a program optimized in consideration of compile instruction information from an operator.
  • FIG. 16 is a diagram for explaining another example of the embodiment of the compilation processing device according to the present invention.
  • FIG. 2 is a view for explaining the compiling apparatus 1 according to the first embodiment.
  • the compilation processing device 100 of the first embodiment converts a source program described in a high-level programming language stored in a source program storage unit 10 into a target program.
  • An executable program executable by an electronic computer is generated and stored in the executable program storage unit 20.
  • the compiling device 100 generates profile information from information obtained by executing the executable program stored in the rush program storage unit 20 and executes the profile information using the profile information. By performing the process of generating a formal program, an optimized executable program can be generated.
  • a compile processing apparatus 100 according to the first embodiment will be described. As shown in FIG. 2, the compile processing apparatus 100 of the first embodiment includes a source program analysis unit 11, a source program analysis information storage unit 12, an execution format generation unit 13, a profile information generation unit A section 14 and a profile information storage section 15 are provided.
  • the source program described in the high-level programming language stored in the source program storage unit 10 is supplied to the source program analysis unit 11 of the compile processing device 100.
  • the source program analysis unit 11 has a function as an analysis information generation unit, and performs analysis processing such as character analysis, syntax analysis, and semantic analysis of the source program, and converts the source program into the source program. Analysis information is generated and stored in the source program analysis information storage unit 12.
  • the analysis information of the source program stored in the source program analysis information storage unit 12 is generated by analyzing the source program, such as intermediate code, assembly code, and machine language. It contains generated information and contains information necessary to generate an executable program.
  • the execution format generation unit 13 generates an execution format program to be executed in the target computer from the analysis information stored in the source program analysis information storage unit 12, and stores this in the execution format program storage unit. Store in 20. As a result, an executable program executable in the target computer is obtained in the executable program storage unit 20.
  • the executable program at this stage is generated directly from the source program and has not been optimized. For this reason, even if this executable program is executed, useless processing is performed and high-speed processing may not be performed.
  • the profile information generation section 14 of the compilation processing apparatus 100 generates profile information from information obtained by executing the target executable program stored in the executable program storage section 20. This is stored in the profile information storage unit 15.
  • the analysis information of the source program generated by the first compile process stored in the source program analysis information storage unit 12 and the profile information storage unit 15 are stored.
  • the executable format generating unit 13 performs the process of generating the executable program again.
  • This process of generating the executable program again is a process for generating an optimized executable program. This processing is performed, as shown in FIG. 2, by using the solution stored in the source program analysis information storage unit 12.
  • the program generated from the analysis information is optimized using the profile information in the profile information storage unit 15 to generate a high-speed executable program without performing unnecessary operations and execute it. This is stored in the format program storage unit 20.
  • FIG. 3 is a diagram for explaining the execution format generation unit 13 of the compilation processing device 100 according to the present embodiment.
  • the execution format generation unit 13 of this embodiment includes a program construction unit 131, and a program execution probability generation program based on profile information to generate an optimized execution format program. It is provided with a probability information generation unit 132 that generates information.
  • the executable form generation unit 13 uses only the analysis information such as the intermediate code and the assembly code stored in the source program analysis information storage unit 12. For example, an executable program that can be executed by a target computer is generated, and this is stored in the executable program storage unit 20.
  • the profile information generating unit 14 of the compiling device 100 is obtained by executing the pre-optimized executable program stored in the executable program storage unit 20. Profile information is generated from the information, and the profile information is stored in the profile information storage unit 15.
  • the profile information stored in the profile information storage unit 15 includes the time elapsed since the execution of the executable program was started and the time elapsed at each time. And detailed information between them. Then, as described above, the execution of the executable program is performed again by using the profile information stored in the profile information storage unit 15, thereby generating the optimized executable program. Is done.
  • the analysis information such as the intermediate code / assembly code of the source program analysis information storage unit 12 is supplied to the program construction unit 131, and the program execution probability information generation unit 1332 supplies the analysis information.
  • the program execution probability information generated by statistically processing the profile information stored in the profile information storage unit 15 is supplied to the program construction unit 131.
  • the probability information generated by the probability information generation unit 13 2 of the execution format generation unit 13 includes, for example, the number of executions of blocks constituting a program, the number of executions of each instruction, the number of branches, and memory. And various types of probability information, such as the number of accesses at the Regis evening.
  • the program construction unit 1331 of the execution format generation unit 13 applies the profile information of the profile information storage unit 15 to the program generated from the analysis information from the source program analysis information storage unit 12.
  • the optimization is performed using the probability information generated from the report, and an accelerated executable program is generated without performing unnecessary operations, and this is stored in the executable program storage unit 20.
  • the analysis is performed by the source program analysis unit 11 to generate various types of data, and the analysis is performed by using the analysis information stored in the source program analysis information storage unit 12.
  • An executable program is generated. That is, in order to generate an optimized executable program, the analysis of the source program is performed in the same manner as before. Since the processing is not repeated, the time required to generate an optimized executable program can be reduced, and an optimized executable program can be generated quickly.
  • the procedure of generating the optimized executable program performed in the compiling device 100 according to the first embodiment is, as described below, performed from the first and second processes. Has become. That is, in the compile processing apparatus 100 of the first embodiment, first, a source program is read from the source program storage unit 10 and the lexical analysis is performed by the source program analysis unit 11. By performing analysis processing such as syntax analysis and semantic analysis, analysis information of the source program is generated and stored in the source program analysis information storage unit 12 (Fig. 2 (1)).
  • an executable program to be executed to obtain profile information is generated (Fig. 2 (1)).
  • the process up to the generation of an executable program from a source program to obtain this profile information is the first process.
  • profile information is generated by the profile information generation unit 14 (FIG. 2 (3)), and is stored in the profile information storage unit 15.
  • the profile information generation unit 14 (FIG. 2 (3))
  • an execution format is generated based on the analysis information generated in the first process and stored in the source program analysis information storage unit 12 and the profile information stored in the profile information storage unit 15. Re-generate the executable program in Part 13 As a result, an executable program optimized based on the profile information is generated and stored in the executable program storage unit 20 (FIG. 2).
  • the process from generation of this profile information to generation of an executable program again by the executable format generation unit 13 is a second process.
  • an optimized executable program is generated using the analysis information stored in the source program analysis information storage unit 12 and the profile information, so that the source program analysis processing is performed. You don't have to do it.
  • the second process does not need to repeat the source program analysis process.
  • the time required to generate an executable program can be reduced, and an optimized executable program can be generated quickly.
  • FIG. 4 is a diagram for explaining an example of a source program stored in the source program storage unit 10.
  • the source program selects either variable a or variable b depending on the condition, and stores the square of the value of the selected variable in variable d.
  • the intermediate program, the assembly code, and the intermediate code generated by analyzing the source program stored in the source program storage unit 10 by the source program analysis unit 11 Analysis information (generation information) such as a machine language is stored in the source program analysis information storage unit 12.
  • generation information such as a machine language is stored in the source program analysis information storage unit 12.
  • which of the intermediate code, the assembly code, the machine language, and the like is generated can be selected, for example, by the user.
  • FIGS. 5 and 6 show the solutions generated in the source program analysis information storage unit 12 when the source program shown in FIG. 4 stored in the source program storage unit 10 is analyzed by the source program analysis unit 11.
  • FIG. 4 is a diagram for describing an example of analysis information.
  • FIG. 5 conceptually shows an example in a case where the generated analysis information is an intermediate code
  • FIG. 6 shows an example in a case where the generated analysis information is an assembly code.
  • BLK1 of the intermediate code (FIG. 5) and b1ock1 of the assembly code (FIG. 6) are blocks for comparing the variables a and b.
  • BLK 2 of the intermediate code (FIG. 5) and block 2 of the assembly code (FIG. 6) are blocks that store the variable a in the variable c when the variable a is larger than the variable b.
  • BLK 3 in Fig. 5 and block 3 in the assembly code (Fig. 6) are blocks that store the value of variable b in variable c when variable b is greater than or equal to variable a.
  • BLK 4 in the intermediate code (Fig. 5) and bloc k 4 in the assembly code (Fig. 6) are blocks that square the selected variable and store the result in variable d.
  • the values of the register r1 and the register r2 are compared, and the comparison result is stored in the register r3.
  • the fourth step of b 1 o c k 1 if the comparison result stored in the register r 3 is r l ⁇ r 2 (variable a ⁇ variable b), a jump to b 10 c k 3 is performed. Therefore, if the comparison result stored in the register r3 is rl> r2 (variable a> variable b), the processing of b10ck2 is performed.
  • b10ck2 is a process performed when the result of comparison between the value of the register r1 and the value of the register r2 at b1ock1 is r1> r2.
  • the variable a is stored in the register r4
  • the value stored in the register r4 is stored in the variable c.
  • the jump to b l o c k 4 is performed.
  • b 1 ock 3 is a process performed when the result of comparison between the value of the register r 1 and the value of the register r 2 at b 10 ck 1 is r 1 ⁇ r 2 as described above. .
  • the variable b is stored in the register r5
  • the value of the register r5 is stored in the variable c.
  • a jump to bloc4 is performed.
  • variable c is stored in the register r6 in the first step, and the variable c is further stored in the second step.
  • c is stored in the register r7.
  • the value stored in the register r6 is multiplied by the value stored in the register r7, and in the fourth step, the multiplication of the third step is performed. Is stored in the register r8.
  • the assembly code of the source program used in this embodiment shown in FIG. 6 is the square of the variable a or the square of the variable b depending on the magnitude relation between the variables a and b. And store it at Regis evening r8.
  • the execution format generation unit 13 converts the analysis information such as the intermediate code and the assembly code stored in the source program analysis information storage unit 12 into a format to be executed in the target electronic device.
  • An executable program is generated and stored in the executable program storage unit 20.
  • the executable program generated in the executable program storage unit 20 is the executable program generated by the first (first) compilation process, and is the executable program before optimization.
  • the profile information generation section 14 of the compilation processing apparatus 100 obtains profile information from information obtained by executing the target execution form program stored in the execution form program storage section 20. Is generated and stored in the profile information storage unit 15.
  • FIG. 7 is a diagram for explaining an example of profile information generated in the profile information storage unit 15 by the profile information generation unit 14.
  • the profile information shown in FIG. 7 executes, for example, an executable program generated from the assembly code shown in FIG. It is generated from the information obtained by this.
  • the opening file information stored in the profile information storage unit 15 includes the elapsed time since the execution of the executable program was started and detailed information at each elapsed time. is there.
  • the profile information indicates, when the executable program stored in the executable program storage unit 20 is executed, with the passage of time, which instruction is executed, where the branch is performed, and which memory is used. This indicates the status of program execution, such as whether or not was accessed or which registry was accessed.
  • the example of the profile information shown in FIG. 7 shows the detailed information at each elapsed time from the start of the execution of the executable program, as follows.
  • the program count (PC) changes
  • b 1 ock 1 of the assembly code shown in FIG. 6 is executed
  • the variable a is It is stored (loaded) during the evening.
  • the comparison instruction (comp are) is executed.
  • a branch instruction (branch1essorequa1) is executed to execute block 3 of the assembly code shown in FIG.
  • a multiplication instruction (mu 1) is executed.
  • a variable obtained from the multiplication instruction executed at the elapsed time 10059 is obtained.
  • the value of d is stored (stored) at the register.
  • the elapsed time and detailed information of the execution state of the executable program corresponding to the elapsed time are stored as profile information in the profile information storage unit 15. Is stored.
  • the source program generated in the source program analysis information storage unit 12 by the source program analysis information storage unit 12 by the first source program analysis process stored in the source program analysis information storage unit 12 is analyzed.
  • the execution format generation unit 13 re-executes the generation process of the execution format program.
  • FIG. 8 is a diagram for explaining an example of the probability information generated by the probability information generation unit 132 based on the profile information stored in the profile information storage unit 15.
  • the example of probability information shown in Fig. 8 is generated based on profile information (Fig. 7) formed from the information obtained by converting the assembly code shown in Fig. 6 into an executable program and executing it. It is a thing.
  • the probability information generation unit 132 executes the execution of each block by performing statistical processing on the profile information stored in the profile information storage unit 15 as described above. It generates probability information such as the number of times, the number of times each instruction is executed, the number of branches, and the number of accesses to memory and registers.
  • the program constructing unit 13 1 of the execution format generating unit 13 analyzes the source program analysis information storage unit 12, the assembly code in this case, and the probability information shown in FIG. Based on the above, an optimized executable program is generated and stored in the executable program storage unit 20.
  • FIG. 9 is a diagram for explaining an example of a program optimized using probability information generated from profile information.
  • FIG. 9 shows, in the form of assembly code, an executable program obtained by optimizing the assembly code shown in FIG. 6 using probability information. As shown in the probability information in FIG. 8, the probability that block 3 is executed is 90%, and the probability that b 10 ck 2 is executed is 10%.
  • the optimized program is the optimized program (assembly code) shown in Fig. 9.
  • variable a is stored in the variable c via the register r 4 at b 10 ck 2, as in the case of the pre-optimization assembly code shown in FIG. In b 1 0 ck 4, the variable a is squared and stored in the variable d. In the block processing, the square of the variable a can be obtained.
  • the probability that the variable b is greater than or equal to the variable a is as high as 90%, and the variable b is An optimized executable program is generated so that the processing in case of a or more can be performed efficiently and quickly.
  • block5 which is a jump destination from b10ck3
  • the execution format generation unit 13 performs rearrangement and addition of instructions, change of allocation of registers, change of branch destinations, copying of codes, deletion of unnecessary codes and instructions, and the like. Thus, it is possible to generate an optimized executable program.
  • the execution format generation unit 13 of the compile processing apparatus 100 functions as a profile information generation execution format program generation unit at the time of the first (first) compile process. After the profile information is generated, optimization is performed using the source program in the source program analysis information storage unit 12 and the probability information generated from the profile information in the profile information storage unit 15. Function as an optimized executable program generation unit that generates the optimized executable program.
  • the process of generating the executable program again is a process for generating an optimized executable program. As shown in FIG. 2, this processing is performed for the program generated from the analysis information stored in the source program analysis information The optimization is performed by using the profile information of the storage unit 15 to generate a high-speed executable program without performing unnecessary operations, and this is stored in the executable program storage unit 20.
  • the analysis is performed by the source program analysis unit 11 to generate various types of data, and the analysis is performed by using the analysis information stored in the source program analysis information storage unit 12.
  • An executable program is generated.
  • the time required to generate the optimized executable program is not repeated because the analysis of the source program is not repeated to generate the optimized executable program.
  • optimized executable programs can be generated quickly.
  • the executable format generating unit 13 of the compiling processor 100 of the first embodiment is Both executable and indirect executable programs can be generated.
  • the direct executable program is one in which the execution of the program depends on the device that executes the program
  • the indirect executable program is one in which the execution of the program is independent of the device that executes the program. It is possible.
  • Whether to generate a direct executable program or an indirect executable program can be automatically switched based on the analysis information stored in the analysis information storage unit 12, for example. It is. For example, when the analysis information stored in the analysis information storage unit 12 is an assembly document code for generating an executable program to be executed on a target computer, the direct execution format is used. When the analysis information stored in the analysis information storage unit 12 is an intermediate code, the program is automatically switched, such as generating an indirectly executable program. can do.
  • whether to generate a direct executable program or an indirect executable program can be switched by, for example, operating a switch provided in the compiling device 100. it can.
  • an executable program for the first process which generates an executable program by performing analysis processing from a source program, and executes the executable program using the analysis information stored in the source program analysis information storage unit 12
  • the generation of the executable form of the second process that generates the file means, for example, that the compilation processing device manages whether the program to be compiled is the first compilation or the second or later compilation. , Can be switched automatically. Further, for example, by operating a switching switch provided in the compiling processor 100, switching between the generation of the execution format program of the first process and the generation of the execution format of the second process is performed. You can also do so.
  • the execution format generation unit 13 generates the execution format program for generating the profile information and the optimized execution format program.
  • the present invention is not limited to this. .
  • an executable format generator for generating profile information executable format generator for generating profile information
  • an optimized executable format generator for generating an optimized executable program are provided separately. You may do so.
  • the source program analysis unit 11 can generate intermediate code, assembly code, machine language, and the like.
  • the analysis information stored in the analysis information storage unit 12 is, for example, an intermediate code
  • the executable program is converted into a code in a format that can be easily constructed, and the executable program is generated.
  • Executable programs need to be further converted to object codes.
  • a precode generator and a boss code generator are required for the execution format generation unit 13.
  • FIG. 10 shows an example in which the analysis information generated in the source program analysis information storage unit 12 is, for example, an intermediate code or the like, and an executable format is generated when an executable program is generated from the intermediate code.
  • FIG. 4 is a diagram for explaining a part 13; As shown in FIG. 10, in this example, a precode generator 13 is provided between the source program analysis information storage unit 12 and the program construction unit 13 1, and a program A boss code generator 13 4 is provided at the subsequent stage of the section 13 1.
  • the precode generator 133 generates code in a format that makes it easy to generate an executable program in the program construction unit 131 from the analysis information stored in the analysis information storage unit 12.
  • the boss code generator 134 generates an off-code code executable form program from the constructed executable form program in the program construction section 131.
  • the analysis information stored in the analysis information storage unit 12 is, for example, a bytecode of a specific programming language (for example, Java).
  • a specific programming language for example, Java
  • the generation of an executable program is converted by the pre-code generator 13 3 into, for example, an intermediate code in a sleek format, and this is supplied to the program construction section 13 1.
  • the program construction unit 1331 constructs an executable program from, for example, the intermediate code supplied from the precode generator 131, or by using profile information.
  • the constructed executable is not object code. Therefore, the post code generator 136 generates an object code executable form program from, for example, an intermediate code executable form program constructed by the program constructing section 131, and executes the generated executable program.
  • the information is stored in the storage unit 20.
  • the analysis information generated in the source program analysis information storage unit 12 can be stored in the intermediate form. Even in the case of a code such as Java code, an executable program of the object code can be generated.
  • the postcode generator can be used. You can avoid using 1 3 4 overnight.
  • the program construction unit 131 can construct an executable program from, for example, a Java bytecode, the executable program generated by the program construction unit 131 may be used.
  • the post code generator 134 By using the post code generator 134 to generate an object code executable program, bridging You can eliminate the need to use 1 3 1
  • the bridging device when constructing an executable program from intermediate code, etc., the executable program is always generated after converting it to an object code.
  • the executable program is always generated directly from the intermediate code, etc.
  • An executable program such as a code may be converted into an offset code by the boost code generator 134.
  • the analysis information generated in the source program analysis information storage unit 12 can be obtained. Even if the intermediate code is as shown in FIG. 4 or the assembly code is as shown in FIG. 6, an executable program can be generated from them.
  • the effective form generator 13 is provided with a precode generator 133 and a post code generator 134, and the object code such as the assembly code is converted to the executable form generator 1 When supplied to 3, the pre-code generator 13 3 and the boost code generator 13 4 may be bypassed.
  • the profile information is generated from information obtained by executing the executable program, as described in the first embodiment.
  • the executable program generated by the compiling device can be easily converted by the compiling device. May not be possible.
  • the generated executable program is an executable program for a computer other than the device that performed the compile process, and the instruction set of the program may be different due to differences in hardware, or 0 S (operating The execution environment of the executable program is different, for example, when the execution system is different. In such a case, the compile processing device cannot execute the generated executable program, and cannot easily obtain profile information.
  • target executable program is to be installed in the memory of a board (target board) of an electronic device such as a VTR, for example, a test board may be used.
  • the executable program must be installed and executed, and the information obtained by this execution must be supplied to the compilation processor.
  • a test board must be prepared in advance, and the test board and the compile processing device must be connected by a large number of codes (cord).
  • a compile processing device is equipped with a violet to execute the target executable program on the test board and obtain profile information. It takes a long time to develop Shimire.
  • an indirect executable intermediate code program that can be executed without depending on the execution environment of the program is generated, and an executable program that optimizes the intermediate code program is generated. Executing in the compile processing device that generates the profile information makes it easy and quick to obtain and optimize the profile information. It is intended to quickly generate the intended executable program.
  • FIG. 11 is a diagram for explaining a compilation processing apparatus 200 that can generate an intermediate code program in an indirect execution format.
  • the compile processing apparatus 200 of this example includes a source program analysis unit 11, a source program analysis information storage unit 12, an execution format generation unit 13A, 13B, and 13 C, a profile information generation unit 14, a profile information storage unit 15, and an indirect execution format intermediate generation unit 17.
  • Each of the execution format generation units 13A, 13B, and 13C is provided for generating a direct execution format program to be executed by a different device. As described above, even when a plurality of execution format generation units 13A, 13B, and 13C are provided to generate different types of execution format programs, the profile information is shared. Can be used.
  • the executable form generation unit 13 A uses the intermediate code
  • the executable form generator 13 B uses the assembly code
  • the executable form generator 13 C uses the other object code, and so on.
  • Different analysis information is used depending on the format program.
  • each of the execution format generation units 13A, 13B, and 13C is basically the same as that of FIG. 3 or FIG.
  • execution format generation unit 13 It is configured in the same way as the above-described execution format generation unit 13 using 10 and can generate an execution format program from the analysis information from the source program analysis information storage unit 12, as well as the profile information. By using the probability report generated from the profile information in the storage unit 15, an optimized executable program can be generated.
  • the indirect executable intermediate generation unit 17 converts the source program analysis information stored in the source program analysis information storage unit 12 into this compilation.
  • An intermediate code program in an indirectly executable form that can be executed by the processing device 200 is generated and stored in the intermediate program storage unit 30.
  • Profile information is generated by a profile information generation unit 14 from information obtained by executing the indirectly executable intermediate code program stored in the intermediate program storage unit 30, and the profile information storage unit 15 Is stored.
  • the profile information stored in the profile information storage unit 15 and the source program analysis information storage unit 12 are stored in one of the execution format generation units 13 A, 13 B, and 13 C. Analysis information and From this, an optimized indirectly executable program that is executable on the target computer is generated. In the second embodiment, which one of the execution format generation units 13A, 13B, and 13C is used is instructed by, for example, an operator of the compile processing device 200.
  • the executable programs generated by the respective executable format generators 13 A, 13 B, and 13 C are the corresponding executable programs 20 A, 2 A 0B and 20C are stored so that an executable program desired by the operator can be generated.
  • the execution format generation units 13A, 13B, and 13C are described as being selected by the operator, but is not limited to this. Absent.
  • the operator selects analysis information to be used, such as an intermediate code, an assembly code, or a machine language
  • the execution format generation unit can be automatically determined.
  • the compile processing unit 200 is configured so that the analysis information to be used and the executable form generation unit to be used have a one-to-one correspondence. You can also.
  • the operator may select both the analysis information to be used and the executable form generation unit to be used, and configure the compile processing apparatus 200 so as to generate a target executable form program. it can. Also, instead of providing a plurality of execution format generation units, for example, analysis information supplied according to an instruction from an operator is converted into an intermediate code, an assembly code, a machine language, another object code, or the like. Even so, it is possible to provide a multifunctional execution format generation unit that can generate an execution format program in accordance with them.
  • the compile processing device 200 is capable of generating an executable program intended by an operator in response to an instruction from the operator, for example.
  • the intermediate executable form intermediate generator 17 It is also possible to switch between supplying an assembly code, supplying an assembly code, supplying a machine language, and so on.
  • the analysis information supplied to the intermediate executable intermediate generation unit 17 and the analysis information supplied to the executable generation units 13A, 13B, and 13C may be different types of code. Yes, and sometimes the same. In short, by making it possible to properly use various types of analysis information, it is possible to more flexibly generate various indirect executable programs (intermediate code programs) and direct executable programs.
  • the intermediate code program is generated by the indirect executable intermediate generation unit 17. For example, whether to generate an executable program by using one of the executable format generation units 13 A, 13 B, and 13 C is switched by, for example, a switch provided in the compilation processing unit 100. Switching can be performed by operating switches and the like.
  • a single compile processor can generate both direct and indirect executables, and executables that can be executed on various computers with different execution environments In this case, it is necessary to input information such as the distinction between the direct execution form and the indirect execution form and the execution environment of the target computer program into the compile processing unit at the time of the compile processing.
  • the compile processing device of the third embodiment receives compile instruction information from an operator of the compile processing device and compile instruction information provided from a program for assisting the compile process, An executable program can be generated in consideration of the received compilation instruction information.
  • FIG. 12 is a diagram for explaining a compile processing device 300 according to the third embodiment.
  • the compile processing apparatus 300 according to the third embodiment includes a source program analysis unit 11, a source program analysis information storage unit 12, an execution format generation unit 13 and profile information. It has a generation unit 14, a profile information storage unit 15, and an instruction information reception unit 18.
  • the components other than the instruction information receiving unit 18 are configured in the same manner as the components of the compile processing device 100 of the first embodiment described above with reference to FIG. Things. For this reason, in the compilation processing device 300 of the third embodiment shown in FIG. 12, the same components as those of the compilation processing device 100 of the first embodiment are included in FIG.
  • the same reference numerals as those of the compile processing device 100 shown in FIG. 2 denote the same parts, and a description thereof will be omitted.
  • the source program shown in FIG. 4 is stored in the source program storage unit 10, and the source program is generated by analyzing the source program by the source program analysis unit 11, for example, Description will be made assuming that the assembly code shown in FIG. 6 is stored in the source program analysis information storage unit 12.
  • the instruction information receiving unit 18 receives a command from the operator 31 such as a keyboard device or a pointing device such as a so-called mouse, or a graphical user interface (GUI: G) which is a program for assisting compilation.
  • GUI graphical user interface
  • Various compile instruction information input through the raphical interface (32) is received and supplied to the executable form generation unit 13.
  • the compilation instruction information is, for example, information such as a distinction between an indirect execution form and a direct execution form, and information for controlling a compilation process.
  • the information for controlling the compilation process includes, for example, information for controlling code placement and information for controlling optimization such as instructing a specific block to be optimized. .
  • the instruction information receiving unit 18 stores the instruction information of a file in which parameters necessary for the compilation process to generate a target executable program and data required for the compilation process are stored. It receives compile instruction information from a program for assisting the compile process that gives information and the like, and supplies this to the executable form generation unit 13.
  • the execution format generation unit 13 also takes into account the compilation instruction information from the instruction information receiving unit 18 and analyzes the source program analysis information storage unit 12 or the source program analysis information storage unit 1. From the analysis information of (2) and the profile information of the profile information storage unit 15, an executable program is generated based on the compilation instruction information. This makes it possible to easily and quickly generate an optimized executable program in consideration of compile instruction information from an operator and a program for assisting the compile process.
  • the compiling device 300 of the third embodiment will be described in more detail using a specific example.
  • information such as the analysis result of the source program analysis unit 11 and the generation result of the executable program generated by the execution format generation unit 13 is provided.
  • various information such as probability information formed by statistically processing profile information is notified to the operator by being displayed on a display connected to the compile processing device 300 of this embodiment. Have been able to.
  • the operator can input various kinds of compiling instruction information while checking the information displayed on the display. That is, in the third embodiment, a graphical user interface 32 is realized, and the compile instruction information is transmitted to the compile processing device 300 through the graphical user interface. Have been able to enter.
  • FIG. 13 shows an instruction information receiving unit 18 of the compile processing apparatus 300 according to the third embodiment, and an execution format generating unit 13 which receives supply of compile instruction information from the instruction information receiving unit 18.
  • the compile instruction information is information that indicates the distinction between the indirect executable form and the direct executable form
  • the received compile instruction information is supplied to the program constructing section 13 1 of the executable form generating section 13. Be paid.
  • the received compile instruction information is information for controlling the optimization to perform the target optimization by changing the probability information generated from the profile information
  • the compile instruction information is received.
  • the generated information is supplied to the probability information generation unit 132.
  • FIG. 14 is a diagram showing a display example of the graphical user interface 32.
  • the probability information generation unit 132 displays the branch probability among the probability information (FIG. 8) generated from the profile information, and a screen for changing the branch probability. Is shown.
  • the probability of executing block 2 (the probability that variable a is larger than variable b) is 10%.
  • the probability that block 3 is executed (the probability that variable b is greater than or equal to variable a) is 90%, and is shown as 90% in F14 in FIG.
  • the probability is changed in the information change input area for controlling the optimization, as indicated by the arrow in FIG.
  • the probability of branching is reversed, the probability of executing block 2 (the probability that variable a is greater than variable b) is changed to 90%, and block 3 is executed.
  • the probability (probability that variable b is greater than or equal to variable a) is changed to 10%.
  • Information for controlling the optimization in this example is supplied to the probability information generation unit 13 2 of the execution form generation unit 13 as described above with reference to FIG. To be changed.
  • the execution format generation unit 13 also receives a program for assisting the compilation process supplied from the instruction information receiving unit 18, for example, the compile instruction information from the graphical user interface. Considering this, an executable program is generated as described above.
  • FIG. 15 shows, as described above with reference to FIG. 14, an executable program generated by changing the branch probability information and performing optimization, as an assembler code.
  • the assembly code shown in FIG. 6 is an assembly code before optimization, and by changing the probability of branching, as shown in FIG. 15, the path of blocklblock2 ⁇ block3 is optimized.
  • the value of the register r 1 (variable a) is stored in the register r 4, so when the variable a is larger than the variable b, b 10 ck following b 10 ck 1 In 2, the square of the variable a is immediately obtained and can be stored in the variable d. That is, the square of the variable 2 can be obtained by the processing of two b 1 o c k.
  • variable b is larger than the variable a
  • the variable b is stored in the variable c in b 1 ock 3 and the variable c is stored in the block 4 as in the case of the assembly code before optimization shown in FIG. (i.e., the variable a) and so is stored in the squared by the variable d, 3 in the process of Tsunobu-locking, c are therefore to be able to obtain the square of the variables a, probability of occurrence Optimized executable program is generated so that the process when variable a is larger than variable b is set to 90%.
  • block 5 to which jump from block 2 is a block following biock.
  • the compile processing apparatus 300 is designed to optimize the target execution in consideration of the operator ⁇ the compile instruction information from the program for assisting the compile processing. Formats Programs can be generated easily and quickly. In other words, the operator can manually give the compile instruction information to the compile processing device 300, so that the compile processing device can be automatically operated. This makes it possible to perform finer control and generate more efficient executable programs.
  • the operator may create an executable program based on the analysis information stored in the source program analysis information storage unit 12 to obtain the profile information, or may optimize the program in consideration of the profile information.
  • An instruction such as whether to generate an executable program can also be supplied to the executable generator 13 through the instruction information receiving unit 18.
  • the compilation instruction information is supplied to the execution format generation unit 13 via the instruction information reception unit 18.
  • most of the compilation instruction information is usually known before the compilation process.
  • compile instruction information that is known before the compile processing is given to the compile processing apparatus in advance so that the compile processing in the compile processing apparatus can be performed promptly.
  • it is possible to quickly generate an executable program by simply correcting the wrong compile instruction information, that is, performing compile processing without inputting all compile instruction information again. It is desirable to be able to do so.
  • the compile processing apparatus is provided with an operator: a compile instruction information storage unit that stores compile instruction information from a program for assisting the compile processing, and executes the compile processing. Do not enter compile instruction information each time. That's what I did.
  • FIG. 16 is a diagram for explaining a compile processing device 400 according to the fourth embodiment.
  • the compile processing apparatus 400 according to the fourth embodiment has the same components as those of the third embodiment described above with reference to FIG.
  • the configuration of the compile processing apparatus 10 of the first embodiment is the same as that of the compile processing apparatus 300 of the first embodiment except for the instruction information receiving section 18 and the compile instruction information storage section 19. A configuration similar to 0 can be used.
  • the instruction information receiving means 18 receives compile instruction information from an operator or a program for assisting the compile processing. Is stored in the compilation instruction information storage unit 19.
  • the compile instruction information stored in the compile instruction information storage unit 19 is read by the executable format generation unit 13 when the executable program is generated. Then, the executable form generation unit 13 generates an executable form program in consideration of the compile instruction information read from the compile instruction information storage unit 19.
  • the compilation instruction information is not limited to the above-described execution format, information about the execution environment of the target computer program, and information for controlling compilation, but may be used to generate a target execution format program. It also contains various information required in the compilation process.
  • the indirectly executable intermediate generation unit 17 of the second embodiment can be mounted on the compile processing apparatuses 300 and 400 of the third and fourth embodiments.
  • an instruction to generate an intermediate code program from an operator or the like can be supplied to the indirectly executable intermediate generation unit 17 to generate the intermediate code program.
  • the compile processing device can be configured by software. That is, it is possible to form a compile processing program having the functions of the compile processing device according to each of the above-described embodiments. Further, the execution format generation unit of the compilation processing device according to the above-described embodiment links a plurality of related execution format programs with each other,
  • compile processing apparatus of each of the above-described embodiments can be used alone, but can be mounted on various electronic computers and used.
  • the compile processing apparatus can generate an executable program that can be executed on a target computer without depending on the data structure of a program to be handled.
  • the compile processing apparatus of each of the above-described embodiments can be implemented by the target computer without depending on the hardware configuration of the computer on which the compile processing apparatus is mounted or the data structure of the data such as the program to be handled. It is possible to generate an executable program that can be executed by the electronic device.
  • analysis information of the source program is generated from the source program, and the first executable program is generated based on the analysis information.
  • Generating profile information based on the executable program of the above, and generating a second executable program based on the analysis information and the profile information when generating an optimized executable program, the source An optimized executable program can be generated based on the analysis information and profile information of the source program generated by analyzing the source program without repeatedly using the program. Therefore, optimal When generating an executable program in a simplified form, there is no need to duplicate the analysis of the source program that was used to generate the executable program for generating the profile information, which is faster.
  • an executable program that is optimized for Further, according to the compile processing device of the present invention, by storing the analysis information, an executable program before optimization for generating profile information, which is executed to obtain profile information, is also optimized.
  • the generated executable program can also be generated by the same executable program generator. Therefore, it is not necessary to provide the profile information generation executable program generation unit and the optimized execution program generation unit separately, and the configuration of the compile processing device can be simplified.
  • the compile processing device of the present invention by storing the profiling information, the compile processing device can execute on a target computer and has a format unique to the computer.
  • a program suitable for the execution environment of the computer program can be generated.
  • profile information of the program in the direct execution format can be obtained, and an optimized execution format program can be generated.
  • a program in an indirect execution format can be generated. Since the indirectly executable program can be executed without depending on a device such as a computer which executes the indirectly executable program, the compile processing device executes the indirectly executable program to obtain profile information, thereby obtaining profile information. This profile By using the file information, an optimized executable program can be created.
  • a so-called intermediate code program generated by an indirect executable intermediate program generation unit can be executed without depending on an execution environment of a computer program on which the program is executed.
  • profile information for the program can be obtained, and by using the profile information, a target optimized program of an indirect execution format can be easily and quickly generated.
  • the compile processing device of the present invention it is possible to easily and quickly generate an executable program in consideration of compile instruction information from an operator.
  • the operator can store the compile instruction information determined before the compile processing in the compile instruction information storage unit in advance. Therefore, it is possible to reduce the time required for inputting the compile instruction information at the time of executing the compile processing, and to respond to a request from the operator in consideration of the compile instruction information stored in the compile instruction information storage unit.
  • An executable program can be generated more quickly.
  • an executable program is generated in consideration of compile instruction information from a program for assisting compile processing. And can be generated quickly.
  • the compile processing device of the present invention various types of programs from the program for assisting the compile processing necessary for the compile processing are provided. Since the compilation instruction information can be stored in the compilation instruction information storage unit in advance, there is no need to execute a program for assisting the compilation processing during the compilation processing. This makes it possible to more quickly generate a target executable program in consideration of the compile instruction information stored in the compile instruction information storage unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Devices For Executing Special Programs (AREA)
  • Debugging And Monitoring (AREA)

Abstract

L'invention concerne un analyseur (11) de programme source qui effectue plusieurs analyses d'un programme source, génère des informations d'analyse du programme source et les mémorise dans une mémoire (12) d'informations d'analyse de programme source. Sur la base des informations d'analyse dans la mémoire (12) d'informations d'analyse de programme source, un générateur de programme exécutable (13) génère un programme exécutable permettant de générer des informations de profil. Un générateur d'informations de profil (14) génère des informations de profil sur la base des informations obtenues en exécutant le programme. Le générateur de programme exécutable (13) génère un programme exécutable optimisé sur la base des informations d'analyse du programme source mémorisés dans la mémoire (12) d'informations d'analyse de programme source et des informations de profil générées par le générateur d'informations de profil (14).
PCT/JP1999/003710 1998-07-10 1999-07-08 Procede et appareil de compilation WO2000003322A1 (fr)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
JP19558698 1998-07-10
JP10/195586 1998-07-10
JP11/188661 1999-07-02
JP11188661A JP2000081984A (ja) 1998-07-10 1999-07-02 コンパイル処理装置およびコンパイル処理方法

Publications (1)

Publication Number Publication Date
WO2000003322A1 true WO2000003322A1 (fr) 2000-01-20

Family

ID=26505064

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP1999/003710 WO2000003322A1 (fr) 1998-07-10 1999-07-08 Procede et appareil de compilation

Country Status (2)

Country Link
JP (1) JP2000081984A (fr)
WO (1) WO2000003322A1 (fr)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4328328B2 (ja) * 2003-10-23 2009-09-09 富士通株式会社 ソフトウエア開発ツールプログラム

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6353646A (ja) * 1986-08-22 1988-03-07 Nec Corp 最適目的プログラム生成方式
JPS63276127A (ja) * 1987-05-07 1988-11-14 Fujitsu Ltd ダイナミック命令生成方式
JPH064299A (ja) * 1992-06-24 1994-01-14 Nec Software Ltd 最適化オブジェクトプログラム生成方式
JPH06202875A (ja) * 1992-12-28 1994-07-22 Nec Corp インライン展開による最適化を行うコンパイラ
US5659752A (en) * 1995-06-30 1997-08-19 International Business Machines Corporation System and method for improving branch prediction in compiled program code
JPH09288580A (ja) * 1996-04-19 1997-11-04 Nec Corp ソースプログラムの最適化装置および最適化方法
JPH09330233A (ja) * 1996-03-15 1997-12-22 Hewlett Packard Co <Hp> 最適目的コード生成方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6353646A (ja) * 1986-08-22 1988-03-07 Nec Corp 最適目的プログラム生成方式
JPS63276127A (ja) * 1987-05-07 1988-11-14 Fujitsu Ltd ダイナミック命令生成方式
JPH064299A (ja) * 1992-06-24 1994-01-14 Nec Software Ltd 最適化オブジェクトプログラム生成方式
JPH06202875A (ja) * 1992-12-28 1994-07-22 Nec Corp インライン展開による最適化を行うコンパイラ
US5659752A (en) * 1995-06-30 1997-08-19 International Business Machines Corporation System and method for improving branch prediction in compiled program code
JPH09330233A (ja) * 1996-03-15 1997-12-22 Hewlett Packard Co <Hp> 最適目的コード生成方法
JPH09288580A (ja) * 1996-04-19 1997-11-04 Nec Corp ソースプログラムの最適化装置および最適化方法

Also Published As

Publication number Publication date
JP2000081984A (ja) 2000-03-21

Similar Documents

Publication Publication Date Title
US5881290A (en) Industrial controller decompiler accommodating an expandable instruction set
US5367685A (en) Method and apparatus for resolving data references in generated code
US6978450B2 (en) Method and system for optimizing compilation time of a program by selectively reusing object code
US5819097A (en) Industrial controller compiler with expandable instruction set
JP4822817B2 (ja) コンパイルシステム
US7299462B2 (en) Relocation format for linking
JPH11338710A (ja) 複数種の命令セットを持つプロセッサのためのコンパイル方法ならびに装置および同方法がプログラムされ記録される記録媒体
US20180032320A1 (en) Computer-implemented method for allowing modification of a region of original code
US20100106950A1 (en) Method and system for loading status control of dll
KR20070057666A (ko) 무선 장치에서 사용할모놀리식(monolithic)이미지를 제공하기 위한시스템 및 방법
JP2008269569A (ja) コード変換装置
US8930925B2 (en) Method for enabling compilation of a Cobol source program utilizing a two-stage compilation process, the Cobol source program including a mix of Cobol, C++ or JAVA statements, and optional OpenMP directives
US6859932B1 (en) Relocation format for linking
JPH0926884A (ja) バイナリ操作を必要とするタスク中に必要なフロー情報を使用可能とする方法および装置
US20060107258A1 (en) Program, program code optimization method, program code compile method, program code, and information processing system
EP1085410A2 (fr) Format de relogement pour édition de liens
GB2358491A (en) A relocation format for linking
JP6790869B2 (ja) コンパイル方法、コンパイルプログラム及び情報処理装置
US6802060B1 (en) Linker using relocation sequences
WO2000003322A1 (fr) Procede et appareil de compilation
US5940620A (en) Compiler with intermediate compiling mechanism
US6086622A (en) Method and apparatus for converting an architecture of a program and method, and apparatus for debugging a program by using them
KR100790470B1 (ko) 디바이스 드라이버 테스트를 위한 테스트 케이스 자동 생성방법 및 장치
WO2005041028A1 (fr) Programme outil pour la mise au point de logiciels
US20050125783A1 (en) Program optimization with intermediate code

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): CA US

WWE Wipo information: entry into national phase

Ref document number: 09486865

Country of ref document: US