1 //===--- PNaCl.h - Declare PNaCl target feature support ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares PNaCl TargetInfo objects.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_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"
26 class LLVM_LIBRARY_VISIBILITY PNaClTargetInfo : public TargetInfo {
28 PNaClTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
29 : TargetInfo(Triple) {
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
45 void getArchDefines(const LangOptions &Opts, MacroBuilder &Builder) const;
47 void getTargetDefines(const LangOptions &Opts,
48 MacroBuilder &Builder) const override {
49 getArchDefines(Opts, Builder);
52 bool hasFeature(StringRef Feature) const override {
53 return Feature == "pnacl";
56 ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
58 BuiltinVaListKind getBuiltinVaListKind() const override {
59 return TargetInfo::PNaClABIBuiltinVaList;
62 ArrayRef<const char *> getGCCRegNames() const override;
64 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
66 bool validateAsmConstraint(const char *&Name,
67 TargetInfo::ConstraintInfo &Info) const override {
71 const char *getClobbers() const override { return ""; }
74 // We attempt to use PNaCl (le32) frontend and Mips32EL backend.
75 class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo {
77 NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
78 : MipsTargetInfo(Triple, Opts) {}
80 BuiltinVaListKind getBuiltinVaListKind() const override {
81 return TargetInfo::PNaClABIBuiltinVaList;
84 } // namespace targets
87 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PNACL_H