Patentable/Patents/US-8484630
US-8484630

Code motion based on live ranges in an optimizing compiler

PublishedJuly 9, 2013
Assigneenot available in USPTO data we have
Inventorsnot available in USPTO data we have
Technical Abstract

Optimizing program code in a static compiler by determining the live ranges of variables and determining which live ranges are candidates for moving code from the use site to the definition site of source code. Live ranges for variables in a flow graph are determined. Selected live ranges are determined as candidates in which code will be moved from a use site within the source code to a definition site within the source code. Optimization opportunities within the source code are identified based on the code motion.

Patent Claims
20 claims

Legal claims defining the scope of protection. Each claim is shown in both the original legal language and a plain English translation.

Claim 1

Original Legal Text

1. A method of compiler optimization, the method comprising: performing analysis of a source code to identify a use site and an associated definition site in a portion of the source code; building a control flow graph and a data flow graph wherein at least one live range is identified using the control flow graph and a data flow graph; determining whether the at least one identified live range is a candidate for code motion in the source code; designating, based on an analysis of the at least one live range, variables in the source code that are candidates for a renaming of the variables, wherein each live range of variables is computed recursively; determining, based on predetermined criteria, whether each live range of variables are candidates for code motion in the source code; responsive to a positive determination, modifying the code at the associated definition site and the use site; and optimizing the code in the compiler based on the modification by moving source code from the use site to the associated definition site, wherein a temporary variable is defined for each relocated variable.

Plain English Translation

A compiler optimization method identifies use and definition sites of variables in source code. It constructs control and data flow graphs, identifying live ranges of variables. It then determines if a live range is suitable for code motion, potentially renaming variables within that range. This suitability is determined recursively and based on predefined criteria. If suitable, the compiler modifies the code at the definition and use sites, and then optimizes by moving code from the use site to the definition site, creating a temporary variable for each moved variable.

Claim 2

Original Legal Text

2. The method of claim 1 , wherein the analysis of live ranges comprises performing a data flow analysis that determines definition information and use information of a plurality of variables in source code.

Plain English Translation

The compiler optimization method analyzes live ranges by performing data flow analysis to determine definition and use information for variables in the source code. This analysis tracks how variables are defined and used throughout the program, providing a basis for deciding whether code motion is beneficial. The data flow analysis focuses on understanding variable dependencies and lifecycles to enable informed optimization decisions, building on the core process of identifying definition and use sites, and moving code based on live range suitability from claim 1.

Claim 3

Original Legal Text

3. The method of claim 2 , wherein a data flow analysis comprises implementing a single static assignment analysis.

Plain English Translation

The compiler optimization's data flow analysis, which analyzes variable definition and use information from claim 2, implements single static assignment (SSA). SSA ensures each variable is assigned only once, simplifying the data flow analysis and making it easier to track variable dependencies and identify opportunities for code motion. This SSA implementation directly enhances the data flow analysis step by providing a clearer, more structured representation of variable usage, which in turn improves the accuracy and effectiveness of the compiler's optimization process described in claim 1.

Claim 4

Original Legal Text

4. The method of claim 3 , wherein the single static assignment analysis includes automatically generating the control flow graph and the data flow graph.

Plain English Translation

The compiler's single static assignment analysis from claim 3 automatically generates the control flow and data flow graphs. This automation streamlines the optimization process by eliminating the need for manual graph construction. The system automatically creates the control flow graph, which shows the program's execution paths, and the data flow graph, which shows how data moves through the program. This automatic generation further simplifies the analysis described in claim 1.

Claim 5

Original Legal Text

5. The method of claim 1 , wherein the designating comprises checking variables in the expressions in the code and determining reached uses of the variables in the live range.

Plain English Translation

In the compiler optimization method, designating variables for renaming involves checking variables within expressions and determining which uses of those variables are reached within the live range. This ensures that the renaming process doesn't introduce errors or unexpected behavior by carefully considering the scope and impact of each variable modification. This focuses on checking which variables in expressions can be changed in the live range, further improving the processes defined in claim 1.

Claim 6

Original Legal Text

6. The method of claim 1 , further comprising creating the temporary variable based on a data type and data length of an expression of reached uses in the live range.

Plain English Translation

In the compiler optimization method, creating a temporary variable involves basing its data type and data length on the expression of reached uses within the live range. This ensures that the temporary variable is compatible with the data it will hold and prevents data type mismatches or truncation errors during code motion, as described in claim 1. This further clarifies how the temporary variable is defined by considering existing variables' attributes.

Claim 7

Original Legal Text

7. The method of claim 6 , wherein modifying the code comprises renaming the variables in the live range at all definition sites in the code and the use sites in the code.

Plain English Translation

When modifying the code in the compiler optimization method, variables within the live range are renamed at all definition and use sites within the code. This ensures consistency and prevents errors that could arise from using different names for the same variable in different parts of the code. By renaming the variables in live range at all locations, the method ensures seamless code execution following code motion per claim 1.

Claim 8

Original Legal Text

8. The method of claim 1 , wherein the predetermined criteria is based on determining whether a variable expression of the live range potentially exposes code folding opportunities in the code.

Plain English Translation

The predefined criteria for determining code motion suitability is based on whether a variable expression within the live range potentially exposes code folding opportunities. Code folding simplifies expressions, leading to more efficient code execution. Identifying and exploiting these opportunities during the code motion process further optimizes the code as described in claim 1. The predetermined criteria uses variable expression of the live range to check for potential improvements.

Claim 9

Original Legal Text

9. The method of claim 1 , wherein the predetermined criteria is based on determining if a data type of a variable expression using the temporary variable is preferable to the original variable expression.

Plain English Translation

The predefined criteria for determining code motion suitability is based on whether the data type of a variable expression using the temporary variable is preferable to the original variable expression. This ensures that the code motion improves the code's efficiency or clarity by using a more appropriate data type. Selecting a better data type during code motion is a key part of optimizing the code, further augmenting the logic described in claim 1.

Claim 10

Original Legal Text

10. The method of claim 1 , wherein optimizing the code comprises folding the code.

Plain English Translation

Optimizing the code in the compiler optimization method involves code folding. Code folding simplifies expressions, leading to more efficient code execution. The act of folding the code occurs after the modification of the use and definition sites from claim 1.

Claim 11

Original Legal Text

11. A computer program product comprising non-transitory computer recordable media including instructions stored thereon, which when executed by a processor, performs actions that optimizes source code in a compiler, the actions comprising: performing analysis of a source code to determine a use site and an associated definition site in a portion of the source code; building a control flow graph and a data flow graph wherein at least one live range is identified using the control flow graph and a data flow graph; determining whether the at least one identified live range is a candidate for code motion in the source code; designating, based on an analysis of the at least one live range, variables in the source code that are candidates for a renaming of the variables, wherein each live range of variables is computed recursively; determining, based on a predetermined criteria, whether each live range of variables is a candidate for code motion in the source code; responsive to a positive determination, modifying the code at the associated definition site and the use site; and optimizing the code in the compiler based on the modification by moving source code from the use site to the associated definition site to define a temporary variable for each relocated variable.

Plain English Translation

A computer program product (software) optimizes source code in a compiler. It analyzes source code to identify variable use and definition sites. It builds control and data flow graphs to identify live ranges of variables. It determines if a live range is suitable for code motion, potentially renaming variables. Suitability is determined recursively and based on criteria. If suitable, it modifies the code at the definition and use sites and then optimizes by moving code from the use site to the definition site, creating a temporary variable for each moved variable.

Claim 12

Original Legal Text

12. The computer program product of claim 11 , wherein the analysis of the at least one live range comprises performing a data flow analysis that determines definition information and use information of a plurality of variables in source code.

Plain English Translation

The computer program product (software) analyzes live ranges by performing data flow analysis to determine definition and use information for variables in the source code, enabling code motion opportunities and enhancing the core process of identifying definition and use sites, and moving code based on live range suitability from claim 11. This clarifies that the data flow analysis component assesses variable usage and dependencies.

Claim 13

Original Legal Text

13. The computer program product of claim 12 , wherein the data flow analysis comprises implementing a single static assignment analysis.

Plain English Translation

The computer program product's data flow analysis, which analyzes variable definition and use information from claim 12, implements single static assignment (SSA). SSA simplifies the data flow analysis and makes it easier to track variable dependencies and identify opportunities for code motion, further enhancing the process from claim 11. This clarifies that SSA helps with better and more streamlined identification of code optimization.

Claim 14

Original Legal Text

14. The computer program product of claim 11 , further comprising creating the temporary variable based on a data type and data length of an expression of reached uses in the live range.

Plain English Translation

In the computer program product, creating a temporary variable involves basing its data type and data length on the expression of reached uses within the live range. This ensures that the temporary variable is compatible with the data it will hold and prevents data type mismatches or truncation errors during code motion, as described in claim 11. This further clarifies how temporary variables are sized and typed based on their data usage.

Claim 15

Original Legal Text

15. The computer program product of claim 11 , wherein modifying the code comprises renaming the variables in the at least one live range at all associated definition sites in the code and the use sites in the code.

Plain English Translation

When modifying the code in the computer program product, variables within the live range are renamed at all definition and use sites within the code. This ensures consistency and prevents errors that could arise from using different names for the same variable in different parts of the code, improving optimization described in claim 11. This clarifies that the renaming ensures integrity of code at every definition and use.

Claim 16

Original Legal Text

16. The computer program product of claim 11 , wherein the predetermined criteria is based on determining whether a variable expression of the at least one live range potentially exposes code folding opportunities in the code.

Plain English Translation

The predetermined criteria for code motion suitability in the computer program product is based on whether a variable expression within the live range potentially exposes code folding opportunities. Code folding simplifies expressions, leading to more efficient code execution, which improves optimization mentioned in claim 11. The predetermined criteria uses variable expression of the live range to check for potential improvements.

Claim 17

Original Legal Text

17. A system for code optimization in a compiler, the system comprising: a processor; a memory coupled to the processor, wherein the memory having stored computer usable code therein, the computer usable code comprising: computer usable code that performs analysis of a source code to determine a use site and an associated definition site of the source code; computer usable code that builds a control flow graph and a data flow graph wherein at least one live range is identified using the control flow graph and a data flow graph; computer usable code that determines whether the at least one live range identified is a candidate for code motion in the source code; computer usable code that designates, based on an analysis of the at least one live range, variables in the source code that are candidates for a renaming of the variables, wherein each live range of variables is computed recursively; computer usable code that determines, based on a predetermined criteria, whether the each live range of variables are candidates for code motion in the source code; computer usable code that, responsive to a positive determination, modifies the code at the associated definition site and the use site; and computer usable code that optimizes the code in the compiler based on the modification by moving source code from the use site to the associated definition site to define a temporary variable for each relocated variable.

Plain English Translation

A compiler optimization system includes a processor and memory. The memory stores code that performs the following: It analyzes source code to identify use and definition sites of variables. It builds control and data flow graphs, identifying live ranges of variables. It determines if a live range is suitable for code motion, potentially renaming variables. Suitability is determined recursively and based on criteria. If suitable, it modifies the code at the definition and use sites and then optimizes by moving code from the use site to the definition site, creating a temporary variable for each moved variable.

Claim 18

Original Legal Text

18. The system of claim 17 , further comprising computer usable code that creates the temporary variable based on a data type and data length of an expression of reached uses in the live range.

Plain English Translation

The compiler optimization system includes code to create a temporary variable, basing its data type and data length on the expression of reached uses within the live range. This ensures that the temporary variable is compatible with the data it will hold and prevents data type mismatches or truncation errors during code motion as described in claim 17. This ensures the types match during variable creation.

Claim 19

Original Legal Text

19. The system of claim 18 , further comprising computer usable code that modifies the code by renaming the variables in the at least one live range at all associated definition sites in the code and the use sites in the code.

Plain English Translation

The compiler optimization system includes code to modify the code by renaming variables within the live range at all definition and use sites within the code. This ensures consistency and prevents errors that could arise from using different names for the same variable in different parts of the code, building upon the core system from claim 17. This ensures the variable names are properly synchronized.

Claim 20

Original Legal Text

20. The system of claim 18 , further comprising computer usable code that optimizes the code by folding the code.

Plain English Translation

The compiler optimization system includes code to optimize the code by code folding. Code folding simplifies expressions, leading to more efficient code execution, improving performance on the system described in claim 18.

Classification Codes (CPC)

Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.

Patent Metadata

Filing Date

December 23, 2008

Publication Date

July 9, 2013

Want to explore more patents?

Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.

Citation & reuse

Analysis on this page is generated by Patentable — an AI-powered patent intelligence platform. AI-generated summaries, explanations, FAQs, and analysis may be reused with attribution and a visible link back to the canonical URL below. Patent abstracts and claims are USPTO public domain.

Cite as: Patentable. “Code motion based on live ranges in an optimizing compiler” (US-8484630). https://patentable.app/patents/US-8484630

© 2026 Nomic Interactive Technology LLC. Machine-readable context available at /api/llm-context/US-8484630. See llms.txt for full attribution policy.