clang 24.0.0git
TCE.h
Go to the documentation of this file.
1//===--- TCE.h - Declare TCE 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 TCE TargetInfo objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
15
18#include "llvm/Support/Compiler.h"
19#include "llvm/TargetParser/Triple.h"
20
21namespace clang {
22namespace targets {
23
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.
27//
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
31
32static constexpr LangASMap TCEOpenCLAddrSpaceMap = {
36 // FIXME: generic has to be added to the target
40};
41
42class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {
43public:
44 TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
45 : TargetInfo(Triple) {
46 TLSSupported = false;
47 IntWidth = 32;
49 PointerWidth = 32;
50 IntAlign = 32;
52 PointerAlign = 32;
53 SuitableAlign = 32;
58 FloatWidth = 32;
59 FloatAlign = 32;
60 DoubleWidth = 32;
61 DoubleAlign = 32;
62 LongDoubleWidth = 32;
63 LongDoubleAlign = 32;
64 FloatFormat = &llvm::APFloat::IEEEsingle();
65 DoubleFormat = &llvm::APFloat::IEEEsingle();
66 LongDoubleFormat = &llvm::APFloat::IEEEsingle();
67 resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"
68 "i16:16:32-i32:32:32-i64:32:32-"
69 "f16:16:16-f32:32:32-f64:32:32-v64:64:64-"
70 "i128:128-"
71 "v128:128:128-v256:256:256-v512:512:512-"
72 "v1024:1024:1024-v2048:2048:2048-"
73 "v4096:4096:4096-a0:0:32-n32");
76 }
77
78 void getTargetDefines(const LangOptions &Opts,
79 MacroBuilder &Builder) const override;
80
81 bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }
82
84 return {};
85 }
86
87 std::string_view getClobbers() const override { return ""; }
88
92
93 ArrayRef<const char *> getGCCRegNames() const override { return {}; }
94
95 bool validateAsmConstraint(const char *&Name,
96 TargetInfo::ConstraintInfo &info) const override {
97 return true;
98 }
99
101 return {};
102 }
103
104 // TCE does not have fixed, but user specified register names.
105 bool isValidGCCRegisterName(StringRef Name) const override { return true; }
106};
107
108class LLVM_LIBRARY_VISIBILITY TCELETargetInfo : public TCETargetInfo {
109public:
110 TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
111 : TCETargetInfo(Triple, Opts) {
112 BigEndian = false;
113
114 resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"
115 "i16:16:32-i32:32:32-i64:32:32-"
116 "f16:16:16-f32:32:32-f64:32:32-v64:64:64-"
117 "i128:128-"
118 "v128:128:128-v256:256:256-v512:512:512-"
119 "v1024:1024:1024-v2048:2048:2048-"
120 "v4096:4096:4096-a0:0:32-n32");
121 }
122
123 void getTargetDefines(const LangOptions &Opts,
124 MacroBuilder &Builder) const override;
125};
126
127class LLVM_LIBRARY_VISIBILITY TCELE64TargetInfo : public TCETargetInfo {
128public:
129 TCELE64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
130 : TCETargetInfo(Triple, Opts) {
131 BigEndian = false;
132
133 resetDataLayout("e-p:64:64:64-i1:8:64-i8:8:64-"
134 "i16:16:64-i32:32:64-i64:64:64-"
135 "f16:16:64-f32:32:64-f64:64:64-v64:64:64-"
136 "i128:128-"
137 "v128:128:128-v256:256:256-v512:512:512-"
138 "v1024:1024:1024-v2048:2048:2048-"
139 "v4096:4096:4096-a0:0:64-n64");
140
142 PointerWidth = 64;
143 PointerAlign = 64;
148 DoubleWidth = 64;
149 DoubleAlign = 64;
150 LongDoubleWidth = 64;
151 LongDoubleAlign = 64;
152 DoubleFormat = &llvm::APFloat::IEEEdouble();
153 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
154 }
155
156 void getTargetDefines(const LangOptions &Opts,
157 MacroBuilder &Builder) const override;
158};
159
160} // namespace targets
161} // namespace clang
162#endif // LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
Defines the clang::TargetOptions class.
The type of a lookup table which maps from language-specific address spaces to target-specific ones.
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)
const LangASMap * AddrSpaceMap
Definition TargetInfo.h:260
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition TargetInfo.h:337
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition TargetInfo.h:342
void resetDataLayout(StringRef DL)
Set the data layout to the given string.
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition TargetInfo.h:389
Options for controlling the target.
TCELE64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition TCE.h:129
TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition TCE.h:110
bool isValidGCCRegisterName(StringRef Name) const override
Returns whether the passed in string is a valid register name according to GCC.
Definition TCE.h:105
ArrayRef< const char * > getGCCRegNames() const override
Definition TCE.h:93
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition TCE.h:89
TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition TCE.h:44
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition TCE.h:100
llvm::SmallVector< Builtin::InfosShard > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition TCE.h:83
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition TCE.h:87
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition TCE.h:95
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition TCE.h:81
Defines the clang::TargetInfo interface.
static constexpr LangASMap TCEOpenCLAddrSpaceMap
Definition TCE.h:32
The JSON file list parser is used to communicate input to InstallAPI.
const llvm::fltSemantics * DoubleFormat
Definition TargetInfo.h:144
const llvm::fltSemantics * LongDoubleFormat
Definition TargetInfo.h:144
const llvm::fltSemantics * FloatFormat
Definition TargetInfo.h:143