# US 2018/0321925 A1 · Automatically Transform Pass-by-Value Semantics into Pass-by-Reference Implementation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2018/0321925 A1
- Document ID: US20180321925A1
- Status: Published application
- Kind: A1
- Application number: 15/588,298
- Filed: 2017-05-05
- Published: 2018-11-08
- Earliest claimed: 2017-05-05
- Assignees: National Instruments Corporation
- Applicants: National Instruments Corporation
- Inventors: Hojin Kee; David C. Uliana; Tai A. Ly; Adam T. Arnesen
- Web page: https://patentgrep.com/patent/US20180321925A1

## CPC

- G06F 8/436: {Semantic checking}
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 8/443: {Optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

System and method for compiling a program, including determining one or more program structures containing one or more variables at the entry and exit of each program structure, wherein each variable specifies a value transfer operation between outside the program structure and inside the program structure. Each value transfer operation may specify a value transfer between a respective one or more source variables and a destination variable. A subset of the destination variables may be determined for which assigning the destination variable to a memory resource of a corresponding source variable does not disrupt the functionality of the program. For each of the one or more value transfer operations, the value transfer operation may be implemented, where the implementation of the value transfer operation may be executable to assign each of the determined subset of destination variables to a respective memory resource, thereby mapping the variables to the memory resources, and dynamically change the mapping, including assigning the destination variable to the memory resource of a first source variable of the one or more source variables, thereby transferring the value from the first source variable to the destination variable without copying the value between the memory resources. The method may be implemented for programs operating according to either a static or dynamic schedule.

## Claims

### Claim 1

An apparatus, comprising:
a processor; and
a non-transitory computer accessible memory medium coupled to the processor that stores program instructions executable by the apparatus to perform:
compiling a program to generate output code, the compiling comprising:
determining one or more program structures in the program containing one or more variables at the entry or exit of each of these program structures, wherein each variable at the entry or exit of a program structure specifies a value transfer between outside of a program structure and inside the program structure, and wherein each value transfer specifies a value transfer from one or more source variables to a destination variable; and
implementing each of the value transfer operations in the output code, wherein, during operation based on the output code, the implementation of the value transfer operation includes:
assigning each variable of the value transfer operation to a respective memory resource, thereby mapping the variables to the memory resources;
determining a subset of the destination variables for which assigning the destination variable to a memory resource of a corresponding source variable does not disrupt the functionality of the program; and
for the subset of the destination variables, dynamically changing the mapping, including assigning the destination variable to the memory resource of a first source variable of the one or more source variables, thereby transferring the value from the first source variable to the destination variable without copying the value between the memory resources.

### Claim 2 (depends on 1)

The apparatus of claim 1,
wherein said determining the subset of the destination variables comprises determining a memory resource requirement associated with the program.

### Claim 3 (depends on 2)

The apparatus of claim 2, wherein said compiling the program further comprises:
determining that the one or more program structures operate with a static schedule; and
in response to determining that the one or more program structures operate with a static schedule, collecting variables that transfer values across program structures into a group of related variables and analyzing the lifetimes of the related variables in the group of related variables.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein said compiling the program further comprises:
determining temporal overlap of the lifetimes of the related variables in the group of related variables; and
wherein said determining the subset of the destination variables is based on the determined temporal overlap of the lifetimes.

### Claim 5 (depends on 2)

The apparatus of claim 2, wherein said compiling the program further comprises:
determining that the one or more program structures operate with a dynamic schedule;
in response to determining that the one or more program structures operate with a dynamic schedule:
construct a segment dependency graph based on the one or more structures;
extract a segment conflict graph based on the segment dependency graph; and
determine the memory resource requirement associated with the program based on a maximum clique size of the segment conflict graph.

### Claim 6 (depends on 1)

The apparatus of claim 1, wherein the output code is configured for operation by a programmable hardware device.

### Claim 7

A non-transitory computer accessible memory medium that stores program instructions executable by a functional unit to perform operations comprising:
compiling a program to generate output code, the compiling comprising:
determining one or more program structures in the program containing one or more variables at one or more of the entry and exit of each of these program structures, wherein each variable specifies a value transfer between outside of a program structure and inside the program structure, and wherein each value transfer specifies a value transfer from one or more source variables to a destination variable; and
implementing each of the value transfer operations in the output code, wherein, during operation based on the output code, the implementation of the value transfer operation includes:
assigning each variable of the value transfer operation to a respective memory resource, thereby mapping the variables to the memory resources;
determining a subset of the destination variables for which assigning the destination variable to a memory resource of a corresponding source variable does not disrupt the functionality of the program; and
for the determined subset of the destination variables, dynamically changing the mapping, including assigning the destination variable to the memory resource of a first source variable of the one or more source variables, thereby transferring the value from the first source variable to the destination variable without copying the value between the memory resources.

### Claim 8 (depends on 7)

The memory medium of claim 7,
wherein said determining the subset of the destination variables comprises determining a memory resource requirement associated with the program.

### Claim 9 (depends on 7)

The memory medium of claim 7, wherein said compiling the program further comprises:
determining that the one or more program structures operate with a static schedule; and
in response to determining that the one or more program structures operate with a static schedule, collecting variables that transfer values across program structures into a group of related variables and analyzing the lifetimes of the related variables in the group of related variables.

### Claim 10 (depends on 9)

The memory medium of claim 9, wherein said compiling the program further comprises:
determining temporal overlap of the lifetimes of the related variables in the group of related variables; and
wherein said determining the subset of the destination variables is based on the determined temporal overlap of the lifetimes.

### Claim 11 (depends on 8)

The memory medium of claim 8, wherein said compiling the program further comprises:
in response to determining that the one or more program structures operate with a dynamic schedule:
constructing a segment dependency graph based on the one or more program structures;
extracting a segment conflict graph based on the segment dependency graph; and
determining the memory resource requirement associated with the program based on a maximum clique size of the segment conflict graph.

### Claim 12 (depends on 7)

The memory medium of claim 7, wherein the output code is configured for programming a programmable hardware device to perform operations to implement the functionality of the program.

### Claim 13 (depends on 7)

The memory medium of claim 7, wherein said compiling allows operation of two or more program structures in a pipelined manner by passing values between the two or more program structures without copying values between their respective memory resources.

### Claim 14

A method for compiling a program to generate output code, the method comprising:
determining one or more program structures in the program containing one or more variables at the entry or exit of each of these program structures, wherein each variable at the entry or exit of a program structure specifies a value transfer between outside of a program structure and inside the program structure, and wherein each value transfer specifies a value transfer from one or more source variables to a destination variable;
implementing each of the value transfer operations in the output code, wherein, during operation based on the output code, the implementation of the value transfer operation includes:
assigning each variable of the value transfer operation to a respective memory resource, thereby mapping the variables to the memory resources;
determining a subset of the destination variables for which assigning the destination variable to a memory resource of a corresponding source variable does not disrupt the functionality of the program; and
for the subset of the destination variables, dynamically changing the mapping, including assigning the destination variable to the memory resource of a first source variable of the one or more source variables, thereby transferring the value from the first source variable to the destination variable without copying the value between the memory resources.

### Claim 15 (depends on 14)

The method of claim 14,
wherein said determining the subset of the destination variables comprises determining a memory resource requirement associated with the program.

### Claim 16 (depends on 15)

The method of claim 15, wherein said compiling the program further comprises:
determining that the one or more program structures operate with a static schedule; and
in response to determining that the one or more program structures operate with a static schedule, collecting variables that transfer values across program structures into a group of related variables and analyzing the lifetimes of the related variables in the group of related variables.

### Claim 17 (depends on 16)

The method of claim 16, wherein said compiling the program further comprises:
determining temporal overlap of the lifetimes of the related variables in the group of related variables; and
wherein said determining the subset of the destination variables is based on the determined temporal overlap of the lifetimes.

### Claim 18 (depends on 15)

The method of claim 15, wherein said compiling the program further comprises:
determining that the one or more program structures operate with a dynamic schedule;
in response to determining that the one or more program structures operate with a dynamic schedule:
construct a segment dependency graph based on the one or more structures;
extract a segment conflict graph based on the segment dependency graph; and
determine the memory resource requirement associated with the program based on a maximum clique size of the segment conflict graph.

### Claim 19 (depends on 14)

The method of claim 14, the method further comprising:
programming a programmable hardware device based on the output code such that the programmable hardware device is configured to operate to perform the functionality.

### Claim 20 (depends on 14)

The method of claim 14, wherein said compiling allows operation of two or more program structures in a pipelined manner.
