Interrupt control method and device based on function call graph
Through the method based on the function call graph, the registers actually used by the interrupt service routine are accurately identified and the corresponding register usage information is generated, which solves the unnecessary saving and recovery problems caused by the hardware mechanism, and improves the efficiency and response speed of interrupt processing.
Patent Information
- Application Number
- CN202510771853.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-06-11
AI Technical Summary
In the prior art, the register state caused by the hardware mechanism during the interrupt processing is unnecessary to be saved and restored, resulting in additional time overhead and reducing the interrupt processing efficiency.
Through the method based on the function call graph, the registers actually used by the interrupt service routine are accurately identified, the corresponding register usage information is generated, unnecessary storage and recovery instructions are avoided, and register management is optimized.
Improves the efficiency and response speed of interrupt processing, reduces unnecessary register operations, and improves the overall performance of the system.
Smart Images

Figure CN120295841A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of interrupt handling, and in particular, to an interrupt control method and device based on a function call graph. Background Art
[0002] During the interrupt handling process, the processor must save its current running state to a specified register or storage space and restore this state after the interrupt returns to ensure the continuity before and after the interrupt handling. This state is the so-called interrupt context, which generally includes key information such as the control status register, general-purpose registers, and floating-point registers of the processor. The time required for the saving and restoration of the interrupt context is one of the key technical factors affecting the system interrupt response speed.
[0003] In the prior art, the automatic switching of the context is usually achieved through a mechanism supported by hardware. However, since the hardware can only manage the context by saving the complete register state when triggering an interrupt. This means that even if some general-purpose registers are not used in the current interrupt handling, they will be unnecessarily saved and restored, resulting in additional time overhead and reducing the overall interrupt handling efficiency.
[0004] Therefore, it is necessary to provide an interrupt control method and device based on a function call graph to effectively solve the above problems. Summary of the Invention
[0005] The present invention provides an interrupt control method and device based on a function call graph, which can improve the efficiency and response speed of interrupt handling by accurately identifying the registers actually used by the interrupt service routine.
[0006] The embodiments of the present invention provide an interrupt control method based on a function call graph, including: Obtain an interrupt handling function, and the compiler generates a function call graph corresponding to the interrupt handling function; If the currently compiled function belongs to the functions in the function call graph, generate usage information for each caller save register allocated to the function; If the currently compiled function does not belong to the functions in the function call graph, perform normal compilation; When the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each allocated first caller save register and each allocated first callee save register; at the same time, the compiler does not generate instructions for saving and restoring the first caller save register and the first callee save register when generating code; When the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller-saved registers and the second callee-saved registers used in each instruction of the function; meanwhile, if there are instructions in the code for saving and restoring the second caller-saved registers and the second callee-saved registers, those instructions are deleted; Update the register usage information of the function.
[0007] Preferably, updating the register usage information of the function includes: If the function call graph is empty, the function does not call other functions and there is no need to update the register usage information; If the function call graph is not empty, perform a depth-first traversal on each function in the function call graph, and incorporate the caller-saved register information of the sub-functions into the parent function.
[0008] Preferably, incorporating the caller-saved register information of the sub-functions into the parent function includes: If the function in the function call graph is a function with source code, if its register usage information already completely includes the caller-saved register usage information of all sub-functions, there is no need to update; if the function in the function call graph does not call other functions, mark its register usage information as complete; if the function in the function call graph has one or more sub-functions, recursively update the register usage information of the one or more sub-functions, and incorporate the caller-saved register usage information of the one or more sub-functions into the register usage information of the function in the function call graph; if the function in the function call graph already includes the caller-saved register usage information of all sub-functions, mark the register usage information of the function in the function call graph as complete; If the function in the function call graph is a function with only binary code, if the instruction is a function call, identify the called function and recursively execute this step; if the instruction uses a caller-saved register, update the usage information of the caller-saved register.
[0009] Preferably, use a bitmask method to record the register usage information of the interrupt handling function, where 1 indicates that the register of the interrupt handling function is used, and 0 indicates that the register of the interrupt handling function is not used.
[0010] Preferably, the method further includes: Simultaneously with the registration of the interrupt handling function, synchronously register the register usage information corresponding to the interrupt handling function. The processor reads the register usage information when the interrupt is triggered and determines the set of registers to be saved according to the register usage information.
[0011] Preferably, before the processor responds to the interrupt handling function and is ready to jump to the interrupt service routine, the processor reads the register usage information corresponding to the interrupt number; According to the register usage information corresponding to the interrupt number, it is judged whether the register is in an unrecovered state. If the register recovery has not been completed for the previous interrupt, the unpreserved registers required for the current interrupt are confirmed, and the processor automatically preserves the unpreserved registers; if the register recovery has been completed for the previous interrupt, the processor automatically preserves the registers marked as used in the register usage information.
[0012] Preferably, before the interrupt handling function is about to return, the processor determines whether to immediately recover the registers according to the current interrupt status; If the current interrupt status is that there is a new interrupt handling request, no register recovery operation is performed, the current context is marked as unrecovered, the current interrupt process is exited, and the execution jumps to a new interrupt service routine; If the current interrupt status is that there is no new interrupt handling request, all the preserved registers in the current context are recovered, and the interrupt handling function exits normally.
[0013] Preferably, a dedicated register is set to store the register usage information table. The register usage information table includes an indexing basis and table entry contents. The indexing basis includes the interrupt number ID, and the table entry contents include the register usage information corresponding to the interrupt number ID.
[0014] Preferably, the reading of the table entry contents includes: Calculating the address according to the interrupt number ID: base address + ID × information item size; Reading the corresponding register usage information from the address.
[0015] An embodiment of the present invention further provides an interrupt control device based on a function call graph, including: A function call graph generation module, which is used to obtain an interrupt handling function, and the compiler generates a function call graph corresponding to the interrupt handling function; A register usage information generation module, which is used to save register generation usage information for each caller assigned to the function if the currently compiled function belongs to the function in the function call graph; A first usage information setting module, which is used when the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each first caller save register and each first callee save register assigned; meanwhile, the compiler does not generate instructions for saving and restoring the first caller save register and the first callee save register when generating code; A second usage information setting module, which is used to update the usage information according to the second caller-saved registers and the second callee-saved registers used in each instruction of the function when the interrupt handling function is a function written in a low-level language; meanwhile, if there are instructions in the code for saving and restoring the second caller-saved registers and the second callee-saved registers, those instructions are deleted; A register usage information update module, which is used to update the register usage information of a function.
[0016] Compared with the prior art, the technical solution of the embodiment of the present invention has the following beneficial effects: A method and device for interrupt control based on a function call graph according to an embodiment of the present invention. The method includes: obtaining an interrupt handling function, and a compiler generating a function call graph corresponding to the interrupt handling function; if the currently compiled function belongs to the functions in the function call graph, generating usage information for each caller-saved register allocated to the function; when the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each allocated first caller-saved register and each allocated first callee-saved register; meanwhile, the compiler does not generate instructions for saving and restoring the first caller-saved registers and the first callee-saved registers when generating code; when the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller-saved registers and the second callee-saved registers used in each instruction of the function; meanwhile, if there are instructions in the code for saving and restoring the second caller-saved registers and the second callee-saved registers, those instructions are deleted; updating the register usage information of the function, thereby improving the efficiency and response speed of interrupt handling by accurately identifying the registers actually used by the interrupt service routine; Further, if the function call graph is empty, the function does not call other functions and there is no need to update the register usage information; if the function call graph is not empty, perform a depth-first traversal on each function in the function call graph, and incorporate the caller-saved register information of the sub-function into the parent function, thereby effectively updating the register usage information of the function; Further, if the function in the function call graph is a function with source code, if its register usage information already completely includes the caller-saved register usage information of all sub-functions, there is no need to update it; if the function in the function call graph does not call other functions, mark its register usage information as complete; if there is one or more sub-functions in the function call graph, recursively update the register usage information of the one or more sub-functions, and incorporate the caller-saved register usage information of the one or more sub-functions into the register usage information of the function in the function call graph; if the function in the function call graph already includes the caller-saved register usage information of all sub-functions, mark the register usage information of the function in the function call graph as complete; if the function in the function call graph is a function with only binary code, if the instruction is a function call, identify the called function and recursively execute this step; if the instruction uses a caller-saved register, update the caller-saved register usage information, so as to adopt different strategies for updating functions for different situations of functions with source code and functions with only binary code. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention, rather than all embodiments. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0018] Figure 1 Schematic flowchart of an interrupt control method based on a function call graph provided by an embodiment of the present invention; Figure 2 Schematic diagram of a function call graph of an interrupt control method based on a function call graph provided by an embodiment of the present invention; Figure 3 Schematic flowchart of an interrupt control method based on a function call graph provided by another embodiment of the present invention; Figure 4 Schematic diagram of modules of an interrupt control device based on a function call graph provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0020] The technical solutions of the present invention will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0021] Based on the problems existing in the prior art, the embodiments of the present invention provide an interrupt control method and device based on a function call graph, which can accurately identify the registers actually used by an interrupt service routine, thereby improving the efficiency and response speed of interrupt processing.
[0022] Figure 1 It is a schematic flowchart of an interrupt control method based on a function call graph provided for an embodiment of the present invention. Now refer to Figure 1 , the embodiments of the present invention provide an interrupt control method based on a function call graph, including: Step S101: Obtain an interrupt handling function, and the compiler generates a function call graph corresponding to the interrupt handling function; Step S102: If the currently compiled function belongs to the functions in the function call graph, save register usage information for each caller assigned to the function; Step S103: If the currently compiled function does not belong to the functions in the function call graph, perform normal compilation; Step S104: When the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each caller-saved register and each callee-saved register assigned to it; at the same time, the compiler does not generate instructions for saving and restoring the caller-saved register and the callee-saved register when generating code; Step S105: When the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller-saved register and the second callee-saved register used in each instruction of the function; at the same time, if there are instructions for saving and restoring the second caller-saved register and the second callee-saved register in the code, delete those instructions; Step S106: Update the register usage information of the function.
[0023] Specifically, the compiler analyzes the general registers and floating-point registers actually used by each interrupt handling function and generates register usage information. Each register usage information has a unique symbolic name and corresponds one-to-one with the corresponding interrupt handling function for subsequent software calls.
[0024] In step S104, since the compiler does not generate instructions for saving and restoring the first caller-saved registers and the first callee-saved registers when generating code, unnecessary register save and restore operations are avoided. Functions written in a high-level language can be functions written in C language, for example.
[0025] In step S105, since if there are instructions for saving and restoring the second caller-saved registers and the second callee-saved registers in the code, those instructions are deleted, thus avoiding duplicate saving. Functions written in a low-level language can be functions written in assembly language, for example.
[0026] For example, the compiler analyzes the register usage information of the interrupt handling functions. The interrupt handling functions can include interrupt handling function 0, interrupt handling function 1... interrupt handling function n - 1, and correspondingly, register usage information 0, register usage information 1... register usage information n - 1 can be generated.
[0027] Figure 2 Schematic diagram of the function call graph of the interrupt control method based on the function call graph provided by an embodiment of the present invention. Now refer to Figure 2 , the register usage information of the interrupt handling function includes: ISR, A1_U, A2_U, and A3. The usage information A1_U of the caller-saved registers of function A1 includes: A1, B1_U, and B2. The usage information B1_U of the caller-saved registers of function B1 includes: B1 and C1. The usage information of the caller-saved registers of function C1: the caller-saved registers C1 used by the self-contained function itself.
[0028] In some embodiments, the updating of the register usage information of the function includes: If the function call graph is empty, it means the function does not call other functions and there is no need to update the register usage information; If the function call graph is not empty, perform a depth-first traversal on each function in the function call graph and incorporate the caller-saved register information of the sub-functions into the parent function.
[0029] In some embodiments, the incorporating of the caller-saved register information of the sub-functions into the parent function includes: If the function in the function call graph is a function with source code, if its register usage information already completely contains the caller-saved register usage information of all sub-functions, there is no need to update it; if the function in the function call graph does not call other functions, mark its register usage information as complete; if there is one or more sub-functions in the function call graph, recursively update the register usage information of the one or more sub-functions, and incorporate the caller-saved register usage information of the one or more sub-functions into the register usage information of the function in the function call graph; if the function in the function call graph already contains the caller-saved register usage information of all sub-functions, mark the register usage information of the function in the function call graph as complete; If the function in the function call graph is a function with only binary code, if the instruction is a function call, identify the called function and recursively execute this step; if the instruction uses a caller-saved register, update the caller-saved register usage information.
[0030] In some embodiments, the register usage information of the interrupt handling function is recorded in a bitmask manner, with one bit representing the usage status of one register. For example, 1 indicates that the register of the interrupt handling function is in use, and 0 indicates that the register of the interrupt handling function is not in use. For example, for 32 registers, a 32-bit (4-byte) bitmask data can be used for representation.
[0031] In some embodiments, the method further includes: When registering the interrupt handling function, synchronously register the register usage information corresponding to the interrupt handling function. When the interrupt is triggered, the processor reads the register usage information and determines the set of registers that need to be saved according to the register usage information.
[0032] In some embodiments, before the processor responds to the interrupt handling function and is about to jump to the interrupt service routine (ISR), the processor reads the register usage information corresponding to the interrupt number; Judge whether the register is in an unrecovered state according to the register usage information corresponding to the interrupt number. If the register recovery of the previous interrupt has not been completed, confirm the registers that are not saved and need to be used for the current interrupt, and the processor automatically saves the registers that are not saved; if the register recovery of the previous interrupt has been completed, the processor automatically saves the registers marked as being used in the register usage information.
[0033] In some embodiments, before the interrupt handling function is about to return, the processor determines whether to immediately restore the registers according to the current interrupt state; If the current interrupt status indicates that there is a new interrupt handling request, no register restoration operation is performed. Mark the current context as not restored, exit the current interrupt process, and jump to execute the new interrupt service routine; If the current interrupt status indicates that there is no new interrupt handling request, restore all the registers saved in the current context and normally exit the interrupt handling function.
[0034] In some embodiments, a dedicated register is set to store a register usage information table. The register usage information table includes an indexing basis and table entry content. The indexing basis includes an interrupt number ID, and the table entry content includes the register usage information corresponding to the interrupt number ID.
[0035] For example, register usage information 0, register usage information 1... register usage information n - 1 are all stored in the register usage information table.
[0036] In some embodiments, the reading of the table entry content includes: Calculate the address according to the interrupt number ID: base address + ID × information item size; Read the corresponding register usage information from the address.
[0037] Figure 3 The flowchart of the interrupt control method based on the function call graph provided by another embodiment of the present invention. Now refer to Figure 3 , an embodiment of the present invention provides an interrupt control method based on a function call graph, including: Step S301: Obtain an interrupt handling function, and the compiler generates a function call graph corresponding to the interrupt handling function; Step S302: If the currently compiled function belongs to the functions in the function call graph, generate usage information for saving registers for each caller assigned to the function; Step S303: If the currently compiled function does not belong to the functions in the function call graph, perform normal compilation; Step S304: When the interrupt handling function is a function written in a high - level language, the compiler sets corresponding usage information for saving registers for each assigned first caller and for saving registers for each assigned first callee; meanwhile, when generating code, the compiler does not generate instructions for saving and restoring the saved registers of the first caller and the first callee; Step S305: When the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller-saved registers and the second callee-saved registers used in each instruction of the function; meanwhile, if there are instructions in the code for saving and restoring the second caller-saved registers and the second callee-saved registers, those instructions are deleted; Step S306: Update the register usage information of the function; Step S307: If the function call graph is empty, it means the function does not call other functions and there is no need to update the register usage information; Step S308: If the function call graph is not empty, perform a depth-first traversal on each function in the function call graph, and incorporate the caller-saved register information of the sub-function into the parent function.
[0038] Figure 4 The module schematic diagram of the interrupt control device based on the function call graph provided by an embodiment of the present invention. Now refer to Figure 4 , an embodiment of the present invention provides an interrupt control device based on a function call graph, including: A function call graph generation module 41, which is used to obtain an interrupt handling function, and the compiler generates a corresponding function call graph for the interrupt handling function; A register usage information generation module 42, which is used to generate usage information for each caller-saved register allocated to the function if the currently compiled function belongs to the functions in the function call graph; A first usage information setting module 43, which is used to when the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each allocated first caller-saved register and each allocated first callee-saved register; meanwhile, the compiler does not generate instructions for saving and restoring the first caller-saved registers and the first callee-saved registers when generating code; A second usage information setting module 44, which is used to when the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller-saved registers and the second callee-saved registers used in each instruction of the function; meanwhile, if there are instructions in the code for saving and restoring the second caller-saved registers and the second callee-saved registers, those instructions are deleted; A register usage information update module 45, which is used to update the register usage information of the function.
[0039] In summary, for the interrupt control method and device based on a function call graph provided by the embodiments of the present invention, the method includes: obtaining an interrupt handling function, and a compiler generating a function call graph corresponding to the interrupt handling function; if the currently compiled function belongs to a function in the function call graph, saving register generation usage information for each caller allocated to the function; when the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each first caller save register and each first callee save register allocated thereto; meanwhile, when generating code, the compiler does not generate instructions for saving and restoring the first caller save register and the first callee save register; when the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller save register and the second callee save register used in each instruction of the function; meanwhile, if there are instructions in the code for saving and restoring the second caller save register and the second callee save register, delete those instructions; updating the register usage information of the function, and by accurately identifying the registers actually used by the interrupt service routine, the efficiency and response speed of interrupt handling are improved; Further, if the function call graph is empty, it means that the function does not call other functions, and there is no need to update the register usage information; if the function call graph is not empty, perform a depth-first traversal on each function in the function call graph, and incorporate the caller save register information of the sub-function into the parent function, thereby effectively updating the register usage information of the function; Further, if the function in the function call graph is a function with source code, if its register usage information already completely includes the caller save register usage information of all sub-functions, there is no need to update; if the function in the function call graph does not call other functions, mark its register usage information as complete; if the function in the function call graph has one or more sub-functions, recursively update the register usage information of the one or more sub-functions, and incorporate the caller save register usage information of the one or more sub-functions into the register usage information of the function in the function call graph; if the function in the function call graph already includes the caller save register usage information of all sub-functions, mark the register usage information of the function in the function call graph as complete; if the function in the function call graph is a function with only binary code, if the instruction is a function call, identify the called function and recursively execute this step; if the instruction uses a caller save register, update the usage information of the caller save register, thereby adopting different strategies for updating the function for different situations of functions with source code and functions with only binary code.
[0040] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An interrupt control method based on a function call graph, characterized in that, The method includes: Obtain an interrupt handling function, and the compiler generates a function call graph corresponding to the interrupt handling function; If the currently compiled function belongs to the functions in the function call graph, generate usage information for saving registers for each caller assigned to the function; If the currently compiled function does not belong to the functions in the function call graph, perform normal compilation; When the interrupt handling function is a function written in a high-level language, the compiler sets corresponding usage information for each first caller save register and each first callee save register assigned; meanwhile, when generating code, the compiler does not generate instructions for saving and restoring the first caller save register and the first callee save register; When the interrupt handling function is a function written in a low-level language, the compiler updates the usage information according to the second caller save register and the second callee save register used in each instruction of the function; meanwhile, if there are instructions for saving and restoring the second caller save register and the second callee save register in the code, delete the instructions; Update the register usage information of the function.
2. The interrupt control method based on a function call graph according to claim 1, wherein The updating of the register usage information of the function includes: If the function call graph is empty, the function does not call other functions and there is no need to update the register usage information; If the function call graph is not empty, perform a depth-first traversal on each function in the function call graph, and incorporate the caller save register information of the sub-functions into the parent function.
3. The interrupt control method based on a function call graph according to claim 2, wherein The incorporating of the caller save register information of the sub-functions into the parent function includes: If the function in the function call graph is a function with source code, if its register usage information already completely includes the caller save register usage information of all sub-functions, there is no need to update; if the function in the function call graph does not call other functions, mark its register usage information as complete; if the function in the function call graph has one or more sub-functions, recursively update the register usage information of the one or more sub-functions, and incorporate the caller save register usage information of the one or more sub-functions into the register usage information of the function in the function call graph; if the function in the function call graph already includes the caller save register usage information of all sub-functions, mark the register usage information of the function in the function call graph as complete; If the function in the function call graph is a function with only binary code, if the instruction is a function call, identify the called function and recursively execute this step; if the instruction uses a caller save register, update the usage information of the caller save register.
4. The interrupt control method based on a function call graph according to claim 1, wherein Use a bit mask method to record the register usage information of the interrupt handling function, where 1 indicates that the register of the interrupt handling function is used, and 0 indicates that the register of the interrupt handling function is not used.
5. The interrupt control method based on a function call graph according to claim 1, characterized in that The method further includes: When registering an interrupt handling function, the usage information of the registers corresponding to the interrupt handling function is registered synchronously. When an interrupt is triggered, the processor reads the register usage information and determines the set of registers to be saved according to the register usage information.
6. The interrupt control method based on a function call graph according to claim 1, wherein Before the processor responds to the interrupt handling function and is about to jump to the interrupt service routine, the processor reads the register usage information corresponding to the interrupt number. According to the register usage information corresponding to the interrupt number, it is judged whether the register is in an unrecovered state. If the register recovery of the previous interrupt has not been completed, the registers that are not saved and are required to be used in the current interrupt are confirmed, and the processor automatically saves the unsaved registers. If the register recovery of the previous interrupt has been completed, the processor automatically saves the registers marked as used in the register usage information.
7. The interrupt control method based on a function call graph according to claim 1, wherein Before the interrupt handling function is about to return, the processor determines whether to immediately restore the registers according to the current interrupt state. If the current interrupt state is that there is a new interrupt handling request, no register restoration operation is performed, the current context is marked as unrecovered, the current interrupt process is exited, and the execution jumps to a new interrupt service routine. If the current interrupt state is that there is no new interrupt handling request, all the saved registers in the current context are restored, and the interrupt handling function is exited normally.
8. The interrupt control method based on a function call graph according to claim 1, characterized in that, A dedicated register is set to store the register usage information table. The register usage information table includes an indexing basis and table entry content. The indexing basis includes the interrupt number ID, and the table entry content includes the register usage information corresponding to the interrupt number ID.
9. The interrupt control method based on a function call graph according to claim 8, wherein The reading of the table entry content includes: Calculating the address according to the interrupt number ID: base address + ID × information item size; Reading the corresponding register usage information from the address.
10. An interrupt control device based on a function call graph, characterized in that, The device includes: A function call graph generation module, which is used to obtain the interrupt handling function, and the compiler generates a function call graph corresponding to the interrupt handling function; A register usage information generation module, which is used to save the register generation usage information for each caller allocated to the function if the currently compiled function belongs to the function in the function call graph; A first usage information setting module, which is used to set corresponding usage information for each saved register of the first caller and each saved register of the first callee allocated when the interrupt handling function is a function written in a high-level language. At the same time, when generating code, the compiler does not generate instructions for saving and restoring the saved registers of the first caller and the saved registers of the first callee; A second usage information setting module, which is used to update the usage information according to the second caller-saved registers and the second callee-saved registers used in each instruction of the function when the interrupt handling function is a function written in a low-level language. At the same time, if there are instructions for saving and restoring the second caller-saved registers and the second callee-saved registers in the code, the instructions are deleted; A register usage information update module, which is used to update the register usage information of the function.
Citation Information
Patent Citations
Interrupt processing method, electronic equipment and storage medium
CN117407054A
Compiler capable of reducing interrupt handling in optimization and its optimization method
CN1223402A
Language processing apparatus, language processing method, and computer program product
US20110167415A1
Compiler capable of reducing interrupt handling in optimization and its optimization method
US6282705B1