clang  14.0.0git
PNaCl.h
Go to the documentation of this file.
1 //===--- PNaCl.h - Declare PNaCl 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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares PNaCl TargetInfo objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
15 
16 #include "Mips.h"
17 #include "clang/Basic/TargetInfo.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/Compiler.h"
21 
22 namespace clang {
23 namespace targets {
24 
25 class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo {
26 public:
27  PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
28  : TargetInfo(Triple) {
29  this->LongAlign = 32;
30  this->LongWidth = 32;
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
42  }
43 
44  void getArchDefines(const LangOptions &Opts, MacroBuilder &Builder) const;
45 
46  void getTargetDefines(const LangOptions &Opts,
47  MacroBuilder &Builder) const override {
48  getArchDefines(Opts, Builder);
49  }
50 
51  bool hasFeature(StringRef Feature) const override {
52  return Feature == "pnacl";
53  }
54 
55  ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
56 
59  }
60 
61  ArrayRef<const char *> getGCCRegNames() const override;
62 
63  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
64 
65  bool validateAsmConstraint(const char *&Name,
66  TargetInfo::ConstraintInfo &Info) const override {
67  return false;
68  }
69 
70  const char *getClobbers() const override { return ""; }
71 
72  bool hasExtIntType() const override { return true; }
73 };
74 
75 // We attempt to use PNaCl (le32) frontend and Mips32EL backend.
76 class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo {
77 public:
78  NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
79  : MipsTargetInfo(Triple, Opts) {}
80 
83  }
84 };
85 } // namespace targets
86 } // namespace clang
87 
88 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
clang::TargetInfo::PNaClABIBuiltinVaList
@ PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
Definition: TargetInfo.h:280
clang::targets::PNaClTargetInfo::PNaClTargetInfo
PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: PNaCl.h:27
clang::targets::PNaClTargetInfo::getClobbers
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: PNaCl.h:70
Mips.h
TargetInfo.h
clang::targets::MipsTargetInfo
Definition: Mips.h:24
clang::targets::NaClMips32TargetInfo
Definition: PNaCl.h:76
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:189
clang::targets::PNaClTargetInfo::getBuiltinVaListKind
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: PNaCl.h:57
clang::TargetInfo::BuiltinVaListKind
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:267
clang::targets::NaClMips32TargetInfo::NaClMips32TargetInfo
NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: PNaCl.h:78
clang::targets::PNaClTargetInfo::validateAsmConstraint
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: PNaCl.h:65
clang::targets::NaClMips32TargetInfo::getBuiltinVaListKind
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: PNaCl.h:81
clang::targets::PNaClTargetInfo::getTargetBuiltins
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition: PNaCl.h:55
TargetOptions.h
llvm::ArrayRef
Definition: LLVM.h:34
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:969
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang
Definition: CalledOnceCheck.h:17
clang::TransferrableTargetInfo::SignedInt
@ SignedInt
Definition: TargetInfo.h:125
clang::TransferrableTargetInfo::SignedLongLong
@ SignedLongLong
Definition: TargetInfo.h:129
clang::targets::PNaClTargetInfo::hasFeature
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition: PNaCl.h:51
clang::targets::PNaClTargetInfo::getTargetDefines
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
Definition: PNaCl.h:46
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
clang::MacroBuilder
Definition: MacroBuilder.h:23
clang::targets::PNaClTargetInfo::hasExtIntType
bool hasExtIntType() const override
Determine whether the _ExtInt type is supported on this target.
Definition: PNaCl.h:72
clang::TransferrableTargetInfo::UnsignedInt
@ UnsignedInt
Definition: TargetInfo.h:126
clang::targets::PNaClTargetInfo
Definition: PNaCl.h:25