This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add more robust compile time architecture detection
ClosedPublic

Authored by gchatelet on Oct 29 2021, 7:44 AM.

Details

Summary

We may want to restrict the detected platforms to only x86_64 and aarch64.
There are still custom detection in api.td but I don't think we can handle these:

  • config/linux/api.td:205
  • config/linux/api.td:199

Diff Detail

Event Timeline

gchatelet created this revision.Oct 29 2021, 7:44 AM
gchatelet requested review of this revision.Oct 29 2021, 7:44 AM
michaelrj added inline comments.Oct 29 2021, 9:47 AM
libc/src/__support/architectures.h
37–51

I don't think we actually support these architectures yet, do we need macros for them?

sivachandra accepted this revision.Oct 29 2021, 10:44 AM

Thanks for the nice cleanup.

libc/src/__support/architectures.h
37–51

I will leave it up to @gchatelet as to what he thinks about this. My personal opinion - no harm having these macros for the sake of completeness even if unused.

This revision is now accepted and ready to land.Oct 29 2021, 10:44 AM
gchatelet added inline comments.Oct 29 2021, 12:59 PM
libc/src/__support/architectures.h
37–51

Yes we don't support them for now. Since it may confuse people into thinking they are officially supported I will remove them.
Note that these macros are fetched almost verbatim from Google's cpu_features (a side project of mine) so it's easy to fetch them back if needed.

michaelrj accepted this revision.Oct 29 2021, 1:03 PM
michaelrj added inline comments.
libc/src/__support/architectures.h
37–51

SGTM

gchatelet updated this revision to Diff 383477.Oct 29 2021, 1:05 PM
  • Remove unsupported architectures
gchatelet updated this revision to Diff 383481.Oct 29 2021, 1:12 PM
  • Remove unsupported architectures
This revision was landed with ongoing or failed builds.Oct 29 2021, 1:15 PM
This revision was automatically updated to reflect the committed changes.

This patch broke the build so I've reverted it. I'll resubmit when it's fixed - and after the weekend :)

gchatelet reopened this revision.Nov 2 2021, 3:20 AM
This revision is now accepted and ready to land.Nov 2 2021, 3:20 AM
gchatelet updated this revision to Diff 384029.Nov 2 2021, 3:46 AM
  • Fix includes

Builders seems to be happy so I'll resubmit this patch.