Skip to content

harm: Make*-traits should describe arguments only #11

Description

@monoid

Many instructions have very similar structure of possible arguments (for example, ldr and str). Right now they define MakeLdr/Ldr<...> and MakeStr/Str<...> with macros and ldr/str functions.

Instead, we should define with macros common trait and type MakeLdrLikeArgs/LdrLikeArgs<...>, and define

pub struct<D, A> Ldr(LdrLikeArgs<D,A>);

pub fn ldr<D, A, RD, RA>(dst: D, addr: A) -> Ldr<RD, RA>
    where LdrLikeArgs<RD, RA>: MakeLdrLikeArgs<D, A>
{
    Ldr(LdrLikeArgs::make(dst, addr))
    // or, perhaps, LdrLikeArgs::make(dst, addr, Ldr) to work with both fallible and unfallible variants
}

Failing variants of Make*-traits should be handled, though.

It should make the codebase smaller and reduce compilation time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions