[clang] [llvm] [clangd] Add support for the c2000 architecture (PR #125663)
James Nagurne via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 14:50:32 PST 2025
================
@@ -0,0 +1,100 @@
+#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_C2000_H
+#define LLVM_CLANG_LIB_BASIC_TARGETS_C2000_H
+
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/TargetInfo.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/TargetParser/Triple.h"
+
+namespace clang {
+namespace targets {
+
+class C2000TargetInfo : public TargetInfo {
+ static const char *const GCCRegNames[];
+ bool eabi = false;
+ bool strict = false;
+ bool opt = false;
+ bool fpu64 = false;
+ bool fpu32 = false;
+ bool relaxed = false;
+ bool tmu_support = false;
+ bool cla_support = false;
+ bool vcu_support = false;
+ bool cla0 = false;
+ bool cla1 = false;
+ bool cla2 = false;
+ bool vcu2 = false;
+ bool vcrc = false;
+ bool tmu1 = false;
+ bool idiv0 = false;
+
+public:
+ C2000TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+ : TargetInfo(Triple) {
+ TLSSupported = false;
+ BigEndian = false;
+ BoolWidth = BoolAlign = 16;
+ IntWidth = IntAlign = 16;
+ LongLongWidth = 64;
+ LongLongAlign = 32;
+ FloatWidth = FloatAlign = 32;
+ DoubleWidth = 64;
+ DoubleAlign = 32;
+ LongDoubleWidth = 64;
+ LongDoubleAlign = 32;
+ PointerWidth = 32;
+ PointerAlign = 16;
+ Char16Type = UnsignedShort;
+ Char32Type = UnsignedLong;
+ SizeType = UnsignedLong;
+ PtrDiffType = SignedLong;
+ WCharType = UnsignedLong;
+ WIntType = UnsignedLong;
+ IntMaxType = SignedLongLong;
+ IntPtrType = SignedInt;
+ resetDataLayout(
+ "e-m:e-p:32:16-i16:16-i32:32-i64:32-f32:32-f64:32-a:8-n16:32-S32");
+ }
+
+ bool handleTargetFeatures(std::vector<std::string> &Features,
+ DiagnosticsEngine &Diags) override;
+
+ void getTargetDefines(const LangOptions &Opts,
+ MacroBuilder &Builder) const override;
+
+ ArrayRef<Builtin::Info> getTargetBuiltins() const override { return {}; }
+
+ bool hasFeature(StringRef Feature) const override;
+
+ ArrayRef<const char *> getGCCRegNames() const override;
+
+ ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
+ // Make these be recognized by llc (f.e., in clobber list)
----------------
DragonDisciple wrote:
Copy-pasted and should likely be an empty set instead. 'llc' should never see code generated by this target.
https://github.com/llvm/llvm-project/pull/125663
More information about the cfe-commits
mailing list