Semantic Comparison of Compiler Machine Code Traces

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing compiler technologies face difficulties in directly comparing machine code outputs from different compilers due to differences in instructions, instruction scheduling, register allocation, and optimizations, making it hard to identify semantic errors.

Innovation Solution

The method involves transforming machine code traces into a uniform expression format, merging multiple instances of the same expression type, sorting operands, and performing optimizations, allowing for semantic comparison of machine code traces generated by different compilers.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If machine code traces from different compilers are directly compared, then comparison simplicity is improved, but measurement precision deteriorates due to differences in instructions, scheduling, and register allocation

Engineering Contradiction:
Improvecomparison simplicityVSAvoidsemantic comparison accuracy
Core Design Contradiction:
Ease of operationVSMeasurement precision

Solution Approach 1:

The patent introduces an intermediate representation (IR) as a mediator between different compiler outputs. The IR serves as a common language that captures the semantic meaning of machine code traces without being tied to compiler-specific instructions or optimizations. By translating traces from different compilers into this unified IR format, the system enables accurate semantic comparison while maintaining operational simplicity.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent transforms the comparison parameters from low-level machine code details (specific instructions, register allocations, scheduling) to high-level semantic parameters in the intermediate representation. This parameter transformation allows comparison to focus on meaningful semantic differences rather than implementation variations, thereby improving measurement precision without sacrificing ease of operation.

Inventive Principle:
Principle #35Parameter changes

2Measurement precision

If compiler outputs are transformed into uniform expression format, then semantic comparison accuracy is improved, but device complexity increases due to transformation and merging operations

Engineering Contradiction:
Improvesemantic comparison accuracyVSAvoidtransformation system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The transformation process is segmented into distinct, modular operations: translation of machine code to intermediate representation, merging of equivalent expressions, and normalization of the resulting structure. Each segment handles a specific aspect of the transformation, making the overall complex process manageable and maintainable while achieving high semantic comparison accuracy.

Inventive Principle:
Principle #1Segmentation

3Productivity

If multiple expression instances are merged into single instances, then comparison efficiency is improved, but information loss may occur

Engineering Contradiction:
Improvecomparison efficiencyVSAvoidtrace detail information
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The system performs preliminary actions by translating machine code traces into an intermediate representation that preserves semantic information in a structured format before merging occurs. This preliminary translation ensures that all necessary information is captured and organized, allowing subsequent merging operations to combine equivalent expressions without losing meaningful distinctions. The preliminary structuring enables efficient comparison while preventing information loss.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10503634B1Semantic comparison of computer compiler traces
Publication Date: 2019.12.10 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10503634B1 patent drawing
  • US10503634B1 patent drawing
  • US10503634B1 patent drawing

AI summary

Techniques are described for semantically comparing machine code traces generated by compilers that compile computer software code. For example, a trace of machine code generated by a compiler can be obtained. The trace can be transformed into a set of expressions in a uniform expression format (e.g., by performing translation of the trace instructions into corresponding expressions and/or by performing other transformations). The set of expressions in the uniform expression format can be compared to other sets of expressions in the uniform expression format (e.g., other sets of expressions created from traces of machine code from other compilers). Results of the comparison can comprise indications of whether the sets of expressions match.