This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add register definitions for cfi directives
ClosedPublic

Authored by abrachet on Jan 16 2023, 4:40 PM.

Details

Summary

Add {e,r}flags, {g,f}s.base registers so they can be referenced in cfi
directives,. They are not otherwise useable in any instructions,
but can be implicitly pushed to the stack like with pushf for
{e,r}flags.

Diff Detail

Event Timeline

abrachet created this revision.Jan 16 2023, 4:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2023, 4:40 PM
abrachet requested review of this revision.Jan 16 2023, 4:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2023, 4:40 PM
mcgrathr added inline comments.
llvm/lib/Target/X86/X86RegisterInfo.td
315

Should this use DwarfRegAlias?

abrachet updated this revision to Diff 489660.Jan 16 2023, 5:46 PM
abrachet marked an inline comment as done.
abrachet added inline comments.
llvm/lib/Target/X86/X86RegisterInfo.td
315

Sure should

IIUC, they can be used only under privileged mode. Is there a real case that compiler will emit these directives?

Assembler syntax exists for humans who write assembly, not just for compilers.
Compilers do not emit CFI that refers to these registers.

The lack of these registers is a regression in LLVM's assembler compared to the GNU assembler.

pengfei accepted this revision.Jan 18 2023, 7:19 PM

You are right. Clang can compile assembly file and should be able to parse these directives too. LGTM, thanks!

This revision is now accepted and ready to land.Jan 18 2023, 7:19 PM
This revision was landed with ongoing or failed builds.Jan 19 2023, 6:11 AM
This revision was automatically updated to reflect the committed changes.
abrachet marked an inline comment as done.
skan added a subscriber: skan.Jan 30 2023, 8:38 AM