[PATCH] D75002: [AArch64] Predefine __AARCH64_CMODEL_*__ as GCC does

Roland McGrath via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 16:39:25 PST 2020


mcgrathr updated this revision to Diff 246043.
mcgrathr added a comment.

update log


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75002

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/test/Preprocessor/init.c


Index: clang/test/Preprocessor/init.c
===================================================================
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -285,6 +285,7 @@
 // AARCH64-NOT:#define __AARCH64EB__ 1
 // AARCH64:#define __AARCH64EL__ 1
 // AARCH64-NOT:#define __AARCH_BIG_ENDIAN 1
+// AARCH64:#define __AARCH64_CMODEL_SMALL__ 1
 // AARCH64:#define __ARM_64BIT_STATE 1
 // AARCH64:#define __ARM_ARCH 8
 // AARCH64:#define __ARM_ARCH_ISA_A64 1
Index: clang/lib/Basic/Targets/AArch64.cpp
===================================================================
--- clang/lib/Basic/Targets/AArch64.cpp
+++ clang/lib/Basic/Targets/AArch64.cpp
@@ -194,6 +194,14 @@
     Builder.defineMacro("__LP64__");
   }
 
+  std::string CodeModel = getTargetOpts().CodeModel;
+  if (CodeModel == "default")
+    CodeModel = "small";
+  for (auto& c : CodeModel) {
+    c = toupper(c);
+  }
+  Builder.defineMacro("__AARCH64_CMODEL_" + CodeModel + "__");
+
   // ACLE predefines. Many can only have one possible value on v8 AArch64.
   Builder.defineMacro("__ARM_ACLE", "200");
   Builder.defineMacro("__ARM_ARCH", "8");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75002.246043.patch
Type: text/x-patch
Size: 1133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200222/adb206ca/attachment-0001.bin>


More information about the cfe-commits mailing list