diff options
author | Ivan Krasin <krasin@chromium.org> | 2011-08-24 20:22:22 +0000 |
---|---|---|
committer | Ivan Krasin <krasin@chromium.org> | 2011-08-24 20:22:22 +0000 |
commit | ef05abda02375a6565edcc0bdf20bdd41c0a87b3 (patch) | |
tree | 3da732000ceb134a997e05c802ede9c602c974f2 /lib/Basic/Targets.cpp | |
parent | bd85b1394017cdd75294c75e5bad351a70b2e21c (diff) |
Add PNaCl TargetInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r-- | lib/Basic/Targets.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 07c5bb85c8..fb1a08e09f 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -2843,6 +2843,70 @@ void MipselTargetInfo::getTargetDefines(const LangOptions &Opts, } } // end anonymous namespace. +namespace { +class PNaClTargetInfo : public TargetInfo { +public: + PNaClTargetInfo(const std::string& triple) : TargetInfo(triple) { + this->UserLabelPrefix = ""; + this->LongAlign = 32; + this->LongWidth = 32; + this->PointerAlign = 32; + this->PointerWidth = 32; + this->IntMaxType = TargetInfo::SignedLongLong; + this->UIntMaxType = TargetInfo::UnsignedLongLong; + this->Int64Type = TargetInfo::SignedLongLong; + this->SizeType = TargetInfo::UnsignedInt; + DescriptionString = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-" + "f32:32:32-f64:64:64-p:32:32:32-v128:32:32"; + } + + void getDefaultFeatures(const std::string &CPU, + llvm::StringMap<bool> &Features) const { + } + virtual void getArchDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { + Builder.defineMacro("__le32__"); + Builder.defineMacro("__pnacl__"); + } + virtual void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { + Builder.defineMacro("__native_client__"); + getArchDefines(Opts, Builder); + } + virtual void getTargetBuiltins(const Builtin::Info *&Records, + unsigned &NumRecords) const { + } + virtual const char *getVAListDeclaration() const { + return "typedef void* __builtin_va_list;"; + } + virtual void getGCCRegNames(const char * const *&Names, + unsigned &NumNames) const; + virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, + unsigned &NumAliases) const; + virtual bool validateAsmConstraint(const char *&Name, + TargetInfo::ConstraintInfo &Info) const { + return false; + } + + virtual const char *getClobbers() const { + return ""; + } +}; + +void PNaClTargetInfo::getGCCRegNames(const char * const *&Names, + unsigned &NumNames) const { + Names = NULL; + NumNames = 0; +} + +void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, + unsigned &NumAliases) const { + Aliases = NULL; + NumAliases = 0; +} +} // end anonymous namespace. + + //===----------------------------------------------------------------------===// // Driver code //===----------------------------------------------------------------------===// @@ -2913,6 +2977,14 @@ static TargetInfo *AllocateTarget(const std::string &T) { return new MipsTargetInfo(T); } + case llvm::Triple::le32: + switch (os) { + case llvm::Triple::NativeClient: + return new PNaClTargetInfo(T); + default: + return NULL; + } + case llvm::Triple::ppc: if (Triple.isOSDarwin()) return new DarwinPPC32TargetInfo(T); |