This is an archive of the discontinued LLVM Phabricator instance.

[Basic] X86 backend changes for UEFI
Needs ReviewPublic

Authored by Prabhuk on Sep 21 2023, 1:35 PM.

Details

Summary

X86_64 UEFI target uses Microsoft X64 Calling Convention.

Diff Detail

Event Timeline

Prabhuk created this revision.Sep 21 2023, 1:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2023, 1:35 PM
Prabhuk requested review of this revision.Sep 21 2023, 1:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2023, 1:35 PM
Prabhuk updated this revision to Diff 557199.Sep 21 2023, 1:37 PM

Clang Driver changes for UEFI X86_64

Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2023, 1:37 PM
Prabhuk updated this revision to Diff 557203.Sep 21 2023, 1:57 PM

Uploading the backend changes correctly.

mysterymath added inline comments.Sep 21 2023, 2:13 PM
llvm/lib/Target/X86/X86CallingConv.td
522

You'll need to add switching for Win64 here too; this appears to be the convention used for assigning return values.

1165

It looks like you'll need some stitching in X86RegisterInfo.cpp to cause the Win64 set of callee-saved registers to be used for UEFI targets.

Prabhuk updated this revision to Diff 557214.Sep 21 2023, 6:42 PM

Handle UEFI64 in X86RegisterInfo for all Win64 equivalent cases except for Swift and OCL.

Prabhuk marked 2 inline comments as done.Sep 21 2023, 6:43 PM

There should also be tests for this behavior in llvm/test/CodeGen/X86. I wouldn't think it necessary to fully test the calling convention; that should already be well covered; just something in those key test files (e.g., sse-regcall.ll) to verify that the uefi OS actually switches the calling convention at these key points.