[PATCH] D69597: Implement `sys::getHostCPUName()` for Darwin ARM

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 18:48:30 PDT 2019


beanz marked 2 inline comments as done.
beanz added a subscriber: rjmccall.
beanz added inline comments.


================
Comment at: llvm/lib/Support/Host.cpp:1238
+    switch (hostInfo.cpu_subtype) {
+    case CPU_SUBTYPE_ARM_V7S:
+      return "swift";
----------------
efriedma wrote:
> What do 64-bit devices return here?  (I assume the call returns CPU_TYPE_ARM for 32-bit code regardless of the CPU?)
Modern Apple 64-bit devices can't execute 32bit code, so that really should never happen. If it does, returning a value that matches the binary's CPU type/subtype is probably reasonable.

I could break the arm 32/64-bit implementations up into separate `ifdef` blocks if that seems more sane to you. In that case we could return `cyclone` for arm 32 in the arm 64 implementation, but we would still likely want the sys call to determine if the cpu type is 64 or 32 bit.


================
Comment at: llvm/lib/Support/Host.cpp:1245
+  if (hostInfo.cpu_type == CPU_TYPE_ARM64) {
+   switch (hostInfo.cpu_subtype) {
+    default:
----------------
efriedma wrote:
> Can we skip the syscall on `__aarch64__` targets, since you don't really check the result?
Sure... Until arm64e pointer authentication lands in upstream (see @rjmccall's RFC). At which point this changes. I tried to structure the code to take that into account.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69597/new/

https://reviews.llvm.org/D69597





More information about the llvm-commits mailing list