IP Library › Granted Patent US 10,409,570
Granted Patent B2
US 10,409,570 · App. 15/297,606 · Granted Sep 10, 2019

Feedback directed program stack optimization

Inventors: Michal Silbermintz (Tel Mond, IL); John Russo (Austin, TX)
Assignee: NXP USA, Inc.
G06F8/4434G06F8/443G06F8/447
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,409,570
App. No.
15/297,606
Granted
Sep 10, 2019
Kind
B2
Abstract

A processing device includes an instruction memory to store executable applications that are executable by a target processor, and a compiler. The compiler includes a builder module and a call graph generator. The builder module to build executable applications for the target processor based on a set of instructions. The call graph generator to create a first call graph that indicates a stack usage for each call path of the executable applications. If a first executable application built by the builder module includes a call path that exceeds a stack size constraint of the target processor, the builder module to optimize only functions within the call path that exceeds the stack size constraint in response to the request from the evaluation monitor, and to build a second executable application based on the set of instructions. The second executable application is optimized for stack memory usage of the target processor.

Claims (57)

1. A method comprising:

building, by a builder module of a compiler, a first executable application that is executable by a target processor based on a set of instructions;

creating, by a call graph generator of the compiler, a first call graph for the first executable application, the first call graph comprises a stack memory usage for each function and each child of the function in the first executable application;

comparing a stack size of a first call path in the first call graph of the first executable application to a stack size constraint of the target processor to determine the first call path exceeds the stack size constraint;

comparing a stack size of a second call path in the first call graph of the first executable application to the stack size constraint of the target processor to determine the second call path is within the stack size constraint;

selecting a first stack optimization technique in response to determining that the first call path exceeds the stack size constraint;

building a second executable application based on the set of instructions wherein building the second executable application implements the selected first stack optimization technique in response to the first call path exceeding the stack size constraint;

creating, by the call path generator, a second call graph for the second executable application;

comparing a stack size of a first call path in the second call graph of the second executable application to the stack size constraint of the target processor to determine whether the first call path in the second call graph of the second executable application exceeds the stack size constraint;

optimizing, in the second executable application, only functions within the first call path in the second call graph that exceed the stack size constraint in response to the first call path in the second call graph exceeding the stack size constraint and the second call path being within the stack size constraint;

selecting a second stack optimization technique when the first call path in the second call graph of the second executable application exceeds the stack size constraint;

building a third executable application based on the set of instructions wherein building the third executable application implements the selected second stack optimization; and

creating, by the call path generator, a third call graph for the third executable application.

2. The method of claim 1 , wherein the second call graph differs from the first call graph only with respect to functions that are optimized for the stack memory usage.

3. The method of claim 1 , further comprising:

providing, by the call graph generator, a stack estimation output, wherein the stack estimation output comprises a stack memory usage for a function and each child of the function in the first call path, and a remaining amount of stack memory size for the first call path.

4. The method of claim 1 , further comprising:

storing the optimized second executable application in a memory for the target processor.

5. The method of claim 1 , wherein a function in the second executable application is optimized as compared to the same function in the first executable application using an optimization technique selected from a group consisting of: selective in-lining and outlining; stack placement algorithms to minimize alignment padding; register allocation algorithm selection; instruction selection to minimize resource usage; and data analysis to allocate variables to static memory.

6. A processing device comprising:

an instruction memory to store executable applications that are executable by a target processor; and

a compiler including:

a builder module;

a call graph generator; and

an evaluation monitor;

wherein the compiler is configured to:

build, by the builder module, a first executable application that is executable by the target processor based on a set of instructions;

create, by the call graph generator, a first call graph for the first executable application, the first call graph comprises a stack memory usage for each function and each child of the function in the first executable application;

compare, by the evaluation monitor, a stack size of a first call path in the first call graph of the first executable application to a stack site constraint of the target processor to determine the first call path exceeds the stack size constraint;

compare a stack size of a second call path in the first call graph of the first executable application to the stack size constraint of the target processor to determine the second call path is within the stack size constraint;

select a first stack optimization technique in response to determining that the first call path exceeds the stack size constraint;

build a second executable application based on the set of instructions wherein building the second executable application implements the selected first stack optimization technique in response to the first call path exceeding the stack size constraint;

create, by the call path generator, a second call graph for the second executable application;

compare a stack size of a first call path in the second call graph of the second executable application to the stack size constraint of the target processor to determine whether the first call path in the second call graph of the second executable application exceeds the stack size constraint;

optimize, in the second executable application, only functions within the first call path in the second call graph that exceed the stack size constraint in response to the first call path in the second call graph exceeding the stack size constraint and the second call path being within the stack size constraint;

select a second stack optimization technique when the first call path in the second call graph of the second executable application exceeds the stack size constraint;

build a third executable application based on the set of instructions wherein building the third executable application implements the selected second stack optimization; and

create, by the call path generator, a third call graph for the third executable application.

7. The processing device of claim 6 , further comprising:

a memory configured to store the optimized second executable application for the target processor.

8. The processing device of claim 7 , wherein the second call graph differs from the first call graph only with respect to functions that are optimized for the stack memory usage.

9. The processing device of claim 6 , the call graph generator further to provide a stack estimation output, wherein the stack estimation output comprises a stack memory usage for a function and each child of the function in a call path, and a remaining amount of stack memory size for the call path.

10. The processing device of claim 6 , wherein a function in the second executable application is optimized as compared to the same function in the first executable application using an optimization technique selected from a group consisting of: selective in-lining and outlining; stack placement algorithms to minimize alignment padding; register allocation algorithm selection; instruction selection to minimize resource usage; and data analysis to allocate variables to static memory.

11. The method of claim 1 , further comprising:

comparing a stack size of the first call path in the third call graph of the third executable application to the stack size constraint of the target processor to determine whether the first call path exceeds the stack size constraint; and

optimizing, in the third executable application, only functions within the first call path in the third call graph that exceed the stack size constraint when the first call path in the third call graph exceeds the stack size constraint.

12. The method of claim 11 , further comprising:

selecting the first and second stack optimization techniques when the first call path in the third call graph exceeds the stack size constraint;

building a fourth executable application based on the set of instructions wherein building the fourth executable application implements a combination of the the selected first and second stack optimization techniques when the first call path in the third call graph exceeds the stack size constraint; and

creating, by the call path generator, a fourth call graph for the fourth executable application.

13. The processing device of claim 6 , wherein the compiler is further configured to:

compare a stack size of the first call path in the third call graph of the third executable application to the stack size constraint of the target processor to determine whether the first call path exceeds the stack size constraint; and

optimize, in the third executable application, only functions within the first call path in the third call graph that exceed the stack size constraint when the first call path in the third call graph exceeds the stack size constraint.

14. The processing device of claim 6 , wherein the compiler is further configured to:

select the first and second stack optimization techniques when the first call path in the third call graph exceeds the stack size constraint;

build a fourth executable application based on the set of instructions wherein building the fourth executable application implements a combination of the the selected first and second stack optimization techniques when the first call path in the third call graph exceeds the stack size constraint; and

create a fourth call graph for the fourth executable application.

Assignments (3)
CORRECTIVE ASSIGNMENT TO CORRECT THE NATURE OF CONVEYANCE PREVIOUSLY RECORDED AT REEL: 040626 FRAME: 0683. ASSIGNOR(S) HEREBY CONFIRMS THE MERGER AND CHANGE OF NAME EFFECTIVE NOVEMBER 7, 2016. Recorded Jan 12, 2017
From: NXP SEMICONDUCTORS USA, INC. (MERGED INTO); FREESCALE SEMICONDUCTOR, INC. (UNDER)
To: NXP USA, INC.
Reel/Frame 041414/0883 →
CHANGE OF NAME Recorded Nov 16, 2016
From: FREESCALE SEMICONDUCTOR INC.
To: NXP USA, INC.
Reel/Frame 040626/0683 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 19, 2016
From: SILBERMINTZ, MICHAL; RUSSO, JOHN
To: FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 040064/0029 →
Continuity (1)
Related Publication 20180107465A1 · Apr 19, 2018