Customizable Compiler Attributes for Code Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing compilers lack the ability to access and utilize additional information provided by programmers about programming constructs, which can be valuable for code checking and optimization, due to limitations in the programming language syntax and potential changes to the compiled code.

Innovation Solution

The introduction of customizable compiler attributes and logic within the source code allows programmers to provide additional information to the compiler, enabling code checking and optimization at compile time without altering the compiled code, using built-in compiler functions to evaluate and process these attributes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If programmers provide additional information about programming constructs in source code, then code checking and optimization capabilities are improved, but the complexity of the compiler system increases

Engineering Contradiction:
Improvecode checking accuracyVSAvoidcompiler system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent introduces compiler attributes as intermediary elements that bridge the gap between source code and compiler analysis. These attributes serve as a mediator that carries additional information from programmer-defined source code to compiler evaluation functions, enabling enhanced code checking without fundamentally restructuring the compiler architecture. The attributes act as a buffer layer that translates programmer intent into compiler-understandable form.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent segments the additional information about programming constructs into discrete compiler attributes that can be independently defined, evaluated, and processed. Each attribute represents a specific piece of information (e.g., about a programming construct's properties) that can be separately managed by the compiler. This segmentation allows the compiler to process only the relevant attributes needed for specific optimization or checking tasks, rather than handling all information monolithically.

Inventive Principle:
Principle #1Segmentation

2Productivity

If the compiler utilizes additional information from programmer-provided attributes, then code optimization is improved, but the difficulty of detecting and measuring programming construct properties increases

Engineering Contradiction:
Improvecode optimization efficiencyVSAvoidprogramming construct property detection
Core Design Contradiction:
ProductivityVSDifficulty of detecting and measuring

Solution Approach 1:

The patent implements self-service by allowing the source code itself to carry the additional information through compiler attributes embedded within the code. Rather than requiring separate external documentation or complex analysis tools, the programming constructs provide their own metadata directly in the source code. This self-service approach enables the compiler to extract optimization information directly from the code structure without needing external assistance.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent applies preliminary action by having programmers define compiler attributes and evaluation logic during the source code writing phase, before compilation occurs. This advance preparation of attribute definitions and evaluation functions allows the compiler to perform efficient optimizations during compilation, rather than requiring complex runtime analysis. The difficult detection and measurement tasks are shifted to compile time when the full source code context is available.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If compiler attributes are defined and evaluated in source code, then early detection of logic errors is improved, but the extent of automation in the compilation process decreases

Engineering Contradiction:
Improvelogic error detectionVSAvoidcompilation process automation
Core Design Contradiction:
ReliabilityVSExtent of automation

Solution Approach 1:

The patent applies partial action by allowing programmers to selectively enable compiler attributes and evaluation functions only where needed in the source code. Rather than requiring full automation of all compilation aspects, the system allows partial manual specification of attributes for specific programming constructs where early error detection is critical. This selective approach maintains automation for standard compilation tasks while adding targeted manual oversight for complex logic verification.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS12182553B2User customizable compiler attributes for code optimization
Publication Date: 2024.12.31 RED HAT LLC
  • US12182553B2 patent drawing
  • US12182553B2 patent drawing
  • US12182553B2 patent drawing

AI summary

Disclosed herein is technology to use customized compiler attributes to enhance code optimizations. An example method may include: accessing, by a processing device executing a compiler, a source code comprising a compiler attribute, wherein the compiler attribute is defined by text in the source code; detecting, by the processing device, a call in the source code to a compiler function that processes the compiler attribute, wherein the source code includes logic to process the compiler attribute; executing, by the processing device, the compiler function at compile time, wherein the compiler function uses the logic to process the compiler attribute and generates attribute data; and using, by the compiler, the attribute data to optimize object code generated from the source code.