Path: blob/main/contrib/llvm-project/clang/lib/Basic/Targets/TCE.h
35266 views
//===--- TCE.h - Declare TCE 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 TCE TargetInfo objects.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H13#define LLVM_CLANG_LIB_BASIC_TARGETS_TCE_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 {2223// llvm and clang cannot be used directly to output native binaries for24// target, but is used to compile C code to llvm bitcode with correct25// type and alignment information.26//27// TCE uses the llvm bitcode as input and uses it for generating customized28// target processor and program binary. TCE co-design environment is29// publicly available in http://tce.cs.tut.fi3031static const unsigned TCEOpenCLAddrSpaceMap[] = {320, // Default333, // opencl_global344, // opencl_local355, // opencl_constant360, // opencl_private371, // opencl_global_device381, // opencl_global_host39// FIXME: generic has to be added to the target400, // opencl_generic410, // cuda_device420, // cuda_constant430, // cuda_shared440, // sycl_global450, // sycl_global_device460, // sycl_global_host470, // sycl_local480, // sycl_private490, // ptr32_sptr500, // ptr32_uptr510, // ptr64520, // hlsl_groupshared53// Wasm address space values for this target are dummy values,54// as it is only enabled for Wasm targets.5520, // wasm_funcref56};5758class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {59public:60TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)61: TargetInfo(Triple) {62TLSSupported = false;63IntWidth = 32;64LongWidth = LongLongWidth = 32;65PointerWidth = 32;66IntAlign = 32;67LongAlign = LongLongAlign = 32;68PointerAlign = 32;69SuitableAlign = 32;70SizeType = UnsignedInt;71IntMaxType = SignedLong;72IntPtrType = SignedInt;73PtrDiffType = SignedInt;74FloatWidth = 32;75FloatAlign = 32;76DoubleWidth = 32;77DoubleAlign = 32;78LongDoubleWidth = 32;79LongDoubleAlign = 32;80FloatFormat = &llvm::APFloat::IEEEsingle();81DoubleFormat = &llvm::APFloat::IEEEsingle();82LongDoubleFormat = &llvm::APFloat::IEEEsingle();83resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"84"i16:16:32-i32:32:32-i64:32:32-"85"f32:32:32-f64:32:32-v64:32:32-"86"v128:32:32-v256:32:32-v512:32:32-"87"v1024:32:32-a0:0:32-n32");88AddrSpaceMap = &TCEOpenCLAddrSpaceMap;89UseAddrSpaceMapMangling = true;90}9192void getTargetDefines(const LangOptions &Opts,93MacroBuilder &Builder) const override;9495bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }9697ArrayRef<Builtin::Info> getTargetBuiltins() const override {98return std::nullopt;99}100101std::string_view getClobbers() const override { return ""; }102103BuiltinVaListKind getBuiltinVaListKind() const override {104return TargetInfo::VoidPtrBuiltinVaList;105}106107ArrayRef<const char *> getGCCRegNames() const override {108return std::nullopt;109}110111bool validateAsmConstraint(const char *&Name,112TargetInfo::ConstraintInfo &info) const override {113return true;114}115116ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {117return std::nullopt;118}119};120121class LLVM_LIBRARY_VISIBILITY TCELETargetInfo : public TCETargetInfo {122public:123TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)124: TCETargetInfo(Triple, Opts) {125BigEndian = false;126127resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"128"i16:16:32-i32:32:32-i64:32:32-"129"f32:32:32-f64:32:32-v64:32:32-"130"v128:32:32-v256:32:32-v512:32:32-"131"v1024:32:32-a0:0:32-n32");132}133134void getTargetDefines(const LangOptions &Opts,135MacroBuilder &Builder) const override;136};137} // namespace targets138} // namespace clang139#endif // LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H140141142