1 //===--- MSP430.h - Declare MSP430 target feature support -------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file declares MSP430 TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
16 #include "clang/Basic/TargetInfo.h"
17 #include "clang/Basic/TargetOptions.h"
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/TargetParser/Triple.h"
24 class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo
: public TargetInfo
{
25 static const char *const GCCRegNames
[];
28 MSP430TargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&)
29 : TargetInfo(Triple
) {
35 LongAlign
= LongLongAlign
= 16;
38 DoubleWidth
= LongDoubleWidth
= 64;
39 DoubleAlign
= LongDoubleAlign
= 16;
43 SizeType
= UnsignedInt
;
44 IntMaxType
= SignedLongLong
;
45 IntPtrType
= SignedInt
;
46 PtrDiffType
= SignedInt
;
47 SigAtomicType
= SignedLong
;
48 resetDataLayout("e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16");
50 void getTargetDefines(const LangOptions
&Opts
,
51 MacroBuilder
&Builder
) const override
;
53 ArrayRef
<Builtin::Info
> getTargetBuiltins() const override
{
58 bool allowsLargerPreferedTypeAlignment() const override
{ return false; }
60 bool hasFeature(StringRef Feature
) const override
{
61 return Feature
== "msp430";
64 ArrayRef
<const char *> getGCCRegNames() const override
;
66 ArrayRef
<TargetInfo::GCCRegAlias
> getGCCRegAliases() const override
{
67 // Make r0 - r3 be recognized by llc (f.e., in clobber list)
68 static const TargetInfo::GCCRegAlias GCCRegAliases
[] = {
74 return llvm::ArrayRef(GCCRegAliases
);
77 bool validateAsmConstraint(const char *&Name
,
78 TargetInfo::ConstraintInfo
&info
) const override
{
81 case 'K': // the constant 1
82 case 'L': // constant -1^20 .. 1^19
83 case 'M': // constant 1-4:
86 // No target constraints for now.
90 const char *getClobbers() const override
{
91 // FIXME: Is this really right?
95 BuiltinVaListKind
getBuiltinVaListKind() const override
{
97 return TargetInfo::CharPtrBuiltinVaList
;
101 } // namespace targets
103 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H