1 //===--- PNaCl.h - Declare PNaCl target feature support ---------*- C++ -*-===//
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-exception
7 //===----------------------------------------------------------------------===//
9 // This file declares PNaCl TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
17 #include "clang/Basic/TargetInfo.h"
18 #include "clang/Basic/TargetOptions.h"
19 #include "llvm/Support/Compiler.h"
20 #include "llvm/TargetParser/Triple.h"
25 class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo
: public TargetInfo
{
27 PNaClTargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&Opts
)
28 : TargetInfo(Triple
) {
31 this->PointerAlign
= 32;
32 this->PointerWidth
= 32;
33 this->IntMaxType
= TargetInfo::SignedLongLong
;
34 this->Int64Type
= TargetInfo::SignedLongLong
;
35 this->DoubleAlign
= 64;
36 this->LongDoubleWidth
= 64;
37 this->LongDoubleAlign
= 64;
38 this->SizeType
= TargetInfo::UnsignedInt
;
39 this->PtrDiffType
= TargetInfo::SignedInt
;
40 this->IntPtrType
= TargetInfo::SignedInt
;
41 this->RegParmMax
= 0; // Disallow regparm
44 void getArchDefines(const LangOptions
&Opts
, MacroBuilder
&Builder
) const;
46 void getTargetDefines(const LangOptions
&Opts
,
47 MacroBuilder
&Builder
) const override
{
48 getArchDefines(Opts
, Builder
);
51 bool hasFeature(StringRef Feature
) const override
{
52 return Feature
== "pnacl";
55 ArrayRef
<Builtin::Info
> getTargetBuiltins() const override
{
59 BuiltinVaListKind
getBuiltinVaListKind() const override
{
60 return TargetInfo::PNaClABIBuiltinVaList
;
63 ArrayRef
<const char *> getGCCRegNames() const override
;
65 ArrayRef
<TargetInfo::GCCRegAlias
> getGCCRegAliases() const override
;
67 bool validateAsmConstraint(const char *&Name
,
68 TargetInfo::ConstraintInfo
&Info
) const override
{
72 const char *getClobbers() const override
{ return ""; }
74 bool hasBitIntType() const override
{ return true; }
77 // We attempt to use PNaCl (le32) frontend and Mips32EL backend.
78 class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo
: public MipsTargetInfo
{
80 NaClMips32TargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&Opts
)
81 : MipsTargetInfo(Triple
, Opts
) {}
83 BuiltinVaListKind
getBuiltinVaListKind() const override
{
84 return TargetInfo::PNaClABIBuiltinVaList
;
87 } // namespace targets
90 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H