Skip to content

Optimize instruction selection #2

@hexratcc

Description

@hexratcc

The current instruction selection scheme which is used to locate instructions based off of a list of operands and the mnemonic is very naive and won't scale very well. A (much) more performant algorithm would be nice for this, as this currently takes up most of the runtime.

Potential ideas:

  • Hashed operands x mnemonic
  • Hashed operands x hashed mnemonic

It's most likely smarter to wait until all/most of the instructions are implemented, as there will most likely be edge cases which we'll need to account for, as of now, the edge cases include:

  • Immediate operands don't matter, we can just use the first (sorted) variant with an immediate operand at the relevant slot. The size discrepancy will then be sorted out in the find_instruction_info function. The same applies to moffset operands.
  • Relocation operands are representable by immediate operands, for this purpose we have to think of immediate operands as being relocations as well.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions