1 //===--- XCore.h - Declare XCore 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 XCore TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
16 #include "clang/Basic/TargetInfo.h"
17 #include "clang/Basic/TargetOptions.h"
18 #include "llvm/ADT/Triple.h"
19 #include "llvm/Support/Compiler.h"
24 class LLVM_LIBRARY_VISIBILITY XCoreTargetInfo
: public TargetInfo
{
25 static const Builtin::Info BuiltinInfo
[];
28 XCoreTargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&)
29 : TargetInfo(Triple
) {
33 DoubleAlign
= LongDoubleAlign
= 32;
34 SizeType
= UnsignedInt
;
35 PtrDiffType
= SignedInt
;
36 IntPtrType
= SignedInt
;
37 WCharType
= UnsignedChar
;
38 WIntType
= UnsignedInt
;
39 UseZeroLengthBitfieldAlignment
= true;
40 resetDataLayout("e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32"
41 "-f64:32-a:0:32-n32");
44 void getTargetDefines(const LangOptions
&Opts
,
45 MacroBuilder
&Builder
) const override
;
47 ArrayRef
<Builtin::Info
> getTargetBuiltins() const override
;
49 BuiltinVaListKind
getBuiltinVaListKind() const override
{
50 return TargetInfo::VoidPtrBuiltinVaList
;
53 const char *getClobbers() const override
{ return ""; }
55 ArrayRef
<const char *> getGCCRegNames() const override
{
56 static const char *const GCCRegNames
[] = {
57 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
58 "r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
60 return llvm::makeArrayRef(GCCRegNames
);
63 ArrayRef
<TargetInfo::GCCRegAlias
> getGCCRegAliases() const override
{
67 bool validateAsmConstraint(const char *&Name
,
68 TargetInfo::ConstraintInfo
&Info
) const override
{
72 int getEHDataRegisterNumber(unsigned RegNo
) const override
{
73 // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
74 return (RegNo
< 2) ? RegNo
: -1;
77 bool allowsLargerPreferedTypeAlignment() const override
{ return false; }
79 bool hasBitIntType() const override
{ return true; }
81 } // namespace targets
83 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H