clang 22.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
18#include "llvm/Support/Compiler.h"
19#include "llvm/TargetParser/Triple.h"
20
21namespace clang {
22namespace targets {
23
24class 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
35public:
36 LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
37 : TargetInfo(Triple) {
39
40 // Setting RegParmMax equal to what mregparm was set to in the old
41 // toolchain
42 RegParmMax = 4;
43
44 // Set the default CPU to V11
45 CPU = CK_V11;
46
47 // Temporary approach to make everything at least word-aligned and allow for
48 // safely casting between pointers with different alignment requirements.
49 // TODO: Remove this when there are no more cast align warnings on the
50 // firmware.
51 MinGlobalAlign = 32;
52 }
53
54 void getTargetDefines(const LangOptions &Opts,
55 MacroBuilder &Builder) const override;
56
57 bool isValidCPUName(StringRef Name) const override;
58
59 void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
60
61 bool setCPU(const std::string &Name) override;
62
63 bool hasFeature(StringRef Feature) const override;
64
65 ArrayRef<const char *> getGCCRegNames() const override;
66
67 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
68
72
74 return {};
75 }
76
77 bool validateAsmConstraint(const char *&Name,
78 TargetInfo::ConstraintInfo &info) const override {
79 return false;
80 }
81
82 std::string_view getClobbers() const override { return ""; }
83
84 bool hasBitIntType() const override { return true; }
85};
86} // namespace targets
87} // namespace clang
88
89#endif // LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
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
Defines the clang::TargetOptions class.
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 RegParmMax
Definition TargetInfo.h:256
void resetDataLayout(StringRef DL)
Set the data layout to the given string.
Options for controlling the target.
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition Lanai.h:77
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition Lanai.h:84
LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition Lanai.h:36
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition Lanai.h:69
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition Lanai.h:82
llvm::SmallVector< Builtin::InfosShard > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition Lanai.h:73
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.