Path: blob/main/contrib/llvm-project/clang/lib/Basic/Targets/PNaCl.h
35267 views
//===--- PNaCl.h - Declare PNaCl 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 PNaCl TargetInfo objects.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H13#define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H1415#include "Mips.h"16#include "clang/Basic/TargetInfo.h"17#include "clang/Basic/TargetOptions.h"18#include "llvm/Support/Compiler.h"19#include "llvm/TargetParser/Triple.h"2021namespace clang {22namespace targets {2324class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo {25public:26PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)27: TargetInfo(Triple) {28this->LongAlign = 32;29this->LongWidth = 32;30this->PointerAlign = 32;31this->PointerWidth = 32;32this->IntMaxType = TargetInfo::SignedLongLong;33this->Int64Type = TargetInfo::SignedLongLong;34this->DoubleAlign = 64;35this->LongDoubleWidth = 64;36this->LongDoubleAlign = 64;37this->SizeType = TargetInfo::UnsignedInt;38this->PtrDiffType = TargetInfo::SignedInt;39this->IntPtrType = TargetInfo::SignedInt;40this->RegParmMax = 0; // Disallow regparm41}4243void getArchDefines(const LangOptions &Opts, MacroBuilder &Builder) const;4445void getTargetDefines(const LangOptions &Opts,46MacroBuilder &Builder) const override {47getArchDefines(Opts, Builder);48}4950bool hasFeature(StringRef Feature) const override {51return Feature == "pnacl";52}5354ArrayRef<Builtin::Info> getTargetBuiltins() const override {55return std::nullopt;56}5758BuiltinVaListKind getBuiltinVaListKind() const override {59return TargetInfo::PNaClABIBuiltinVaList;60}6162ArrayRef<const char *> getGCCRegNames() const override;6364ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;6566bool validateAsmConstraint(const char *&Name,67TargetInfo::ConstraintInfo &Info) const override {68return false;69}7071std::string_view getClobbers() const override { return ""; }7273bool hasBitIntType() const override { return true; }74};7576// We attempt to use PNaCl (le32) frontend and Mips32EL backend.77class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo {78public:79NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)80: MipsTargetInfo(Triple, Opts) {}8182BuiltinVaListKind getBuiltinVaListKind() const override {83return TargetInfo::PNaClABIBuiltinVaList;84}85};86} // namespace targets87} // namespace clang8889#endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H909192