13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_WEBASSEMBLY_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_WEBASSEMBLY_H
18#include "llvm/Support/Compiler.h"
19#include "llvm/TargetParser/Triple.h"
57 bool HasAtomics =
false;
58 bool HasBulkMemory =
false;
59 bool HasBulkMemoryOpt =
false;
60 bool HasCallIndirectOverlong =
false;
61 bool HasExceptionHandling =
false;
62 bool HasExtendedConst =
false;
64 bool HasMultiMemory =
false;
65 bool HasMultivalue =
false;
66 bool HasMutableGlobals =
false;
67 bool HasNontrappingFPToInt =
false;
68 bool HasReferenceTypes =
false;
69 bool HasSignExt =
false;
70 bool HasTailCall =
false;
71 bool HasWideArithmetic =
false;
81 LargeArrayMinWidth = 128;
82 LargeArrayAlign = 128;
83 SigAtomicType = SignedLong;
84 LongDoubleWidth = LongDoubleAlign = 128;
85 LongDoubleFormat = &llvm::APFloat::IEEEquad();
86 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
89 SizeType = UnsignedLong;
90 PtrDiffType = SignedLong;
91 IntPtrType = SignedLong;
92 HasUnalignedAccess =
true;
95 StringRef getABI()
const override;
96 bool setABI(
const std::string &Name)
override;
104 static void setSIMDLevel(llvm::StringMap<bool> &Features, SIMDEnum Level,
110 const std::vector<std::string> &FeaturesVec)
const override;
111 bool hasFeature(StringRef Feature)
const final;
113 void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
114 bool Enabled)
const final;
116 bool handleTargetFeatures(std::vector<std::string> &Features,
119 bool isValidCPUName(StringRef Name)
const final;
122 bool setCPU(
const std::string &Name)
final {
return isValidCPUName(Name); }
126 BuiltinVaListKind getBuiltinVaListKind() const final {
127 return VoidPtrBuiltinVaList;
130 ArrayRef<const char *> getGCCRegNames() const final {
return {}; }
132 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const final {
136 bool validateAsmConstraint(
const char *&Name,
137 TargetInfo::ConstraintInfo &Info)
const final {
141 std::string_view getClobbers() const final {
return ""; }
143 bool isCLZForZeroUndef() const final {
return false; }
145 bool hasInt128Type() const final {
return true; }
147 IntType getIntTypeByWidth(
unsigned BitWidth,
bool IsSigned)
const final {
149 return BitWidth == 64 ? (IsSigned ? SignedLongLong : UnsignedLongLong)
150 : TargetInfo::getIntTypeByWidth(BitWidth, IsSigned);
153 IntType getLeastIntTypeByWidth(
unsigned BitWidth,
bool IsSigned)
const final {
155 return BitWidth == 64
156 ? (IsSigned ? SignedLongLong : UnsignedLongLong)
157 : TargetInfo::getLeastIntTypeByWidth(BitWidth, IsSigned);
160 CallingConvCheckResult checkCallingConvention(CallingConv CC)
const override {
172 bool hasBitIntType()
const override {
return true; }
174 bool hasProtectedVisibility()
const override {
return false; }
176 void adjust(DiagnosticsEngine &Diags, LangOptions &Opts)
override;
185 if (
T.isOSEmscripten())
187 "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-"
190 resetDataLayout(
"e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-"
205 LongAlign = LongWidth = 64;
206 PointerAlign = PointerWidth = 64;
207 SizeType = UnsignedLong;
208 PtrDiffType = SignedLong;
209 IntPtrType = SignedLong;
210 if (
T.isOSEmscripten())
212 "e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-f128:64-n32:64-"
215 resetDataLayout(
"e-m:e-p:64:64-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-"
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Exposes information about the current target.
Options for controlling the target.
WebAssembly32TargetInfo(const llvm::Triple &T, const TargetOptions &Opts)
WebAssembly64TargetInfo(const llvm::Triple &T, const TargetOptions &Opts)
WebAssemblyTargetInfo(const llvm::Triple &T, const TargetOptions &)
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Defines the clang::TargetInfo interface.
static const unsigned WebAssemblyAddrSpaceMap[]
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T