[clang] [Clang][Xtensa] Add Xtensa target. (PR #118008)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 11:38:35 PST 2024


================
@@ -0,0 +1,62 @@
+//===--- Xtensa.cpp - Implement Xtensa target feature support -------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements Xtensa TargetInfo objects.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Xtensa.h"
+#include "clang/Basic/Builtins.h"
+#include "clang/Basic/MacroBuilder.h"
+#include "clang/Basic/TargetBuiltins.h"
+
+using namespace clang;
+using namespace clang::targets;
+
+void XtensaTargetInfo::getTargetDefines(const LangOptions &Opts,
+                                        MacroBuilder &Builder) const {
+  Builder.defineMacro("__xtensa__");
+  Builder.defineMacro("__XTENSA__");
+  if (BigEndian)
----------------
efriedma-quic wrote:

On targets which have two endian variants; the endianness is usually part of the triple, because there isn't any ABI-compatible subset.

I won't insist on it for an embedded target like this, but you might want to consider it.

https://github.com/llvm/llvm-project/pull/118008


More information about the cfe-commits mailing list