Path: blob/main/contrib/llvm-project/clang/lib/Basic/Targets/MSP430.h
35267 views
//===--- MSP430.h - Declare MSP430 target feature support -------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file declares MSP430 TargetInfo objects.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H13#define LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H1415#include "clang/Basic/TargetInfo.h"16#include "clang/Basic/TargetOptions.h"17#include "llvm/Support/Compiler.h"18#include "llvm/TargetParser/Triple.h"1920namespace clang {21namespace targets {2223class LLVM_LIBRARY_VISIBILITY MSP430TargetInfo : public TargetInfo {24static const char *const GCCRegNames[];2526public:27MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)28: TargetInfo(Triple) {29TLSSupported = false;30IntWidth = 16;31IntAlign = 16;32LongWidth = 32;33LongLongWidth = 64;34LongAlign = LongLongAlign = 16;35FloatWidth = 32;36FloatAlign = 16;37DoubleWidth = LongDoubleWidth = 64;38DoubleAlign = LongDoubleAlign = 16;39PointerWidth = 16;40PointerAlign = 16;41SuitableAlign = 16;42SizeType = UnsignedInt;43IntMaxType = SignedLongLong;44IntPtrType = SignedInt;45PtrDiffType = SignedInt;46SigAtomicType = SignedLong;47resetDataLayout("e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16");48}49void getTargetDefines(const LangOptions &Opts,50MacroBuilder &Builder) const override;5152ArrayRef<Builtin::Info> getTargetBuiltins() const override {53// FIXME: Implement.54return std::nullopt;55}5657bool allowsLargerPreferedTypeAlignment() const override { return false; }5859bool hasFeature(StringRef Feature) const override {60return Feature == "msp430";61}6263ArrayRef<const char *> getGCCRegNames() const override;6465ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {66// Make r0 - r3 be recognized by llc (f.e., in clobber list)67static const TargetInfo::GCCRegAlias GCCRegAliases[] = {68{{"r0"}, "pc"},69{{"r1"}, "sp"},70{{"r2"}, "sr"},71{{"r3"}, "cg"},72};73return llvm::ArrayRef(GCCRegAliases);74}7576bool validateAsmConstraint(const char *&Name,77TargetInfo::ConstraintInfo &info) const override {78// FIXME: implement79switch (*Name) {80case 'K': // the constant 181case 'L': // constant -1^20 .. 1^1982case 'M': // constant 1-4:83return true;84}85// No target constraints for now.86return false;87}8889std::string_view getClobbers() const override {90// FIXME: Is this really right?91return "";92}9394BuiltinVaListKind getBuiltinVaListKind() const override {95// FIXME: implement96return TargetInfo::CharPtrBuiltinVaList;97}98};99100} // namespace targets101} // namespace clang102#endif // LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H103104105