17330f729Sjoerg //===--- PNaCl.h - Declare PNaCl target feature support ---------*- C++ -*-===// 27330f729Sjoerg // 37330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 47330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information. 57330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 67330f729Sjoerg // 77330f729Sjoerg //===----------------------------------------------------------------------===// 87330f729Sjoerg // 97330f729Sjoerg // This file declares PNaCl TargetInfo objects. 107330f729Sjoerg // 117330f729Sjoerg //===----------------------------------------------------------------------===// 127330f729Sjoerg 137330f729Sjoerg #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H 147330f729Sjoerg #define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H 157330f729Sjoerg 167330f729Sjoerg #include "Mips.h" 177330f729Sjoerg #include "clang/Basic/TargetInfo.h" 187330f729Sjoerg #include "clang/Basic/TargetOptions.h" 197330f729Sjoerg #include "llvm/ADT/Triple.h" 207330f729Sjoerg #include "llvm/Support/Compiler.h" 217330f729Sjoerg 227330f729Sjoerg namespace clang { 237330f729Sjoerg namespace targets { 247330f729Sjoerg 257330f729Sjoerg class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo { 267330f729Sjoerg public: PNaClTargetInfo(const llvm::Triple & Triple,const TargetOptions & Opts)277330f729Sjoerg PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 287330f729Sjoerg : TargetInfo(Triple) { 297330f729Sjoerg this->LongAlign = 32; 307330f729Sjoerg this->LongWidth = 32; 317330f729Sjoerg this->PointerAlign = 32; 327330f729Sjoerg this->PointerWidth = 32; 337330f729Sjoerg this->IntMaxType = TargetInfo::SignedLongLong; 347330f729Sjoerg this->Int64Type = TargetInfo::SignedLongLong; 357330f729Sjoerg this->DoubleAlign = 64; 367330f729Sjoerg this->LongDoubleWidth = 64; 377330f729Sjoerg this->LongDoubleAlign = 64; 387330f729Sjoerg this->SizeType = TargetInfo::UnsignedInt; 397330f729Sjoerg this->PtrDiffType = TargetInfo::SignedInt; 407330f729Sjoerg this->IntPtrType = TargetInfo::SignedInt; 417330f729Sjoerg this->RegParmMax = 0; // Disallow regparm 427330f729Sjoerg } 437330f729Sjoerg 447330f729Sjoerg void getArchDefines(const LangOptions &Opts, MacroBuilder &Builder) const; 457330f729Sjoerg getTargetDefines(const LangOptions & Opts,MacroBuilder & Builder)467330f729Sjoerg void getTargetDefines(const LangOptions &Opts, 477330f729Sjoerg MacroBuilder &Builder) const override { 487330f729Sjoerg getArchDefines(Opts, Builder); 497330f729Sjoerg } 507330f729Sjoerg hasFeature(StringRef Feature)517330f729Sjoerg bool hasFeature(StringRef Feature) const override { 527330f729Sjoerg return Feature == "pnacl"; 537330f729Sjoerg } 547330f729Sjoerg getTargetBuiltins()557330f729Sjoerg ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; } 567330f729Sjoerg getBuiltinVaListKind()577330f729Sjoerg BuiltinVaListKind getBuiltinVaListKind() const override { 587330f729Sjoerg return TargetInfo::PNaClABIBuiltinVaList; 597330f729Sjoerg } 607330f729Sjoerg 617330f729Sjoerg ArrayRef<const char *> getGCCRegNames() const override; 627330f729Sjoerg 637330f729Sjoerg ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override; 647330f729Sjoerg validateAsmConstraint(const char * & Name,TargetInfo::ConstraintInfo & Info)657330f729Sjoerg bool validateAsmConstraint(const char *&Name, 667330f729Sjoerg TargetInfo::ConstraintInfo &Info) const override { 677330f729Sjoerg return false; 687330f729Sjoerg } 697330f729Sjoerg getClobbers()707330f729Sjoerg const char *getClobbers() const override { return ""; } 71*e038c9c4Sjoerg hasExtIntType()72*e038c9c4Sjoerg bool hasExtIntType() const override { return true; } 737330f729Sjoerg }; 747330f729Sjoerg 757330f729Sjoerg // We attempt to use PNaCl (le32) frontend and Mips32EL backend. 767330f729Sjoerg class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo { 777330f729Sjoerg public: NaClMips32TargetInfo(const llvm::Triple & Triple,const TargetOptions & Opts)787330f729Sjoerg NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 797330f729Sjoerg : MipsTargetInfo(Triple, Opts) {} 807330f729Sjoerg getBuiltinVaListKind()817330f729Sjoerg BuiltinVaListKind getBuiltinVaListKind() const override { 827330f729Sjoerg return TargetInfo::PNaClABIBuiltinVaList; 837330f729Sjoerg } 847330f729Sjoerg }; 857330f729Sjoerg } // namespace targets 867330f729Sjoerg } // namespace clang 877330f729Sjoerg 887330f729Sjoerg #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H 89