clang 24.0.0git
MSP430.h
Go to the documentation of this file.
1//===--- MSP430.h - Declare MSP430 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 MSP430 TargetInfo objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
15
18#include "llvm/Support/Compiler.h"
19#include "llvm/TargetParser/Triple.h"
20
21namespace clang {
22namespace targets {
23
24class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo {
25 static const char *const GCCRegNames[];
26
27public:
28 MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
29 : TargetInfo(Triple) {
30 TLSSupported = false;
31 IntWidth = 16;
32 IntAlign = 16;
33 LongWidth = 32;
34 LongLongWidth = 64;
36 FloatWidth = 32;
37 FloatAlign = 16;
40 PointerWidth = 16;
41 PointerAlign = 16;
42 SuitableAlign = 16;
51 }
52 void getTargetDefines(const LangOptions &Opts,
53 MacroBuilder &Builder) const override;
54
56 // FIXME: Implement.
57 return {};
58 }
59
60 bool allowsLargerPreferedTypeAlignment() const override { return false; }
61
62 bool hasFeature(StringRef Feature) const override {
63 return Feature == "msp430";
64 }
65
66 ArrayRef<const char *> getGCCRegNames() const override;
67
69 // Make r0 - r3 be recognized by llc (f.e., in clobber list)
70 static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
71 {{"r0"}, "pc"},
72 {{"r1"}, "sp"},
73 {{"r2"}, "sr"},
74 {{"r3"}, "cg"},
75 };
76 return llvm::ArrayRef(GCCRegAliases);
77 }
78
79 bool validateAsmConstraint(const char *&Name,
80 TargetInfo::ConstraintInfo &info) const override {
81 // FIXME: implement
82 switch (*Name) {
83 case 'K': // the constant 1
84 case 'L': // constant -1^20 .. 1^19
85 case 'M': // constant 1-4:
86 return true;
87 }
88 // No target constraints for now.
89 return false;
90 }
91
92 std::string_view getClobbers() const override {
93 // FIXME: Is this really right?
94 return "";
95 }
96
97 // The registers that receive the exception pointer and the selector, R12
98 // and R13, as in GCC.
99 int getEHDataRegisterNumber(unsigned RegNo) const override {
100 if (RegNo == 0)
101 return 12;
102 if (RegNo == 1)
103 return 13;
104 return -1;
105 }
106
108 // FIXME: implement
110 }
111};
112
113} // namespace targets
114} // namespace clang
115#endif // LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
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:341
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
Definition TargetInfo.h:343
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 MSP430.h:79
llvm::SmallVector< Builtin::InfosShard > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition MSP430.h:55
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition MSP430.h:62
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition MSP430.h:60
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition MSP430.h:107
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition MSP430.h:92
MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition MSP430.h:28
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition MSP430.h:99
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition MSP430.h:68
Defines the clang::TargetInfo interface.
Top level wrappers for InstallAPI frontend operations.