Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: lib/Basic/Targets.cpp

Issue 7717004: Add PNaCl TargetInfo to Clang (Closed) Base URL: http://llvm.org/svn/llvm-project/cfe/trunk/
Patch Set: aligment Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 138336)
+++ lib/Basic/Targets.cpp (working copy)
@@ -2843,6 +2843,65 @@
}
} // end anonymous namespace.
+namespace {
+class PNaClTargetInfo : public TargetInfo {
+public:
+ PNaClTargetInfo(const std::string& triple) : TargetInfo(triple) {
+ this->UserLabelPrefix = "";
+ this->LongWidth = this->LongAlign =
+ this->PointerWidth = this->PointerAlign = 32;
nlewycky 2011/08/23 21:22:26 I don't think this is worth saving two lines :)
krasin 2011/08/23 22:12:30 Done.
+ 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,
nlewycky 2011/08/23 21:22:26 Do you really want to leave this blank? __PNACL32_
krasin 2011/08/23 22:12:30 You're right. PNaCl gcc defines __pnacl__. Clang a
+ MacroBuilder &Builder) const {
nlewycky 2011/08/23 21:22:26 whitespace
krasin 2011/08/23 22:12:30 Done.
+ }
+ virtual void getTargetDefines(const LangOptions &Opts,
+ MacroBuilder &Builder) const {
+ Builder.defineMacro("__native_client__");
+ }
+ 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 {
nlewycky 2011/08/23 21:22:26 whitespace
krasin 2011/08/23 22:12:30 Done.
+ Names = NULL;
+ NumNames = 0;
+}
+
+void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
+ unsigned &NumAliases) const {
nlewycky 2011/08/23 21:22:26 whitespace
krasin 2011/08/23 22:12:30 Done.
+ Aliases = NULL;
+ NumAliases = 0;
+}
+} // end anonymous namespace.
+
+
//===----------------------------------------------------------------------===//
// Driver code
//===----------------------------------------------------------------------===//
@@ -2912,6 +2971,13 @@
default:
return new MipsTargetInfo(T);
}
+ case llvm::Triple::le32:
nlewycky 2011/08/23 21:22:26 Please add a blank line above.
krasin 2011/08/23 22:12:30 Done.
+ switch (os) {
+ case llvm::Triple::NativeClient:
+ return new PNaClTargetInfo(T);
+ default:
+ return NULL;
+ }
case llvm::Triple::ppc:
if (Triple.isOSDarwin())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698