clang 22.0.0git
CSKY.h
Go to the documentation of this file.
1//===--- CSKY.h - Declare CSKY target feature support -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares CSKY TargetInfo objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H
15
18#include "llvm/TargetParser/CSKYTargetParser.h"
19
20namespace clang {
21namespace targets {
22
23class LLVM_LIBRARY_VISIBILITY CSKYTargetInfo : public TargetInfo {
24protected:
25 std::string ABI;
26 llvm::CSKY::ArchKind Arch = llvm::CSKY::ArchKind::INVALID;
27 std::string CPU;
28
29 bool HardFloat = false;
30 bool HardFloatABI = false;
31 bool FPUV2_SF = false;
32 bool FPUV2_DF = false;
33 bool FPUV3_SF = false;
34 bool FPUV3_DF = false;
35 bool VDSPV2 = false;
36 bool VDSPV1 = false;
37 bool DSPV2 = false;
38 bool is3E3R1 = false;
39
40public:
41 CSKYTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
42 : TargetInfo(Triple) {
43 NoAsmVariants = true;
44 LongLongAlign = 32;
45 SuitableAlign = 32;
52
55 setABI("abiv2");
57 }
58
59 StringRef getABI() const override { return ABI; }
60 bool setABI(const std::string &Name) override {
61 if (Name == "abiv2" || Name == "abiv1") {
62 ABI = Name;
63 return true;
64 }
65 return false;
66 }
67
68 bool setCPU(const std::string &Name) override;
69
70 bool isValidCPUName(StringRef Name) const override;
71
72 unsigned getMinGlobalAlign(uint64_t, bool HasNonWeakDef) const override;
73
75 return {};
76 }
77
81
82 bool validateAsmConstraint(const char *&Name,
83 TargetInfo::ConstraintInfo &info) const override;
84
85 std::string_view getClobbers() const override { return ""; }
86
87 void getTargetDefines(const LangOptions &Opts,
88 MacroBuilder &Builder) const override;
89 bool hasFeature(StringRef Feature) const override;
90 bool handleTargetFeatures(std::vector<std::string> &Features,
91 DiagnosticsEngine &Diags) override;
92
93 /// Whether target allows to overalign ABI-specified preferred alignment
94 bool allowsLargerPreferedTypeAlignment() const override { return false; }
95
96 bool hasBitIntType() const override { return true; }
97
98protected:
99 ArrayRef<const char *> getGCCRegNames() const override;
100
101 ArrayRef<GCCRegAlias> getGCCRegAliases() const override;
102};
103
104} // namespace targets
105} // namespace clang
106
107#endif // LLVM_CLANG_LIB_BASIC_TARGETS_CSKY_H
Defines the clang::MacroBuilder utility class.
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Definition Module.cpp:95
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:232
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
TargetInfo(const llvm::Triple &T)
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition TargetInfo.h:333
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition TargetInfo.h:338
unsigned char MaxAtomicPromoteWidth
Definition TargetInfo.h:252
void resetDataLayout(StringRef DL)
Set the data layout to the given string.
unsigned char MaxAtomicInlineWidth
Definition TargetInfo.h:252
Options for controlling the target.
CSKYTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition CSKY.h:41
bool setABI(const std::string &Name) override
Use the specified ABI.
Definition CSKY.h:60
llvm::CSKY::ArchKind Arch
Definition CSKY.h:26
StringRef getABI() const override
Get the ABI currently in use.
Definition CSKY.h:59
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition CSKY.h:85
llvm::SmallVector< Builtin::InfosShard > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition CSKY.h:74
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition CSKY.h:94
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition CSKY.h:96
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition CSKY.h:78
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
Definition TargetInfo.h:187