clang  6.0.0svn
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"
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 
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 
82  }
83 };
84 } // namespace targets
85 } // namespace clang
86 
87 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: PNaCl.h:28
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
Definition: TargetInfo.h:165
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: PNaCl.h:71
NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Definition: PNaCl.h:77
Options for controlling the target.
Definition: TargetOptions.h:26
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: PNaCl.h:58
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: PNaCl.h:66
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
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
Exposes information about the current target.
Definition: TargetInfo.h:54
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: PNaCl.h:80
Defines the clang::TargetOptions class.
Dataflow Directional Tag Classes.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
Definition: PNaCl.h:47
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:152
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition: PNaCl.h:52
Defines the clang::TargetInfo interface.