Chromium Code Reviews| Index: lib/Basic/Targets.cpp |
| =================================================================== |
| --- lib/Basic/Targets.cpp (revision 138336) |
| +++ lib/Basic/Targets.cpp (working copy) |
| @@ -2843,6 +2843,70 @@ |
| } |
| } // 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;"; |
|
jvoung - send to chromium...
2011/08/24 18:04:11
Should va_list be something more like what is docu
krasin
2011/08/24 18:06:15
I believe so. In fact, I have derived this particu
krasin
2011/08/24 19:33:17
Done.
|
| + } |
| + 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 @@ |
| 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); |