clang 8.0.0

PNaCl.h
Go to the documentation of this file.
1 //===--- PNaCl.h - Declare PNaCl target feature support ---------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares PNaCl TargetInfo objects.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
16
17 #include "Mips.h"
18 #include "clang/Basic/TargetInfo.h"
19 #include "clang/Basic/TargetOptions.h"
20 #include "llvm/ADT/Triple.h"
21 #include "llvm/Support/Compiler.h"
22
23 namespace clang {
24 namespace targets {
25
26 class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo {
27 public:
28 PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
29 : TargetInfo(Triple) {
30 this->LongAlign = 32;
31 this->LongWidth = 32;
32 this->PointerAlign = 32;
33 this->PointerWidth = 32;
34 this->IntMaxType = TargetInfo::SignedLongLong;
35 this->Int64Type = TargetInfo::SignedLongLong;
36 this->DoubleAlign = 64;
37 this->LongDoubleWidth = 64;
38 this->LongDoubleAlign = 64;
39 this->SizeType = TargetInfo::UnsignedInt;
40 this->PtrDiffType = TargetInfo::SignedInt;
41 this->IntPtrType = TargetInfo::SignedInt;
42 this->RegParmMax = 0; // Disallow regparm
43 }
44
45 void getArchDefines(const LangOptions &Opts, MacroBuilder &Builder) const;
46
47 void getTargetDefines(const LangOptions &Opts,
48 MacroBuilder &Builder) const override {
49 getArchDefines(Opts, Builder);
50 }
51
52 bool hasFeature(StringRef Feature) const override {
53 return Feature == "pnacl";
54 }
55
56 ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
57
58 BuiltinVaListKind getBuiltinVaListKind() const override {
59 return TargetInfo::PNaClABIBuiltinVaList;
60 }
61
62 ArrayRef<const char *> getGCCRegNames() const override;
63
64 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
65
66 bool validateAsmConstraint(const char *&Name,
67 TargetInfo::ConstraintInfo &Info) const override {
68 return false;
69 }
70
71 const char *getClobbers() const override { return ""; }
72 };
73
74 // We attempt to use PNaCl (le32) frontend and Mips32EL backend.
75 class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo {
76 public:
77 NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
78 : MipsTargetInfo(Triple, Opts) {}
79
80 BuiltinVaListKind getBuiltinVaListKind() const override {
81 return TargetInfo::PNaClABIBuiltinVaList;
82 }
83 };
84 } // namespace targets
85 } // namespace clang
86
87 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
clang::targets::PNaClTargetInfo::PNaClTargetInfo
PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: PNaCl.h:28
clang::TargetInfo::PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
Definition: TargetInfo.h:195
clang::targets::PNaClTargetInfo::getClobbers
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: PNaCl.h:71
clang::targets::NaClMips32TargetInfo
Definition: PNaCl.h:75
clang::targets::NaClMips32TargetInfo::NaClMips32TargetInfo
NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: PNaCl.h:77
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:27
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:58
clang::TargetInfo::SignedInt
Definition: TargetInfo.h:164
clang::targets::PNaClTargetInfo::validateAsmConstraint
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: PNaCl.h:66
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:50
clang::TargetInfo::UnsignedInt
Definition: TargetInfo.h:165
llvm::ArrayRef
Definition: LLVM.h:32
clang::TargetInfo::SignedLongLong
Definition: TargetInfo.h:168
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:56
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:54
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:795
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:80
TargetOptions.h
Defines the clang::TargetOptions class.
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::targets::MipsTargetInfo
Definition: Mips.h:25
Mips.h
clang::targets::PNaClTargetInfo::getTargetDefines
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
Definition: PNaCl.h:47
clang::MacroBuilder
Definition: MacroBuilder.h:24
clang::TargetInfo::BuiltinVaListKind
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:182
clang::targets::PNaClTargetInfo::hasFeature
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition: PNaCl.h:52
TargetInfo.h
Defines the clang::TargetInfo interface.
clang::targets::PNaClTargetInfo
Definition: PNaCl.h:26