avr-llvm / llvm

[MERGED UPSTREAM] AVR backend for the LLVM compiler library
220 stars 21 forks source link

Add selection pattern support to InstAlias #111

Closed dylanmckay closed 8 years ago

dylanmckay commented 9 years ago

It would be a lot more ergonomic if we could add instruction selection patterns to InstAlias instructions.

Once this is implemented, we should refactor instructions which are actually aliases, but can't be represented that way because of patterns, into InstAlias classes with a pattern.

See a29503819340b48e537ba6ae7e2848ec91f4b020 for a compelling example. A new instruction format was introduced, which is synonymous to FRdRr but with one repeated operand, and much less clarity.

dylanmckay commented 9 years ago

It is unclear how to implement this. I have several ideas.

  1. Parsing the DAG pattern list and adding it verbatim to the parent instruction (that is being aliased) pattern list. This won't work because a pattern has to include all operands. Perhaps it is possible to do some funky parsing of the InstAlias DAG and see what operands are equal, and have some complicated logic handling this.
  2. Considering the InstAlias a seperate instruction, but only in instruction selection. This would probably be the cleanest way.
dylanmckay commented 8 years ago

Closing because this is a large change, not worth the hassle, and it is out of scope.