This is an archive of the discontinued LLVM Phabricator instance.

[llvm-exegesis] Allow the target to disable the selection of some registers.
ClosedPublic

Authored by courbet on Mar 26 2019, 7:44 AM.

Details

Summary

This prevents "Cannot encode high byte register in REX-prefixed instruction"
from happening on instructions that require REX encoding when AH & co
get selected.
On the down side, these 4 registers can no longer be selected
automatically, but this avoids having to expose all the X86 encoding
complexity.

Diff Detail

Repository
rL LLVM

Event Timeline

courbet created this revision.Mar 26 2019, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2019, 7:44 AM
This revision is now accepted and ready to land.Mar 26 2019, 7:51 AM

Would be a good idea to add a test for some opcode that used to fail with that error?

The issue is that such a test would have failed in a non-deterministic manner, which is why I've only added a unit test. But now that this should not longer fail, let's add one.

courbet updated this revision to Diff 192282.Mar 26 2019, 8:32 AM

Add unit test.

This revision was automatically updated to reflect the committed changes.

What protects R8-R15 in 32-bit mode or SIL/DIL/BPL/SPL?

What protects R8-R15 in 32-bit mode or SIL/DIL/BPL/SPL?

Is there a register class that can used reliably for this purpose?

What protects R8-R15 in 32-bit mode or SIL/DIL/BPL/SPL?

Thanks Craig,

This is the x86_64 target (the only one we support at the moment) so we're good on the first part :)

For the rest, TBH I'm not well versed in the subtleties of X86 encoding, so got these registers from the list here.
As Guillaume mentioned if there is a register class I can use I'll be happy to.

What protects R8-R15 in 32-bit mode or SIL/DIL/BPL/SPL?

Thanks Craig,

This is the x86_64 target (the only one we support at the moment) so we're good on the first part :)

For the rest, TBH I'm not well versed in the subtleties of X86 encoding, so got these registers from the list here.
As Guillaume mentioned if there is a register class I can use I'll be happy to.

I should have phrased my question better. SIL/DIL/BPL/SPL are only available in x86_64. So if that's all you support then you are ok.

OK cool thanks for having a look.