1 //===--- TCE.h - Declare TCE 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 TCE TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_TCE_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 // llvm and clang cannot be used directly to output native binaries for
25 // target, but is used to compile C code to llvm bitcode with correct
26 // type and alignment information.
28 // TCE uses the llvm bitcode as input and uses it for generating customized
29 // target processor and program binary. TCE co-design environment is
30 // publicly available in http://tce.cs.tut.fi
32 static const unsigned TCEOpenCLAddrSpaceMap
[] = {
38 1, // opencl_global_device
39 1, // opencl_global_host
40 // FIXME: generic has to be added to the target
46 0, // sycl_global_device
47 0, // sycl_global_host
55 class LLVM_LIBRARY_VISIBILITY TCETargetInfo
: public TargetInfo
{
57 TCETargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&)
58 : TargetInfo(Triple
) {
61 LongWidth
= LongLongWidth
= 32;
64 LongAlign
= LongLongAlign
= 32;
67 SizeType
= UnsignedInt
;
68 IntMaxType
= SignedLong
;
69 IntPtrType
= SignedInt
;
70 PtrDiffType
= SignedInt
;
77 FloatFormat
= &llvm::APFloat::IEEEsingle();
78 DoubleFormat
= &llvm::APFloat::IEEEsingle();
79 LongDoubleFormat
= &llvm::APFloat::IEEEsingle();
80 resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"
81 "i16:16:32-i32:32:32-i64:32:32-"
82 "f32:32:32-f64:32:32-v64:32:32-"
83 "v128:32:32-v256:32:32-v512:32:32-"
84 "v1024:32:32-a0:0:32-n32");
85 AddrSpaceMap
= &TCEOpenCLAddrSpaceMap
;
86 UseAddrSpaceMapMangling
= true;
89 void getTargetDefines(const LangOptions
&Opts
,
90 MacroBuilder
&Builder
) const override
;
92 bool hasFeature(StringRef Feature
) const override
{ return Feature
== "tce"; }
94 ArrayRef
<Builtin::Info
> getTargetBuiltins() const override
{ return None
; }
96 const char *getClobbers() const override
{ return ""; }
98 BuiltinVaListKind
getBuiltinVaListKind() const override
{
99 return TargetInfo::VoidPtrBuiltinVaList
;
102 ArrayRef
<const char *> getGCCRegNames() const override
{ return None
; }
104 bool validateAsmConstraint(const char *&Name
,
105 TargetInfo::ConstraintInfo
&info
) const override
{
109 ArrayRef
<TargetInfo::GCCRegAlias
> getGCCRegAliases() const override
{
114 class LLVM_LIBRARY_VISIBILITY TCELETargetInfo
: public TCETargetInfo
{
116 TCELETargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&Opts
)
117 : TCETargetInfo(Triple
, Opts
) {
120 resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"
121 "i16:16:32-i32:32:32-i64:32:32-"
122 "f32:32:32-f64:32:32-v64:32:32-"
123 "v128:32:32-v256:32:32-v512:32:32-"
124 "v1024:32:32-a0:0:32-n32");
127 void getTargetDefines(const LangOptions
&Opts
,
128 MacroBuilder
&Builder
) const override
;
130 } // namespace targets
132 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H