brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 005cab9 Raw
143 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file declares TCE TargetInfo objects.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H14#define LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H15 16#include "clang/Basic/TargetInfo.h"17#include "clang/Basic/TargetOptions.h"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 for25// target, but is used to compile C code to llvm bitcode with correct26// type and alignment information.27//28// TCE uses the llvm bitcode as input and uses it for generating customized29// target processor and program binary. TCE co-design environment is30// publicly available in http://tce.cs.tut.fi31 32static const unsigned TCEOpenCLAddrSpaceMap[] = {33    0, // Default34    3, // opencl_global35    4, // opencl_local36    5, // opencl_constant37    0, // opencl_private38    1, // opencl_global_device39    1, // opencl_global_host40    // FIXME: generic has to be added to the target41    0, // opencl_generic42    0, // cuda_device43    0, // cuda_constant44    0, // cuda_shared45    0, // sycl_global46    0, // sycl_global_device47    0, // sycl_global_host48    0, // sycl_local49    0, // sycl_private50    0, // ptr32_sptr51    0, // ptr32_uptr52    0, // ptr6453    0, // hlsl_groupshared54    0, // hlsl_constant55    0, // hlsl_private56    0, // hlsl_device57    0, // hlsl_input58    // Wasm address space values for this target are dummy values,59    // as it is only enabled for Wasm targets.60    20, // wasm_funcref61};62 63class LLVM_LIBRARY_VISIBILITY TCETargetInfo : public TargetInfo {64public:65  TCETargetInfo(const llvm::Triple &Triple, const TargetOptions &)66      : TargetInfo(Triple) {67    TLSSupported = false;68    IntWidth = 32;69    LongWidth = LongLongWidth = 32;70    PointerWidth = 32;71    IntAlign = 32;72    LongAlign = LongLongAlign = 32;73    PointerAlign = 32;74    SuitableAlign = 32;75    SizeType = UnsignedInt;76    IntMaxType = SignedLong;77    IntPtrType = SignedInt;78    PtrDiffType = SignedInt;79    FloatWidth = 32;80    FloatAlign = 32;81    DoubleWidth = 32;82    DoubleAlign = 32;83    LongDoubleWidth = 32;84    LongDoubleAlign = 32;85    FloatFormat = &llvm::APFloat::IEEEsingle();86    DoubleFormat = &llvm::APFloat::IEEEsingle();87    LongDoubleFormat = &llvm::APFloat::IEEEsingle();88    resetDataLayout("E-p:32:32:32-i1:8:8-i8:8:32-"89                    "i16:16:32-i32:32:32-i64:32:32-"90                    "f32:32:32-f64:32:32-v64:32:32-"91                    "v128:32:32-v256:32:32-v512:32:32-"92                    "v1024:32:32-a0:0:32-n32");93    AddrSpaceMap = &TCEOpenCLAddrSpaceMap;94    UseAddrSpaceMapMangling = true;95  }96 97  void getTargetDefines(const LangOptions &Opts,98                        MacroBuilder &Builder) const override;99 100  bool hasFeature(StringRef Feature) const override { return Feature == "tce"; }101 102  llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override {103    return {};104  }105 106  std::string_view getClobbers() const override { return ""; }107 108  BuiltinVaListKind getBuiltinVaListKind() const override {109    return TargetInfo::VoidPtrBuiltinVaList;110  }111 112  ArrayRef<const char *> getGCCRegNames() const override { return {}; }113 114  bool validateAsmConstraint(const char *&Name,115                             TargetInfo::ConstraintInfo &info) const override {116    return true;117  }118 119  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {120    return {};121  }122};123 124class LLVM_LIBRARY_VISIBILITY TCELETargetInfo : public TCETargetInfo {125public:126  TCELETargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)127      : TCETargetInfo(Triple, Opts) {128    BigEndian = false;129 130    resetDataLayout("e-p:32:32:32-i1:8:8-i8:8:32-"131                    "i16:16:32-i32:32:32-i64:32:32-"132                    "f32:32:32-f64:32:32-v64:32:32-"133                    "v128:32:32-v256:32:32-v512:32:32-"134                    "v1024:32:32-a0:0:32-n32");135  }136 137  void getTargetDefines(const LangOptions &Opts,138                        MacroBuilder &Builder) const override;139};140} // namespace targets141} // namespace clang142#endif // LLVM_CLANG_LIB_BASIC_TARGETS_TCE_H143