clang  6.0.0svn
TCE.h
Go to the documentation of this file.
1 //===--- TCE.h - Declare TCE target feature support -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares TCE TargetInfo objects.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
16 
17 #include "clang/Basic/TargetInfo.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/Compiler.h"
21 
22 namespace clang {
23 namespace targets {
24 
25 // llvm and clang cannot be used directly to output native binaries for
26 // target, but is used to compile C code to llvm bitcode with correct
27 // type and alignment information.
28 //
29 // TCE uses the llvm bitcode as input and uses it for generating customized
30 // target processor and program binary. TCE co-design environment is
31 // publicly available in http://tce.cs.tut.fi
32 
33 static const unsigned TCEOpenCLAddrSpaceMap[] = {
34  0, // Default
35  3, // opencl_global
36  4, // opencl_local
37  5, // opencl_constant
38  0, // opencl_private
39  // FIXME: generic has to be added to the target
40  0, // opencl_generic
41  0, // cuda_device
42  0, // cuda_constant
43  0 // cuda_shared
44 };
45 
46 class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {
47 public:
48  TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
49  : TargetInfo(Triple) {
50  TLSSupported = false;
51  IntWidth = 32;
52  LongWidth = LongLongWidth = 32;
53  PointerWidth = 32;
54  IntAlign = 32;
55  LongAlign = LongLongAlign = 32;
56  PointerAlign = 32;
57  SuitableAlign = 32;
58  SizeType = UnsignedInt;
59  IntMaxType = SignedLong;
60  IntPtrType = SignedInt;
61  PtrDiffType = SignedInt;
62  FloatWidth = 32;
63  FloatAlign = 32;
64  DoubleWidth = 32;
65  DoubleAlign = 32;
66  LongDoubleWidth = 32;
67  LongDoubleAlign = 32;
68  FloatFormat = &llvm::APFloat::IEEEsingle();
69  DoubleFormat = &llvm::APFloat::IEEEsingle();
70  LongDoubleFormat = &llvm::APFloat::IEEEsingle();
71  resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"
72  "i16:16:32-i32:32:32-i64:32:32-"
73  "f32:32:32-f64:32:32-v64:32:32-"
74  "v128:32:32-v256:32:32-v512:32:32-"
75  "v1024:32:32-a0:0:32-n32");
76  AddrSpaceMap = &TCEOpenCLAddrSpaceMap;
77  UseAddrSpaceMapMangling = true;
78  }
79 
80  void getTargetDefines(const LangOptions &Opts,
81  MacroBuilder &Builder) const override;
82 
83  bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }
84 
85  ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
86 
87  const char *getClobbers() const override { return ""; }
88 
91  }
92 
93  ArrayRef<const char *> getGCCRegNames() const override { return None; }
94 
95  bool validateAsmConstraint(const char *&Name,
96  TargetInfo::ConstraintInfo &info) const override {
97  return true;
98  }
99 
101  return None;
102  }
103 };
104 
105 class LLVM_LIBRARY_VISIBILITY TCELETargetInfo : public TCETargetInfo {
106 public:
107  TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
108  : TCETargetInfo(Triple, Opts) {
109  BigEndian = false;
110 
111  resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"
112  "i16:16:32-i32:32:32-i64:32:32-"
113  "f32:32:32-f64:32:32-v64:32:32-"
114  "v128:32:32-v256:32:32-v512:32:32-"
115  "v1024:32:32-a0:0:32-n32");
116  }
117 
118  void getTargetDefines(const LangOptions &Opts,
119  MacroBuilder &Builder) const override;
120 };
121 } // namespace targets
122 } // namespace clang
123 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H
static const unsigned TCEOpenCLAddrSpaceMap[]
Definition: TCE.h:33
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition: TCE.h:83
TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: TCE.h:107
Options for controlling the target.
Definition: TargetOptions.h:26
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: TCE.h:48
typedef void* __builtin_va_list;
Definition: TargetInfo.h:157
Exposes information about the current target.
Definition: TargetInfo.h:54
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: TCE.h:87
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: TCE.h:100
Defines the clang::TargetOptions class.
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition: TCE.h:95
ArrayRef< const char * > getGCCRegNames() const override
Definition: TCE.h:93
Dataflow Directional Tag Classes.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:152
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition: TCE.h:85
Defines the clang::TargetInfo interface.
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: TCE.h:89