clang  14.0.0git
Lanai.h
Go to the documentation of this file.
1 //===--- Lanai.h - Declare Lanai 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 Lanai TargetInfo objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
15 
16 #include "clang/Basic/TargetInfo.h"
18 #include "llvm/ADT/Triple.h"
19 #include "llvm/Support/Compiler.h"
20 
21 namespace clang {
22 namespace targets {
23 
24 class LLVM_LIBRARY_VISIBILITY LanaiTargetInfo : public TargetInfo {
25  // Class for Lanai (32-bit).
26  // The CPU profiles supported by the Lanai backend
27  enum CPUKind {
28  CK_NONE,
29  CK_V11,
30  } CPU;
31 
32  static const TargetInfo::GCCRegAlias GCCRegAliases[];
33  static const char *const GCCRegNames[];
34 
35 public:
36  LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
37  : TargetInfo(Triple) {
38  // Description string has to be kept in sync with backend.
39  resetDataLayout("E" // Big endian
40  "-m:e" // ELF name manging
41  "-p:32:32" // 32 bit pointers, 32 bit aligned
42  "-i64:64" // 64 bit integers, 64 bit aligned
43  "-a:0:32" // 32 bit alignment of objects of aggregate type
44  "-n32" // 32 bit native integer width
45  "-S64" // 64 bit natural stack alignment
46  );
47 
48  // Setting RegParmMax equal to what mregparm was set to in the old
49  // toolchain
50  RegParmMax = 4;
51 
52  // Set the default CPU to V11
53  CPU = CK_V11;
54 
55  // Temporary approach to make everything at least word-aligned and allow for
56  // safely casting between pointers with different alignment requirements.
57  // TODO: Remove this when there are no more cast align warnings on the
58  // firmware.
59  MinGlobalAlign = 32;
60  }
61 
62  void getTargetDefines(const LangOptions &Opts,
63  MacroBuilder &Builder) const override;
64 
65  bool isValidCPUName(StringRef Name) const override;
66 
67  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
68 
69  bool setCPU(const std::string &Name) override;
70 
71  bool hasFeature(StringRef Feature) const override;
72 
73  ArrayRef<const char *> getGCCRegNames() const override;
74 
75  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
76 
79  }
80 
81  ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
82 
83  bool validateAsmConstraint(const char *&Name,
84  TargetInfo::ConstraintInfo &info) const override {
85  return false;
86  }
87 
88  const char *getClobbers() const override { return ""; }
89 
90  bool hasExtIntType() const override { return true; }
91 };
92 } // namespace targets
93 } // namespace clang
94 
95 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::targets::LanaiTargetInfo
Definition: Lanai.h:24
TargetInfo.h
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:189
clang::targets::LanaiTargetInfo::getClobbers
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: Lanai.h:88
clang::TargetInfo::VoidPtrBuiltinVaList
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition: TargetInfo.h:270
clang::TargetInfo::BuiltinVaListKind
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:265
clang::targets::LanaiTargetInfo::getTargetBuiltins
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition: Lanai.h:81
clang::targets::LanaiTargetInfo::LanaiTargetInfo
LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: Lanai.h:36
clang::targets::LanaiTargetInfo::getBuiltinVaListKind
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: Lanai.h:77
clang::targets::LanaiTargetInfo::validateAsmConstraint
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition: Lanai.h:83
clang::targets::GCCRegNames
static const char *const GCCRegNames[]
Definition: X86.cpp:43
clang::TargetInfo::GCCRegAlias
Definition: TargetInfo.h:1142
clang::targets::LanaiTargetInfo::hasExtIntType
bool hasExtIntType() const override
Determine whether the _ExtInt type is supported on this target.
Definition: Lanai.h:90
TargetOptions.h
llvm::ArrayRef< const char * >
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:960
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang
Definition: CalledOnceCheck.h:17
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
llvm::SmallVectorImpl
Definition: LLVM.h:39
clang::MacroBuilder
Definition: MacroBuilder.h:23
hasFeature
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:101