1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
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" |
18 | #include "clang/Basic/TargetOptions.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; |
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 | |
57 | BuiltinVaListKind getBuiltinVaListKind() const override { |
58 | return TargetInfo::PNaClABIBuiltinVaList; |
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 | |
73 | |
74 | class LLVM_LIBRARY_VISIBILITY NaClMips32TargetInfo : public MipsTargetInfo { |
75 | public: |
76 | NaClMips32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) |
77 | : MipsTargetInfo(Triple, Opts) {} |
78 | |
79 | BuiltinVaListKind getBuiltinVaListKind() const override { |
80 | return TargetInfo::PNaClABIBuiltinVaList; |
81 | } |
82 | }; |
83 | } |
84 | } |
85 | |
86 | #endif |
87 | |