Skip to main content

gtirb-live-register-analysis

Overview

The gtirb-live-register-analysis package provides a Python API for live register analysis of GTIRB functions. A simple interface is also provided for working with gtirb-rewriting patches.

Supported ABIs

ISA File Format
X64 (x86-64) ELF

Getting Started

Generic Usage

from gtirb_live_register_analysis import LiveRegisterManager

reg_manager = LiveRegisterManager(module)

# Analyze function of interest
reg_manager.analyze(function)

# The sets of live and free registers can then be retrieved
live_regs = reg_manager.live_registers(function, block, instruction_idx)
free_regs = reg_manager.free_registers(function, block, instruction_idx)

Use with gtirb-rewriting patches

Wrap the decorator function around a patch function to assign free registers to be used as scratch registers. When there are not enough free registers, the library falls back to gtirb-rewriting, which generates code to spill/restore the excess registers to stack.

@reg_manager.allocate_registers(function, block, instruction_idx)
@patch_constraints(x86_syntax=X86Syntax.INTEL, scratch_registers=6)
def my_patch(self, ctx: InsertionContext):
    reg1, reg2, reg3, reg4, reg5, reg6 = ctx.scratch_registers
    return f"""
        xor {reg1}, {reg1}
        xor {reg2}, {reg2}
        xor {reg3}, {reg3}
        xor {reg4}, {reg4}
        xor {reg5}, {reg5}
        xor {reg6}, {reg6}
    """

rewriting_ctx.insert_at(block, offset, Patch.from_function(my_patch))

Metadata

Release files for gtirb-live-register-analysis 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gtirb-live-register-analysis 0.0.10
File Size Uploaded Provenance Actions
gtirb-live-register-analysis-0.0.10.tar.gz 17.6 kB Without provenance Details for gtirb-live-register-analysis-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gtirb-live-register-analysis 0.0.10
File Interpreter ABI Platform Actions
gtirb_live_register_analysis-0.0.10-py3-none-any.whl Python 3 none any Details for gtirb_live_register_analysis-0.0.10-py3-none-any.whl

Total release size: 36.6 kB

Release files / gtirb-live-register-analysis-0.0.10.tar.gz

Download URL gtirb-live-register-analysis-0.0.10.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9dcbd921c92139ba3bab3ac7d0e69a5ec324ab16d67e6a3c3ef041e8ac5bd1bd
BLAKE2b-256 checksum
How to use checksums
d4f4fea508f6a594596b9068044f85ccd8c6cafab7d0dc163e4ecdb27f1bdfbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / gtirb_live_register_analysis-0.0.10-py3-none-any.whl

Download URL gtirb_live_register_analysis-0.0.10-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ad0d569d6eb6c55976e9b1a4c066e51ead925f20477153a403f59f6304caaa2
BLAKE2b-256 checksum
How to use checksums
37524aad20ed0f7038271d2c3268231643e3b8882eed689a41725f1994478089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Security for gtirb-live-register-analysis 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page