This patch adds the assembler part of the REX instruction set extension. A full description of the REX instruction set can be downloaded at http://www.gaisler.com/doc/antn/GRLIB-TN-0001.pdf.
This update contains some small fixes and has been rebased relative the latest master.
Let me know if the patch is too big. I can divide it into smaller parts if that will simplify the review process.
"fi" doesn't mean anything to me. I see what from the REX spec this is implementing, but it could use a better name, and a comment about what it's for.
Mark intended fall-through after code with LLVM_FALLTHROUGH
Why do we need this, vs using FK_Data_4?
And isn't this the same as FK_PCRel_4?
You used a different name here (fixup_sparc_pc32 vs fixup_sparc_disp32).
Why the change here?
Should probably have Rex in its name.
I think this needs to also be controlled by an AssemblerPredicate.
And we'll want to have many of the standard instructions (e.g. those that aren't format-3) with a predicate that disables them in rex mode too, right?
Thank you James for reviewing the patch!
In this updated version I have tried to address your comments and done the following changes:
- Expanded the fi suffix to say RexFixedRegImm and added a comment describing its use.
- Simplified the RexFR class as the imm field was always 0.
- Marked the case entries that are supposed to fall through with LLVM_FALLTHROUGH.
- Added assembler predicates to prevent REX instructions from being used when not compiling for REX and the other way around for Format 2 and coprocessor instructions.
- Switched from introducing new relocations to use already existing equivalent relocations (FK_Data_4 and FK_PCRel_4).
- I extracted the change to getCallTargetOpValue to its own patch as it is a generic bug fix and not related to the REX patch. This has the effect that one of the tests in this patch fails if the other patch is not applied.