Crate strop

Source
Expand description

§Superoptimizer written in Rust

This program stochastically generates assembly language programs that compute a given function. Strop provides mechanisms for generating programs, and mutating them in ways that stochastically approach the desired output.

Another way to describe strop, is that it randomly generates pretty good assembly programs.

So far, strop has had a focus on supporting architectures that are not well supported by mainstream compilers such as LLVM. These have included architectures common in low-end embedded, and hobbyist retrocomputing.

Re-exports§

pub use branches::Branch;

Modules§

armv4t
The armv4t module, the strop back-end for targeting the ARMv4T CPUs, including the ARM7TDMI.
branches
Module defining traits and things for scrutinizing and treating instructions which implement relative jumps, optional or otherwise. This includes such instructions as:
dataflow
This module contains miscellaneous conveniences for performing dataflow analysis on code sequences.
m6502
This is the back-end targeting the MOS 6502, a well-known 8-bit retro CPU.
m6809
This is the back-end targeting the Motorola 6809, another beloved 8-bit retro CPU.
mips
A back-end targeting MIPS processors.
test
Module containing miscellaneous functions for testing callables
z80
A back-end targeting the Z80, a well-known 8-bit retro CPU.

Structs§

BruteForce
Performs a brute force search over a given search space Searchable
Generate
A genetic algorithm for finding good functions
Sequence
Sequence<T> is a straight-line sequence of things, such as machine instructions or other sequences.
StaticAnalysis
Result of a static analysis pass. Explains why a code sequence has been found to be illogical or unsuitable, and provides a way to prune such a sequence from the search.
Trace
A wrapper which writes to stdout

Enums§

RunError
Enum representing possible errors when running (a subroutine, a function, an interrupt handler, etc…)
StepError
Enum representing possible errors when stepping

Traits§

AsBruteforce
Trait for returning a BruteForce object
BruteforceSearch
Impl this trait on any code sequence (a subroutine, a function, other passes) so that the brute force search can mutate and query it.
Callable
A trait for objects which may be called.
Crossover
A trait for taking two items having the same type, and producing a thrid item of the same type, having a value being a mashup of the two parents. Such a thing is used in the genetic algorithm
Disassemble
A trait for printing out the disassembly of an instruction, a subroutine, or anything else
Encode
Trait for things that can be converted to sequences (of bytes, words, etc)
Goto
Trait for starting a search from a particular point in the search space.
Mutate
A trait for anything that can be randomly mutated
Objective
Objective function. The genetic algorithms try to minimize this function. Possible functions include “length of program” (the algorithm tries to reduce this, so it will find the shortest program), and “average runtime in machine cycles” (the algorithm tries to reduce this, so it will find faster programs).
Step
Impl this on a datatype that may be iterated by mutating the datum in place. This is then used by the library to perform bruteforce searches and such
ToBruteForce
Converts something to a BruteForce, which performs brute force searches over some search space for a given function.
ToTrace
Wraps an object up in a Trace, so that each mutation is printed to stdout.

Type Aliases§

IterationResult
Return type for in-place iteration
RunResult
Return type for in-place iteration